agent-messenger 1.15.0 → 2.0.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/README.md +73 -13
- package/.claude-plugin/marketplace.json +51 -12
- package/.claude-plugin/plugin.json +14 -3
- package/CONTRIBUTING.md +24 -3
- package/README.md +209 -52
- package/bun.lock +350 -2
- package/cubic.yaml +69 -0
- package/dist/package.json +118 -9
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +27 -6
- package/dist/src/cli.js.map +1 -1
- package/dist/src/platforms/channeltalk/client.d.ts +5 -1
- package/dist/src/platforms/channeltalk/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/client.js +23 -6
- package/dist/src/platforms/channeltalk/client.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.js +4 -4
- package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/shared.js +1 -1
- package/dist/src/platforms/channeltalk/commands/shared.js.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.d.ts +2 -2
- package/dist/src/platforms/channeltalk/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.js +4 -4
- package/dist/src/platforms/channeltalk/ensure-auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/index.d.ts +2 -2
- package/dist/src/platforms/channeltalk/index.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/index.js +1 -2
- package/dist/src/platforms/channeltalk/index.js.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.d.ts +8 -0
- package/dist/src/platforms/channeltalk/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.js +127 -13
- package/dist/src/platforms/channeltalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/channeltalk/types.d.ts +52 -949
- package/dist/src/platforms/channeltalk/types.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/types.js +1 -1
- package/dist/src/platforms/channeltalk/types.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts +5 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.js +24 -9
- package/dist/src/platforms/channeltalkbot/client.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.js +2 -2
- package/dist/src/platforms/channeltalkbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.js +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/index.d.ts +2 -1
- package/dist/src/platforms/channeltalkbot/index.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/index.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/types.d.ts +24 -186
- package/dist/src/platforms/channeltalkbot/types.d.ts.map +1 -1
- package/dist/src/platforms/discord/client.d.ts +7 -1
- package/dist/src/platforms/discord/client.d.ts.map +1 -1
- package/dist/src/platforms/discord/client.js +27 -6
- package/dist/src/platforms/discord/client.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js +2 -2
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/commands/channel.js +3 -3
- package/dist/src/platforms/discord/commands/channel.js.map +1 -1
- package/dist/src/platforms/discord/commands/dm.js +2 -2
- package/dist/src/platforms/discord/commands/dm.js.map +1 -1
- package/dist/src/platforms/discord/commands/file.js +3 -3
- package/dist/src/platforms/discord/commands/file.js.map +1 -1
- package/dist/src/platforms/discord/commands/friend.js +1 -1
- package/dist/src/platforms/discord/commands/friend.js.map +1 -1
- package/dist/src/platforms/discord/commands/member.js +1 -1
- package/dist/src/platforms/discord/commands/member.js.map +1 -1
- package/dist/src/platforms/discord/commands/mention.js +1 -1
- package/dist/src/platforms/discord/commands/mention.js.map +1 -1
- package/dist/src/platforms/discord/commands/message.js +6 -6
- package/dist/src/platforms/discord/commands/message.js.map +1 -1
- package/dist/src/platforms/discord/commands/note.js +2 -2
- package/dist/src/platforms/discord/commands/note.js.map +1 -1
- package/dist/src/platforms/discord/commands/profile.js +1 -1
- package/dist/src/platforms/discord/commands/profile.js.map +1 -1
- package/dist/src/platforms/discord/commands/reaction.js +3 -3
- package/dist/src/platforms/discord/commands/reaction.js.map +1 -1
- package/dist/src/platforms/discord/commands/server.js +1 -1
- package/dist/src/platforms/discord/commands/server.js.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.js +1 -1
- package/dist/src/platforms/discord/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/discord/commands/thread.js +2 -2
- package/dist/src/platforms/discord/commands/thread.js.map +1 -1
- package/dist/src/platforms/discord/commands/user.js +3 -3
- package/dist/src/platforms/discord/commands/user.js.map +1 -1
- package/dist/src/platforms/discord/ensure-auth.js +1 -1
- package/dist/src/platforms/discord/ensure-auth.js.map +1 -1
- package/dist/src/platforms/discord/index.d.ts +6 -0
- package/dist/src/platforms/discord/index.d.ts.map +1 -0
- package/dist/src/platforms/discord/index.js +5 -0
- package/dist/src/platforms/discord/index.js.map +1 -0
- package/dist/src/platforms/discord/listener.d.ts +41 -0
- package/dist/src/platforms/discord/listener.d.ts.map +1 -0
- package/dist/src/platforms/discord/listener.js +262 -0
- package/dist/src/platforms/discord/listener.js.map +1 -0
- package/dist/src/platforms/discord/types.d.ts +150 -352
- package/dist/src/platforms/discord/types.d.ts.map +1 -1
- package/dist/src/platforms/discord/types.js +28 -0
- package/dist/src/platforms/discord/types.js.map +1 -1
- package/dist/src/platforms/discordbot/client.d.ts +4 -1
- package/dist/src/platforms/discordbot/client.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/client.js +23 -7
- package/dist/src/platforms/discordbot/client.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/auth.js +2 -2
- package/dist/src/platforms/discordbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/shared.js +1 -1
- package/dist/src/platforms/discordbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/discordbot/types.d.ts +15 -203
- package/dist/src/platforms/discordbot/types.d.ts.map +1 -1
- package/dist/src/platforms/instagram/cli.d.ts +5 -0
- package/dist/src/platforms/instagram/cli.d.ts.map +1 -0
- package/dist/src/platforms/instagram/cli.js +30 -0
- package/dist/src/platforms/instagram/cli.js.map +1 -0
- package/dist/src/platforms/instagram/client.d.ts +65 -0
- package/dist/src/platforms/instagram/client.d.ts.map +1 -0
- package/dist/src/platforms/instagram/client.js +524 -0
- package/dist/src/platforms/instagram/client.js.map +1 -0
- package/dist/src/platforms/instagram/commands/auth.d.ts +3 -0
- package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/auth.js +330 -0
- package/dist/src/platforms/instagram/commands/auth.js.map +1 -0
- package/dist/src/platforms/instagram/commands/chat.d.ts +3 -0
- package/dist/src/platforms/instagram/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/chat.js +42 -0
- package/dist/src/platforms/instagram/commands/chat.js.map +1 -0
- package/dist/src/platforms/instagram/commands/index.d.ts +4 -0
- package/dist/src/platforms/instagram/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/index.js +4 -0
- package/dist/src/platforms/instagram/commands/index.js.map +1 -0
- package/dist/src/platforms/instagram/commands/message.d.ts +3 -0
- package/dist/src/platforms/instagram/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/message.js +102 -0
- package/dist/src/platforms/instagram/commands/message.js.map +1 -0
- package/dist/src/platforms/instagram/commands/shared.d.ts +8 -0
- package/dist/src/platforms/instagram/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/instagram/commands/shared.js +31 -0
- package/dist/src/platforms/instagram/commands/shared.js.map +1 -0
- package/dist/src/platforms/instagram/credential-manager.d.ts +20 -0
- package/dist/src/platforms/instagram/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/instagram/credential-manager.js +104 -0
- package/dist/src/platforms/instagram/credential-manager.js.map +1 -0
- package/dist/src/platforms/instagram/ensure-auth.d.ts +2 -0
- package/dist/src/platforms/instagram/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/instagram/ensure-auth.js +21 -0
- package/dist/src/platforms/instagram/ensure-auth.js.map +1 -0
- package/dist/src/platforms/instagram/index.d.ts +5 -0
- package/dist/src/platforms/instagram/index.d.ts.map +1 -0
- package/dist/src/platforms/instagram/index.js +5 -0
- package/dist/src/platforms/instagram/index.js.map +1 -0
- package/dist/src/platforms/instagram/listener.d.ts +32 -0
- package/dist/src/platforms/instagram/listener.d.ts.map +1 -0
- package/dist/src/platforms/instagram/listener.js +87 -0
- package/dist/src/platforms/instagram/listener.js.map +1 -0
- package/dist/src/platforms/instagram/types.d.ts +61 -0
- package/dist/src/platforms/instagram/types.d.ts.map +1 -0
- package/dist/src/platforms/instagram/types.js +89 -0
- package/dist/src/platforms/instagram/types.js.map +1 -0
- package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts +27 -0
- package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js +213 -0
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js.map +1 -0
- package/dist/src/platforms/kakaotalk/cli.d.ts +5 -0
- package/dist/src/platforms/kakaotalk/cli.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/cli.js +30 -0
- package/dist/src/platforms/kakaotalk/cli.js.map +1 -0
- package/dist/src/platforms/kakaotalk/client.d.ts +40 -0
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/client.js +290 -0
- package/dist/src/platforms/kakaotalk/client.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/auth.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/auth.js +515 -0
- package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/chat.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/chat.js +23 -0
- package/dist/src/platforms/kakaotalk/commands/chat.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/index.d.ts +4 -0
- package/dist/src/platforms/kakaotalk/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/index.js +4 -0
- package/dist/src/platforms/kakaotalk/commands/index.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/message.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/message.js +41 -0
- package/dist/src/platforms/kakaotalk/commands/message.js.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/shared.d.ts +7 -0
- package/dist/src/platforms/kakaotalk/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/shared.js +24 -0
- package/dist/src/platforms/kakaotalk/commands/shared.js.map +1 -0
- package/dist/src/platforms/kakaotalk/credential-manager.d.ts +27 -0
- package/dist/src/platforms/kakaotalk/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/credential-manager.js +82 -0
- package/dist/src/platforms/kakaotalk/credential-manager.js.map +1 -0
- package/dist/src/platforms/kakaotalk/ensure-auth.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/ensure-auth.js +11 -0
- package/dist/src/platforms/kakaotalk/ensure-auth.js.map +1 -0
- package/dist/src/platforms/kakaotalk/index.d.ts +7 -0
- package/dist/src/platforms/kakaotalk/index.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/index.js +5 -0
- package/dist/src/platforms/kakaotalk/index.js.map +1 -0
- package/dist/src/platforms/kakaotalk/listener.d.ts +24 -0
- package/dist/src/platforms/kakaotalk/listener.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/listener.js +171 -0
- package/dist/src/platforms/kakaotalk/listener.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/config.d.ts +14 -0
- package/dist/src/platforms/kakaotalk/protocol/config.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/config.js +23 -0
- package/dist/src/platforms/kakaotalk/protocol/config.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/connection.d.ts +25 -0
- package/dist/src/platforms/kakaotalk/protocol/connection.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/connection.js +144 -0
- package/dist/src/platforms/kakaotalk/protocol/connection.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/crypto.d.ts +8 -0
- package/dist/src/platforms/kakaotalk/protocol/crypto.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/crypto.js +51 -0
- package/dist/src/platforms/kakaotalk/protocol/crypto.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/packet.d.ts +7 -0
- package/dist/src/platforms/kakaotalk/protocol/packet.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/packet.js +38 -0
- package/dist/src/platforms/kakaotalk/protocol/packet.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts +18 -0
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/session.js +127 -0
- package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/types.d.ts +41 -0
- package/dist/src/platforms/kakaotalk/protocol/types.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/protocol/types.js +8 -0
- package/dist/src/platforms/kakaotalk/protocol/types.js.map +1 -0
- package/dist/src/platforms/kakaotalk/token-extractor.d.ts +17 -0
- package/dist/src/platforms/kakaotalk/token-extractor.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/token-extractor.js +273 -0
- package/dist/src/platforms/kakaotalk/token-extractor.js.map +1 -0
- package/dist/src/platforms/kakaotalk/types.d.ts +198 -0
- package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/types.js +74 -0
- package/dist/src/platforms/kakaotalk/types.js.map +1 -0
- package/dist/src/platforms/line/cli.d.ts +5 -0
- package/dist/src/platforms/line/cli.d.ts.map +1 -0
- package/dist/src/platforms/line/cli.js +32 -0
- package/dist/src/platforms/line/cli.js.map +1 -0
- package/dist/src/platforms/line/client.d.ts +31 -0
- package/dist/src/platforms/line/client.d.ts.map +1 -0
- package/dist/src/platforms/line/client.js +296 -0
- package/dist/src/platforms/line/client.js.map +1 -0
- package/dist/src/platforms/line/commands/auth.d.ts +3 -0
- package/dist/src/platforms/line/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/auth.js +199 -0
- package/dist/src/platforms/line/commands/auth.js.map +1 -0
- package/dist/src/platforms/line/commands/chat.d.ts +3 -0
- package/dist/src/platforms/line/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/chat.js +28 -0
- package/dist/src/platforms/line/commands/chat.js.map +1 -0
- package/dist/src/platforms/line/commands/friend.d.ts +3 -0
- package/dist/src/platforms/line/commands/friend.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/friend.js +25 -0
- package/dist/src/platforms/line/commands/friend.js.map +1 -0
- package/dist/src/platforms/line/commands/index.d.ts +6 -0
- package/dist/src/platforms/line/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/index.js +6 -0
- package/dist/src/platforms/line/commands/index.js.map +1 -0
- package/dist/src/platforms/line/commands/message.d.ts +3 -0
- package/dist/src/platforms/line/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/message.js +48 -0
- package/dist/src/platforms/line/commands/message.js.map +1 -0
- package/dist/src/platforms/line/commands/profile.d.ts +3 -0
- package/dist/src/platforms/line/commands/profile.d.ts.map +1 -0
- package/dist/src/platforms/line/commands/profile.js +23 -0
- package/dist/src/platforms/line/commands/profile.js.map +1 -0
- package/dist/src/platforms/line/credential-manager.d.ts +22 -0
- package/dist/src/platforms/line/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/line/credential-manager.js +71 -0
- package/dist/src/platforms/line/credential-manager.js.map +1 -0
- package/dist/src/platforms/line/ensure-auth.d.ts +3 -0
- package/dist/src/platforms/line/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/line/ensure-auth.js +10 -0
- package/dist/src/platforms/line/ensure-auth.js.map +1 -0
- package/dist/src/platforms/line/index.d.ts +7 -0
- package/dist/src/platforms/line/index.d.ts.map +1 -0
- package/dist/src/platforms/line/index.js +6 -0
- package/dist/src/platforms/line/index.js.map +1 -0
- package/dist/src/platforms/line/listener.d.ts +22 -0
- package/dist/src/platforms/line/listener.d.ts.map +1 -0
- package/dist/src/platforms/line/listener.js +121 -0
- package/dist/src/platforms/line/listener.js.map +1 -0
- package/dist/src/platforms/line/types.d.ts +165 -0
- package/dist/src/platforms/line/types.d.ts.map +1 -0
- package/dist/src/platforms/line/types.js +79 -0
- package/dist/src/platforms/line/types.js.map +1 -0
- package/dist/src/platforms/slack/cli.d.ts.map +1 -1
- package/dist/src/platforms/slack/cli.js +6 -1
- package/dist/src/platforms/slack/cli.js.map +1 -1
- package/dist/src/platforms/slack/client.d.ts +81 -3
- package/dist/src/platforms/slack/client.d.ts.map +1 -1
- package/dist/src/platforms/slack/client.js +568 -41
- package/dist/src/platforms/slack/client.js.map +1 -1
- package/dist/src/platforms/slack/commands/activity.js +1 -1
- package/dist/src/platforms/slack/commands/activity.js.map +1 -1
- package/dist/src/platforms/slack/commands/auth.js +2 -2
- package/dist/src/platforms/slack/commands/auth.js.map +1 -1
- package/dist/src/platforms/slack/commands/bookmark.d.ts +3 -0
- package/dist/src/platforms/slack/commands/bookmark.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/bookmark.js +116 -0
- package/dist/src/platforms/slack/commands/bookmark.js.map +1 -0
- package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/channel.js +178 -6
- package/dist/src/platforms/slack/commands/channel.js.map +1 -1
- package/dist/src/platforms/slack/commands/drafts.js +1 -1
- package/dist/src/platforms/slack/commands/drafts.js.map +1 -1
- package/dist/src/platforms/slack/commands/emoji.d.ts +3 -0
- package/dist/src/platforms/slack/commands/emoji.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/emoji.js +27 -0
- package/dist/src/platforms/slack/commands/emoji.js.map +1 -0
- package/dist/src/platforms/slack/commands/file.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/file.js +26 -5
- package/dist/src/platforms/slack/commands/file.js.map +1 -1
- package/dist/src/platforms/slack/commands/index.d.ts +5 -0
- package/dist/src/platforms/slack/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/index.js +5 -0
- package/dist/src/platforms/slack/commands/index.js.map +1 -1
- package/dist/src/platforms/slack/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/message.js +134 -8
- package/dist/src/platforms/slack/commands/message.js.map +1 -1
- package/dist/src/platforms/slack/commands/pin.d.ts +3 -0
- package/dist/src/platforms/slack/commands/pin.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/pin.js +76 -0
- package/dist/src/platforms/slack/commands/pin.js.map +1 -0
- package/dist/src/platforms/slack/commands/reaction.js +3 -3
- package/dist/src/platforms/slack/commands/reaction.js.map +1 -1
- package/dist/src/platforms/slack/commands/reminder.d.ts +3 -0
- package/dist/src/platforms/slack/commands/reminder.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/reminder.js +98 -0
- package/dist/src/platforms/slack/commands/reminder.js.map +1 -0
- package/dist/src/platforms/slack/commands/saved.js +1 -1
- package/dist/src/platforms/slack/commands/saved.js.map +1 -1
- package/dist/src/platforms/slack/commands/sections.js +1 -1
- package/dist/src/platforms/slack/commands/sections.js.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.js +12 -1
- package/dist/src/platforms/slack/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/slack/commands/unread.js +3 -3
- package/dist/src/platforms/slack/commands/unread.js.map +1 -1
- package/dist/src/platforms/slack/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/user.js +78 -1
- package/dist/src/platforms/slack/commands/user.js.map +1 -1
- package/dist/src/platforms/slack/commands/usergroup.d.ts +3 -0
- package/dist/src/platforms/slack/commands/usergroup.d.ts.map +1 -0
- package/dist/src/platforms/slack/commands/usergroup.js +190 -0
- package/dist/src/platforms/slack/commands/usergroup.js.map +1 -0
- package/dist/src/platforms/slack/credential-manager.d.ts +2 -1
- package/dist/src/platforms/slack/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/slack/credential-manager.js +2 -1
- package/dist/src/platforms/slack/credential-manager.js.map +1 -1
- package/dist/src/platforms/slack/ensure-auth.js +4 -4
- package/dist/src/platforms/slack/ensure-auth.js.map +1 -1
- package/dist/src/platforms/slack/index.d.ts +4 -1
- package/dist/src/platforms/slack/index.d.ts.map +1 -1
- package/dist/src/platforms/slack/index.js +3 -1
- package/dist/src/platforms/slack/index.js.map +1 -1
- package/dist/src/platforms/slack/listener.d.ts +30 -0
- package/dist/src/platforms/slack/listener.d.ts.map +1 -0
- package/dist/src/platforms/slack/listener.js +157 -0
- package/dist/src/platforms/slack/listener.js.map +1 -0
- package/dist/src/platforms/slack/types.d.ts +198 -275
- package/dist/src/platforms/slack/types.d.ts.map +1 -1
- package/dist/src/platforms/slack/types.js +22 -0
- package/dist/src/platforms/slack/types.js.map +1 -1
- package/dist/src/platforms/slackbot/client.d.ts +4 -1
- package/dist/src/platforms/slackbot/client.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/client.js +40 -21
- package/dist/src/platforms/slackbot/client.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/auth.js +2 -2
- package/dist/src/platforms/slackbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/shared.js +1 -1
- package/dist/src/platforms/slackbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/slackbot/types.d.ts +20 -282
- package/dist/src/platforms/slackbot/types.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.d.ts +5 -1
- package/dist/src/platforms/teams/client.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.js +27 -9
- package/dist/src/platforms/teams/client.js.map +1 -1
- package/dist/src/platforms/teams/commands/auth.js +3 -3
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/commands/channel.js +3 -3
- package/dist/src/platforms/teams/commands/channel.js.map +1 -1
- package/dist/src/platforms/teams/commands/file.js +3 -3
- package/dist/src/platforms/teams/commands/file.js.map +1 -1
- package/dist/src/platforms/teams/commands/message.js +4 -4
- package/dist/src/platforms/teams/commands/message.js.map +1 -1
- package/dist/src/platforms/teams/commands/reaction.js +2 -2
- package/dist/src/platforms/teams/commands/reaction.js.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.js +1 -1
- package/dist/src/platforms/teams/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/teams/commands/team.js +1 -1
- package/dist/src/platforms/teams/commands/team.js.map +1 -1
- package/dist/src/platforms/teams/commands/user.js +3 -3
- package/dist/src/platforms/teams/commands/user.js.map +1 -1
- package/dist/src/platforms/teams/ensure-auth.js +1 -1
- package/dist/src/platforms/teams/ensure-auth.js.map +1 -1
- package/dist/src/platforms/teams/index.d.ts +6 -0
- package/dist/src/platforms/teams/index.d.ts.map +1 -0
- package/dist/src/platforms/teams/index.js +5 -0
- package/dist/src/platforms/teams/index.js.map +1 -0
- package/dist/src/platforms/teams/types.d.ts +26 -193
- package/dist/src/platforms/teams/types.d.ts.map +1 -1
- package/dist/src/platforms/telegram/app-config.d.ts +7 -0
- package/dist/src/platforms/telegram/app-config.d.ts.map +1 -0
- package/dist/src/platforms/telegram/app-config.js +39 -0
- package/dist/src/platforms/telegram/app-config.js.map +1 -0
- package/dist/src/platforms/telegram/chat-utils.d.ts +5 -0
- package/dist/src/platforms/telegram/chat-utils.d.ts.map +1 -0
- package/dist/src/platforms/telegram/chat-utils.js +33 -0
- package/dist/src/platforms/telegram/chat-utils.js.map +1 -0
- package/dist/src/platforms/telegram/cli.d.ts +5 -0
- package/dist/src/platforms/telegram/cli.d.ts.map +1 -0
- package/dist/src/platforms/telegram/cli.js +15 -0
- package/dist/src/platforms/telegram/cli.js.map +1 -0
- package/dist/src/platforms/telegram/client.d.ts +47 -0
- package/dist/src/platforms/telegram/client.d.ts.map +1 -0
- package/dist/src/platforms/telegram/client.js +481 -0
- package/dist/src/platforms/telegram/client.js.map +1 -0
- package/dist/src/platforms/telegram/commands/auth.d.ts +44 -0
- package/dist/src/platforms/telegram/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/auth.js +522 -0
- package/dist/src/platforms/telegram/commands/auth.js.map +1 -0
- package/dist/src/platforms/telegram/commands/chat.d.ts +3 -0
- package/dist/src/platforms/telegram/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/chat.js +55 -0
- package/dist/src/platforms/telegram/commands/chat.js.map +1 -0
- package/dist/src/platforms/telegram/commands/index.d.ts +4 -0
- package/dist/src/platforms/telegram/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/index.js +4 -0
- package/dist/src/platforms/telegram/commands/index.js.map +1 -0
- package/dist/src/platforms/telegram/commands/message.d.ts +3 -0
- package/dist/src/platforms/telegram/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/message.js +40 -0
- package/dist/src/platforms/telegram/commands/message.js.map +1 -0
- package/dist/src/platforms/telegram/commands/shared.d.ts +10 -0
- package/dist/src/platforms/telegram/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/telegram/commands/shared.js +32 -0
- package/dist/src/platforms/telegram/commands/shared.js.map +1 -0
- package/dist/src/platforms/telegram/credential-manager.d.ts +25 -0
- package/dist/src/platforms/telegram/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/telegram/credential-manager.js +159 -0
- package/dist/src/platforms/telegram/credential-manager.js.map +1 -0
- package/dist/src/platforms/telegram/my-telegram-org.d.ts +14 -0
- package/dist/src/platforms/telegram/my-telegram-org.d.ts.map +1 -0
- package/dist/src/platforms/telegram/my-telegram-org.js +164 -0
- package/dist/src/platforms/telegram/my-telegram-org.js.map +1 -0
- package/dist/src/platforms/telegram/tdlib.d.ts +11 -0
- package/dist/src/platforms/telegram/tdlib.d.ts.map +1 -0
- package/dist/src/platforms/telegram/tdlib.js +113 -0
- package/dist/src/platforms/telegram/tdlib.js.map +1 -0
- package/dist/src/platforms/telegram/types.d.ts +192 -0
- package/dist/src/platforms/telegram/types.d.ts.map +1 -0
- package/dist/src/platforms/telegram/types.js +183 -0
- package/dist/src/platforms/telegram/types.js.map +1 -0
- package/dist/src/platforms/whatsapp/cli.d.ts +6 -0
- package/dist/src/platforms/whatsapp/cli.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/cli.js +31 -0
- package/dist/src/platforms/whatsapp/cli.js.map +1 -0
- package/dist/src/platforms/whatsapp/client.d.ts +39 -0
- package/dist/src/platforms/whatsapp/client.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/client.js +436 -0
- package/dist/src/platforms/whatsapp/client.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/auth.d.ts +3 -0
- package/dist/src/platforms/whatsapp/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/auth.js +170 -0
- package/dist/src/platforms/whatsapp/commands/auth.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/chat.d.ts +3 -0
- package/dist/src/platforms/whatsapp/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/chat.js +42 -0
- package/dist/src/platforms/whatsapp/commands/chat.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/index.d.ts +4 -0
- package/dist/src/platforms/whatsapp/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/index.js +4 -0
- package/dist/src/platforms/whatsapp/commands/index.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/message.d.ts +3 -0
- package/dist/src/platforms/whatsapp/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/message.js +61 -0
- package/dist/src/platforms/whatsapp/commands/message.js.map +1 -0
- package/dist/src/platforms/whatsapp/commands/shared.d.ts +8 -0
- package/dist/src/platforms/whatsapp/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/commands/shared.js +37 -0
- package/dist/src/platforms/whatsapp/commands/shared.js.map +1 -0
- package/dist/src/platforms/whatsapp/credential-manager.d.ts +20 -0
- package/dist/src/platforms/whatsapp/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/credential-manager.js +104 -0
- package/dist/src/platforms/whatsapp/credential-manager.js.map +1 -0
- package/dist/src/platforms/whatsapp/ensure-auth.d.ts +2 -0
- package/dist/src/platforms/whatsapp/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/ensure-auth.js +23 -0
- package/dist/src/platforms/whatsapp/ensure-auth.js.map +1 -0
- package/dist/src/platforms/whatsapp/index.d.ts +4 -0
- package/dist/src/platforms/whatsapp/index.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/index.js +4 -0
- package/dist/src/platforms/whatsapp/index.js.map +1 -0
- package/dist/src/platforms/whatsapp/suppress-ws-warnings.d.ts +11 -0
- package/dist/src/platforms/whatsapp/suppress-ws-warnings.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/suppress-ws-warnings.js +24 -0
- package/dist/src/platforms/whatsapp/suppress-ws-warnings.js.map +1 -0
- package/dist/src/platforms/whatsapp/types.d.ts +42 -0
- package/dist/src/platforms/whatsapp/types.d.ts.map +1 -0
- package/dist/src/platforms/whatsapp/types.js +75 -0
- package/dist/src/platforms/whatsapp/types.js.map +1 -0
- package/dist/src/platforms/whatsappbot/cli.d.ts +5 -0
- package/dist/src/platforms/whatsappbot/cli.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/cli.js +17 -0
- package/dist/src/platforms/whatsappbot/cli.js.map +1 -0
- package/dist/src/platforms/whatsappbot/client.d.ts +31 -0
- package/dist/src/platforms/whatsappbot/client.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/client.js +202 -0
- package/dist/src/platforms/whatsappbot/client.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/auth.d.ts +28 -0
- package/dist/src/platforms/whatsappbot/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/auth.js +163 -0
- package/dist/src/platforms/whatsappbot/commands/auth.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/index.d.ts +4 -0
- package/dist/src/platforms/whatsappbot/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/index.js +4 -0
- package/dist/src/platforms/whatsappbot/commands/index.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/message.d.ts +27 -0
- package/dist/src/platforms/whatsappbot/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/message.js +122 -0
- package/dist/src/platforms/whatsappbot/commands/message.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/shared.d.ts +9 -0
- package/dist/src/platforms/whatsappbot/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/shared.js +13 -0
- package/dist/src/platforms/whatsappbot/commands/shared.js.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/template.d.ts +16 -0
- package/dist/src/platforms/whatsappbot/commands/template.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/commands/template.js +51 -0
- package/dist/src/platforms/whatsappbot/commands/template.js.map +1 -0
- package/dist/src/platforms/whatsappbot/credential-manager.d.ts +17 -0
- package/dist/src/platforms/whatsappbot/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/credential-manager.js +121 -0
- package/dist/src/platforms/whatsappbot/credential-manager.js.map +1 -0
- package/dist/src/platforms/whatsappbot/index.d.ts +5 -0
- package/dist/src/platforms/whatsappbot/index.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/index.js +4 -0
- package/dist/src/platforms/whatsappbot/index.js.map +1 -0
- package/dist/src/platforms/whatsappbot/types.d.ts +66 -0
- package/dist/src/platforms/whatsappbot/types.d.ts.map +1 -0
- package/dist/src/platforms/whatsappbot/types.js +28 -0
- package/dist/src/platforms/whatsappbot/types.js.map +1 -0
- package/dist/src/tui/adapters/channeltalk-adapter.d.ts +19 -0
- package/dist/src/tui/adapters/channeltalk-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/channeltalk-adapter.js +88 -0
- package/dist/src/tui/adapters/channeltalk-adapter.js.map +1 -0
- package/dist/src/tui/adapters/discord-adapter.d.ts +22 -0
- package/dist/src/tui/adapters/discord-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/discord-adapter.js +100 -0
- package/dist/src/tui/adapters/discord-adapter.js.map +1 -0
- package/dist/src/tui/adapters/instagram-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/instagram-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/instagram-adapter.js +115 -0
- package/dist/src/tui/adapters/instagram-adapter.js.map +1 -0
- package/dist/src/tui/adapters/kakaotalk-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/kakaotalk-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/kakaotalk-adapter.js +146 -0
- package/dist/src/tui/adapters/kakaotalk-adapter.js.map +1 -0
- package/dist/src/tui/adapters/line-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/line-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/line-adapter.js +92 -0
- package/dist/src/tui/adapters/line-adapter.js.map +1 -0
- package/dist/src/tui/adapters/slack-adapter.d.ts +23 -0
- package/dist/src/tui/adapters/slack-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/slack-adapter.js +111 -0
- package/dist/src/tui/adapters/slack-adapter.js.map +1 -0
- package/dist/src/tui/adapters/teams-adapter.d.ts +20 -0
- package/dist/src/tui/adapters/teams-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/teams-adapter.js +85 -0
- package/dist/src/tui/adapters/teams-adapter.js.map +1 -0
- package/dist/src/tui/adapters/telegram-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/telegram-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/telegram-adapter.js +183 -0
- package/dist/src/tui/adapters/telegram-adapter.js.map +1 -0
- package/dist/src/tui/adapters/types.d.ts +41 -0
- package/dist/src/tui/adapters/types.d.ts.map +1 -0
- package/dist/src/tui/adapters/types.js +2 -0
- package/dist/src/tui/adapters/types.js.map +1 -0
- package/dist/src/tui/adapters/whatsapp-adapter.d.ts +18 -0
- package/dist/src/tui/adapters/whatsapp-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/whatsapp-adapter.js +120 -0
- package/dist/src/tui/adapters/whatsapp-adapter.js.map +1 -0
- package/dist/src/tui/app.d.ts +2 -0
- package/dist/src/tui/app.d.ts.map +1 -0
- package/dist/src/tui/app.js +652 -0
- package/dist/src/tui/app.js.map +1 -0
- package/dist/src/tui/cli.d.ts +3 -0
- package/dist/src/tui/cli.d.ts.map +1 -0
- package/dist/src/tui/cli.js +14 -0
- package/dist/src/tui/cli.js.map +1 -0
- package/dist/src/tui/utils.d.ts +5 -0
- package/dist/src/tui/utils.d.ts.map +1 -0
- package/dist/src/tui/utils.js +54 -0
- package/dist/src/tui/utils.js.map +1 -0
- package/dist/src/tui/views/channel-picker.d.ts +18 -0
- package/dist/src/tui/views/channel-picker.d.ts.map +1 -0
- package/dist/src/tui/views/channel-picker.js +131 -0
- package/dist/src/tui/views/channel-picker.js.map +1 -0
- package/dist/src/tui/views/workspace-picker.d.ts +18 -0
- package/dist/src/tui/views/workspace-picker.d.ts.map +1 -0
- package/dist/src/tui/views/workspace-picker.js +131 -0
- package/dist/src/tui/views/workspace-picker.js.map +1 -0
- package/docs/bun.lock +2 -666
- package/docs/content/docs/agent-skills.mdx +1 -1
- package/docs/content/docs/{integrations → cli}/channeltalk.mdx +9 -5
- package/docs/content/docs/{integrations → cli}/channeltalkbot.mdx +1 -1
- package/docs/content/docs/cli/instagram.mdx +211 -0
- package/docs/content/docs/cli/kakaotalk.mdx +286 -0
- package/docs/content/docs/cli/line.mdx +306 -0
- package/docs/content/docs/cli/meta.json +18 -0
- package/docs/content/docs/cli/slack.mdx +395 -0
- package/docs/content/docs/{integrations → cli}/slackbot.mdx +1 -1
- package/docs/content/docs/{integrations → cli}/teams.mdx +2 -2
- package/docs/content/docs/cli/telegram.mdx +107 -0
- package/docs/content/docs/cli/whatsapp.mdx +163 -0
- package/docs/content/docs/cli/whatsappbot.mdx +169 -0
- package/docs/content/docs/index.mdx +21 -15
- package/docs/content/docs/meta.json +9 -1
- package/docs/content/docs/quick-start.mdx +24 -8
- package/docs/content/docs/sdk/channeltalk.mdx +384 -0
- package/docs/content/docs/sdk/channeltalkbot.mdx +395 -0
- package/docs/content/docs/sdk/discord.mdx +535 -0
- package/docs/content/docs/sdk/instagram.mdx +367 -0
- package/docs/content/docs/sdk/kakaotalk.mdx +290 -0
- package/docs/content/docs/sdk/line.mdx +347 -0
- package/docs/content/docs/sdk/meta.json +4 -0
- package/docs/content/docs/sdk/slack.mdx +671 -0
- package/docs/content/docs/sdk/teams.mdx +350 -0
- package/docs/content/docs/sdk/whatsapp.mdx +293 -0
- package/docs/content/docs/sdk/whatsappbot.mdx +266 -0
- package/docs/content/docs/tui.mdx +137 -0
- package/docs/public/tui.png +0 -0
- package/docs/src/app/page.tsx +885 -308
- package/e2e/discordbot.e2e.test.ts +1 -1
- package/examples/discord-listen.ts +56 -0
- package/examples/kakaotalk-listen.ts +49 -0
- package/examples/slack-listen.ts +60 -0
- package/package.json +118 -9
- package/scripts/postbuild.ts +1 -0
- package/scripts/prepublish.ts +21 -1
- package/skills/agent-channeltalk/SKILL.md +18 -6
- package/skills/agent-channeltalkbot/SKILL.md +1 -1
- package/skills/agent-discord/SKILL.md +77 -2
- package/skills/agent-discord/references/common-patterns.md +1 -1
- package/skills/agent-discordbot/SKILL.md +1 -1
- package/skills/agent-instagram/SKILL.md +383 -0
- package/skills/agent-instagram/references/authentication.md +256 -0
- package/skills/agent-instagram/references/common-patterns.md +362 -0
- package/skills/agent-instagram/templates/chat-summary.sh +124 -0
- package/skills/agent-instagram/templates/monitor-chat.sh +143 -0
- package/skills/agent-instagram/templates/post-message.sh +130 -0
- package/skills/agent-kakaotalk/SKILL.md +587 -0
- package/skills/agent-kakaotalk/references/authentication.md +343 -0
- package/skills/agent-kakaotalk/references/common-patterns.md +403 -0
- package/skills/agent-kakaotalk/templates/chat-summary.sh +121 -0
- package/skills/agent-kakaotalk/templates/monitor-chat.sh +160 -0
- package/skills/agent-kakaotalk/templates/post-message.sh +123 -0
- package/skills/agent-line/SKILL.md +490 -0
- package/skills/agent-line/references/authentication.md +297 -0
- package/skills/agent-line/references/common-patterns.md +355 -0
- package/skills/agent-line/templates/chat-summary.sh +63 -0
- package/skills/agent-line/templates/monitor-chat.sh +76 -0
- package/skills/agent-line/templates/post-message.sh +123 -0
- package/skills/agent-slack/SKILL.md +259 -7
- package/skills/agent-slack/references/common-patterns.md +105 -39
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-slackbot/references/common-patterns.md +52 -0
- package/skills/agent-teams/SKILL.md +49 -1
- package/skills/agent-telegram/SKILL.md +123 -0
- package/skills/agent-whatsapp/SKILL.md +382 -0
- package/skills/agent-whatsapp/references/authentication.md +191 -0
- package/skills/agent-whatsapp/references/common-patterns.md +336 -0
- package/skills/agent-whatsapp/templates/chat-summary.sh +122 -0
- package/skills/agent-whatsapp/templates/monitor-chat.sh +157 -0
- package/skills/agent-whatsapp/templates/post-message.sh +120 -0
- package/skills/agent-whatsappbot/SKILL.md +371 -0
- package/skills/agent-whatsappbot/references/authentication.md +216 -0
- package/skills/agent-whatsappbot/references/common-patterns.md +331 -0
- package/skills/agent-whatsappbot/templates/account-summary.sh +127 -0
- package/skills/agent-whatsappbot/templates/post-message.sh +120 -0
- package/skills/agent-whatsappbot/templates/send-template.sh +153 -0
- package/src/cli.ts +34 -6
- package/src/platforms/channeltalk/client.test.ts +30 -28
- package/src/platforms/channeltalk/client.ts +29 -8
- package/src/platforms/channeltalk/commands/auth.ts +9 -7
- package/src/platforms/channeltalk/commands/shared.ts +1 -1
- package/src/platforms/channeltalk/ensure-auth.ts +10 -8
- package/src/platforms/channeltalk/index.test.ts +114 -0
- package/src/platforms/channeltalk/index.ts +27 -14
- package/src/platforms/channeltalk/token-extractor.test.ts +227 -65
- package/src/platforms/channeltalk/token-extractor.ts +146 -25
- package/src/platforms/channeltalk/types.ts +3 -1
- package/src/platforms/channeltalkbot/client.test.ts +12 -12
- package/src/platforms/channeltalkbot/client.ts +31 -11
- package/src/platforms/channeltalkbot/commands/auth.test.ts +1 -5
- package/src/platforms/channeltalkbot/commands/auth.ts +2 -2
- package/src/platforms/channeltalkbot/commands/shared.ts +1 -1
- package/src/platforms/channeltalkbot/index.test.ts +76 -0
- package/src/platforms/channeltalkbot/index.ts +14 -11
- package/src/platforms/discord/client.test.ts +30 -30
- package/src/platforms/discord/client.ts +33 -6
- package/src/platforms/discord/commands/auth.test.ts +2 -2
- package/src/platforms/discord/commands/auth.ts +2 -2
- package/src/platforms/discord/commands/channel.test.ts +6 -6
- package/src/platforms/discord/commands/channel.ts +3 -3
- package/src/platforms/discord/commands/dm.ts +2 -2
- package/src/platforms/discord/commands/file.ts +3 -3
- package/src/platforms/discord/commands/friend.test.ts +5 -5
- package/src/platforms/discord/commands/friend.ts +1 -1
- package/src/platforms/discord/commands/member.test.ts +4 -4
- package/src/platforms/discord/commands/member.ts +1 -1
- package/src/platforms/discord/commands/mention.test.ts +4 -4
- package/src/platforms/discord/commands/mention.ts +1 -1
- package/src/platforms/discord/commands/message.ts +6 -6
- package/src/platforms/discord/commands/note.ts +2 -2
- package/src/platforms/discord/commands/profile.ts +1 -1
- package/src/platforms/discord/commands/reaction.ts +3 -3
- package/src/platforms/discord/commands/server.test.ts +2 -2
- package/src/platforms/discord/commands/server.ts +1 -1
- package/src/platforms/discord/commands/snapshot.ts +1 -1
- package/src/platforms/discord/commands/thread.test.ts +5 -5
- package/src/platforms/discord/commands/thread.ts +2 -2
- package/src/platforms/discord/commands/user.ts +3 -3
- package/src/platforms/discord/ensure-auth.ts +1 -1
- package/src/platforms/discord/index.test.ts +84 -0
- package/src/platforms/discord/index.ts +51 -0
- package/src/platforms/discord/listener.test.ts +782 -0
- package/src/platforms/discord/listener.ts +297 -0
- package/src/platforms/discord/types.ts +133 -0
- package/src/platforms/discordbot/client.test.ts +33 -33
- package/src/platforms/discordbot/client.ts +28 -7
- package/src/platforms/discordbot/commands/auth.test.ts +1 -5
- package/src/platforms/discordbot/commands/auth.ts +2 -2
- package/src/platforms/discordbot/commands/channel.test.ts +1 -5
- package/src/platforms/discordbot/commands/message.test.ts +1 -3
- package/src/platforms/discordbot/commands/server.test.ts +1 -5
- package/src/platforms/discordbot/commands/shared.ts +1 -1
- package/src/platforms/discordbot/commands/snapshot.test.ts +1 -3
- package/src/platforms/discordbot/commands/thread.test.ts +1 -3
- package/src/platforms/discordbot/commands/user.test.ts +1 -5
- package/src/platforms/instagram/cli.ts +37 -0
- package/src/platforms/instagram/client.test.ts +396 -0
- package/src/platforms/instagram/client.ts +655 -0
- package/src/platforms/instagram/commands/auth.ts +401 -0
- package/src/platforms/instagram/commands/chat.ts +49 -0
- package/src/platforms/instagram/commands/index.ts +3 -0
- package/src/platforms/instagram/commands/message.ts +134 -0
- package/src/platforms/instagram/commands/shared.test.ts +51 -0
- package/src/platforms/instagram/commands/shared.ts +55 -0
- package/src/platforms/instagram/credential-manager.test.ts +277 -0
- package/src/platforms/instagram/credential-manager.ts +134 -0
- package/src/platforms/instagram/ensure-auth.test.ts +84 -0
- package/src/platforms/instagram/ensure-auth.ts +24 -0
- package/src/platforms/instagram/index.test.ts +44 -0
- package/src/platforms/instagram/index.ts +16 -0
- package/src/platforms/instagram/listener.test.ts +130 -0
- package/src/platforms/instagram/listener.ts +106 -0
- package/src/platforms/instagram/types.test.ts +228 -0
- package/src/platforms/instagram/types.ts +153 -0
- package/src/platforms/kakaotalk/auth/kakao-login.ts +296 -0
- package/src/platforms/kakaotalk/cli.ts +37 -0
- package/src/platforms/kakaotalk/client.test.ts +490 -0
- package/src/platforms/kakaotalk/client.ts +328 -0
- package/src/platforms/kakaotalk/commands/auth.ts +569 -0
- package/src/platforms/kakaotalk/commands/chat.ts +34 -0
- package/src/platforms/kakaotalk/commands/index.ts +3 -0
- package/src/platforms/kakaotalk/commands/message.ts +56 -0
- package/src/platforms/kakaotalk/commands/shared.ts +38 -0
- package/src/platforms/kakaotalk/credential-manager.test.ts +231 -0
- package/src/platforms/kakaotalk/credential-manager.ts +110 -0
- package/src/platforms/kakaotalk/ensure-auth.ts +16 -0
- package/src/platforms/kakaotalk/index.test.ts +68 -0
- package/src/platforms/kakaotalk/index.ts +30 -0
- package/src/platforms/kakaotalk/listener.test.ts +370 -0
- package/src/platforms/kakaotalk/listener.ts +203 -0
- package/src/platforms/kakaotalk/protocol/NOTICE.md +51 -0
- package/src/platforms/kakaotalk/protocol/config.ts +28 -0
- package/src/platforms/kakaotalk/protocol/connection.ts +159 -0
- package/src/platforms/kakaotalk/protocol/crypto.ts +71 -0
- package/src/platforms/kakaotalk/protocol/packet.ts +47 -0
- package/src/platforms/kakaotalk/protocol/session.ts +156 -0
- package/src/platforms/kakaotalk/protocol/types.ts +42 -0
- package/src/platforms/kakaotalk/token-extractor.ts +320 -0
- package/src/platforms/kakaotalk/types.ts +212 -0
- package/src/platforms/line/cli.ts +39 -0
- package/src/platforms/line/client.test.ts +162 -0
- package/src/platforms/line/client.ts +352 -0
- package/src/platforms/line/commands/auth.ts +219 -0
- package/src/platforms/line/commands/chat.ts +34 -0
- package/src/platforms/line/commands/friend.ts +28 -0
- package/src/platforms/line/commands/index.ts +5 -0
- package/src/platforms/line/commands/message.ts +59 -0
- package/src/platforms/line/commands/profile.ts +24 -0
- package/src/platforms/line/credential-manager.test.ts +163 -0
- package/src/platforms/line/credential-manager.ts +99 -0
- package/src/platforms/line/ensure-auth.ts +13 -0
- package/src/platforms/line/index.test.ts +48 -0
- package/src/platforms/line/index.ts +27 -0
- package/src/platforms/line/listener.test.ts +341 -0
- package/src/platforms/line/listener.ts +138 -0
- package/src/platforms/line/types.test.ts +157 -0
- package/src/platforms/line/types.ts +181 -0
- package/src/platforms/slack/cli.ts +10 -0
- package/src/platforms/slack/client.test.ts +703 -69
- package/src/platforms/slack/client.ts +653 -44
- package/src/platforms/slack/commands/activity.ts +1 -1
- package/src/platforms/slack/commands/auth.ts +2 -2
- package/src/platforms/slack/commands/bookmark.test.ts +91 -0
- package/src/platforms/slack/commands/bookmark.ts +148 -0
- package/src/platforms/slack/commands/channel.test.ts +1 -1
- package/src/platforms/slack/commands/channel.ts +230 -5
- package/src/platforms/slack/commands/drafts.ts +1 -1
- package/src/platforms/slack/commands/emoji.test.ts +32 -0
- package/src/platforms/slack/commands/emoji.ts +33 -0
- package/src/platforms/slack/commands/file.ts +30 -4
- package/src/platforms/slack/commands/index.ts +5 -0
- package/src/platforms/slack/commands/message.ts +173 -7
- package/src/platforms/slack/commands/pin.test.ts +72 -0
- package/src/platforms/slack/commands/pin.ts +93 -0
- package/src/platforms/slack/commands/reaction.ts +3 -3
- package/src/platforms/slack/commands/reminder.test.ts +86 -0
- package/src/platforms/slack/commands/reminder.ts +125 -0
- package/src/platforms/slack/commands/saved.ts +1 -1
- package/src/platforms/slack/commands/sections.ts +1 -1
- package/src/platforms/slack/commands/snapshot.test.ts +4 -4
- package/src/platforms/slack/commands/snapshot.ts +14 -1
- package/src/platforms/slack/commands/unread.test.ts +3 -3
- package/src/platforms/slack/commands/unread.ts +3 -3
- package/src/platforms/slack/commands/user.ts +90 -1
- package/src/platforms/slack/commands/usergroup.test.ts +157 -0
- package/src/platforms/slack/commands/usergroup.ts +242 -0
- package/src/platforms/slack/credential-manager.ts +3 -1
- package/src/platforms/slack/ensure-auth.ts +4 -4
- package/src/platforms/slack/index.test.ts +59 -0
- package/src/platforms/slack/index.ts +46 -1
- package/src/platforms/slack/listener.test.ts +370 -0
- package/src/platforms/slack/listener.ts +181 -0
- package/src/platforms/slack/types.ts +187 -0
- package/src/platforms/slackbot/client.test.ts +26 -26
- package/src/platforms/slackbot/client.ts +40 -22
- package/src/platforms/slackbot/commands/auth.test.ts +1 -5
- package/src/platforms/slackbot/commands/auth.ts +2 -2
- package/src/platforms/slackbot/commands/shared.ts +1 -1
- package/src/platforms/teams/client.test.ts +34 -34
- package/src/platforms/teams/client.ts +32 -9
- package/src/platforms/teams/commands/auth.test.ts +2 -2
- package/src/platforms/teams/commands/auth.ts +3 -3
- package/src/platforms/teams/commands/channel.test.ts +6 -6
- package/src/platforms/teams/commands/channel.ts +3 -3
- package/src/platforms/teams/commands/file.ts +3 -3
- package/src/platforms/teams/commands/message.ts +4 -4
- package/src/platforms/teams/commands/reaction.ts +2 -2
- package/src/platforms/teams/commands/snapshot.ts +1 -1
- package/src/platforms/teams/commands/team.test.ts +2 -2
- package/src/platforms/teams/commands/team.ts +1 -1
- package/src/platforms/teams/commands/user.ts +3 -3
- package/src/platforms/teams/ensure-auth.ts +1 -1
- package/src/platforms/teams/index.test.ts +74 -0
- package/src/platforms/teams/index.ts +30 -0
- package/src/platforms/telegram/app-config.test.ts +44 -0
- package/src/platforms/telegram/app-config.ts +53 -0
- package/src/platforms/telegram/chat-utils.test.ts +71 -0
- package/src/platforms/telegram/chat-utils.ts +39 -0
- package/src/platforms/telegram/cli.ts +20 -0
- package/src/platforms/telegram/client.test.ts +90 -0
- package/src/platforms/telegram/client.ts +623 -0
- package/src/platforms/telegram/commands/auth.test.ts +113 -0
- package/src/platforms/telegram/commands/auth.ts +662 -0
- package/src/platforms/telegram/commands/chat.ts +65 -0
- package/src/platforms/telegram/commands/index.ts +3 -0
- package/src/platforms/telegram/commands/message.ts +51 -0
- package/src/platforms/telegram/commands/shared.test.ts +15 -0
- package/src/platforms/telegram/commands/shared.ts +50 -0
- package/src/platforms/telegram/credential-manager.test.ts +152 -0
- package/src/platforms/telegram/credential-manager.ts +203 -0
- package/src/platforms/telegram/my-telegram-org.ts +206 -0
- package/src/platforms/telegram/tdlib.ts +159 -0
- package/src/platforms/telegram/types.test.ts +74 -0
- package/src/platforms/telegram/types.ts +417 -0
- package/src/platforms/whatsapp/cli.ts +38 -0
- package/src/platforms/whatsapp/client.ts +526 -0
- package/src/platforms/whatsapp/commands/auth.ts +205 -0
- package/src/platforms/whatsapp/commands/chat.ts +49 -0
- package/src/platforms/whatsapp/commands/index.ts +3 -0
- package/src/platforms/whatsapp/commands/message.ts +79 -0
- package/src/platforms/whatsapp/commands/shared.ts +61 -0
- package/src/platforms/whatsapp/credential-manager.test.ts +278 -0
- package/src/platforms/whatsapp/credential-manager.ts +134 -0
- package/src/platforms/whatsapp/ensure-auth.test.ts +85 -0
- package/src/platforms/whatsapp/ensure-auth.ts +26 -0
- package/src/platforms/whatsapp/index.test.ts +39 -0
- package/src/platforms/whatsapp/index.ts +16 -0
- package/src/platforms/whatsapp/suppress-ws-warnings.ts +21 -0
- package/src/platforms/whatsapp/types.test.ts +190 -0
- package/src/platforms/whatsapp/types.ts +95 -0
- package/src/platforms/whatsappbot/cli.ts +23 -0
- package/src/platforms/whatsappbot/client.test.ts +411 -0
- package/src/platforms/whatsappbot/client.ts +256 -0
- package/src/platforms/whatsappbot/commands/auth.ts +206 -0
- package/src/platforms/whatsappbot/commands/index.ts +3 -0
- package/src/platforms/whatsappbot/commands/message.ts +148 -0
- package/src/platforms/whatsappbot/commands/shared.ts +22 -0
- package/src/platforms/whatsappbot/commands/template.ts +69 -0
- package/src/platforms/whatsappbot/credential-manager.test.ts +303 -0
- package/src/platforms/whatsappbot/credential-manager.ts +148 -0
- package/src/platforms/whatsappbot/index.test.ts +34 -0
- package/src/platforms/whatsappbot/index.ts +18 -0
- package/src/platforms/whatsappbot/types.test.ts +141 -0
- package/src/platforms/whatsappbot/types.ts +71 -0
- package/src/tui/adapters/channeltalk-adapter.ts +102 -0
- package/src/tui/adapters/discord-adapter.ts +112 -0
- package/src/tui/adapters/instagram-adapter.ts +132 -0
- package/src/tui/adapters/kakaotalk-adapter.ts +163 -0
- package/src/tui/adapters/line-adapter.ts +109 -0
- package/src/tui/adapters/slack-adapter.ts +128 -0
- package/src/tui/adapters/teams-adapter.ts +95 -0
- package/src/tui/adapters/telegram-adapter.ts +203 -0
- package/src/tui/adapters/types.ts +43 -0
- package/src/tui/adapters/whatsapp-adapter.ts +138 -0
- package/src/tui/app.ts +689 -0
- package/src/tui/cli.ts +18 -0
- package/src/tui/utils.test.ts +149 -0
- package/src/tui/utils.ts +58 -0
- package/src/tui/views/channel-picker.ts +146 -0
- package/src/tui/views/workspace-picker.ts +146 -0
- package/docs/content/docs/integrations/meta.json +0 -5
- package/docs/content/docs/integrations/slack.mdx +0 -218
- package/docs/content/docs/{integrations → cli}/discord.mdx +19 -19
- package/docs/content/docs/{integrations → cli}/discordbot.mdx +8 -8
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# send-template.sh - Send a WhatsApp template message via Cloud API
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# ./send-template.sh <to> <template-name> [--language <code>] [--components <json>]
|
|
7
|
+
#
|
|
8
|
+
# Arguments:
|
|
9
|
+
# to - Recipient phone number (e.g. 15551234567)
|
|
10
|
+
# template-name - Name of the approved template to send
|
|
11
|
+
#
|
|
12
|
+
# Options:
|
|
13
|
+
# --language <code> - Language code (default: en_US)
|
|
14
|
+
# --components <json> - JSON array of template components (variables, buttons, etc.)
|
|
15
|
+
#
|
|
16
|
+
# Example:
|
|
17
|
+
# ./send-template.sh 15551234567 hello_world
|
|
18
|
+
# ./send-template.sh 15551234567 order_confirmation --language en_US
|
|
19
|
+
# ./send-template.sh 15551234567 shipping_update --components '[{"type":"body","parameters":[{"type":"text","text":"ORDER-123"}]}]'
|
|
20
|
+
|
|
21
|
+
set -euo pipefail
|
|
22
|
+
|
|
23
|
+
# Check arguments
|
|
24
|
+
if [ $# -lt 2 ]; then
|
|
25
|
+
echo "Usage: $0 <to> <template-name> [--language <code>] [--components <json>]"
|
|
26
|
+
echo ""
|
|
27
|
+
echo "Examples:"
|
|
28
|
+
echo " $0 15551234567 hello_world"
|
|
29
|
+
echo " $0 15551234567 order_confirmation --language en_US"
|
|
30
|
+
echo " $0 15551234567 shipping_update --components '[{\"type\":\"body\",\"parameters\":[{\"type\":\"text\",\"text\":\"ORDER-123\"}]}]'"
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
TO="$1"
|
|
35
|
+
TEMPLATE_NAME="$2"
|
|
36
|
+
shift 2
|
|
37
|
+
|
|
38
|
+
# Parse optional arguments
|
|
39
|
+
LANGUAGE="en_US"
|
|
40
|
+
COMPONENTS=""
|
|
41
|
+
|
|
42
|
+
while [ $# -gt 0 ]; do
|
|
43
|
+
case "$1" in
|
|
44
|
+
--language)
|
|
45
|
+
if [ $# -lt 2 ]; then
|
|
46
|
+
echo "Error: --language requires a value"
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
LANGUAGE="$2"
|
|
50
|
+
shift 2
|
|
51
|
+
;;
|
|
52
|
+
--components)
|
|
53
|
+
if [ $# -lt 2 ]; then
|
|
54
|
+
echo "Error: --components requires a value"
|
|
55
|
+
exit 1
|
|
56
|
+
fi
|
|
57
|
+
COMPONENTS="$2"
|
|
58
|
+
shift 2
|
|
59
|
+
;;
|
|
60
|
+
*)
|
|
61
|
+
echo "Unknown option: $1"
|
|
62
|
+
exit 1
|
|
63
|
+
;;
|
|
64
|
+
esac
|
|
65
|
+
done
|
|
66
|
+
|
|
67
|
+
# Colors for output
|
|
68
|
+
RED='\033[0;31m'
|
|
69
|
+
GREEN='\033[0;32m'
|
|
70
|
+
YELLOW='\033[1;33m'
|
|
71
|
+
NC='\033[0m' # No Color
|
|
72
|
+
|
|
73
|
+
# Check if agent-whatsappbot is installed
|
|
74
|
+
if ! command -v agent-whatsappbot &> /dev/null; then
|
|
75
|
+
echo -e "${RED}Error: agent-whatsappbot not found${NC}"
|
|
76
|
+
echo ""
|
|
77
|
+
echo "Install it with:"
|
|
78
|
+
echo " npm install -g agent-messenger"
|
|
79
|
+
exit 1
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
# Check authentication
|
|
83
|
+
echo "Checking authentication..."
|
|
84
|
+
AUTH_STATUS=$(agent-whatsappbot auth status 2>&1) || true
|
|
85
|
+
|
|
86
|
+
if ! echo "$AUTH_STATUS" | jq -e '.valid' > /dev/null 2>&1; then
|
|
87
|
+
echo -e "${RED}Not authenticated!${NC}"
|
|
88
|
+
echo ""
|
|
89
|
+
echo "Run this to authenticate:"
|
|
90
|
+
echo " agent-whatsappbot auth set <phone-number-id> <access-token>"
|
|
91
|
+
exit 1
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
PHONE_ID=$(echo "$AUTH_STATUS" | jq -r '.phone_number_id // "Unknown"')
|
|
95
|
+
echo -e "${GREEN}✓ Authenticated (Phone ID: $PHONE_ID)${NC}"
|
|
96
|
+
echo ""
|
|
97
|
+
|
|
98
|
+
# Send template message with retry logic
|
|
99
|
+
max_attempts=3
|
|
100
|
+
attempt=1
|
|
101
|
+
|
|
102
|
+
echo "Sending template '$TEMPLATE_NAME' to $TO..."
|
|
103
|
+
echo "Language: $LANGUAGE"
|
|
104
|
+
if [ -n "$COMPONENTS" ]; then
|
|
105
|
+
echo "Components: $COMPONENTS"
|
|
106
|
+
fi
|
|
107
|
+
echo ""
|
|
108
|
+
|
|
109
|
+
while [ $attempt -le $max_attempts ]; do
|
|
110
|
+
echo -e "${YELLOW}Attempt $attempt/$max_attempts...${NC}"
|
|
111
|
+
|
|
112
|
+
if [ -n "$COMPONENTS" ]; then
|
|
113
|
+
RESULT=$(agent-whatsappbot message send-template "$TO" "$TEMPLATE_NAME" --language "$LANGUAGE" --components "$COMPONENTS" 2>&1) || true
|
|
114
|
+
else
|
|
115
|
+
RESULT=$(agent-whatsappbot message send-template "$TO" "$TEMPLATE_NAME" --language "$LANGUAGE" 2>&1) || true
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
if echo "$RESULT" | jq -e '.messages' > /dev/null 2>&1; then
|
|
119
|
+
echo -e "${GREEN}✓ Template message sent successfully!${NC}"
|
|
120
|
+
|
|
121
|
+
MSG_ID=$(echo "$RESULT" | jq -r '.messages[0].id // ""')
|
|
122
|
+
|
|
123
|
+
echo ""
|
|
124
|
+
echo "Message details:"
|
|
125
|
+
echo " To: $TO"
|
|
126
|
+
echo " Template: $TEMPLATE_NAME"
|
|
127
|
+
echo " Language: $LANGUAGE"
|
|
128
|
+
if [ -n "$MSG_ID" ]; then
|
|
129
|
+
echo " Message ID: $MSG_ID"
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
exit 0
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
if echo "$RESULT" | jq -e '.error' > /dev/null 2>&1; then
|
|
136
|
+
ERROR_MSG=$(echo "$RESULT" | jq -r '.error // "Unknown error"')
|
|
137
|
+
|
|
138
|
+
echo -e "${RED}✗ Failed: $ERROR_MSG${NC}"
|
|
139
|
+
else
|
|
140
|
+
echo -e "${RED}✗ Unexpected error: $RESULT${NC}"
|
|
141
|
+
fi
|
|
142
|
+
|
|
143
|
+
if [ $attempt -lt $max_attempts ]; then
|
|
144
|
+
SLEEP_TIME=$((attempt * 2))
|
|
145
|
+
echo "Retrying in ${SLEEP_TIME}s..."
|
|
146
|
+
sleep $SLEEP_TIME
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
attempt=$((attempt + 1))
|
|
150
|
+
done
|
|
151
|
+
|
|
152
|
+
echo -e "${RED}Failed after $max_attempts attempts${NC}"
|
|
153
|
+
exit 1
|
package/src/cli.ts
CHANGED
|
@@ -20,30 +20,58 @@ program.command('slack', 'Interact with Slack workspaces', {
|
|
|
20
20
|
executableFile: join(__dirname, 'platforms', 'slack', `cli${ext}`),
|
|
21
21
|
})
|
|
22
22
|
|
|
23
|
+
program.command('slackbot', 'Interact with Slack using bot tokens', {
|
|
24
|
+
executableFile: join(__dirname, 'platforms', 'slackbot', `cli${ext}`),
|
|
25
|
+
})
|
|
26
|
+
|
|
23
27
|
program.command('discord', 'Interact with Discord guilds', {
|
|
24
28
|
executableFile: join(__dirname, 'platforms', 'discord', `cli${ext}`),
|
|
25
29
|
})
|
|
26
30
|
|
|
31
|
+
program.command('discordbot', 'Interact with Discord using bot tokens', {
|
|
32
|
+
executableFile: join(__dirname, 'platforms', 'discordbot', `cli${ext}`),
|
|
33
|
+
})
|
|
34
|
+
|
|
27
35
|
program.command('teams', 'Interact with Microsoft Teams', {
|
|
28
36
|
executableFile: join(__dirname, 'platforms', 'teams', `cli${ext}`),
|
|
29
37
|
})
|
|
30
38
|
|
|
31
|
-
program.command('
|
|
32
|
-
executableFile: join(__dirname, 'platforms', '
|
|
39
|
+
program.command('telegram', 'Interact with Telegram via TDLib', {
|
|
40
|
+
executableFile: join(__dirname, 'platforms', 'telegram', `cli${ext}`),
|
|
33
41
|
})
|
|
34
42
|
|
|
35
|
-
program.command('
|
|
36
|
-
executableFile: join(__dirname, 'platforms', '
|
|
43
|
+
program.command('whatsapp', 'Interact with WhatsApp via linked device', {
|
|
44
|
+
executableFile: join(__dirname, 'platforms', 'whatsapp', `cli${ext}`),
|
|
37
45
|
})
|
|
38
46
|
|
|
39
|
-
program.command('
|
|
40
|
-
executableFile: join(__dirname, 'platforms', '
|
|
47
|
+
program.command('whatsappbot', 'Interact with WhatsApp using Cloud API credentials', {
|
|
48
|
+
executableFile: join(__dirname, 'platforms', 'whatsappbot', `cli${ext}`),
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
program.command('line', 'Interact with LINE', {
|
|
52
|
+
executableFile: join(__dirname, 'platforms', 'line', `cli${ext}`),
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
program.command('instagram', 'Interact with Instagram DMs', {
|
|
56
|
+
executableFile: join(__dirname, 'platforms', 'instagram', `cli${ext}`),
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
program.command('kakaotalk', 'Interact with KakaoTalk', {
|
|
60
|
+
executableFile: join(__dirname, 'platforms', 'kakaotalk', `cli${ext}`),
|
|
41
61
|
})
|
|
42
62
|
|
|
43
63
|
program.command('channeltalk', 'Interact with Channel Talk', {
|
|
44
64
|
executableFile: join(__dirname, 'platforms', 'channeltalk', `cli${ext}`),
|
|
45
65
|
})
|
|
46
66
|
|
|
67
|
+
program.command('channeltalkbot', 'Interact with Channel Talk using API credentials', {
|
|
68
|
+
executableFile: join(__dirname, 'platforms', 'channeltalkbot', `cli${ext}`),
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
program.command('tui', 'Launch unified messenger TUI', {
|
|
72
|
+
executableFile: join(__dirname, 'tui', `cli${ext}`),
|
|
73
|
+
})
|
|
74
|
+
|
|
47
75
|
program.parse(process.argv)
|
|
48
76
|
|
|
49
77
|
export default program
|
|
@@ -50,17 +50,19 @@ describe('ChannelClient', () => {
|
|
|
50
50
|
|
|
51
51
|
const getJsonBody = (callIndex = 0) => JSON.parse(String(fetchCalls[callIndex]?.options?.body)) as Record<string, unknown>
|
|
52
52
|
|
|
53
|
-
test('
|
|
54
|
-
expect(()
|
|
55
|
-
expect(()
|
|
56
|
-
|
|
57
|
-
expect(
|
|
53
|
+
test('login() requires account cookie', async () => {
|
|
54
|
+
await expect(new ChannelClient().login({ accountCookie: '' })).rejects.toThrow(ChannelError)
|
|
55
|
+
await expect(new ChannelClient().login({ accountCookie: '', sessionCookie: 'session-cookie' })).rejects.toThrow(ChannelError)
|
|
56
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie' })
|
|
57
|
+
expect(client).toBeInstanceOf(ChannelClient)
|
|
58
|
+
const client2 = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: '' })
|
|
59
|
+
expect(client2).toBeInstanceOf(ChannelClient)
|
|
58
60
|
})
|
|
59
61
|
|
|
60
62
|
test('successful GET request returns unwrapped JSON', async () => {
|
|
61
63
|
mockResponse({ account: { id: 'acc-1', name: 'Desk Owner', email: 'owner@example.com', emailVerified: true, language: 'en', country: 'KR', createdAt: 1 } })
|
|
62
64
|
|
|
63
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
65
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
64
66
|
const account = await client.getAccount()
|
|
65
67
|
|
|
66
68
|
expect(account.id).toBe('acc-1')
|
|
@@ -71,7 +73,7 @@ describe('ChannelClient', () => {
|
|
|
71
73
|
mockResponse({ account: { id: 'acc-1', name: 'Desk Owner', email: 'owner@example.com', emailVerified: true, language: 'en', country: 'KR', createdAt: 1 } })
|
|
72
74
|
mockResponse({ channel: { id: 'ch-1', name: 'Support' } })
|
|
73
75
|
|
|
74
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
76
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
75
77
|
await client.getAccount()
|
|
76
78
|
await client.getChannel('ch-1')
|
|
77
79
|
|
|
@@ -87,7 +89,7 @@ describe('ChannelClient', () => {
|
|
|
87
89
|
mockResponse({ errors: [{ message: 'Rate limited' }] }, 429, { 'Retry-After': '0.05' })
|
|
88
90
|
mockResponse({ account: { id: 'acc-1', name: 'Desk Owner', email: 'owner@example.com', emailVerified: true, language: 'en', country: 'KR', createdAt: 1 } })
|
|
89
91
|
|
|
90
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
92
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
91
93
|
const start = Date.now()
|
|
92
94
|
const account = await client.getAccount()
|
|
93
95
|
const elapsed = Date.now() - start
|
|
@@ -102,7 +104,7 @@ describe('ChannelClient', () => {
|
|
|
102
104
|
mockResponse({ errors: [{ message: 'Server error' }] }, 500)
|
|
103
105
|
mockResponse({ account: { id: 'acc-1', name: 'Desk Owner', email: 'owner@example.com', emailVerified: true, language: 'en', country: 'KR', createdAt: 1 } })
|
|
104
106
|
|
|
105
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
107
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
106
108
|
const start = Date.now()
|
|
107
109
|
const account = await client.getAccount()
|
|
108
110
|
const elapsed = Date.now() - start
|
|
@@ -115,7 +117,7 @@ describe('ChannelClient', () => {
|
|
|
115
117
|
test('4xx non-429 throws immediately without retry', async () => {
|
|
116
118
|
mockResponse({ type: 'forbidden', errors: [{ message: 'Forbidden' }] }, 403)
|
|
117
119
|
|
|
118
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
120
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
119
121
|
await expect(client.getAccount()).rejects.toThrow(ChannelError)
|
|
120
122
|
expect(fetchCalls).toHaveLength(1)
|
|
121
123
|
})
|
|
@@ -129,7 +131,7 @@ describe('ChannelClient', () => {
|
|
|
129
131
|
throw new Error('socket hang up')
|
|
130
132
|
}
|
|
131
133
|
|
|
132
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
134
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
133
135
|
|
|
134
136
|
try {
|
|
135
137
|
await client.getAccount()
|
|
@@ -144,7 +146,7 @@ describe('ChannelClient', () => {
|
|
|
144
146
|
test('204 response returns undefined', async () => {
|
|
145
147
|
mockResponse(null, 204)
|
|
146
148
|
|
|
147
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
149
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
148
150
|
const result = await (client as unknown as { request: <T>(method: string, path: string) => Promise<T> }).request<void>('GET', '/desk/account')
|
|
149
151
|
|
|
150
152
|
expect(result).toBeUndefined()
|
|
@@ -168,7 +170,7 @@ describe('ChannelClient', () => {
|
|
|
168
170
|
test('listChannels includes query params', async () => {
|
|
169
171
|
mockResponse({ channels: [{ id: 'ch-1', name: 'Support' }] })
|
|
170
172
|
|
|
171
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
173
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
172
174
|
const channels = await client.listChannels({ limit: 500 })
|
|
173
175
|
|
|
174
176
|
expect(channels[0]?.id).toBe('ch-1')
|
|
@@ -178,7 +180,7 @@ describe('ChannelClient', () => {
|
|
|
178
180
|
test('getChannel uses the channel detail endpoint', async () => {
|
|
179
181
|
mockResponse({ channel: { id: 'ch-1', name: 'Support' } })
|
|
180
182
|
|
|
181
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
183
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
182
184
|
await client.getChannel('ch-1')
|
|
183
185
|
|
|
184
186
|
expect(fetchCalls[0].url).toBe('https://desk-api.channel.io/desk/channels/ch-1')
|
|
@@ -187,7 +189,7 @@ describe('ChannelClient', () => {
|
|
|
187
189
|
test('listManagers uses the managers endpoint', async () => {
|
|
188
190
|
mockResponse({ managers: [{ id: 'mgr-1', channelId: 'ch-1', accountId: 'acc-1', name: 'Alex' }] })
|
|
189
191
|
|
|
190
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
192
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
191
193
|
const managers = await client.listManagers('ch-1', { limit: 200 })
|
|
192
194
|
|
|
193
195
|
expect(managers[0]?.id).toBe('mgr-1')
|
|
@@ -197,7 +199,7 @@ describe('ChannelClient', () => {
|
|
|
197
199
|
test('getManagerRole unwraps the role response', async () => {
|
|
198
200
|
mockResponse({ role: { permissions: ['read'] } })
|
|
199
201
|
|
|
200
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
202
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
201
203
|
const role = await client.getManagerRole('ch-1')
|
|
202
204
|
|
|
203
205
|
expect(role).toEqual({ permissions: ['read'] })
|
|
@@ -209,7 +211,7 @@ describe('ChannelClient', () => {
|
|
|
209
211
|
mockResponse({ group: { id: 'grp-1', channelId: 'ch-1', name: 'ops' } })
|
|
210
212
|
mockResponse({ messages: [{ id: 'msg-1' }] })
|
|
211
213
|
|
|
212
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
214
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
213
215
|
await client.listGroups('ch-1', { limit: 500 })
|
|
214
216
|
await client.getGroup('ch-1', 'grp-1')
|
|
215
217
|
await client.getGroupMessages('ch-1', 'grp-1', { sortOrder: 'desc', limit: 100, since: 'cursor-1' })
|
|
@@ -227,7 +229,7 @@ describe('ChannelClient', () => {
|
|
|
227
229
|
test('sendGroupMessage includes requestId in the body', async () => {
|
|
228
230
|
mockResponse({ message: { id: 'msg-1', requestId: 'req-123' } })
|
|
229
231
|
|
|
230
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
232
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
231
233
|
const blocks = ChannelClient.wrapTextInBlocks('hello group')
|
|
232
234
|
await client.sendGroupMessage('ch-1', 'grp-1', blocks, 'req-123')
|
|
233
235
|
|
|
@@ -241,7 +243,7 @@ describe('ChannelClient', () => {
|
|
|
241
243
|
mockResponse({ messages: [{ id: 'msg-1' }] })
|
|
242
244
|
mockResponse({ message: { id: 'msg-2', requestId: 'req-234' } })
|
|
243
245
|
|
|
244
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
246
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
245
247
|
const blocks = ChannelClient.wrapTextInBlocks('hello dm')
|
|
246
248
|
|
|
247
249
|
await client.listDirectChats('ch-1', { limit: 200 })
|
|
@@ -260,7 +262,7 @@ describe('ChannelClient', () => {
|
|
|
260
262
|
mockResponse({ messages: [{ id: 'msg-1' }] })
|
|
261
263
|
mockResponse({ message: { id: 'msg-2', requestId: 'req-345' } })
|
|
262
264
|
|
|
263
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
265
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
264
266
|
const blocks = ChannelClient.wrapTextInBlocks('hello user')
|
|
265
267
|
|
|
266
268
|
await client.listUserChats('ch-1', { state: 'opened', limit: 25 })
|
|
@@ -278,7 +280,7 @@ describe('ChannelClient', () => {
|
|
|
278
280
|
test('listBots uses the bots endpoint', async () => {
|
|
279
281
|
mockResponse({ bots: [{ id: 'bot-1', channelId: 'ch-1', name: 'DeskBot' }] })
|
|
280
282
|
|
|
281
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
283
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
282
284
|
const bots = await client.listBots('ch-1', { limit: 1000 })
|
|
283
285
|
|
|
284
286
|
expect(bots[0]?.id).toBe('bot-1')
|
|
@@ -288,7 +290,7 @@ describe('ChannelClient', () => {
|
|
|
288
290
|
test('5xx on POST does not retry', async () => {
|
|
289
291
|
mockResponse({ type: 'server_error', errors: [{ message: 'Server error' }] }, 500)
|
|
290
292
|
|
|
291
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
293
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
292
294
|
await expect(client.sendGroupMessage('ch-1', 'grp-1', ChannelClient.wrapTextInBlocks('hello'), 'req-123')).rejects.toThrow(ChannelError)
|
|
293
295
|
expect(fetchCalls).toHaveLength(1)
|
|
294
296
|
})
|
|
@@ -296,7 +298,7 @@ describe('ChannelClient', () => {
|
|
|
296
298
|
test('error responses use desk API error fields', async () => {
|
|
297
299
|
mockResponse({ type: 'not_found', status: 404, errors: [{ message: 'Missing resource' }], language: 'en' }, 404)
|
|
298
300
|
|
|
299
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
301
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
300
302
|
|
|
301
303
|
try {
|
|
302
304
|
await client.getChannel('missing')
|
|
@@ -315,7 +317,7 @@ describe('ChannelClient', () => {
|
|
|
315
317
|
})
|
|
316
318
|
mockResponse({ account: { id: 'acc-2', name: 'Desk Owner', email: 'owner@example.com', emailVerified: true, language: 'en', country: 'KR', createdAt: 2 } })
|
|
317
319
|
|
|
318
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
320
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
319
321
|
await client.getAccount()
|
|
320
322
|
|
|
321
323
|
const start = Date.now()
|
|
@@ -329,7 +331,7 @@ describe('ChannelClient', () => {
|
|
|
329
331
|
test('generated requests still include the cookie header on post endpoints', async () => {
|
|
330
332
|
mockResponse({ message: { id: 'msg-1' } })
|
|
331
333
|
|
|
332
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
334
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
333
335
|
await client.sendDirectChatMessage('ch-1', 'dm-1', ChannelClient.wrapTextInBlocks('hello'), 'req-999')
|
|
334
336
|
|
|
335
337
|
expect(getHeaders().Cookie).toBe('x-account=account-cookie; ch-session-1=session-cookie')
|
|
@@ -344,7 +346,7 @@ describe('ChannelClient', () => {
|
|
|
344
346
|
}
|
|
345
347
|
mockResponse(searchResponse)
|
|
346
348
|
|
|
347
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
349
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
348
350
|
const result = await client.searchTeamChatMessages('ch-1', 'hello world', { limit: 10 })
|
|
349
351
|
|
|
350
352
|
const url = new URL(fetchCalls[0].url)
|
|
@@ -363,7 +365,7 @@ describe('ChannelClient', () => {
|
|
|
363
365
|
}
|
|
364
366
|
mockResponse(searchResponse)
|
|
365
367
|
|
|
366
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
368
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
367
369
|
const result = await client.searchUserChatMessages('ch-1', 'test query')
|
|
368
370
|
|
|
369
371
|
const url = new URL(fetchCalls[0].url)
|
|
@@ -375,7 +377,7 @@ describe('ChannelClient', () => {
|
|
|
375
377
|
test('searchTeamChatMessages works without limit parameter', async () => {
|
|
376
378
|
mockResponse({ hits: [], bots: [], sessions: [] })
|
|
377
379
|
|
|
378
|
-
const client = new ChannelClient('account-cookie', 'session-cookie')
|
|
380
|
+
const client = await new ChannelClient().login({ accountCookie: 'account-cookie', sessionCookie: 'session-cookie' })
|
|
379
381
|
await client.searchTeamChatMessages('ch-1', 'test')
|
|
380
382
|
|
|
381
383
|
const url = new URL(fetchCalls[0].url)
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
MessageBlock,
|
|
12
12
|
} from './types'
|
|
13
13
|
import { ChannelError } from './types'
|
|
14
|
+
import { ChannelCredentialManager } from './credential-manager'
|
|
14
15
|
|
|
15
16
|
const BASE_URL = 'https://desk-api.channel.io'
|
|
16
17
|
const MAX_RETRIES = 3
|
|
@@ -23,18 +24,37 @@ interface ChannelApiErrorResponse {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export class ChannelClient {
|
|
26
|
-
private accountCookie: string
|
|
27
|
+
private accountCookie: string | null = null
|
|
27
28
|
private sessionCookie: string | undefined
|
|
28
29
|
private rateLimitRemaining: number | null = null
|
|
29
30
|
private rateLimitResetAt = 0
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
|
|
32
|
+
async login(credentials?: { accountCookie: string; sessionCookie?: string }): Promise<this> {
|
|
33
|
+
if (credentials) {
|
|
34
|
+
if (!credentials.accountCookie) {
|
|
35
|
+
throw new ChannelError('Account cookie is required', 'missing_account_cookie')
|
|
36
|
+
}
|
|
37
|
+
this.accountCookie = credentials.accountCookie
|
|
38
|
+
this.sessionCookie = credentials.sessionCookie
|
|
39
|
+
return this
|
|
34
40
|
}
|
|
35
41
|
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
const { ensureChannelAuth } = await import('./ensure-auth')
|
|
43
|
+
await ensureChannelAuth()
|
|
44
|
+
const creds = await new ChannelCredentialManager().getCredentials()
|
|
45
|
+
if (!creds) {
|
|
46
|
+
throw new ChannelError(
|
|
47
|
+
'No Channel Talk credentials found. Make sure Channel Talk desktop app is installed and logged in.',
|
|
48
|
+
'no_credentials',
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
return this.login({ accountCookie: creds.account_cookie, sessionCookie: creds.session_cookie ?? undefined })
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private ensureAuth(): void {
|
|
55
|
+
if (this.accountCookie === null) {
|
|
56
|
+
throw new ChannelError('Not authenticated. Call .login() first.', 'not_authenticated')
|
|
57
|
+
}
|
|
38
58
|
}
|
|
39
59
|
|
|
40
60
|
static wrapTextInBlocks(text: string): MessageBlock[] {
|
|
@@ -222,8 +242,8 @@ export class ChannelClient {
|
|
|
222
242
|
private getHeaders(): Record<string, string> {
|
|
223
243
|
return {
|
|
224
244
|
Cookie: this.sessionCookie
|
|
225
|
-
? `x-account=${this.accountCookie}; ch-session-1=${this.sessionCookie}`
|
|
226
|
-
: `x-account=${this.accountCookie}`,
|
|
245
|
+
? `x-account=${this.accountCookie!}; ch-session-1=${this.sessionCookie}`
|
|
246
|
+
: `x-account=${this.accountCookie!}`,
|
|
227
247
|
'Content-Type': 'application/json',
|
|
228
248
|
}
|
|
229
249
|
}
|
|
@@ -255,6 +275,7 @@ export class ChannelClient {
|
|
|
255
275
|
}
|
|
256
276
|
|
|
257
277
|
private async request<T>(method: string, path: string, body?: unknown, unwrapKey?: string): Promise<T> {
|
|
278
|
+
this.ensureAuth()
|
|
258
279
|
const url = `${BASE_URL}${path}`
|
|
259
280
|
let lastError: Error | undefined
|
|
260
281
|
|
|
@@ -50,15 +50,17 @@ type ChannelCredentialManagerLike = Pick<
|
|
|
50
50
|
>
|
|
51
51
|
type ChannelTokenExtractorLike = Pick<ChannelTokenExtractor, 'extract'>
|
|
52
52
|
|
|
53
|
-
let createChannelClient
|
|
54
|
-
|
|
53
|
+
let createChannelClient: (accountCookie: string, sessionCookie?: string) => ChannelClientLike | Promise<ChannelClientLike> = async (
|
|
54
|
+
accountCookie: string,
|
|
55
|
+
sessionCookie?: string,
|
|
56
|
+
): Promise<ChannelClientLike> => new ChannelClient().login({ accountCookie, sessionCookie })
|
|
55
57
|
|
|
56
58
|
let createCredentialManager = (): ChannelCredentialManagerLike => new ChannelCredentialManager()
|
|
57
59
|
|
|
58
60
|
let createTokenExtractor = (): ChannelTokenExtractorLike => new ChannelTokenExtractor()
|
|
59
61
|
|
|
60
62
|
export function setChannelAuthCommandDependenciesForTesting(dependencies: {
|
|
61
|
-
createChannelClient?: (accountCookie: string, sessionCookie?: string) => ChannelClientLike
|
|
63
|
+
createChannelClient?: (accountCookie: string, sessionCookie?: string) => ChannelClientLike | Promise<ChannelClientLike>
|
|
62
64
|
createCredentialManager?: () => ChannelCredentialManagerLike
|
|
63
65
|
createTokenExtractor?: () => ChannelTokenExtractorLike
|
|
64
66
|
}): void {
|
|
@@ -68,8 +70,8 @@ export function setChannelAuthCommandDependenciesForTesting(dependencies: {
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
export function resetChannelAuthCommandDependenciesForTesting(): void {
|
|
71
|
-
createChannelClient = (accountCookie: string, sessionCookie?: string): ChannelClientLike =>
|
|
72
|
-
new ChannelClient(accountCookie, sessionCookie)
|
|
73
|
+
createChannelClient = async (accountCookie: string, sessionCookie?: string): Promise<ChannelClientLike> =>
|
|
74
|
+
new ChannelClient().login({ accountCookie, sessionCookie })
|
|
73
75
|
createCredentialManager = (): ChannelCredentialManagerLike => new ChannelCredentialManager()
|
|
74
76
|
createTokenExtractor = (): ChannelTokenExtractorLike => new ChannelTokenExtractor()
|
|
75
77
|
}
|
|
@@ -86,7 +88,7 @@ export async function extractAction(options: ActionOptions = {}): Promise<Extrac
|
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
const client = createChannelClient(extracted.accountCookie, extracted.sessionCookie)
|
|
91
|
+
const client = await createChannelClient(extracted.accountCookie, extracted.sessionCookie)
|
|
90
92
|
const account = await client.getAccount()
|
|
91
93
|
const channels = await client.listChannels()
|
|
92
94
|
|
|
@@ -141,7 +143,7 @@ export async function statusAction(options: ActionOptions = {}): Promise<StatusR
|
|
|
141
143
|
const storedWorkspace = (await credManager.listAll()).find((workspace) => workspace.workspace_id === creds.workspace_id)
|
|
142
144
|
|
|
143
145
|
try {
|
|
144
|
-
const client = createChannelClient(creds.account_cookie, creds.session_cookie ?? undefined)
|
|
146
|
+
const client = await createChannelClient(creds.account_cookie, creds.session_cookie ?? undefined)
|
|
145
147
|
const account = await client.getAccount()
|
|
146
148
|
|
|
147
149
|
return {
|
|
@@ -14,7 +14,7 @@ export async function getClient(options: SharedOptions = {}): Promise<ChannelCli
|
|
|
14
14
|
throw new Error('No credentials. Run "agent-channeltalk auth extract" first.')
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
return new ChannelClient(creds.account_cookie, creds.session_cookie)
|
|
17
|
+
return new ChannelClient().login({ accountCookie: creds.account_cookie, sessionCookie: creds.session_cookie })
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export async function getCurrentWorkspaceId(options: SharedOptions = {}): Promise<string> {
|
|
@@ -9,13 +9,15 @@ type ChannelCredentialManagerLike = Pick<
|
|
|
9
9
|
>
|
|
10
10
|
type ChannelTokenExtractorLike = Pick<ChannelTokenExtractor, 'extract'>
|
|
11
11
|
|
|
12
|
-
let createChannelClient
|
|
13
|
-
|
|
12
|
+
let createChannelClient: (accountCookie: string, sessionCookie?: string) => ChannelClientLike | Promise<ChannelClientLike> = async (
|
|
13
|
+
accountCookie: string,
|
|
14
|
+
sessionCookie?: string,
|
|
15
|
+
): Promise<ChannelClientLike> => new ChannelClient().login({ accountCookie, sessionCookie })
|
|
14
16
|
let createCredentialManager = (): ChannelCredentialManagerLike => new ChannelCredentialManager()
|
|
15
17
|
let createTokenExtractor = (): ChannelTokenExtractorLike => new ChannelTokenExtractor()
|
|
16
18
|
|
|
17
19
|
export function setEnsureChannelAuthDependenciesForTesting(deps: {
|
|
18
|
-
createClient?: (accountCookie: string, sessionCookie?: string) => ChannelClientLike
|
|
20
|
+
createClient?: (accountCookie: string, sessionCookie?: string) => ChannelClientLike | Promise<ChannelClientLike>
|
|
19
21
|
createCredentialManager?: () => ChannelCredentialManagerLike
|
|
20
22
|
createTokenExtractor?: () => ChannelTokenExtractorLike
|
|
21
23
|
}): void {
|
|
@@ -25,15 +27,15 @@ export function setEnsureChannelAuthDependenciesForTesting(deps: {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export function resetEnsureChannelAuthDependenciesForTesting(): void {
|
|
28
|
-
createChannelClient = (accountCookie: string, sessionCookie?: string): ChannelClientLike =>
|
|
29
|
-
new ChannelClient(accountCookie, sessionCookie)
|
|
30
|
+
createChannelClient = async (accountCookie: string, sessionCookie?: string): Promise<ChannelClientLike> =>
|
|
31
|
+
new ChannelClient().login({ accountCookie, sessionCookie })
|
|
30
32
|
createCredentialManager = () => new ChannelCredentialManager()
|
|
31
33
|
createTokenExtractor = () => new ChannelTokenExtractor()
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
// Keep old API for backward compatibility
|
|
35
37
|
export const setEnsureChannelAuthClientFactoryForTesting = (
|
|
36
|
-
factory: (accountCookie: string, sessionCookie?: string) => ChannelClientLike
|
|
38
|
+
factory: (accountCookie: string, sessionCookie?: string) => ChannelClientLike | Promise<ChannelClientLike>,
|
|
37
39
|
): void => setEnsureChannelAuthDependenciesForTesting({ createClient: factory })
|
|
38
40
|
|
|
39
41
|
export const resetEnsureChannelAuthClientFactoryForTesting = (): void =>
|
|
@@ -46,7 +48,7 @@ export async function ensureChannelAuth(): Promise<void> {
|
|
|
46
48
|
|
|
47
49
|
if (creds) {
|
|
48
50
|
try {
|
|
49
|
-
const client = createChannelClient(creds.account_cookie, creds.session_cookie ?? undefined)
|
|
51
|
+
const client = await createChannelClient(creds.account_cookie, creds.session_cookie ?? undefined)
|
|
50
52
|
await client.getAccount()
|
|
51
53
|
return
|
|
52
54
|
} catch {
|
|
@@ -60,7 +62,7 @@ export async function ensureChannelAuth(): Promise<void> {
|
|
|
60
62
|
return
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
const client = createChannelClient(extracted.accountCookie, extracted.sessionCookie)
|
|
65
|
+
const client = await createChannelClient(extracted.accountCookie, extracted.sessionCookie)
|
|
64
66
|
const account = await client.getAccount()
|
|
65
67
|
const channels = await client.listChannels()
|
|
66
68
|
if (channels.length === 0) {
|