agent-messenger 2.7.0 → 2.9.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 -12
- 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 +4 -2
- package/dist/src/platforms/channeltalk/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/snapshot.js +86 -31
- 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/channeltalkbot/commands/snapshot.d.ts +3 -1
- package/dist/src/platforms/channeltalkbot/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/snapshot.js +110 -60
- package/dist/src/platforms/channeltalkbot/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.d.ts +1 -0
- package/dist/src/platforms/discord/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.js +48 -34
- package/dist/src/platforms/discord/commands/snapshot.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/discordbot/commands/snapshot.d.ts +2 -0
- package/dist/src/platforms/discordbot/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/commands/snapshot.js +46 -34
- package/dist/src/platforms/discordbot/commands/snapshot.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/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.js +75 -55
- package/dist/src/platforms/slack/commands/snapshot.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/snapshot.d.ts +1 -0
- package/dist/src/platforms/teams/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.js +44 -31
- package/dist/src/platforms/teams/commands/snapshot.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 +3 -7
- 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 +1 -0
- package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.js +14 -7
- 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.js.map +1 -1
- 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/agent-skills.mdx +0 -10
- package/docs/content/docs/cli/channeltalk.mdx +42 -30
- package/docs/content/docs/cli/channeltalkbot.mdx +23 -13
- package/docs/content/docs/cli/discord.mdx +23 -7
- package/docs/content/docs/cli/discordbot.mdx +23 -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/slack.mdx +24 -7
- package/docs/content/docs/cli/teams.mdx +24 -8
- package/docs/content/docs/cli/webex.mdx +34 -21
- 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 +19 -9
- package/skills/agent-channeltalk/references/common-patterns.md +10 -9
- package/skills/agent-channeltalkbot/SKILL.md +19 -9
- package/skills/agent-channeltalkbot/references/common-patterns.md +10 -9
- package/skills/agent-discord/SKILL.md +18 -9
- package/skills/agent-discord/references/common-patterns.md +8 -7
- package/skills/agent-discordbot/SKILL.md +18 -9
- 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 +19 -10
- package/skills/agent-slack/references/common-patterns.md +4 -7
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +18 -9
- package/skills/agent-teams/references/common-patterns.md +9 -7
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +13 -4
- package/skills/agent-webex/references/common-patterns.md +8 -2
- 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 +77 -30
- package/src/platforms/channeltalk/commands/snapshot.ts +112 -34
- 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 +43 -13
- package/src/platforms/channeltalkbot/commands/snapshot.ts +131 -64
- 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/snapshot.test.ts +1 -1
- package/src/platforms/discord/commands/snapshot.ts +58 -42
- 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 +43 -19
- package/src/platforms/discordbot/commands/snapshot.ts +54 -37
- 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/snapshot.test.ts +63 -8
- package/src/platforms/slack/commands/snapshot.ts +98 -66
- 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/snapshot.test.ts +1 -1
- package/src/platforms/teams/commands/snapshot.ts +53 -38
- 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 +4 -12
- package/src/platforms/webex/client.ts +14 -52
- 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 +42 -4
- package/src/platforms/webex/commands/snapshot.ts +19 -11
- 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 +6 -18
- package/src/platforms/webex/markdown-to-html.ts +8 -8
- package/src/platforms/webex/token-extractor.ts +6 -29
- 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,4 +1,5 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, mock, spyOn, test } from 'bun:test'
|
|
2
|
+
|
|
2
3
|
import { WebexError } from '../types'
|
|
3
4
|
|
|
4
5
|
const mockHandleError = mock((err: Error) => {
|
|
@@ -10,12 +11,36 @@ mock.module('@/shared/utils/error-handler', () => ({
|
|
|
10
11
|
}))
|
|
11
12
|
|
|
12
13
|
const mockSpaces = [
|
|
13
|
-
{
|
|
14
|
-
|
|
14
|
+
{
|
|
15
|
+
id: 'space-1',
|
|
16
|
+
title: 'General',
|
|
17
|
+
type: 'group',
|
|
18
|
+
isLocked: false,
|
|
19
|
+
lastActivity: '2024-01-15T00:00:00.000Z',
|
|
20
|
+
created: '2024-01-01T00:00:00.000Z',
|
|
21
|
+
creatorId: 'person-1',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'space-2',
|
|
25
|
+
title: 'Random',
|
|
26
|
+
type: 'group',
|
|
27
|
+
isLocked: false,
|
|
28
|
+
lastActivity: '2024-01-14T00:00:00.000Z',
|
|
29
|
+
created: '2024-01-01T00:00:00.000Z',
|
|
30
|
+
creatorId: 'person-1',
|
|
31
|
+
},
|
|
15
32
|
]
|
|
16
33
|
|
|
17
34
|
const mockMyMemberships = [
|
|
18
|
-
{
|
|
35
|
+
{
|
|
36
|
+
id: 'mem-1',
|
|
37
|
+
roomId: 'space-1',
|
|
38
|
+
personId: 'person-1',
|
|
39
|
+
personEmail: 'alice@example.com',
|
|
40
|
+
personDisplayName: 'Alice',
|
|
41
|
+
isModerator: true,
|
|
42
|
+
created: '2024-01-01T00:00:00.000Z',
|
|
43
|
+
},
|
|
19
44
|
]
|
|
20
45
|
|
|
21
46
|
const mockListSpaces = mock(() => Promise.resolve(mockSpaces as any))
|
|
@@ -54,9 +79,21 @@ describe('snapshot command', () => {
|
|
|
54
79
|
consoleSpy.mockRestore()
|
|
55
80
|
})
|
|
56
81
|
|
|
57
|
-
test('returns spaces with id
|
|
82
|
+
test('brief snapshot returns spaces with id and title only', async () => {
|
|
58
83
|
await snapshotAction({})
|
|
59
84
|
|
|
85
|
+
expect(consoleSpy).toHaveBeenCalled()
|
|
86
|
+
const output = JSON.parse(consoleSpy.mock.calls[consoleSpy.mock.calls.length - 1][0])
|
|
87
|
+
expect(output.spaces).toHaveLength(1)
|
|
88
|
+
expect(output.spaces[0].id).toBe('space-1')
|
|
89
|
+
expect(output.spaces[0].title).toBe('General')
|
|
90
|
+
expect(output.spaces[0].type).toBeUndefined()
|
|
91
|
+
expect(output.hint).toBeDefined()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('full snapshot returns spaces with id, title, type, lastActivity', async () => {
|
|
95
|
+
await snapshotAction({ full: true })
|
|
96
|
+
|
|
60
97
|
expect(consoleSpy).toHaveBeenCalled()
|
|
61
98
|
const output = JSON.parse(consoleSpy.mock.calls[consoleSpy.mock.calls.length - 1][0])
|
|
62
99
|
expect(output.spaces).toHaveLength(1)
|
|
@@ -64,6 +101,7 @@ describe('snapshot command', () => {
|
|
|
64
101
|
expect(output.spaces[0].title).toBe('General')
|
|
65
102
|
expect(output.spaces[0].type).toBe('group')
|
|
66
103
|
expect(output.spaces[0].lastActivity).toBe('2024-01-15T00:00:00.000Z')
|
|
104
|
+
expect(output.hint).toBeUndefined()
|
|
67
105
|
})
|
|
68
106
|
|
|
69
107
|
test('filters spaces to only those in my memberships', async () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
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 { WebexClient } from '../client'
|
|
5
7
|
|
|
6
|
-
export async function snapshotAction(options: {
|
|
7
|
-
pretty?: boolean
|
|
8
|
-
}): Promise<void> {
|
|
8
|
+
export async function snapshotAction(options: { full?: boolean; pretty?: boolean }): Promise<void> {
|
|
9
9
|
try {
|
|
10
10
|
const client = await new WebexClient().login()
|
|
11
11
|
|
|
@@ -15,13 +15,19 @@ export async function snapshotAction(options: {
|
|
|
15
15
|
const allSpaces = await client.listSpaces({ max: 100 })
|
|
16
16
|
const spaces = allSpaces.filter((s) => myRoomIds.has(s.id))
|
|
17
17
|
|
|
18
|
-
const snapshot = {
|
|
19
|
-
spaces:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const snapshot: Record<string, any> = {
|
|
19
|
+
spaces: options.full
|
|
20
|
+
? spaces.map((s) => ({
|
|
21
|
+
id: s.id,
|
|
22
|
+
title: s.title,
|
|
23
|
+
type: s.type,
|
|
24
|
+
lastActivity: s.lastActivity,
|
|
25
|
+
}))
|
|
26
|
+
: spaces.map((s) => ({ id: s.id, title: s.title })),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!options.full) {
|
|
30
|
+
snapshot.hint = "Use 'message list <space>' for messages, 'space info <space>' for space details."
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
console.log(formatOutput(snapshot, options.pretty))
|
|
@@ -31,10 +37,12 @@ export async function snapshotAction(options: {
|
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
export const snapshotCommand = new Command('snapshot')
|
|
34
|
-
.description('Get workspace
|
|
40
|
+
.description('Get workspace overview for AI agents (brief by default, use --full for comprehensive data)')
|
|
41
|
+
.option('--full', 'Include full space details (verbose)')
|
|
35
42
|
.option('--pretty', 'Pretty print JSON output')
|
|
36
43
|
.action(async (options) => {
|
|
37
44
|
await snapshotAction({
|
|
45
|
+
full: options.full,
|
|
38
46
|
pretty: options.pretty,
|
|
39
47
|
})
|
|
40
48
|
})
|
|
@@ -59,9 +59,9 @@ let consoleLogSpy: ReturnType<typeof spyOn>
|
|
|
59
59
|
beforeEach(() => {
|
|
60
60
|
mockListSpaces.mockReset().mockImplementation(() => Promise.resolve(mockSpaces))
|
|
61
61
|
mockGetSpace.mockReset().mockImplementation(() => Promise.resolve(mockSpace))
|
|
62
|
-
mockLogin
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
mockLogin
|
|
63
|
+
.mockReset()
|
|
64
|
+
.mockImplementation(() => Promise.resolve({ listSpaces: mockListSpaces, getSpace: mockGetSpace }))
|
|
65
65
|
mockHandleError.mockReset().mockImplementation((err: Error) => {
|
|
66
66
|
throw err
|
|
67
67
|
})
|
|
@@ -5,11 +5,7 @@ import { formatOutput } from '@/shared/utils/output'
|
|
|
5
5
|
|
|
6
6
|
import { WebexClient } from '../client'
|
|
7
7
|
|
|
8
|
-
export async function listAction(options: {
|
|
9
|
-
type?: string
|
|
10
|
-
limit?: number
|
|
11
|
-
pretty?: boolean
|
|
12
|
-
}): Promise<void> {
|
|
8
|
+
export async function listAction(options: { type?: string; limit?: number; pretty?: boolean }): Promise<void> {
|
|
13
9
|
try {
|
|
14
10
|
const client = await new WebexClient().login()
|
|
15
11
|
const spaces = await client.listSpaces({ type: options.type, max: options.limit })
|
|
@@ -26,10 +22,7 @@ export async function listAction(options: {
|
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
24
|
|
|
29
|
-
export async function infoAction(
|
|
30
|
-
spaceId: string,
|
|
31
|
-
options: { pretty?: boolean },
|
|
32
|
-
): Promise<void> {
|
|
25
|
+
export async function infoAction(spaceId: string, options: { pretty?: boolean }): Promise<void> {
|
|
33
26
|
try {
|
|
34
27
|
const client = await new WebexClient().login()
|
|
35
28
|
const space = await client.getSpace(spaceId)
|
|
@@ -18,7 +18,9 @@ const mockUser = {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const makeFakeClient = () => ({
|
|
21
|
-
login: async function (this: unknown) {
|
|
21
|
+
login: async function (this: unknown) {
|
|
22
|
+
return this
|
|
23
|
+
},
|
|
22
24
|
testAuth: async () => mockUser,
|
|
23
25
|
})
|
|
24
26
|
|
|
@@ -100,10 +102,15 @@ test('whoami outputs pretty-printed JSON when --pretty flag is passed', async ()
|
|
|
100
102
|
|
|
101
103
|
test('whoami exits with code 1 when not authenticated', async () => {
|
|
102
104
|
// given: no credentials
|
|
103
|
-
webexClientSpy.mockImplementation(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
webexClientSpy.mockImplementation(
|
|
106
|
+
() =>
|
|
107
|
+
({
|
|
108
|
+
login: async () => {
|
|
109
|
+
throw new WebexError('No Webex credentials found.', 'no_credentials')
|
|
110
|
+
},
|
|
111
|
+
testAuth: async () => mockUser,
|
|
112
|
+
}) as unknown as clientModule.WebexClient,
|
|
113
|
+
)
|
|
107
114
|
|
|
108
115
|
// when: running whoami
|
|
109
116
|
await whoamiCommand.parseAsync([], { from: 'user' })
|
|
@@ -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 { WebexClient } from '../client'
|
|
5
7
|
|
|
6
8
|
export async function whoamiAction(options: { pretty?: boolean }): Promise<void> {
|
|
@@ -95,7 +95,10 @@ export class WebexCredentialManager {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
async requestDeviceCode(
|
|
98
|
+
async requestDeviceCode(
|
|
99
|
+
clientId: string,
|
|
100
|
+
scopes?: string,
|
|
101
|
+
): Promise<{
|
|
99
102
|
deviceCode: string
|
|
100
103
|
userCode: string
|
|
101
104
|
verificationUri: string
|
|
@@ -136,7 +139,13 @@ export class WebexCredentialManager {
|
|
|
136
139
|
}
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
async pollDeviceToken(
|
|
142
|
+
async pollDeviceToken(
|
|
143
|
+
deviceCode: string,
|
|
144
|
+
interval: number,
|
|
145
|
+
expiresIn: number,
|
|
146
|
+
clientId: string,
|
|
147
|
+
clientSecret?: string,
|
|
148
|
+
): Promise<WebexConfig> {
|
|
140
149
|
const basicAuth = btoa(`${clientId}:${clientSecret ?? ''}`)
|
|
141
150
|
const deadline = Date.now() + expiresIn * 1000
|
|
142
151
|
|
|
@@ -32,9 +32,7 @@ export async function ensureWebexAuth(): Promise<void> {
|
|
|
32
32
|
tokenType: 'extracted',
|
|
33
33
|
deviceUrl: extracted.deviceUrl,
|
|
34
34
|
userId: extracted.userId,
|
|
35
|
-
encryptionKeys: extracted.encryptionKeys
|
|
36
|
-
? Object.fromEntries(extracted.encryptionKeys)
|
|
37
|
-
: undefined,
|
|
35
|
+
encryptionKeys: extracted.encryptionKeys ? Object.fromEntries(extracted.encryptionKeys) : undefined,
|
|
38
36
|
})
|
|
39
37
|
} catch {
|
|
40
38
|
// Intentionally silent — best-effort preflight that should not block commands
|
|
@@ -3,13 +3,7 @@ export { WebexCredentialManager } from './credential-manager'
|
|
|
3
3
|
export { WebexTokenExtractor } from './token-extractor'
|
|
4
4
|
export type { ExtractedWebexToken } from './token-extractor'
|
|
5
5
|
export { WebexError } from './types'
|
|
6
|
-
export type {
|
|
7
|
-
WebexConfig,
|
|
8
|
-
WebexMembership,
|
|
9
|
-
WebexMessage,
|
|
10
|
-
WebexPerson,
|
|
11
|
-
WebexSpace,
|
|
12
|
-
} from './types'
|
|
6
|
+
export type { WebexConfig, WebexMembership, WebexMessage, WebexPerson, WebexSpace } from './types'
|
|
13
7
|
export {
|
|
14
8
|
WebexConfigSchema,
|
|
15
9
|
WebexMembershipSchema,
|
|
@@ -30,15 +30,11 @@ describe('markdownToHtml', () => {
|
|
|
30
30
|
})
|
|
31
31
|
|
|
32
32
|
test('converts code blocks without language', () => {
|
|
33
|
-
expect(markdownToHtml('```\nconst x = 1 & 2\n```')).toBe(
|
|
34
|
-
'<pre><code>const x = 1 & 2</code></pre>',
|
|
35
|
-
)
|
|
33
|
+
expect(markdownToHtml('```\nconst x = 1 & 2\n```')).toBe('<pre><code>const x = 1 & 2</code></pre>')
|
|
36
34
|
})
|
|
37
35
|
|
|
38
36
|
test('does not process markdown inside code blocks', () => {
|
|
39
|
-
expect(markdownToHtml('```\n**bold** _italic_\n```')).toBe(
|
|
40
|
-
'<pre><code>**bold** _italic_</code></pre>',
|
|
41
|
-
)
|
|
37
|
+
expect(markdownToHtml('```\n**bold** _italic_\n```')).toBe('<pre><code>**bold** _italic_</code></pre>')
|
|
42
38
|
})
|
|
43
39
|
|
|
44
40
|
test('converts links', () => {
|
|
@@ -56,15 +52,11 @@ describe('markdownToHtml', () => {
|
|
|
56
52
|
})
|
|
57
53
|
|
|
58
54
|
test('allows mailto: links', () => {
|
|
59
|
-
expect(markdownToHtml('[email](mailto:a@b.com)')).toBe(
|
|
60
|
-
'<a href="mailto:a@b.com">email</a>',
|
|
61
|
-
)
|
|
55
|
+
expect(markdownToHtml('[email](mailto:a@b.com)')).toBe('<a href="mailto:a@b.com">email</a>')
|
|
62
56
|
})
|
|
63
57
|
|
|
64
58
|
test('escapes quotes in URLs to prevent attribute breakout', () => {
|
|
65
|
-
expect(markdownToHtml('[x](https://a.com?q="test")')).toBe(
|
|
66
|
-
'<a href="https://a.com?q="test"">x</a>',
|
|
67
|
-
)
|
|
59
|
+
expect(markdownToHtml('[x](https://a.com?q="test")')).toBe('<a href="https://a.com?q="test"">x</a>')
|
|
68
60
|
})
|
|
69
61
|
|
|
70
62
|
test('converts unordered lists', () => {
|
|
@@ -92,9 +84,7 @@ describe('markdownToHtml', () => {
|
|
|
92
84
|
})
|
|
93
85
|
|
|
94
86
|
test('supports nested formatting', () => {
|
|
95
|
-
expect(markdownToHtml('**bold _and italic_**')).toBe(
|
|
96
|
-
'<strong>bold <em>and italic</em></strong>',
|
|
97
|
-
)
|
|
87
|
+
expect(markdownToHtml('**bold _and italic_**')).toBe('<strong>bold <em>and italic</em></strong>')
|
|
98
88
|
})
|
|
99
89
|
|
|
100
90
|
test('escapes html special characters in text', () => {
|
|
@@ -134,9 +124,7 @@ describe('stripMarkdown', () => {
|
|
|
134
124
|
})
|
|
135
125
|
|
|
136
126
|
test('strips block markdown syntax', () => {
|
|
137
|
-
expect(stripMarkdown('# Title\n> quote\n- item\n1. first\n---')).toBe(
|
|
138
|
-
'Title\nquote\nitem\nfirst\n',
|
|
139
|
-
)
|
|
127
|
+
expect(stripMarkdown('# Title\n> quote\n- item\n1. first\n---')).toBe('Title\nquote\nitem\nfirst\n')
|
|
140
128
|
})
|
|
141
129
|
|
|
142
130
|
test('keeps code block content', () => {
|
|
@@ -129,10 +129,7 @@ function processInline(markdown: string): string {
|
|
|
129
129
|
if (!isSafeUrl(url)) {
|
|
130
130
|
return processInline(label)
|
|
131
131
|
}
|
|
132
|
-
return createInlinePlaceholder(
|
|
133
|
-
placeholders,
|
|
134
|
-
`<a href="${escapeHtml(url)}">${processInline(label)}</a>`,
|
|
135
|
-
)
|
|
132
|
+
return createInlinePlaceholder(placeholders, `<a href="${escapeHtml(url)}">${processInline(label)}</a>`)
|
|
136
133
|
})
|
|
137
134
|
|
|
138
135
|
text = escapeHtml(text)
|
|
@@ -145,10 +142,13 @@ function processInline(markdown: string): string {
|
|
|
145
142
|
|
|
146
143
|
function extractCodeBlocks(markdown: string): { text: string; blocks: string[] } {
|
|
147
144
|
const blocks: string[] = []
|
|
148
|
-
const text = markdown.replace(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
const text = markdown.replace(
|
|
146
|
+
/```([a-zA-Z0-9_-]+)?\n([\s\S]*?)\n```/g,
|
|
147
|
+
(_, language: string | undefined, code: string) => {
|
|
148
|
+
const className = language ? ` class="language-${escapeHtml(language)}"` : ''
|
|
149
|
+
return createBlockPlaceholder(blocks, `<pre><code${className}>${escapeHtml(code)}</code></pre>`)
|
|
150
|
+
},
|
|
151
|
+
)
|
|
152
152
|
|
|
153
153
|
return { text, blocks }
|
|
154
154
|
}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
copyFileSync,
|
|
3
|
-
existsSync,
|
|
4
|
-
mkdirSync,
|
|
5
|
-
readdirSync,
|
|
6
|
-
readFileSync,
|
|
7
|
-
rmSync,
|
|
8
|
-
statSync,
|
|
9
|
-
} from 'node:fs'
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync } from 'node:fs'
|
|
10
2
|
import { homedir, tmpdir } from 'node:os'
|
|
11
3
|
import { join } from 'node:path'
|
|
12
4
|
|
|
@@ -73,8 +65,6 @@ const BROWSERS: BrowserConfig[] = [
|
|
|
73
65
|
},
|
|
74
66
|
]
|
|
75
67
|
|
|
76
|
-
const WEBEX_STORAGE_KEY = '_https://web.webex.com\x00\x01webex-web-client-bounded'
|
|
77
|
-
|
|
78
68
|
interface ScanResult {
|
|
79
69
|
token: ExtractedWebexToken | null
|
|
80
70
|
encryptionKeys: Map<string, string>
|
|
@@ -128,10 +118,7 @@ export class WebexTokenExtractor {
|
|
|
128
118
|
case 'win32':
|
|
129
119
|
relative = browser.win32
|
|
130
120
|
if (!relative) return null
|
|
131
|
-
return join(
|
|
132
|
-
process.env.LOCALAPPDATA || join(homedir(), 'AppData', 'Local'),
|
|
133
|
-
relative,
|
|
134
|
-
)
|
|
121
|
+
return join(process.env.LOCALAPPDATA || join(homedir(), 'AppData', 'Local'), relative)
|
|
135
122
|
default:
|
|
136
123
|
return null
|
|
137
124
|
}
|
|
@@ -176,8 +163,7 @@ export class WebexTokenExtractor {
|
|
|
176
163
|
for (const leveldbDir of profileDirs) {
|
|
177
164
|
this.debug(`Scanning: ${leveldbDir}`)
|
|
178
165
|
|
|
179
|
-
const result = await this.scanViaClassicLevelCopy(leveldbDir)
|
|
180
|
-
?? this.scanRawFiles(leveldbDir)
|
|
166
|
+
const result = (await this.scanViaClassicLevelCopy(leveldbDir)) ?? this.scanRawFiles(leveldbDir)
|
|
181
167
|
|
|
182
168
|
if (result?.token) {
|
|
183
169
|
this.debug(`Found token in: ${leveldbDir}`)
|
|
@@ -339,9 +325,7 @@ export class WebexTokenExtractor {
|
|
|
339
325
|
const innermostMarkerIdx = content.indexOf('"supertoken"')
|
|
340
326
|
|
|
341
327
|
const markerIdx =
|
|
342
|
-
outerObjectMarkerIdx !== -1 ? outerObjectMarkerIdx
|
|
343
|
-
: innermostMarkerIdx !== -1 ? innermostMarkerIdx
|
|
344
|
-
: -1
|
|
328
|
+
outerObjectMarkerIdx !== -1 ? outerObjectMarkerIdx : innermostMarkerIdx !== -1 ? innermostMarkerIdx : -1
|
|
345
329
|
|
|
346
330
|
if (markerIdx === -1) return null
|
|
347
331
|
|
|
@@ -387,11 +371,7 @@ export class WebexTokenExtractor {
|
|
|
387
371
|
try {
|
|
388
372
|
const data = JSON.parse(jsonStr)
|
|
389
373
|
|
|
390
|
-
const supertoken =
|
|
391
|
-
data?.Credentials?.['@']?.supertoken ??
|
|
392
|
-
data?.['@']?.supertoken ??
|
|
393
|
-
data?.supertoken ??
|
|
394
|
-
null
|
|
374
|
+
const supertoken = data?.Credentials?.['@']?.supertoken ?? data?.['@']?.supertoken ?? data?.supertoken ?? null
|
|
395
375
|
|
|
396
376
|
if (!supertoken?.access_token) return null
|
|
397
377
|
|
|
@@ -410,10 +390,7 @@ export class WebexTokenExtractor {
|
|
|
410
390
|
result.expiresAt = Date.now() + supertoken.expires_in * 1000
|
|
411
391
|
}
|
|
412
392
|
|
|
413
|
-
const deviceUrl =
|
|
414
|
-
data?.Device?.['@']?.url ??
|
|
415
|
-
data?.['@']?.deviceUrl ??
|
|
416
|
-
null
|
|
393
|
+
const deviceUrl = data?.Device?.['@']?.url ?? data?.['@']?.deviceUrl ?? null
|
|
417
394
|
if (deviceUrl && typeof deviceUrl === 'string') {
|
|
418
395
|
result.deviceUrl = deviceUrl
|
|
419
396
|
}
|
|
@@ -50,12 +50,16 @@ describe('WeChatBotClient', () => {
|
|
|
50
50
|
describe('login', () => {
|
|
51
51
|
test('throws on empty appId', async () => {
|
|
52
52
|
await expect(new WeChatBotClient().login({ appId: '', appSecret: 'secret' })).rejects.toThrow(WeChatBotError)
|
|
53
|
-
await expect(new WeChatBotClient().login({ appId: '', appSecret: 'secret' })).rejects.toThrow(
|
|
53
|
+
await expect(new WeChatBotClient().login({ appId: '', appSecret: 'secret' })).rejects.toThrow(
|
|
54
|
+
'App ID is required',
|
|
55
|
+
)
|
|
54
56
|
})
|
|
55
57
|
|
|
56
58
|
test('throws on empty appSecret', async () => {
|
|
57
59
|
await expect(new WeChatBotClient().login({ appId: 'wx123', appSecret: '' })).rejects.toThrow(WeChatBotError)
|
|
58
|
-
await expect(new WeChatBotClient().login({ appId: 'wx123', appSecret: '' })).rejects.toThrow(
|
|
60
|
+
await expect(new WeChatBotClient().login({ appId: 'wx123', appSecret: '' })).rejects.toThrow(
|
|
61
|
+
'App Secret is required',
|
|
62
|
+
)
|
|
59
63
|
})
|
|
60
64
|
|
|
61
65
|
test('accepts valid credentials and returns client', async () => {
|
|
@@ -62,7 +62,12 @@ export class WeChatBotClient {
|
|
|
62
62
|
throw new WeChatBotError(`Network error fetching access token: ${msg}`, 'network_error')
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const data = (await response.json()) as {
|
|
65
|
+
const data = (await response.json()) as {
|
|
66
|
+
access_token?: string
|
|
67
|
+
expires_in?: number
|
|
68
|
+
errcode?: number
|
|
69
|
+
errmsg?: string
|
|
70
|
+
}
|
|
66
71
|
|
|
67
72
|
if (data.errcode) {
|
|
68
73
|
throw new WeChatBotError(data.errmsg ?? `Error ${data.errcode}`, String(data.errcode))
|
|
@@ -13,17 +13,13 @@ mock.module('../client', () => ({
|
|
|
13
13
|
},
|
|
14
14
|
}))
|
|
15
15
|
|
|
16
|
-
const { setAction, statusAction, clearAction, listAction, useAction, removeAction } =
|
|
17
|
-
'@/platforms/wechatbot/commands/auth'
|
|
18
|
-
)
|
|
16
|
+
const { setAction, statusAction, clearAction, listAction, useAction, removeAction } =
|
|
17
|
+
await import('@/platforms/wechatbot/commands/auth')
|
|
19
18
|
|
|
20
19
|
const testDirs: string[] = []
|
|
21
20
|
|
|
22
21
|
function makeCredManager(): WeChatBotCredentialManager {
|
|
23
|
-
const dir = join(
|
|
24
|
-
import.meta.dir,
|
|
25
|
-
`.test-auth-config-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
26
|
-
)
|
|
22
|
+
const dir = join(import.meta.dir, `.test-auth-config-${Date.now()}-${Math.random().toString(36).slice(2)}`)
|
|
27
23
|
testDirs.push(dir)
|
|
28
24
|
return new WeChatBotCredentialManager(dir)
|
|
29
25
|
}
|
|
@@ -24,10 +24,7 @@ const { sendAction, sendNewsAction } = await import('@/platforms/wechatbot/comma
|
|
|
24
24
|
const testDirs: string[] = []
|
|
25
25
|
|
|
26
26
|
function makeCredManager(): WeChatBotCredentialManager {
|
|
27
|
-
const dir = join(
|
|
28
|
-
import.meta.dir,
|
|
29
|
-
`.test-message-config-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
30
|
-
)
|
|
27
|
+
const dir = join(import.meta.dir, `.test-message-config-${Date.now()}-${Math.random().toString(36).slice(2)}`)
|
|
31
28
|
testDirs.push(dir)
|
|
32
29
|
const manager = new WeChatBotCredentialManager(dir)
|
|
33
30
|
return manager
|
|
@@ -28,7 +28,11 @@ export async function sendAction(openId: string, text: string, options: MessageO
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export async function sendImageAction(
|
|
31
|
+
export async function sendImageAction(
|
|
32
|
+
openId: string,
|
|
33
|
+
mediaId: string,
|
|
34
|
+
options: MessageOptions,
|
|
35
|
+
): Promise<MessageResult> {
|
|
32
36
|
try {
|
|
33
37
|
const client = await getClient(options)
|
|
34
38
|
await client.sendImageMessage(openId, mediaId)
|
|
@@ -31,10 +31,7 @@ const { listAction } = await import('@/platforms/wechatbot/commands/template')
|
|
|
31
31
|
const testDirs: string[] = []
|
|
32
32
|
|
|
33
33
|
function makeCredManager(): WeChatBotCredentialManager {
|
|
34
|
-
const dir = join(
|
|
35
|
-
import.meta.dir,
|
|
36
|
-
`.test-template-config-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
37
|
-
)
|
|
34
|
+
const dir = join(import.meta.dir, `.test-template-config-${Date.now()}-${Math.random().toString(36).slice(2)}`)
|
|
38
35
|
testDirs.push(dir)
|
|
39
36
|
return new WeChatBotCredentialManager(dir)
|
|
40
37
|
}
|
|
@@ -38,10 +38,7 @@ const { listAction } = await import('@/platforms/wechatbot/commands/user')
|
|
|
38
38
|
const testDirs: string[] = []
|
|
39
39
|
|
|
40
40
|
function makeCredManager(): WeChatBotCredentialManager {
|
|
41
|
-
const dir = join(
|
|
42
|
-
import.meta.dir,
|
|
43
|
-
`.test-user-config-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
44
|
-
)
|
|
41
|
+
const dir = join(import.meta.dir, `.test-user-config-${Date.now()}-${Math.random().toString(36).slice(2)}`)
|
|
45
42
|
testDirs.push(dir)
|
|
46
43
|
return new WeChatBotCredentialManager(dir)
|
|
47
44
|
}
|
|
@@ -88,9 +85,7 @@ describe('listAction (user)', () => {
|
|
|
88
85
|
})
|
|
89
86
|
|
|
90
87
|
test('passes nextOpenid option to client', async () => {
|
|
91
|
-
const getFollowersMock = mock(() =>
|
|
92
|
-
Promise.resolve({ total: 1, count: 1, openids: ['openid-3'], next_openid: '' }),
|
|
93
|
-
)
|
|
88
|
+
const getFollowersMock = mock(() => Promise.resolve({ total: 1, count: 1, openids: ['openid-3'], next_openid: '' }))
|
|
94
89
|
mock.module('../client', () => ({
|
|
95
90
|
WeChatBotClient: class MockWeChatBotClient {
|
|
96
91
|
async login() {
|
|
@@ -19,10 +19,7 @@ function isAuthCommand(command: CommandType): boolean {
|
|
|
19
19
|
|
|
20
20
|
const program = new Command()
|
|
21
21
|
|
|
22
|
-
program
|
|
23
|
-
.name('agent-whatsapp')
|
|
24
|
-
.description('CLI tool for WhatsApp via Baileys (linked device)')
|
|
25
|
-
.version(pkg.version)
|
|
22
|
+
program.name('agent-whatsapp').description('CLI tool for WhatsApp via Baileys (linked device)').version(pkg.version)
|
|
26
23
|
|
|
27
24
|
program.hook('preAction', async (_thisCommand, actionCommand) => {
|
|
28
25
|
if (isAuthCommand(actionCommand)) return
|