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,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', () => ({
|
|
@@ -55,10 +67,28 @@ describe('snapshot command', () => {
|
|
|
55
67
|
})
|
|
56
68
|
|
|
57
69
|
describe('snapshotAction', () => {
|
|
58
|
-
test('returns workspace, groups
|
|
70
|
+
test('brief snapshot returns workspace, groups (names), chat counts, and hint', async () => {
|
|
59
71
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
60
72
|
const result = await snapshotAction({ _credManager: manager })
|
|
61
73
|
|
|
74
|
+
expect(result.error).toBeUndefined()
|
|
75
|
+
expect(result.workspace).toBeDefined()
|
|
76
|
+
expect(result.workspace?.id).toBe('ch1')
|
|
77
|
+
expect(result.workspace?.name).toBe('Test Workspace')
|
|
78
|
+
expect(result.groups).toBeDefined()
|
|
79
|
+
expect(result.groups?.[0]).toEqual({ id: 'grp1', name: 'Team Alpha' })
|
|
80
|
+
expect(result.user_chats).toBeDefined()
|
|
81
|
+
expect(result.user_chats?.opened_count).toBe(1)
|
|
82
|
+
expect(result.hint).toBeDefined()
|
|
83
|
+
expect(result.managers).toBeUndefined()
|
|
84
|
+
expect(result.bots).toBeUndefined()
|
|
85
|
+
expect(mockGetGroupMessages).not.toHaveBeenCalled()
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
test('full snapshot returns workspace, groups, user_chats, managers, bots', async () => {
|
|
89
|
+
const manager = new ChannelBotCredentialManager(tempDir)
|
|
90
|
+
const result = await snapshotAction({ full: true, _credManager: manager })
|
|
91
|
+
|
|
62
92
|
expect(result.error).toBeUndefined()
|
|
63
93
|
expect(result.workspace).toBeDefined()
|
|
64
94
|
expect(result.workspace?.id).toBe('ch1')
|
|
@@ -71,7 +101,7 @@ describe('snapshot command', () => {
|
|
|
71
101
|
|
|
72
102
|
test('groups-only flag skips user_chats, managers, bots', async () => {
|
|
73
103
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
74
|
-
const result = await snapshotAction({ groupsOnly: true, _credManager: manager })
|
|
104
|
+
const result = await snapshotAction({ full: true, groupsOnly: true, _credManager: manager })
|
|
75
105
|
|
|
76
106
|
expect(result.error).toBeUndefined()
|
|
77
107
|
expect(result.workspace).toBeDefined()
|
|
@@ -83,7 +113,7 @@ describe('snapshot command', () => {
|
|
|
83
113
|
|
|
84
114
|
test('chats-only flag skips groups, managers, bots', async () => {
|
|
85
115
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
86
|
-
const result = await snapshotAction({ chatsOnly: true, _credManager: manager })
|
|
116
|
+
const result = await snapshotAction({ full: true, chatsOnly: true, _credManager: manager })
|
|
87
117
|
|
|
88
118
|
expect(result.error).toBeUndefined()
|
|
89
119
|
expect(result.workspace).toBeDefined()
|
|
@@ -93,21 +123,21 @@ describe('snapshot command', () => {
|
|
|
93
123
|
expect(result.bots).toBeUndefined()
|
|
94
124
|
})
|
|
95
125
|
|
|
96
|
-
test('groups include recent messages', async () => {
|
|
126
|
+
test('full groups include recent messages', async () => {
|
|
97
127
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
98
|
-
const result = await snapshotAction({ groupsOnly: true, limit: 3, _credManager: manager })
|
|
128
|
+
const result = await snapshotAction({ full: true, groupsOnly: true, limit: 3, _credManager: manager })
|
|
99
129
|
|
|
100
130
|
expect(result.groups?.[0].messages).toBeDefined()
|
|
101
131
|
expect(result.groups?.[0].messages?.[0].id).toBe('msg1')
|
|
102
132
|
})
|
|
103
133
|
|
|
104
|
-
test('user_chats includes counts and recent opened', async () => {
|
|
134
|
+
test('full user_chats includes counts and recent opened', async () => {
|
|
105
135
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
106
|
-
const result = await snapshotAction({ chatsOnly: true, _credManager: manager })
|
|
136
|
+
const result = await snapshotAction({ full: true, chatsOnly: true, _credManager: manager })
|
|
107
137
|
|
|
108
138
|
expect(result.user_chats?.opened_count).toBe(1)
|
|
109
139
|
expect(result.user_chats?.recent_opened).toHaveLength(1)
|
|
110
|
-
expect(result.user_chats?.recent_opened[0].id).toBe('chat1')
|
|
140
|
+
expect(result.user_chats?.recent_opened?.[0].id).toBe('chat1')
|
|
111
141
|
})
|
|
112
142
|
})
|
|
113
143
|
})
|
|
@@ -9,6 +9,7 @@ import { getClient } from './shared'
|
|
|
9
9
|
interface SnapshotOption extends WorkspaceOption {
|
|
10
10
|
groupsOnly?: boolean
|
|
11
11
|
chatsOnly?: boolean
|
|
12
|
+
full?: boolean
|
|
12
13
|
limit?: number
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -33,7 +34,7 @@ interface SnapshotResult {
|
|
|
33
34
|
opened_count: number
|
|
34
35
|
snoozed_count: number
|
|
35
36
|
closed_count: number
|
|
36
|
-
recent_opened
|
|
37
|
+
recent_opened?: Array<{
|
|
37
38
|
id: string
|
|
38
39
|
name?: string
|
|
39
40
|
user_id?: string
|
|
@@ -46,13 +47,13 @@ interface SnapshotResult {
|
|
|
46
47
|
}
|
|
47
48
|
managers?: Array<{ id: string; name: string; description?: string }>
|
|
48
49
|
bots?: Array<{ id: string; name: string }>
|
|
50
|
+
hint?: string
|
|
49
51
|
error?: string
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
export async function snapshotAction(options: SnapshotOption): Promise<SnapshotResult> {
|
|
53
55
|
try {
|
|
54
56
|
const client = await getClient(options)
|
|
55
|
-
const limit = options.limit ?? 5
|
|
56
57
|
|
|
57
58
|
const channel = await client.getChannel()
|
|
58
59
|
const workspace = {
|
|
@@ -62,71 +63,75 @@ export async function snapshotAction(options: SnapshotOption): Promise<SnapshotR
|
|
|
62
63
|
description: channel.description,
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
if (options.
|
|
66
|
-
|
|
67
|
-
const groupsWithMessages = await Promise.all(
|
|
68
|
-
groups.map(async (g) => {
|
|
69
|
-
const messages = await client.getGroupMessages(g.id, { limit, sortOrder: 'desc' })
|
|
70
|
-
return {
|
|
71
|
-
id: g.id,
|
|
72
|
-
name: g.name,
|
|
73
|
-
messages: messages.map((m) => ({
|
|
74
|
-
id: m.id,
|
|
75
|
-
person_type: m.personType,
|
|
76
|
-
plain_text: m.plainText,
|
|
77
|
-
created_at: m.createdAt,
|
|
78
|
-
})),
|
|
79
|
-
}
|
|
80
|
-
}),
|
|
81
|
-
)
|
|
82
|
-
return { workspace, groups: groupsWithMessages }
|
|
66
|
+
if (options.full) {
|
|
67
|
+
return buildFullSnapshot(client, workspace, options)
|
|
83
68
|
}
|
|
84
69
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
])
|
|
91
|
-
|
|
92
|
-
const recentOpened = await Promise.all(
|
|
93
|
-
openedChats.slice(0, 5).map(async (chat) => {
|
|
94
|
-
const messages = await client.getUserChatMessages(chat.id, { limit: 1, sortOrder: 'desc' })
|
|
95
|
-
return {
|
|
96
|
-
id: chat.id,
|
|
97
|
-
name: chat.name,
|
|
98
|
-
user_id: chat.userId,
|
|
99
|
-
last_message: messages[0]
|
|
100
|
-
? {
|
|
101
|
-
id: messages[0].id,
|
|
102
|
-
plain_text: messages[0].plainText,
|
|
103
|
-
created_at: messages[0].createdAt,
|
|
104
|
-
}
|
|
105
|
-
: undefined,
|
|
106
|
-
}
|
|
107
|
-
}),
|
|
108
|
-
)
|
|
70
|
+
return buildBriefSnapshot(client, workspace, options)
|
|
71
|
+
} catch (error) {
|
|
72
|
+
return { error: (error as Error).message }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
109
75
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
76
|
+
async function buildBriefSnapshot(
|
|
77
|
+
client: Awaited<ReturnType<typeof getClient>>,
|
|
78
|
+
workspace: SnapshotResult['workspace'],
|
|
79
|
+
options: SnapshotOption,
|
|
80
|
+
): Promise<SnapshotResult> {
|
|
81
|
+
if (options.groupsOnly) {
|
|
82
|
+
const groups = await client.listGroups({ limit: 20 })
|
|
83
|
+
return {
|
|
84
|
+
workspace,
|
|
85
|
+
groups: groups.map((g) => ({ id: g.id, name: g.name })),
|
|
86
|
+
hint: "Use 'group messages <group>' for messages.",
|
|
119
87
|
}
|
|
88
|
+
}
|
|
120
89
|
|
|
121
|
-
|
|
122
|
-
|
|
90
|
+
if (options.chatsOnly) {
|
|
91
|
+
const [openedChats, snoozedChats, closedChats] = await Promise.all([
|
|
123
92
|
client.listUserChats({ state: 'opened', limit: 10, sortOrder: 'desc' }),
|
|
124
93
|
client.listUserChats({ state: 'snoozed', limit: 1 }),
|
|
125
94
|
client.listUserChats({ state: 'closed', limit: 1 }),
|
|
126
|
-
client.listManagers({ limit: 50 }),
|
|
127
|
-
client.listBots({ limit: 50 }),
|
|
128
95
|
])
|
|
96
|
+
return {
|
|
97
|
+
workspace,
|
|
98
|
+
user_chats: {
|
|
99
|
+
opened_count: openedChats.length,
|
|
100
|
+
snoozed_count: snoozedChats.length,
|
|
101
|
+
closed_count: closedChats.length,
|
|
102
|
+
},
|
|
103
|
+
hint: "Use 'chat list --state opened' for chat details, 'chat messages <chat>' for messages.",
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const [groups, openedChats, snoozedChats, closedChats] = await Promise.all([
|
|
108
|
+
client.listGroups({ limit: 20 }),
|
|
109
|
+
client.listUserChats({ state: 'opened', limit: 10, sortOrder: 'desc' }),
|
|
110
|
+
client.listUserChats({ state: 'snoozed', limit: 1 }),
|
|
111
|
+
client.listUserChats({ state: 'closed', limit: 1 }),
|
|
112
|
+
])
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
workspace,
|
|
116
|
+
groups: groups.map((g) => ({ id: g.id, name: g.name })),
|
|
117
|
+
user_chats: {
|
|
118
|
+
opened_count: openedChats.length,
|
|
119
|
+
snoozed_count: snoozedChats.length,
|
|
120
|
+
closed_count: closedChats.length,
|
|
121
|
+
},
|
|
122
|
+
hint: "Use 'group messages <group>' for group messages, 'chat list --state opened' for chats, 'manager list' for managers.",
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function buildFullSnapshot(
|
|
127
|
+
client: Awaited<ReturnType<typeof getClient>>,
|
|
128
|
+
workspace: SnapshotResult['workspace'],
|
|
129
|
+
options: SnapshotOption,
|
|
130
|
+
): Promise<SnapshotResult> {
|
|
131
|
+
const limit = options.limit ?? 5
|
|
129
132
|
|
|
133
|
+
if (options.groupsOnly) {
|
|
134
|
+
const groups = await client.listGroups({ limit: 20 })
|
|
130
135
|
const groupsWithMessages = await Promise.all(
|
|
131
136
|
groups.map(async (g) => {
|
|
132
137
|
const messages = await client.getGroupMessages(g.id, { limit, sortOrder: 'desc' })
|
|
@@ -142,6 +147,15 @@ export async function snapshotAction(options: SnapshotOption): Promise<SnapshotR
|
|
|
142
147
|
}
|
|
143
148
|
}),
|
|
144
149
|
)
|
|
150
|
+
return { workspace, groups: groupsWithMessages }
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (options.chatsOnly) {
|
|
154
|
+
const [openedChats, snoozedChats, closedChats] = await Promise.all([
|
|
155
|
+
client.listUserChats({ state: 'opened', limit: 10, sortOrder: 'desc' }),
|
|
156
|
+
client.listUserChats({ state: 'snoozed', limit: 1 }),
|
|
157
|
+
client.listUserChats({ state: 'closed', limit: 1 }),
|
|
158
|
+
])
|
|
145
159
|
|
|
146
160
|
const recentOpened = await Promise.all(
|
|
147
161
|
openedChats.slice(0, 5).map(async (chat) => {
|
|
@@ -163,26 +177,78 @@ export async function snapshotAction(options: SnapshotOption): Promise<SnapshotR
|
|
|
163
177
|
|
|
164
178
|
return {
|
|
165
179
|
workspace,
|
|
166
|
-
groups: groupsWithMessages,
|
|
167
180
|
user_chats: {
|
|
168
181
|
opened_count: openedChats.length,
|
|
169
182
|
snoozed_count: snoozedChats.length,
|
|
170
183
|
closed_count: closedChats.length,
|
|
171
184
|
recent_opened: recentOpened,
|
|
172
185
|
},
|
|
173
|
-
managers: managers.map((m) => ({ id: m.id, name: m.name, description: m.description })),
|
|
174
|
-
bots: bots.map((b) => ({ id: b.id, name: b.name })),
|
|
175
186
|
}
|
|
176
|
-
}
|
|
177
|
-
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const [groups, openedChats, snoozedChats, closedChats, managers, bots] = await Promise.all([
|
|
190
|
+
client.listGroups({ limit: 20 }),
|
|
191
|
+
client.listUserChats({ state: 'opened', limit: 10, sortOrder: 'desc' }),
|
|
192
|
+
client.listUserChats({ state: 'snoozed', limit: 1 }),
|
|
193
|
+
client.listUserChats({ state: 'closed', limit: 1 }),
|
|
194
|
+
client.listManagers({ limit: 50 }),
|
|
195
|
+
client.listBots({ limit: 50 }),
|
|
196
|
+
])
|
|
197
|
+
|
|
198
|
+
const groupsWithMessages = await Promise.all(
|
|
199
|
+
groups.map(async (g) => {
|
|
200
|
+
const messages = await client.getGroupMessages(g.id, { limit, sortOrder: 'desc' })
|
|
201
|
+
return {
|
|
202
|
+
id: g.id,
|
|
203
|
+
name: g.name,
|
|
204
|
+
messages: messages.map((m) => ({
|
|
205
|
+
id: m.id,
|
|
206
|
+
person_type: m.personType,
|
|
207
|
+
plain_text: m.plainText,
|
|
208
|
+
created_at: m.createdAt,
|
|
209
|
+
})),
|
|
210
|
+
}
|
|
211
|
+
}),
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
const recentOpened = await Promise.all(
|
|
215
|
+
openedChats.slice(0, 5).map(async (chat) => {
|
|
216
|
+
const messages = await client.getUserChatMessages(chat.id, { limit: 1, sortOrder: 'desc' })
|
|
217
|
+
return {
|
|
218
|
+
id: chat.id,
|
|
219
|
+
name: chat.name,
|
|
220
|
+
user_id: chat.userId,
|
|
221
|
+
last_message: messages[0]
|
|
222
|
+
? {
|
|
223
|
+
id: messages[0].id,
|
|
224
|
+
plain_text: messages[0].plainText,
|
|
225
|
+
created_at: messages[0].createdAt,
|
|
226
|
+
}
|
|
227
|
+
: undefined,
|
|
228
|
+
}
|
|
229
|
+
}),
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
workspace,
|
|
234
|
+
groups: groupsWithMessages,
|
|
235
|
+
user_chats: {
|
|
236
|
+
opened_count: openedChats.length,
|
|
237
|
+
snoozed_count: snoozedChats.length,
|
|
238
|
+
closed_count: closedChats.length,
|
|
239
|
+
recent_opened: recentOpened,
|
|
240
|
+
},
|
|
241
|
+
managers: managers.map((m) => ({ id: m.id, name: m.name, description: m.description })),
|
|
242
|
+
bots: bots.map((b) => ({ id: b.id, name: b.name })),
|
|
178
243
|
}
|
|
179
244
|
}
|
|
180
245
|
|
|
181
246
|
export const snapshotCommand = new Command('snapshot')
|
|
182
|
-
.description('Workspace overview for AI
|
|
247
|
+
.description('Workspace overview for AI agents (brief by default, use --full for comprehensive data)')
|
|
248
|
+
.option('--full', 'Include messages, managers, and bots (verbose)')
|
|
183
249
|
.option('--groups-only', 'List groups only, skip user chats')
|
|
184
250
|
.option('--chats-only', 'List user chats only, skip groups')
|
|
185
|
-
.option('--limit <n>', 'Messages per group/chat (default: 5)', '5')
|
|
251
|
+
.option('--limit <n>', 'Messages per group/chat with --full (default: 5)', '5')
|
|
186
252
|
.option('--workspace <id>', 'Workspace ID')
|
|
187
253
|
.option('--bot <name>', 'Bot name')
|
|
188
254
|
.option('--pretty', 'Pretty print JSON output')
|
|
@@ -190,6 +256,7 @@ export const snapshotCommand = new Command('snapshot')
|
|
|
190
256
|
try {
|
|
191
257
|
const result = await snapshotAction({
|
|
192
258
|
...options,
|
|
259
|
+
full: options.full,
|
|
193
260
|
limit: parseInt(options.limit, 10),
|
|
194
261
|
})
|
|
195
262
|
console.log(formatOutput(result, options.pretty))
|
|
@@ -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({
|