agent-messenger 2.10.2 → 2.11.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/.env.template +4 -1
- package/README.md +77 -27
- package/bun.lock +26 -0
- package/dist/package.json +14 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts +2 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.js +5 -3
- package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.d.ts +2 -1
- package/dist/src/platforms/channeltalk/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.js +22 -6
- package/dist/src/platforms/channeltalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/cli.js +11 -1
- package/dist/src/platforms/channeltalkbot/cli.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.js +1 -5
- package/dist/src/platforms/channeltalkbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/bot.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/bot.js +1 -6
- package/dist/src/platforms/channeltalkbot/commands/bot.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/chat.js +1 -6
- package/dist/src/platforms/channeltalkbot/commands/chat.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/group.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/group.js +1 -6
- package/dist/src/platforms/channeltalkbot/commands/group.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/manager.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/manager.js +1 -6
- package/dist/src/platforms/channeltalkbot/commands/manager.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/message.js +1 -6
- package/dist/src/platforms/channeltalkbot/commands/message.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/whoami.js +1 -6
- package/dist/src/platforms/channeltalkbot/commands/whoami.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/credential-manager.d.ts +5 -0
- package/dist/src/platforms/channeltalkbot/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/credential-manager.js +34 -4
- package/dist/src/platforms/channeltalkbot/credential-manager.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.d.ts +1 -0
- package/dist/src/platforms/discord/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js +3 -1
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/listener.d.ts +2 -0
- package/dist/src/platforms/discord/listener.d.ts.map +1 -1
- package/dist/src/platforms/discord/listener.js +51 -21
- package/dist/src/platforms/discord/listener.js.map +1 -1
- package/dist/src/platforms/discord/token-extractor.d.ts +2 -1
- package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/discord/token-extractor.js +21 -6
- package/dist/src/platforms/discord/token-extractor.js.map +1 -1
- package/dist/src/platforms/discordbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/cli.js +12 -1
- package/dist/src/platforms/discordbot/cli.js.map +1 -1
- package/dist/src/platforms/discordbot/client.d.ts +3 -0
- package/dist/src/platforms/discordbot/client.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/client.js +3 -0
- package/dist/src/platforms/discordbot/client.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/commands/auth.js +1 -5
- package/dist/src/platforms/discordbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/commands/message.js +1 -6
- package/dist/src/platforms/discordbot/commands/message.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/server.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/commands/server.js +1 -4
- package/dist/src/platforms/discordbot/commands/server.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/commands/whoami.js +1 -6
- package/dist/src/platforms/discordbot/commands/whoami.js.map +1 -1
- package/dist/src/platforms/discordbot/index.d.ts +3 -1
- package/dist/src/platforms/discordbot/index.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/index.js +2 -1
- package/dist/src/platforms/discordbot/index.js.map +1 -1
- package/dist/src/platforms/discordbot/listener.d.ts +43 -0
- package/dist/src/platforms/discordbot/listener.d.ts.map +1 -0
- package/dist/src/platforms/discordbot/listener.js +292 -0
- package/dist/src/platforms/discordbot/listener.js.map +1 -0
- package/dist/src/platforms/discordbot/types.d.ts +161 -0
- package/dist/src/platforms/discordbot/types.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/types.js +34 -0
- package/dist/src/platforms/discordbot/types.js.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.js +3 -1
- package/dist/src/platforms/instagram/commands/auth.js.map +1 -1
- package/dist/src/platforms/instagram/token-extractor.d.ts +2 -1
- package/dist/src/platforms/instagram/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/instagram/token-extractor.js +11 -2
- package/dist/src/platforms/instagram/token-extractor.js.map +1 -1
- package/dist/src/platforms/slack/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/auth.js +4 -2
- package/dist/src/platforms/slack/commands/auth.js.map +1 -1
- package/dist/src/platforms/slack/token-extractor.d.ts +4 -1
- package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/slack/token-extractor.js +64 -15
- 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 +15 -3
- package/dist/src/platforms/slackbot/cli.js.map +1 -1
- package/dist/src/platforms/slackbot/client.d.ts +22 -1
- package/dist/src/platforms/slackbot/client.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/client.js +104 -1
- package/dist/src/platforms/slackbot/client.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/commands/auth.js +1 -5
- package/dist/src/platforms/slackbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/file.d.ts +3 -0
- package/dist/src/platforms/slackbot/commands/file.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/commands/file.js +164 -0
- package/dist/src/platforms/slackbot/commands/file.js.map +1 -0
- package/dist/src/platforms/slackbot/commands/index.d.ts +1 -0
- package/dist/src/platforms/slackbot/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/commands/index.js +1 -0
- package/dist/src/platforms/slackbot/commands/index.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/commands/message.js +19 -0
- package/dist/src/platforms/slackbot/commands/message.js.map +1 -1
- package/dist/src/platforms/slackbot/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/commands/whoami.js +1 -6
- package/dist/src/platforms/slackbot/commands/whoami.js.map +1 -1
- package/dist/src/platforms/slackbot/credential-manager.d.ts +1 -0
- package/dist/src/platforms/slackbot/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/credential-manager.js +30 -2
- package/dist/src/platforms/slackbot/credential-manager.js.map +1 -1
- package/dist/src/platforms/slackbot/index.d.ts +4 -1
- package/dist/src/platforms/slackbot/index.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/index.js +1 -0
- package/dist/src/platforms/slackbot/index.js.map +1 -1
- package/dist/src/platforms/slackbot/listener.d.ts +44 -0
- package/dist/src/platforms/slackbot/listener.d.ts.map +1 -0
- package/dist/src/platforms/slackbot/listener.js +313 -0
- package/dist/src/platforms/slackbot/listener.js.map +1 -0
- package/dist/src/platforms/slackbot/types.d.ts +196 -1
- package/dist/src/platforms/slackbot/types.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/types.js +4 -1
- package/dist/src/platforms/slackbot/types.js.map +1 -1
- package/dist/src/platforms/teams/commands/auth.d.ts +1 -0
- package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/auth.js +37 -6
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/ensure-auth.js +31 -9
- package/dist/src/platforms/teams/ensure-auth.js.map +1 -1
- package/dist/src/platforms/teams/token-extractor.d.ts +4 -1
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/teams/token-extractor.js +71 -29
- package/dist/src/platforms/teams/token-extractor.js.map +1 -1
- package/dist/src/platforms/webex/commands/auth.d.ts +1 -0
- package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/auth.js +3 -1
- package/dist/src/platforms/webex/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/token-extractor.d.ts +3 -1
- package/dist/src/platforms/webex/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/webex/token-extractor.js +16 -2
- package/dist/src/platforms/webex/token-extractor.js.map +1 -1
- package/dist/src/platforms/wechatbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/cli.js +11 -1
- package/dist/src/platforms/wechatbot/cli.js.map +1 -1
- package/dist/src/platforms/wechatbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/commands/auth.js +1 -5
- package/dist/src/platforms/wechatbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/wechatbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/commands/message.js +1 -6
- package/dist/src/platforms/wechatbot/commands/message.js.map +1 -1
- package/dist/src/platforms/wechatbot/commands/template.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/commands/template.js +1 -6
- package/dist/src/platforms/wechatbot/commands/template.js.map +1 -1
- package/dist/src/platforms/wechatbot/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/commands/user.js +1 -6
- package/dist/src/platforms/wechatbot/commands/user.js.map +1 -1
- package/dist/src/platforms/wechatbot/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/commands/whoami.js +1 -6
- package/dist/src/platforms/wechatbot/commands/whoami.js.map +1 -1
- package/dist/src/platforms/whatsappbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/cli.js +11 -1
- package/dist/src/platforms/whatsappbot/cli.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/auth.js +1 -5
- 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 +1 -6
- package/dist/src/platforms/whatsappbot/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/template.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/template.js +1 -6
- package/dist/src/platforms/whatsappbot/commands/template.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/whoami.js +1 -6
- package/dist/src/platforms/whatsappbot/commands/whoami.js.map +1 -1
- package/dist/src/shared/chromium/browsers.d.ts +8 -0
- package/dist/src/shared/chromium/browsers.d.ts.map +1 -1
- package/dist/src/shared/chromium/browsers.js +58 -3
- package/dist/src/shared/chromium/browsers.js.map +1 -1
- package/dist/src/shared/chromium/cli-options.d.ts +5 -0
- package/dist/src/shared/chromium/cli-options.d.ts.map +1 -0
- package/dist/src/shared/chromium/cli-options.js +8 -0
- package/dist/src/shared/chromium/cli-options.js.map +1 -0
- package/dist/src/shared/chromium/index.d.ts +3 -1
- package/dist/src/shared/chromium/index.d.ts.map +1 -1
- package/dist/src/shared/chromium/index.js +2 -1
- package/dist/src/shared/chromium/index.js.map +1 -1
- package/dist/src/shared/utils/cli-output.d.ts +7 -0
- package/dist/src/shared/utils/cli-output.d.ts.map +1 -0
- package/dist/src/shared/utils/cli-output.js +7 -0
- package/dist/src/shared/utils/cli-output.js.map +1 -0
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +73 -20
- package/dist/src/tui/app.js.map +1 -1
- package/docs/content/docs/cli/channeltalk.mdx +4 -0
- package/docs/content/docs/cli/discord.mdx +5 -0
- package/docs/content/docs/cli/instagram.mdx +3 -0
- package/docs/content/docs/cli/slack.mdx +5 -0
- package/docs/content/docs/cli/slackbot.mdx +60 -22
- package/docs/content/docs/cli/teams.mdx +5 -0
- package/docs/content/docs/cli/webex.mdx +3 -0
- package/docs/content/docs/sdk/channeltalkbot.mdx +38 -1
- package/docs/content/docs/sdk/discordbot.mdx +501 -0
- package/docs/content/docs/sdk/meta.json +2 -0
- package/docs/content/docs/sdk/slackbot.mdx +576 -0
- package/e2e/README.md +1 -1
- package/e2e/config.ts +9 -4
- package/examples/discordbot-listen.ts +65 -0
- package/examples/slackbot-listen.ts +65 -0
- package/package.json +14 -1
- package/skills/agent-channeltalk/SKILL.md +5 -1
- package/skills/agent-channeltalk/references/authentication.md +5 -1
- package/skills/agent-channeltalkbot/SKILL.md +17 -3
- package/skills/agent-channeltalkbot/references/authentication.md +7 -5
- package/skills/agent-discord/SKILL.md +5 -1
- package/skills/agent-discord/references/authentication.md +7 -1
- package/skills/agent-discordbot/SKILL.md +13 -2
- package/skills/agent-discordbot/references/common-patterns.md +1 -1
- package/skills/agent-instagram/SKILL.md +7 -1
- package/skills/agent-instagram/references/authentication.md +6 -0
- package/skills/agent-kakaotalk/SKILL.md +1 -1
- package/skills/agent-line/SKILL.md +1 -1
- package/skills/agent-slack/SKILL.md +5 -1
- package/skills/agent-slack/references/authentication.md +7 -1
- package/skills/agent-slackbot/SKILL.md +56 -4
- package/skills/agent-slackbot/references/authentication.md +4 -0
- package/skills/agent-teams/SKILL.md +5 -1
- package/skills/agent-teams/references/authentication.md +7 -1
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +7 -1
- package/skills/agent-webex/references/authentication.md +6 -0
- package/skills/agent-wechatbot/SKILL.md +16 -1
- package/skills/agent-wechatbot/references/authentication.md +219 -0
- package/skills/agent-wechatbot/references/common-patterns.md +358 -0
- package/skills/agent-wechatbot/templates/account-summary.sh +122 -0
- package/skills/agent-wechatbot/templates/post-message.sh +122 -0
- package/skills/agent-wechatbot/templates/send-template.sh +152 -0
- package/skills/agent-whatsapp/SKILL.md +1 -1
- package/skills/agent-whatsappbot/SKILL.md +30 -1
- package/src/platforms/channeltalk/commands/auth.test.ts +15 -3
- package/src/platforms/channeltalk/commands/auth.ts +15 -5
- package/src/platforms/channeltalk/token-extractor.ts +24 -5
- package/src/platforms/channeltalkbot/cli.ts +9 -0
- package/src/platforms/channeltalkbot/commands/auth.ts +1 -5
- package/src/platforms/channeltalkbot/commands/bot.ts +1 -6
- package/src/platforms/channeltalkbot/commands/chat.ts +1 -6
- package/src/platforms/channeltalkbot/commands/group.ts +1 -6
- package/src/platforms/channeltalkbot/commands/manager.ts +1 -6
- package/src/platforms/channeltalkbot/commands/message.ts +1 -6
- package/src/platforms/channeltalkbot/commands/whoami.test.ts +2 -0
- package/src/platforms/channeltalkbot/commands/whoami.ts +1 -6
- package/src/platforms/channeltalkbot/credential-manager.test.ts +96 -2
- package/src/platforms/channeltalkbot/credential-manager.ts +37 -4
- package/src/platforms/discord/commands/auth.ts +13 -2
- package/src/platforms/discord/listener.test.ts +59 -1
- package/src/platforms/discord/listener.ts +43 -19
- package/src/platforms/discord/token-extractor.ts +30 -6
- package/src/platforms/discordbot/cli.ts +10 -0
- package/src/platforms/discordbot/client.ts +4 -0
- package/src/platforms/discordbot/commands/auth.ts +1 -5
- package/src/platforms/discordbot/commands/message.ts +1 -6
- package/src/platforms/discordbot/commands/server.ts +1 -5
- package/src/platforms/discordbot/commands/whoami.ts +1 -6
- package/src/platforms/discordbot/index.test.ts +82 -0
- package/src/platforms/discordbot/index.ts +27 -9
- package/src/platforms/discordbot/listener.test.ts +1002 -0
- package/src/platforms/discordbot/listener.ts +321 -0
- package/src/platforms/discordbot/types.ts +163 -0
- package/src/platforms/instagram/commands/auth.ts +9 -1
- package/src/platforms/instagram/token-extractor.ts +13 -1
- package/src/platforms/slack/commands/auth.ts +11 -2
- package/src/platforms/slack/token-extractor.test.ts +96 -0
- package/src/platforms/slack/token-extractor.ts +76 -13
- package/src/platforms/slackbot/cli.ts +13 -1
- package/src/platforms/slackbot/client.test.ts +274 -0
- package/src/platforms/slackbot/client.ts +130 -2
- package/src/platforms/slackbot/commands/auth.ts +1 -5
- package/src/platforms/slackbot/commands/file.test.ts +201 -0
- package/src/platforms/slackbot/commands/file.ts +212 -0
- package/src/platforms/slackbot/commands/index.ts +1 -0
- package/src/platforms/slackbot/commands/message.ts +22 -0
- package/src/platforms/slackbot/commands/whoami.ts +1 -6
- package/src/platforms/slackbot/credential-manager.test.ts +62 -2
- package/src/platforms/slackbot/credential-manager.ts +32 -2
- package/src/platforms/slackbot/index.test.ts +59 -0
- package/src/platforms/slackbot/index.ts +31 -7
- package/src/platforms/slackbot/listener.test.ts +1012 -0
- package/src/platforms/slackbot/listener.ts +362 -0
- package/src/platforms/slackbot/types.ts +224 -1
- package/src/platforms/teams/commands/auth.test.ts +1 -1
- package/src/platforms/teams/commands/auth.ts +66 -7
- package/src/platforms/teams/ensure-auth.test.ts +56 -5
- package/src/platforms/teams/ensure-auth.ts +39 -11
- package/src/platforms/teams/token-extractor.test.ts +146 -24
- package/src/platforms/teams/token-extractor.ts +87 -29
- package/src/platforms/webex/commands/auth.ts +13 -2
- package/src/platforms/webex/token-extractor.ts +25 -3
- package/src/platforms/wechatbot/cli.ts +9 -0
- package/src/platforms/wechatbot/commands/auth.ts +1 -5
- package/src/platforms/wechatbot/commands/message.ts +1 -6
- package/src/platforms/wechatbot/commands/template.ts +1 -6
- package/src/platforms/wechatbot/commands/user.ts +1 -6
- package/src/platforms/wechatbot/commands/whoami.ts +1 -6
- package/src/platforms/whatsappbot/cli.ts +9 -0
- package/src/platforms/whatsappbot/commands/auth.ts +1 -5
- package/src/platforms/whatsappbot/commands/message.ts +1 -6
- package/src/platforms/whatsappbot/commands/template.ts +1 -6
- package/src/platforms/whatsappbot/commands/whoami.ts +1 -6
- package/src/shared/chromium/browsers.test.ts +80 -0
- package/src/shared/chromium/browsers.ts +72 -3
- package/src/shared/chromium/cli-options.test.ts +22 -0
- package/src/shared/chromium/cli-options.ts +12 -0
- package/src/shared/chromium/index.ts +3 -0
- package/src/shared/utils/cli-output.test.ts +57 -0
- package/src/shared/utils/cli-output.ts +8 -0
- package/src/tui/app.ts +129 -20
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ChromiumCookieDecryptor,
|
|
11
11
|
discoverBrowserProfileDirs,
|
|
12
12
|
getBrowserBasePath,
|
|
13
|
+
getAgentBrowserProfileDirs,
|
|
13
14
|
} from '@/shared/chromium'
|
|
14
15
|
import type { KeychainVariant } from '@/shared/chromium'
|
|
15
16
|
import { DerivedKeyCache } from '@/shared/utils/derived-key-cache'
|
|
@@ -74,12 +75,20 @@ export class DiscordTokenExtractor {
|
|
|
74
75
|
private keyCache: DerivedKeyCache
|
|
75
76
|
private cachedKey: Buffer | null = null
|
|
76
77
|
private decryptor: ChromiumCookieDecryptor
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
private customBrowserProfileDirs: string[]
|
|
79
|
+
|
|
80
|
+
constructor(
|
|
81
|
+
platform?: NodeJS.Platform,
|
|
82
|
+
startupWait?: number,
|
|
83
|
+
killWait?: number,
|
|
84
|
+
keyCache?: DerivedKeyCache,
|
|
85
|
+
customBrowserProfileDirs?: string[],
|
|
86
|
+
) {
|
|
79
87
|
this.platform = platform ?? process.platform
|
|
80
88
|
this.startupWait = startupWait ?? DISCORD_STARTUP_WAIT
|
|
81
89
|
this.killWait = killWait ?? 1000
|
|
82
90
|
this.keyCache = keyCache ?? new DerivedKeyCache()
|
|
91
|
+
this.customBrowserProfileDirs = customBrowserProfileDirs ?? []
|
|
83
92
|
this.decryptor = new ChromiumCookieDecryptor({
|
|
84
93
|
platform: this.platform,
|
|
85
94
|
appKeychainVariants: DISCORD_APP_KEYCHAIN_VARIANTS,
|
|
@@ -125,6 +134,10 @@ export class DiscordTokenExtractor {
|
|
|
125
134
|
}
|
|
126
135
|
}
|
|
127
136
|
|
|
137
|
+
for (const profileDir of getAgentBrowserProfileDirs({ customProfileDirs: this.customBrowserProfileDirs })) {
|
|
138
|
+
dirs.push(join(profileDir, 'Local Storage', 'leveldb'))
|
|
139
|
+
}
|
|
140
|
+
|
|
128
141
|
return dirs
|
|
129
142
|
}
|
|
130
143
|
|
|
@@ -164,6 +177,15 @@ export class DiscordTokenExtractor {
|
|
|
164
177
|
const results: ExtractedDiscordToken[] = []
|
|
165
178
|
const seenTokens = new Set<string>()
|
|
166
179
|
|
|
180
|
+
if (this.customBrowserProfileDirs.length > 0) {
|
|
181
|
+
for (const t of await this.extractFromBrowserLevelDB()) {
|
|
182
|
+
if (!seenTokens.has(t.token)) {
|
|
183
|
+
seenTokens.add(t.token)
|
|
184
|
+
results.push(t)
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
167
189
|
for (const t of await this.extractFromLevelDB()) {
|
|
168
190
|
if (!seenTokens.has(t.token)) {
|
|
169
191
|
seenTokens.add(t.token)
|
|
@@ -171,10 +193,12 @@ export class DiscordTokenExtractor {
|
|
|
171
193
|
}
|
|
172
194
|
}
|
|
173
195
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
seenTokens.
|
|
177
|
-
|
|
196
|
+
if (this.customBrowserProfileDirs.length === 0) {
|
|
197
|
+
for (const t of await this.extractFromBrowserLevelDB()) {
|
|
198
|
+
if (!seenTokens.has(t.token)) {
|
|
199
|
+
seenTokens.add(t.token)
|
|
200
|
+
results.push(t)
|
|
201
|
+
}
|
|
178
202
|
}
|
|
179
203
|
}
|
|
180
204
|
|
|
@@ -22,8 +22,18 @@ program
|
|
|
22
22
|
.name('agent-discordbot')
|
|
23
23
|
.description('CLI tool for Discord bot integration using bot tokens')
|
|
24
24
|
.version(pkg.version)
|
|
25
|
+
.option('--pretty', 'Pretty-print JSON output')
|
|
25
26
|
.option('--bot <id>', 'Bot ID to use')
|
|
26
27
|
.option('--server <id>', 'Server ID to use')
|
|
28
|
+
.hook('preAction', (thisCmd, actionCmd) => {
|
|
29
|
+
for (const [key, value] of Object.entries(thisCmd.opts())) {
|
|
30
|
+
if (value === undefined) continue
|
|
31
|
+
const source = actionCmd.getOptionValueSource(key)
|
|
32
|
+
if (source === undefined || source === 'default') {
|
|
33
|
+
actionCmd.setOptionValue(key, value)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
})
|
|
27
37
|
|
|
28
38
|
program.addCommand(authCommand)
|
|
29
39
|
program.addCommand(whoamiCommand)
|
|
@@ -347,6 +347,10 @@ export class DiscordBotClient {
|
|
|
347
347
|
return this.request<DiscordChannel>('PATCH', `/channels/${threadId}`, { archived })
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
+
async gatewayConnect(): Promise<{ token: string }> {
|
|
351
|
+
return { token: this.ensureAuth() }
|
|
352
|
+
}
|
|
353
|
+
|
|
350
354
|
async resolveChannel(guildId: string, channel: string): Promise<string> {
|
|
351
355
|
if (/^\d+$/.test(channel)) return channel
|
|
352
356
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
2
|
|
|
3
|
+
import { cliOutput } from '@/shared/utils/cli-output'
|
|
3
4
|
import { formatOutput } from '@/shared/utils/output'
|
|
4
5
|
|
|
5
6
|
import { DiscordBotClient } from '../client'
|
|
@@ -163,11 +164,6 @@ export async function removeAction(botId: string, options: ActionOptions): Promi
|
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
function cliOutput(result: ActionResult, pretty?: boolean, exitOnError = true): void {
|
|
167
|
-
console.log(formatOutput(result, pretty))
|
|
168
|
-
if (result.error && exitOnError) process.exit(1)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
167
|
export const authCommand = new Command('auth')
|
|
172
168
|
.description('Bot authentication commands')
|
|
173
169
|
.addCommand(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { cliOutput } from '@/shared/utils/cli-output'
|
|
4
4
|
|
|
5
5
|
import type { BotOption } from './shared'
|
|
6
6
|
import { getClient, getCurrentServer } from './shared'
|
|
@@ -165,11 +165,6 @@ export async function repliesAction(
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
function cliOutput(result: MessageResult, pretty?: boolean): void {
|
|
169
|
-
console.log(formatOutput(result, pretty))
|
|
170
|
-
if (result.error) process.exit(1)
|
|
171
|
-
}
|
|
172
|
-
|
|
173
168
|
export const messageCommand = new Command('message')
|
|
174
169
|
.description('Message commands')
|
|
175
170
|
.addCommand(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { cliOutput } from '@/shared/utils/cli-output'
|
|
4
4
|
|
|
5
5
|
import { DiscordBotCredentialManager } from '../credential-manager'
|
|
6
6
|
import type { BotOption } from './shared'
|
|
@@ -82,10 +82,6 @@ export async function infoAction(serverId: string, options: BotOption): Promise<
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
const cliOutput = (result: ActionResult, pretty?: boolean) => {
|
|
86
|
-
console.log(formatOutput(result, pretty))
|
|
87
|
-
}
|
|
88
|
-
|
|
89
85
|
export const serverCommand = new Command('server')
|
|
90
86
|
.description('Server commands')
|
|
91
87
|
.addCommand(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { cliOutput } from '@/shared/utils/cli-output'
|
|
4
4
|
|
|
5
5
|
import type { BotOption } from './shared'
|
|
6
6
|
import { getClient } from './shared'
|
|
@@ -30,11 +30,6 @@ export async function whoamiAction(options: BotOption): Promise<WhoamiResult> {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function cliOutput(result: WhoamiResult, pretty?: boolean): void {
|
|
34
|
-
console.log(formatOutput(result, pretty))
|
|
35
|
-
if (result.error) process.exit(1)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
33
|
export const whoamiCommand = new Command('whoami')
|
|
39
34
|
.description('Show current authenticated bot')
|
|
40
35
|
.option('--bot <id>', 'Bot ID to use')
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { expect, it } from 'bun:test'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DiscordBotClient,
|
|
5
|
+
DiscordBotConfigSchema,
|
|
6
|
+
DiscordBotCredentialManager,
|
|
7
|
+
DiscordBotCredentialsSchema,
|
|
8
|
+
DiscordBotEntrySchema,
|
|
9
|
+
DiscordBotError,
|
|
10
|
+
DiscordBotListener,
|
|
11
|
+
DiscordChannelSchema,
|
|
12
|
+
DiscordFileSchema,
|
|
13
|
+
DiscordGatewayOpcode,
|
|
14
|
+
DiscordGuildSchema,
|
|
15
|
+
DiscordIntent,
|
|
16
|
+
DiscordMessageSchema,
|
|
17
|
+
DiscordReactionSchema,
|
|
18
|
+
DiscordUserSchema,
|
|
19
|
+
} from '@/platforms/discordbot/index'
|
|
20
|
+
|
|
21
|
+
it('DiscordBotClient is exported from barrel', () => {
|
|
22
|
+
expect(typeof DiscordBotClient).toBe('function')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('DiscordBotError is exported from barrel', () => {
|
|
26
|
+
expect(typeof DiscordBotError).toBe('function')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('DiscordBotCredentialManager is exported from barrel', () => {
|
|
30
|
+
expect(typeof DiscordBotCredentialManager).toBe('function')
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('DiscordBotListener is exported from barrel', () => {
|
|
34
|
+
expect(typeof DiscordBotListener).toBe('function')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('DiscordGatewayOpcode is exported from barrel', () => {
|
|
38
|
+
expect(DiscordGatewayOpcode.Identify).toBe(2)
|
|
39
|
+
expect(DiscordGatewayOpcode.Hello).toBe(10)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('DiscordIntent is exported from barrel', () => {
|
|
43
|
+
expect(DiscordIntent.Guilds).toBe(1)
|
|
44
|
+
expect(DiscordIntent.GuildMessages).toBe(1 << 9)
|
|
45
|
+
expect(DiscordIntent.MessageContent).toBe(1 << 15)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('DiscordBotEntrySchema is exported from barrel', () => {
|
|
49
|
+
expect(typeof DiscordBotEntrySchema.parse).toBe('function')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it('DiscordBotConfigSchema is exported from barrel', () => {
|
|
53
|
+
expect(typeof DiscordBotConfigSchema.parse).toBe('function')
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('DiscordBotCredentialsSchema is exported from barrel', () => {
|
|
57
|
+
expect(typeof DiscordBotCredentialsSchema.parse).toBe('function')
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('DiscordGuildSchema is exported from barrel', () => {
|
|
61
|
+
expect(typeof DiscordGuildSchema.parse).toBe('function')
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('DiscordChannelSchema is exported from barrel', () => {
|
|
65
|
+
expect(typeof DiscordChannelSchema.parse).toBe('function')
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('DiscordMessageSchema is exported from barrel', () => {
|
|
69
|
+
expect(typeof DiscordMessageSchema.parse).toBe('function')
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('DiscordUserSchema is exported from barrel', () => {
|
|
73
|
+
expect(typeof DiscordUserSchema.parse).toBe('function')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('DiscordReactionSchema is exported from barrel', () => {
|
|
77
|
+
expect(typeof DiscordReactionSchema.parse).toBe('function')
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('DiscordFileSchema is exported from barrel', () => {
|
|
81
|
+
expect(typeof DiscordFileSchema.parse).toBe('function')
|
|
82
|
+
})
|
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
export { DiscordBotClient } from './client'
|
|
2
2
|
export { DiscordBotCredentialManager } from './credential-manager'
|
|
3
|
-
export {
|
|
3
|
+
export { DiscordBotListener } from './listener'
|
|
4
|
+
export type {
|
|
4
5
|
DiscordBotConfig,
|
|
5
|
-
DiscordBotConfigSchema,
|
|
6
6
|
DiscordBotCredentials,
|
|
7
|
-
DiscordBotCredentialsSchema,
|
|
8
7
|
DiscordBotEntry,
|
|
8
|
+
DiscordBotListenerEventMap,
|
|
9
|
+
DiscordChannel,
|
|
10
|
+
DiscordFile,
|
|
11
|
+
DiscordGatewayChannelEvent,
|
|
12
|
+
DiscordGatewayEvent,
|
|
13
|
+
DiscordGatewayGenericEvent,
|
|
14
|
+
DiscordGatewayGuildEvent,
|
|
15
|
+
DiscordGatewayInteractionEvent,
|
|
16
|
+
DiscordGatewayMemberEvent,
|
|
17
|
+
DiscordGatewayMessageCreateEvent,
|
|
18
|
+
DiscordGatewayMessageDeleteEvent,
|
|
19
|
+
DiscordGatewayMessageUpdateEvent,
|
|
20
|
+
DiscordGatewayPresenceEvent,
|
|
21
|
+
DiscordGatewayReactionEvent,
|
|
22
|
+
DiscordGatewayTypingEvent,
|
|
23
|
+
DiscordGuild,
|
|
24
|
+
DiscordMessage,
|
|
25
|
+
DiscordReaction,
|
|
26
|
+
DiscordUser,
|
|
27
|
+
} from './types'
|
|
28
|
+
export {
|
|
29
|
+
DiscordBotConfigSchema,
|
|
30
|
+
DiscordBotCredentialsSchema,
|
|
9
31
|
DiscordBotEntrySchema,
|
|
10
32
|
DiscordBotError,
|
|
11
|
-
DiscordChannel,
|
|
12
33
|
DiscordChannelSchema,
|
|
13
|
-
DiscordFile,
|
|
14
34
|
DiscordFileSchema,
|
|
15
|
-
|
|
35
|
+
DiscordGatewayOpcode,
|
|
16
36
|
DiscordGuildSchema,
|
|
17
|
-
|
|
37
|
+
DiscordIntent,
|
|
18
38
|
DiscordMessageSchema,
|
|
19
|
-
DiscordReaction,
|
|
20
39
|
DiscordReactionSchema,
|
|
21
|
-
DiscordUser,
|
|
22
40
|
DiscordUserSchema,
|
|
23
41
|
} from './types'
|