agent-messenger 2.19.4 → 2.20.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/README.md +5 -0
- package/dist/package.json +1 -1
- package/dist/src/platforms/line/client.d.ts +10 -1
- package/dist/src/platforms/line/client.d.ts.map +1 -1
- package/dist/src/platforms/line/client.js +156 -11
- package/dist/src/platforms/line/client.js.map +1 -1
- package/dist/src/platforms/line/e2ee-storage.d.ts +16 -0
- package/dist/src/platforms/line/e2ee-storage.d.ts.map +1 -0
- package/dist/src/platforms/line/e2ee-storage.js +93 -0
- package/dist/src/platforms/line/e2ee-storage.js.map +1 -0
- package/dist/src/platforms/line/index.d.ts +1 -1
- package/dist/src/platforms/line/index.d.ts.map +1 -1
- package/dist/src/platforms/line/index.js.map +1 -1
- package/dist/src/platforms/line/listener.d.ts.map +1 -1
- package/dist/src/platforms/line/listener.js +3 -2
- package/dist/src/platforms/line/listener.js.map +1 -1
- package/dist/src/platforms/line/types.d.ts +13 -0
- package/dist/src/platforms/line/types.d.ts.map +1 -1
- package/dist/src/platforms/line/types.js +6 -0
- package/dist/src/platforms/line/types.js.map +1 -1
- package/dist/src/platforms/teams/cli.d.ts.map +1 -1
- package/dist/src/platforms/teams/cli.js +2 -1
- package/dist/src/platforms/teams/cli.js.map +1 -1
- package/dist/src/platforms/teams/client.d.ts +4 -1
- package/dist/src/platforms/teams/client.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.js +84 -0
- package/dist/src/platforms/teams/client.js.map +1 -1
- package/dist/src/platforms/teams/commands/chat.d.ts +13 -0
- package/dist/src/platforms/teams/commands/chat.d.ts.map +1 -0
- package/dist/src/platforms/teams/commands/chat.js +111 -0
- package/dist/src/platforms/teams/commands/chat.js.map +1 -0
- package/dist/src/platforms/teams/commands/index.d.ts +1 -0
- package/dist/src/platforms/teams/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/index.js +1 -0
- package/dist/src/platforms/teams/commands/index.js.map +1 -1
- package/dist/src/platforms/teams/types.d.ts +24 -0
- package/dist/src/platforms/teams/types.d.ts.map +1 -1
- package/dist/src/platforms/teams/types.js +8 -0
- package/dist/src/platforms/teams/types.js.map +1 -1
- package/dist/src/tui/adapters/line-adapter.js +1 -1
- package/dist/src/tui/adapters/line-adapter.js.map +1 -1
- package/dist/src/vendor/linejs/_dist/client/login.d.ts +2 -1
- package/dist/src/vendor/linejs/client/login.js +3 -2
- package/dist/src/vendor/linejs/client/login.test.ts +11 -0
- package/docs/content/docs/cli/line.mdx +13 -11
- 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 +1 -1
- package/skills/agent-instagram/SKILL.md +1 -1
- package/skills/agent-kakaotalk/SKILL.md +1 -1
- package/skills/agent-line/SKILL.md +7 -5
- package/skills/agent-line/references/common-patterns.md +12 -3
- package/skills/agent-slack/SKILL.md +1 -1
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +20 -2
- package/skills/agent-teams/references/common-patterns.md +28 -0
- 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/line/client.test.ts +190 -2
- package/src/platforms/line/client.ts +183 -13
- package/src/platforms/line/e2ee-storage.test.ts +154 -0
- package/src/platforms/line/e2ee-storage.ts +119 -0
- package/src/platforms/line/index.test.ts +10 -0
- package/src/platforms/line/index.ts +1 -0
- package/src/platforms/line/listener.test.ts +32 -0
- package/src/platforms/line/listener.ts +5 -4
- package/src/platforms/line/types.test.ts +17 -0
- package/src/platforms/line/types.ts +13 -0
- package/src/platforms/slack/commands/auth.test.ts +16 -6
- package/src/platforms/slack/token-extractor.test.ts +34 -7
- package/src/platforms/teams/cli.ts +2 -0
- package/src/platforms/teams/client.test.ts +96 -0
- package/src/platforms/teams/client.ts +133 -0
- package/src/platforms/teams/commands/chat.test.ts +100 -0
- package/src/platforms/teams/commands/chat.ts +131 -0
- package/src/platforms/teams/commands/index.ts +1 -0
- package/src/platforms/teams/types.ts +20 -0
- package/src/tui/adapters/line-adapter.ts +1 -1
- package/src/vendor/linejs/_dist/client/login.d.ts +2 -1
- package/src/vendor/linejs/client/login.js +3 -2
- package/src/vendor/linejs/client/login.test.ts +11 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Command } from 'commander'
|
|
2
|
+
|
|
3
|
+
import { handleError } from '@/shared/utils/error-handler'
|
|
4
|
+
import { formatOutput } from '@/shared/utils/output'
|
|
5
|
+
|
|
6
|
+
import { TeamsClient } from '../client'
|
|
7
|
+
import { TeamsCredentialManager } from '../credential-manager'
|
|
8
|
+
|
|
9
|
+
export async function listAction(options: { pretty?: boolean }): Promise<void> {
|
|
10
|
+
try {
|
|
11
|
+
const credManager = new TeamsCredentialManager()
|
|
12
|
+
const cred = await credManager.getTokenWithExpiry()
|
|
13
|
+
|
|
14
|
+
if (!cred) {
|
|
15
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
16
|
+
process.exit(1)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const client = await new TeamsClient().login({
|
|
20
|
+
token: cred.token,
|
|
21
|
+
tokenExpiresAt: cred.tokenExpiresAt,
|
|
22
|
+
accountType: cred.accountType,
|
|
23
|
+
region: cred.region,
|
|
24
|
+
})
|
|
25
|
+
const chats = await client.listChats()
|
|
26
|
+
|
|
27
|
+
const output = chats.map((chat) => ({
|
|
28
|
+
id: chat.id,
|
|
29
|
+
type: chat.type,
|
|
30
|
+
topic: chat.topic,
|
|
31
|
+
last_message: chat.last_message,
|
|
32
|
+
last_message_at: chat.last_message_at,
|
|
33
|
+
}))
|
|
34
|
+
|
|
35
|
+
console.log(formatOutput(output, options.pretty))
|
|
36
|
+
} catch (error) {
|
|
37
|
+
handleError(error as Error)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function historyAction(chatId: string, options: { limit?: number; pretty?: boolean }): Promise<void> {
|
|
42
|
+
try {
|
|
43
|
+
const credManager = new TeamsCredentialManager()
|
|
44
|
+
const cred = await credManager.getTokenWithExpiry()
|
|
45
|
+
|
|
46
|
+
if (!cred) {
|
|
47
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
48
|
+
process.exit(1)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const client = await new TeamsClient().login({
|
|
52
|
+
token: cred.token,
|
|
53
|
+
tokenExpiresAt: cred.tokenExpiresAt,
|
|
54
|
+
accountType: cred.accountType,
|
|
55
|
+
region: cred.region,
|
|
56
|
+
})
|
|
57
|
+
const limit = options.limit && options.limit > 0 ? options.limit : 50
|
|
58
|
+
const messages = await client.getChatMessages(chatId, limit)
|
|
59
|
+
|
|
60
|
+
const output = messages.map((msg) => ({
|
|
61
|
+
id: msg.id,
|
|
62
|
+
author: msg.author.displayName,
|
|
63
|
+
content: msg.content,
|
|
64
|
+
timestamp: msg.timestamp,
|
|
65
|
+
}))
|
|
66
|
+
|
|
67
|
+
console.log(formatOutput(output, options.pretty))
|
|
68
|
+
} catch (error) {
|
|
69
|
+
handleError(error as Error)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function sendAction(chatId: string, content: string, options: { pretty?: boolean }): Promise<void> {
|
|
74
|
+
try {
|
|
75
|
+
const credManager = new TeamsCredentialManager()
|
|
76
|
+
const cred = await credManager.getTokenWithExpiry()
|
|
77
|
+
|
|
78
|
+
if (!cred) {
|
|
79
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth extract" first.' }, options.pretty))
|
|
80
|
+
process.exit(1)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const client = await new TeamsClient().login({
|
|
84
|
+
token: cred.token,
|
|
85
|
+
tokenExpiresAt: cred.tokenExpiresAt,
|
|
86
|
+
accountType: cred.accountType,
|
|
87
|
+
region: cred.region,
|
|
88
|
+
})
|
|
89
|
+
const message = await client.sendChatMessage(chatId, content)
|
|
90
|
+
|
|
91
|
+
const output = {
|
|
92
|
+
id: message.id,
|
|
93
|
+
content: message.content,
|
|
94
|
+
timestamp: message.timestamp,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
console.log(formatOutput(output, options.pretty))
|
|
98
|
+
} catch (error) {
|
|
99
|
+
handleError(error as Error)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const chatCommand = new Command('chat')
|
|
104
|
+
.description('Chat commands (1:1, group, and self chats)')
|
|
105
|
+
.addCommand(
|
|
106
|
+
new Command('list')
|
|
107
|
+
.description('List 1:1, group, and self chats')
|
|
108
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
109
|
+
.action(listAction),
|
|
110
|
+
)
|
|
111
|
+
.addCommand(
|
|
112
|
+
new Command('history')
|
|
113
|
+
.description('Get chat message history')
|
|
114
|
+
.argument('<chat-id>', 'Chat ID')
|
|
115
|
+
.option('--limit <n>', 'Number of messages to fetch', '50')
|
|
116
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
117
|
+
.action((chatId, options) => {
|
|
118
|
+
return historyAction(chatId, {
|
|
119
|
+
limit: parseInt(options.limit, 10),
|
|
120
|
+
pretty: options.pretty,
|
|
121
|
+
})
|
|
122
|
+
}),
|
|
123
|
+
)
|
|
124
|
+
.addCommand(
|
|
125
|
+
new Command('send')
|
|
126
|
+
.description('Send a message to a chat')
|
|
127
|
+
.argument('<chat-id>', 'Chat ID')
|
|
128
|
+
.argument('<content>', 'Message content')
|
|
129
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
130
|
+
.action(sendAction),
|
|
131
|
+
)
|
|
@@ -35,6 +35,16 @@ export interface TeamsUser {
|
|
|
35
35
|
userPrincipalName?: string
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
export type TeamsChatType = 'oneOnOne' | 'group' | 'self'
|
|
39
|
+
|
|
40
|
+
export interface TeamsChat {
|
|
41
|
+
id: string
|
|
42
|
+
type: TeamsChatType
|
|
43
|
+
topic?: string
|
|
44
|
+
last_message?: string
|
|
45
|
+
last_message_at?: string
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
export interface TeamsReaction {
|
|
39
49
|
emoji: string
|
|
40
50
|
count: number
|
|
@@ -124,6 +134,16 @@ export const TeamsUserSchema = z.object({
|
|
|
124
134
|
userPrincipalName: z.string().optional(),
|
|
125
135
|
})
|
|
126
136
|
|
|
137
|
+
export const TeamsChatTypeSchema = z.enum(['oneOnOne', 'group', 'self'])
|
|
138
|
+
|
|
139
|
+
export const TeamsChatSchema = z.object({
|
|
140
|
+
id: z.string(),
|
|
141
|
+
type: TeamsChatTypeSchema,
|
|
142
|
+
topic: z.string().optional(),
|
|
143
|
+
last_message: z.string().optional(),
|
|
144
|
+
last_message_at: z.string().optional(),
|
|
145
|
+
})
|
|
146
|
+
|
|
127
147
|
export const TeamsReactionSchema = z.object({
|
|
128
148
|
emoji: z.string(),
|
|
129
149
|
count: z.number(),
|
|
@@ -37,7 +37,7 @@ export class LineAdapter implements PlatformAdapter {
|
|
|
37
37
|
return messages.map((msg) => ({
|
|
38
38
|
id: msg.message_id,
|
|
39
39
|
channelId,
|
|
40
|
-
author: msg.author_id ?? 'unknown',
|
|
40
|
+
author: msg.author_name ?? msg.author_id ?? 'unknown',
|
|
41
41
|
content: msg.text ?? '',
|
|
42
42
|
timestamp: msg.sent_at,
|
|
43
43
|
}))
|
|
@@ -34,8 +34,9 @@ export interface WithPasswordOptions {
|
|
|
34
34
|
email: string;
|
|
35
35
|
password: string;
|
|
36
36
|
/** @default 114514 */ pincode?: string;
|
|
37
|
+
/** @default true */ e2ee?: boolean;
|
|
37
38
|
onPincodeRequest(pin: string): void | Promise<void>;
|
|
38
39
|
}
|
|
39
40
|
export declare const loginWithPassword: (opts: WithPasswordOptions, init: InitOptions) => Promise<Client>;
|
|
40
41
|
export declare const loginWithAuthToken: (authToken: string, init: InitOptions) => Promise<Client>;
|
|
41
|
-
//# sourceMappingURL=login.d.ts.map
|
|
42
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -22,7 +22,8 @@ export const loginWithPassword = async (opts, init)=>{
|
|
|
22
22
|
await base.loginProcess.withPassword({
|
|
23
23
|
email: opts.email,
|
|
24
24
|
password: opts.password,
|
|
25
|
-
pincode: opts.pincode
|
|
25
|
+
pincode: opts.pincode,
|
|
26
|
+
e2ee: opts.e2ee
|
|
26
27
|
});
|
|
27
28
|
await base.loginProcess.ready();
|
|
28
29
|
return new Client(base);
|
|
@@ -33,4 +34,4 @@ export const loginWithAuthToken = async (authToken, init)=>{
|
|
|
33
34
|
await base.loginProcess.ready();
|
|
34
35
|
return new Client(base);
|
|
35
36
|
};
|
|
36
|
-
//# sourceMappingURL=login.js.map
|
|
37
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises'
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'bun:test'
|
|
4
|
+
|
|
5
|
+
describe('linejs login wrappers', () => {
|
|
6
|
+
it('passes E2EE option through password login', async () => {
|
|
7
|
+
const source = await readFile(new URL('./login.js', import.meta.url), 'utf8')
|
|
8
|
+
|
|
9
|
+
expect(source).toContain('e2ee: opts.e2ee')
|
|
10
|
+
})
|
|
11
|
+
})
|