agent-messenger 2.17.0 → 2.19.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/bunfig.toml +1 -0
- package/dist/package.json +1 -1
- package/dist/src/platforms/discordbot/client.d.ts +1 -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/message.d.ts +1 -0
- package/dist/src/platforms/discordbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/commands/message.js +2 -0
- package/dist/src/platforms/discordbot/commands/message.js.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.js +1 -3
- package/dist/src/platforms/instagram/commands/auth.js.map +1 -1
- package/dist/src/platforms/kakaotalk/client.d.ts +4 -2
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +16 -2
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.js +2 -17
- package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/message.js +23 -1
- package/dist/src/platforms/kakaotalk/commands/message.js.map +1 -1
- package/dist/src/platforms/kakaotalk/index.d.ts +1 -1
- package/dist/src/platforms/kakaotalk/index.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/index.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts +2 -1
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.js +15 -0
- package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -1
- package/dist/src/platforms/kakaotalk/types.d.ts +18 -0
- package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/types.js +1 -0
- package/dist/src/platforms/kakaotalk/types.js.map +1 -1
- package/dist/src/platforms/line/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/auth.js +2 -4
- package/dist/src/platforms/line/commands/auth.js.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.js +5 -7
- package/dist/src/platforms/telegram/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/commands/auth.d.ts +5 -2
- package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/auth.js +59 -1
- package/dist/src/platforms/webex/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/credential-manager.d.ts +11 -0
- package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/webex/credential-manager.js +37 -0
- package/dist/src/platforms/webex/credential-manager.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/auth.js +2 -4
- package/dist/src/platforms/whatsapp/commands/auth.js.map +1 -1
- package/dist/src/shared/chromium/browsers.js +1 -1
- package/dist/src/shared/chromium/browsers.js.map +1 -1
- package/dist/src/shared/utils/interactive.d.ts +3 -0
- package/dist/src/shared/utils/interactive.d.ts.map +1 -0
- package/dist/src/shared/utils/interactive.js +16 -0
- package/dist/src/shared/utils/interactive.js.map +1 -0
- package/docs/content/docs/cli/discordbot.mdx +6 -0
- package/docs/content/docs/sdk/discordbot.mdx +4 -0
- package/package.json +1 -1
- package/skills/agent-channeltalk/SKILL.md +1 -1
- package/skills/agent-channeltalkbot/SKILL.md +1 -1
- package/skills/agent-discord/SKILL.md +1 -1
- package/skills/agent-discordbot/SKILL.md +9 -1
- package/skills/agent-instagram/SKILL.md +1 -1
- package/skills/agent-kakaotalk/SKILL.md +24 -1
- package/skills/agent-line/SKILL.md +1 -1
- package/skills/agent-slack/SKILL.md +1 -1
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +1 -1
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-telegrambot/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +32 -1
- package/skills/agent-wechatbot/SKILL.md +1 -1
- package/skills/agent-whatsapp/SKILL.md +1 -1
- package/skills/agent-whatsappbot/SKILL.md +1 -1
- package/src/platforms/discord/commands/dm.test.ts +28 -20
- package/src/platforms/discord/commands/reaction.test.ts +12 -7
- package/src/platforms/discordbot/client.test.ts +17 -0
- package/src/platforms/discordbot/client.ts +9 -2
- package/src/platforms/discordbot/commands/message.test.ts +28 -11
- package/src/platforms/discordbot/commands/message.ts +4 -2
- package/src/platforms/instagram/commands/auth.test.ts +11 -9
- package/src/platforms/instagram/commands/auth.ts +1 -4
- package/src/platforms/instagram/commands/chat.test.ts +8 -6
- package/src/platforms/instagram/commands/message.test.ts +8 -6
- package/src/platforms/kakaotalk/client.test.ts +57 -0
- package/src/platforms/kakaotalk/client.ts +23 -2
- package/src/platforms/kakaotalk/commands/auth.ts +2 -18
- package/src/platforms/kakaotalk/commands/message.test.ts +42 -0
- package/src/platforms/kakaotalk/commands/message.ts +33 -2
- package/src/platforms/kakaotalk/index.ts +2 -0
- package/src/platforms/kakaotalk/protocol/session.ts +15 -1
- package/src/platforms/kakaotalk/types.ts +24 -0
- package/src/platforms/line/commands/auth.ts +2 -5
- package/src/platforms/telegram/commands/auth.ts +5 -8
- package/src/platforms/webex/commands/auth.test.ts +178 -14
- package/src/platforms/webex/commands/auth.ts +102 -3
- package/src/platforms/webex/commands/member.test.ts +14 -20
- package/src/platforms/webex/commands/message.test.ts +11 -20
- package/src/platforms/webex/commands/snapshot.test.ts +11 -20
- package/src/platforms/webex/commands/space.test.ts +15 -23
- package/src/platforms/webex/commands/whoami.test.ts +8 -22
- package/src/platforms/webex/credential-manager.test.ts +78 -0
- package/src/platforms/webex/credential-manager.ts +59 -0
- package/src/platforms/whatsapp/commands/auth.ts +2 -5
- package/src/shared/chromium/browsers.ts +1 -1
- package/src/shared/utils/interactive.test.ts +55 -0
- package/src/shared/utils/interactive.ts +15 -0
- package/src/test-setup.ts +5 -0
- package/tsconfig.json +1 -1
|
@@ -3,6 +3,7 @@ import { rm } from 'node:fs/promises'
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
|
|
5
5
|
import { handleError } from '@/shared/utils/error-handler'
|
|
6
|
+
import { isInteractive } from '@/shared/utils/interactive'
|
|
6
7
|
import { formatOutput } from '@/shared/utils/output'
|
|
7
8
|
import { displayQR } from '@/shared/utils/qr'
|
|
8
9
|
import { info } from '@/shared/utils/stderr'
|
|
@@ -22,10 +23,6 @@ interface StatusOptions {
|
|
|
22
23
|
pretty?: boolean
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
function isInteractiveSession(): boolean {
|
|
26
|
-
return Boolean(process.stdin.isTTY && process.stdout.isTTY)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
26
|
async function loginWithPairingCode(options: LoginOptions & { phone: string }): Promise<void> {
|
|
30
27
|
const manager = new WhatsAppCredentialManager()
|
|
31
28
|
const accountId = createAccountId(options.phone)
|
|
@@ -95,7 +92,7 @@ async function loginWithQR(options: LoginOptions): Promise<void> {
|
|
|
95
92
|
await rm(existingPaths.auth_dir, { recursive: true, force: true })
|
|
96
93
|
const paths = await manager.ensureAccountPaths(accountId)
|
|
97
94
|
const client = await new WhatsAppClient().login({ authDir: paths.auth_dir })
|
|
98
|
-
const interactive =
|
|
95
|
+
const interactive = isInteractive()
|
|
99
96
|
|
|
100
97
|
let waitForAuth: () => Promise<void>
|
|
101
98
|
let browserOpened = false
|
|
@@ -75,7 +75,7 @@ export function discoverBrowserProfileDirs(browserBase: string): string[] {
|
|
|
75
75
|
dirs.push(join(browserBase, 'Default'))
|
|
76
76
|
if (!existsSync(browserBase)) return dirs
|
|
77
77
|
try {
|
|
78
|
-
const entries = readdirSync(browserBase, { withFileTypes: true })
|
|
78
|
+
const entries = readdirSync(browserBase, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))
|
|
79
79
|
for (const entry of entries) {
|
|
80
80
|
if (!entry.isDirectory()) continue
|
|
81
81
|
if (!/^Profile \d+$/i.test(entry.name)) continue
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
|
|
2
|
+
|
|
3
|
+
import { hasTTY, isInteractive } from './interactive'
|
|
4
|
+
|
|
5
|
+
describe('isInteractive', () => {
|
|
6
|
+
let originalStdinTTY: boolean | undefined
|
|
7
|
+
let originalStdoutTTY: boolean | undefined
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
originalStdinTTY = process.stdin.isTTY
|
|
11
|
+
originalStdoutTTY = process.stdout.isTTY
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
afterEach(() => {
|
|
15
|
+
Object.defineProperty(process.stdin, 'isTTY', { value: originalStdinTTY, writable: true, configurable: true })
|
|
16
|
+
Object.defineProperty(process.stdout, 'isTTY', { value: originalStdoutTTY, writable: true, configurable: true })
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
function setTTY(stdin: boolean | undefined, stdout: boolean | undefined): void {
|
|
20
|
+
Object.defineProperty(process.stdin, 'isTTY', { value: stdin, writable: true, configurable: true })
|
|
21
|
+
Object.defineProperty(process.stdout, 'isTTY', { value: stdout, writable: true, configurable: true })
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
it('returns true when both stdin and stdout are TTY', () => {
|
|
25
|
+
setTTY(true, true)
|
|
26
|
+
expect(isInteractive()).toBe(true)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('returns false when stdin is not a TTY (piped input)', () => {
|
|
30
|
+
setTTY(undefined, true)
|
|
31
|
+
expect(isInteractive()).toBe(false)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('returns false when stdout is not a TTY (piped output)', () => {
|
|
35
|
+
setTTY(true, undefined)
|
|
36
|
+
expect(isInteractive()).toBe(false)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('returns false when neither is a TTY', () => {
|
|
40
|
+
setTTY(undefined, undefined)
|
|
41
|
+
expect(isInteractive()).toBe(false)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('returns false when stdin/stdout isTTY is explicitly false', () => {
|
|
45
|
+
setTTY(false, false)
|
|
46
|
+
expect(isInteractive()).toBe(false)
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
describe('hasTTY', () => {
|
|
51
|
+
it('returns a boolean reflecting whether a controlling TTY can be opened', () => {
|
|
52
|
+
const result = hasTTY()
|
|
53
|
+
expect(typeof result).toBe('boolean')
|
|
54
|
+
})
|
|
55
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function isInteractive(): boolean {
|
|
2
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY)
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function hasTTY(): boolean {
|
|
6
|
+
try {
|
|
7
|
+
const { openSync, closeSync } = require('node:fs') as typeof import('node:fs')
|
|
8
|
+
const ttyDevice = process.platform === 'win32' ? 'CONIN$' : '/dev/tty'
|
|
9
|
+
const fd = openSync(ttyDevice, 'r')
|
|
10
|
+
closeSync(fd)
|
|
11
|
+
return true
|
|
12
|
+
} catch {
|
|
13
|
+
return false
|
|
14
|
+
}
|
|
15
|
+
}
|
package/tsconfig.json
CHANGED