agent-messenger 2.12.2 → 2.13.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/dist/package.json +1 -1
- package/dist/src/platforms/kakaotalk/chat-classifier.d.ts +18 -0
- package/dist/src/platforms/kakaotalk/chat-classifier.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/chat-classifier.js +29 -0
- package/dist/src/platforms/kakaotalk/chat-classifier.js.map +1 -0
- package/dist/src/platforms/kakaotalk/cli.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/cli.js +2 -1
- package/dist/src/platforms/kakaotalk/cli.js.map +1 -1
- package/dist/src/platforms/kakaotalk/client.d.ts +13 -1
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +225 -8
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/chat.js +2 -1
- package/dist/src/platforms/kakaotalk/commands/chat.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/index.d.ts +1 -0
- package/dist/src/platforms/kakaotalk/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/index.js +1 -0
- package/dist/src/platforms/kakaotalk/commands/index.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/member.d.ts +3 -0
- package/dist/src/platforms/kakaotalk/commands/member.d.ts.map +1 -0
- package/dist/src/platforms/kakaotalk/commands/member.js +22 -0
- package/dist/src/platforms/kakaotalk/commands/member.js.map +1 -0
- package/dist/src/platforms/kakaotalk/index.d.ts +4 -2
- package/dist/src/platforms/kakaotalk/index.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/index.js +2 -1
- package/dist/src/platforms/kakaotalk/index.js.map +1 -1
- package/dist/src/platforms/kakaotalk/listener.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/listener.js +5 -2
- package/dist/src/platforms/kakaotalk/listener.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts +28 -0
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.js +44 -0
- package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -1
- package/dist/src/platforms/kakaotalk/types.d.ts +37 -0
- package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/types.js +17 -0
- package/dist/src/platforms/kakaotalk/types.js.map +1 -1
- package/dist/src/platforms/slackbot/client.d.ts +5 -0
- package/dist/src/platforms/slackbot/client.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/client.js +5 -0
- package/dist/src/platforms/slackbot/client.js.map +1 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.js +3 -3
- package/dist/src/tui/adapters/kakaotalk-adapter.js.map +1 -1
- package/docs/content/docs/cli/kakaotalk.mdx +26 -1
- package/docs/content/docs/sdk/kakaotalk.mdx +45 -13
- package/docs/content/docs/sdk/slackbot.mdx +11 -0
- package/package.json +1 -1
- package/scripts/kakao-loco-capture.ts +466 -0
- 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 +1 -1
- package/skills/agent-instagram/SKILL.md +1 -1
- package/skills/agent-kakaotalk/SKILL.md +30 -3
- package/skills/agent-kakaotalk/references/common-patterns.md +49 -1
- package/skills/agent-line/SKILL.md +1 -1
- package/skills/agent-slack/SKILL.md +1 -1
- package/skills/agent-slackbot/SKILL.md +1 -2
- 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 +1 -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/kakaotalk/chat-classifier.test.ts +33 -0
- package/src/platforms/kakaotalk/chat-classifier.ts +31 -0
- package/src/platforms/kakaotalk/cli.ts +2 -1
- package/src/platforms/kakaotalk/client.test.ts +782 -1
- package/src/platforms/kakaotalk/client.ts +262 -10
- package/src/platforms/kakaotalk/commands/chat.ts +3 -1
- package/src/platforms/kakaotalk/commands/index.ts +1 -0
- package/src/platforms/kakaotalk/commands/member.test.ts +102 -0
- package/src/platforms/kakaotalk/commands/member.ts +32 -0
- package/src/platforms/kakaotalk/index.test.ts +5 -0
- package/src/platforms/kakaotalk/index.ts +4 -0
- package/src/platforms/kakaotalk/listener.test.ts +29 -0
- package/src/platforms/kakaotalk/listener.ts +5 -2
- package/src/platforms/kakaotalk/protocol/session.ts +44 -0
- package/src/platforms/kakaotalk/types.ts +39 -0
- package/src/platforms/slackbot/client.test.ts +67 -0
- package/src/platforms/slackbot/client.ts +17 -1
- package/src/tui/adapters/kakaotalk-adapter.ts +3 -3
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
|
|
3
|
+
import { classifyKakaoChat } from './chat-classifier'
|
|
4
|
+
|
|
5
|
+
describe('classifyKakaoChat', () => {
|
|
6
|
+
it('classifies a normal DM (type 11, 2 members) as dm', () => {
|
|
7
|
+
expect(classifyKakaoChat({ type: 11, active_members: 2 })).toBe('dm')
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
it('classifies a normal group (type 10, 5 members) as group', () => {
|
|
11
|
+
expect(classifyKakaoChat({ type: 10, active_members: 5 })).toBe('group')
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('classifies legacy DM (type 9, 2 members) as dm via member-count fallback', () => {
|
|
15
|
+
expect(classifyKakaoChat({ type: 9, active_members: 2 })).toBe('dm')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('classifies a 3-member group (type 10) as group, not dm', () => {
|
|
19
|
+
expect(classifyKakaoChat({ type: 10, active_members: 3 })).toBe('group')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
for (const type of [2, 13, 14, 15, 16]) {
|
|
23
|
+
it(`classifies open-chat type ${type} as open regardless of member count`, () => {
|
|
24
|
+
expect(classifyKakaoChat({ type, active_members: 1 })).toBe('open')
|
|
25
|
+
expect(classifyKakaoChat({ type, active_members: 2 })).toBe('open')
|
|
26
|
+
expect(classifyKakaoChat({ type, active_members: 50 })).toBe('open')
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
it('classifies a 1-member chat (lone room) as dm', () => {
|
|
31
|
+
expect(classifyKakaoChat({ type: 11, active_members: 1 })).toBe('dm')
|
|
32
|
+
})
|
|
33
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { KakaoChat } from './types'
|
|
2
|
+
|
|
3
|
+
export type KakaoChatKind = 'dm' | 'group' | 'open' | 'unknown'
|
|
4
|
+
|
|
5
|
+
// OpenChat-family `type` codes observed on the wire. KakaoTalk's LOCO
|
|
6
|
+
// protocol exposes a numeric `type` field with no documented mapping; these
|
|
7
|
+
// five codes consistently identify OpenChat rooms across normal OpenChat,
|
|
8
|
+
// OpenChat DMs, and the various OpenChat sub-types seen in production.
|
|
9
|
+
const OPEN_CHAT_TYPE_CODES: ReadonlySet<number> = new Set([2, 13, 14, 15, 16])
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Classify a KakaoTalk chat as `'dm'`, `'group'`, `'open'`, or `'unknown'`.
|
|
13
|
+
*
|
|
14
|
+
* REGRESSION GUARD: An earlier implementation hard-coded `0=dm`, `1=group`,
|
|
15
|
+
* `2=open` on the raw `type` number. Modern KakaoTalk uses codes like `11`
|
|
16
|
+
* for normal DMs and `10` for normal groups, so the old mapping silently
|
|
17
|
+
* classified every real DM as `'unknown'` and bucketed it as a group. Do
|
|
18
|
+
* NOT "simplify" this back to a pure type-code mapping without verifying
|
|
19
|
+
* against a real KakaoTalk session.
|
|
20
|
+
*
|
|
21
|
+
* `'unknown'` is reserved for future protocol drift; the current heuristic
|
|
22
|
+
* never returns it, but it is part of the union so consumers can handle
|
|
23
|
+
* the case defensively.
|
|
24
|
+
*/
|
|
25
|
+
export function classifyKakaoChat(chat: Pick<KakaoChat, 'type' | 'active_members'>): KakaoChatKind {
|
|
26
|
+
if (OPEN_CHAT_TYPE_CODES.has(chat.type)) return 'open'
|
|
27
|
+
// active_members counts the logged-in user, so a 1:1 DM is exactly 2
|
|
28
|
+
// (self + one other) and a "lone" room with only self is 1.
|
|
29
|
+
if (chat.active_members <= 2) return 'dm'
|
|
30
|
+
return 'group'
|
|
31
|
+
}
|
|
@@ -4,7 +4,7 @@ import type { Command as CommandType } from 'commander'
|
|
|
4
4
|
import { Command } from 'commander'
|
|
5
5
|
|
|
6
6
|
import pkg from '../../../package.json' with { type: 'json' }
|
|
7
|
-
import { authCommand, chatCommand, messageCommand, whoamiCommand } from './commands/index'
|
|
7
|
+
import { authCommand, chatCommand, memberCommand, messageCommand, whoamiCommand } from './commands/index'
|
|
8
8
|
import { ensureKakaoAuth } from './ensure-auth'
|
|
9
9
|
|
|
10
10
|
function isAuthCommand(command: CommandType): boolean {
|
|
@@ -30,6 +30,7 @@ program.hook('preAction', async (_thisCommand, actionCommand) => {
|
|
|
30
30
|
|
|
31
31
|
program.addCommand(authCommand)
|
|
32
32
|
program.addCommand(chatCommand)
|
|
33
|
+
program.addCommand(memberCommand)
|
|
33
34
|
program.addCommand(messageCommand)
|
|
34
35
|
program.addCommand(whoamiCommand)
|
|
35
36
|
|