agent-messenger 2.20.5 → 2.22.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 +8 -5
- package/dist/package.json +9 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +3 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/platforms/webex/client.d.ts +19 -0
- package/dist/src/platforms/webex/client.d.ts.map +1 -1
- package/dist/src/platforms/webex/client.js +81 -1
- package/dist/src/platforms/webex/client.js.map +1 -1
- package/dist/src/platforms/webexbot/cli.d.ts +5 -0
- package/dist/src/platforms/webexbot/cli.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/cli.js +33 -0
- package/dist/src/platforms/webexbot/cli.js.map +1 -0
- package/dist/src/platforms/webexbot/client.d.ts +61 -0
- package/dist/src/platforms/webexbot/client.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/client.js +80 -0
- package/dist/src/platforms/webexbot/client.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/auth.d.ts +28 -0
- package/dist/src/platforms/webexbot/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/auth.js +166 -0
- package/dist/src/platforms/webexbot/commands/auth.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/file.d.ts +22 -0
- package/dist/src/platforms/webexbot/commands/file.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/file.js +64 -0
- package/dist/src/platforms/webexbot/commands/file.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/index.d.ts +10 -0
- package/dist/src/platforms/webexbot/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/index.js +10 -0
- package/dist/src/platforms/webexbot/commands/index.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/listen.d.ts +12 -0
- package/dist/src/platforms/webexbot/commands/listen.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/listen.js +85 -0
- package/dist/src/platforms/webexbot/commands/listen.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/member.d.ts +19 -0
- package/dist/src/platforms/webexbot/commands/member.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/member.js +33 -0
- package/dist/src/platforms/webexbot/commands/member.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/message.d.ts +44 -0
- package/dist/src/platforms/webexbot/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/message.js +193 -0
- package/dist/src/platforms/webexbot/commands/message.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/shared.d.ts +9 -0
- package/dist/src/platforms/webexbot/commands/shared.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/shared.js +13 -0
- package/dist/src/platforms/webexbot/commands/shared.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/snapshot.d.ts +24 -0
- package/dist/src/platforms/webexbot/commands/snapshot.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/snapshot.js +37 -0
- package/dist/src/platforms/webexbot/commands/snapshot.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/space.d.ts +28 -0
- package/dist/src/platforms/webexbot/commands/space.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/space.js +61 -0
- package/dist/src/platforms/webexbot/commands/space.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/user.d.ts +30 -0
- package/dist/src/platforms/webexbot/commands/user.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/user.js +66 -0
- package/dist/src/platforms/webexbot/commands/user.js.map +1 -0
- package/dist/src/platforms/webexbot/commands/whoami.d.ts +16 -0
- package/dist/src/platforms/webexbot/commands/whoami.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/commands/whoami.js +29 -0
- package/dist/src/platforms/webexbot/commands/whoami.js.map +1 -0
- package/dist/src/platforms/webexbot/credential-manager.d.ts +17 -0
- package/dist/src/platforms/webexbot/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/credential-manager.js +120 -0
- package/dist/src/platforms/webexbot/credential-manager.js.map +1 -0
- package/dist/src/platforms/webexbot/index.d.ts +9 -0
- package/dist/src/platforms/webexbot/index.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/index.js +6 -0
- package/dist/src/platforms/webexbot/index.js.map +1 -0
- package/dist/src/platforms/webexbot/listener.d.ts +44 -0
- package/dist/src/platforms/webexbot/listener.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/listener.js +214 -0
- package/dist/src/platforms/webexbot/listener.js.map +1 -0
- package/dist/src/platforms/webexbot/types.d.ts +60 -0
- package/dist/src/platforms/webexbot/types.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/types.js +28 -0
- package/dist/src/platforms/webexbot/types.js.map +1 -0
- package/dist/src/platforms/webexbot/wdm-discovery.d.ts +4 -0
- package/dist/src/platforms/webexbot/wdm-discovery.d.ts.map +1 -0
- package/dist/src/platforms/webexbot/wdm-discovery.js +36 -0
- package/dist/src/platforms/webexbot/wdm-discovery.js.map +1 -0
- package/docs/content/docs/cli/meta.json +1 -0
- package/docs/content/docs/cli/webexbot.mdx +292 -0
- package/docs/content/docs/sdk/meta.json +1 -0
- package/docs/content/docs/sdk/webexbot.mdx +342 -0
- package/docs/src/app/page.tsx +115 -19
- package/package.json +9 -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 +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 +1 -1
- package/skills/agent-webexbot/SKILL.md +414 -0
- package/skills/agent-webexbot/references/authentication.md +225 -0
- package/skills/agent-webexbot/references/common-patterns.md +708 -0
- 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/cli.ts +4 -0
- package/src/platforms/webex/client.test.ts +10 -0
- package/src/platforms/webex/client.ts +97 -3
- package/src/platforms/webex/typings/webex-message-handler.d.ts +360 -29
- package/src/platforms/webexbot/cli.ts +48 -0
- package/src/platforms/webexbot/client.test.ts +198 -0
- package/src/platforms/webexbot/client.ts +113 -0
- package/src/platforms/webexbot/commands/auth.test.ts +185 -0
- package/src/platforms/webexbot/commands/auth.ts +210 -0
- package/src/platforms/webexbot/commands/file.ts +104 -0
- package/src/platforms/webexbot/commands/index.ts +9 -0
- package/src/platforms/webexbot/commands/listen.test.ts +20 -0
- package/src/platforms/webexbot/commands/listen.ts +104 -0
- package/src/platforms/webexbot/commands/member.ts +51 -0
- package/src/platforms/webexbot/commands/message.ts +263 -0
- package/src/platforms/webexbot/commands/shared.ts +22 -0
- package/src/platforms/webexbot/commands/snapshot.ts +60 -0
- package/src/platforms/webexbot/commands/space.ts +88 -0
- package/src/platforms/webexbot/commands/user.test.ts +77 -0
- package/src/platforms/webexbot/commands/user.ts +98 -0
- package/src/platforms/webexbot/commands/whoami.ts +43 -0
- package/src/platforms/webexbot/credential-manager.test.ts +182 -0
- package/src/platforms/webexbot/credential-manager.ts +149 -0
- package/src/platforms/webexbot/index.ts +8 -0
- package/src/platforms/webexbot/listener.test.ts +234 -0
- package/src/platforms/webexbot/listener.ts +255 -0
- package/src/platforms/webexbot/types.test.ts +87 -0
- package/src/platforms/webexbot/types.ts +72 -0
- package/src/platforms/webexbot/wdm-discovery.test.ts +97 -0
- package/src/platforms/webexbot/wdm-discovery.ts +43 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/platforms/webexbot/client.ts"],"names":[],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
3
|
+
interface ActionOptions {
|
|
4
|
+
pretty?: boolean;
|
|
5
|
+
bot?: string;
|
|
6
|
+
_credManager?: WebexBotCredentialManager;
|
|
7
|
+
}
|
|
8
|
+
interface ActionResult {
|
|
9
|
+
success?: boolean;
|
|
10
|
+
error?: string;
|
|
11
|
+
bot_id?: string;
|
|
12
|
+
bot_name?: string;
|
|
13
|
+
valid?: boolean;
|
|
14
|
+
bots?: Array<{
|
|
15
|
+
bot_id: string;
|
|
16
|
+
bot_name: string;
|
|
17
|
+
is_current: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare function setAction(token: string, options: ActionOptions): Promise<ActionResult>;
|
|
21
|
+
export declare function clearAction(options: ActionOptions): Promise<ActionResult>;
|
|
22
|
+
export declare function statusAction(options: ActionOptions): Promise<ActionResult>;
|
|
23
|
+
export declare function listAction(options: ActionOptions): Promise<ActionResult>;
|
|
24
|
+
export declare function useAction(botId: string, options: ActionOptions): Promise<ActionResult>;
|
|
25
|
+
export declare function removeAction(botId: string, options: ActionOptions): Promise<ActionResult>;
|
|
26
|
+
export declare const authCommand: Command;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,yBAAyB,CAAA;CACzC;AAED,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,KAAK,CAAC;QACX,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;QAChB,UAAU,EAAE,OAAO,CAAA;KACpB,CAAC,CAAA;CACH;AAED,wBAAsB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CA2B5F;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAQ/E;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAiChF;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAe9E;AAED,wBAAsB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAkB5F;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAa/F;AAED,eAAO,MAAM,WAAW,SAwDrB,CAAA"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cliOutput } from '../../../shared/utils/cli-output.js';
|
|
3
|
+
import { formatOutput } from '../../../shared/utils/output.js';
|
|
4
|
+
import { WebexBotClient } from '../client.js';
|
|
5
|
+
import { WebexBotCredentialManager } from '../credential-manager.js';
|
|
6
|
+
export async function setAction(token, options) {
|
|
7
|
+
try {
|
|
8
|
+
const client = await new WebexBotClient().login({ token });
|
|
9
|
+
const authInfo = await client.testAuth();
|
|
10
|
+
if (authInfo.type !== 'bot') {
|
|
11
|
+
return { error: 'Token is not a bot token. Use agent-webex for user tokens.' };
|
|
12
|
+
}
|
|
13
|
+
const botId = options.bot || authInfo.id || 'default';
|
|
14
|
+
const botName = authInfo.displayName || botId;
|
|
15
|
+
const credManager = options._credManager ?? new WebexBotCredentialManager();
|
|
16
|
+
await credManager.setCredentials({
|
|
17
|
+
token,
|
|
18
|
+
bot_id: botId,
|
|
19
|
+
bot_name: botName,
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
success: true,
|
|
23
|
+
bot_id: botId,
|
|
24
|
+
bot_name: botName,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return { error: error.message };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export async function clearAction(options) {
|
|
32
|
+
try {
|
|
33
|
+
const credManager = options._credManager ?? new WebexBotCredentialManager();
|
|
34
|
+
await credManager.clearCredentials();
|
|
35
|
+
return { success: true };
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
return { error: error.message };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export async function statusAction(options) {
|
|
42
|
+
try {
|
|
43
|
+
const credManager = options._credManager ?? new WebexBotCredentialManager();
|
|
44
|
+
const creds = await credManager.getCredentials(options.bot);
|
|
45
|
+
if (!creds) {
|
|
46
|
+
return {
|
|
47
|
+
valid: false,
|
|
48
|
+
error: options.bot
|
|
49
|
+
? `Bot "${options.bot}" not found. Run "auth list" to see available bots.`
|
|
50
|
+
: 'No credentials configured. Run "auth set <token>" first.',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
let valid = false;
|
|
54
|
+
let authInfo = null;
|
|
55
|
+
try {
|
|
56
|
+
const client = await new WebexBotClient().login({ token: creds.token });
|
|
57
|
+
authInfo = await client.testAuth();
|
|
58
|
+
valid = authInfo.type === 'bot';
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
valid = false;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
valid,
|
|
65
|
+
bot_id: authInfo?.id ?? creds.bot_id,
|
|
66
|
+
bot_name: authInfo?.displayName ?? creds.bot_name,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return { error: error.message };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export async function listAction(options) {
|
|
74
|
+
try {
|
|
75
|
+
const credManager = options._credManager ?? new WebexBotCredentialManager();
|
|
76
|
+
const all = await credManager.listAll();
|
|
77
|
+
return {
|
|
78
|
+
bots: all.map((b) => ({
|
|
79
|
+
bot_id: b.bot_id,
|
|
80
|
+
bot_name: b.bot_name,
|
|
81
|
+
is_current: b.is_current,
|
|
82
|
+
})),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
return { error: error.message };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export async function useAction(botId, options) {
|
|
90
|
+
try {
|
|
91
|
+
const credManager = options._credManager ?? new WebexBotCredentialManager();
|
|
92
|
+
const found = await credManager.setCurrent(botId);
|
|
93
|
+
if (!found) {
|
|
94
|
+
return { error: `Bot "${botId}" not found. Run "auth list" to see available bots.` };
|
|
95
|
+
}
|
|
96
|
+
const creds = await credManager.getCredentials();
|
|
97
|
+
return {
|
|
98
|
+
success: true,
|
|
99
|
+
bot_id: creds?.bot_id,
|
|
100
|
+
bot_name: creds?.bot_name,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
return { error: error.message };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export async function removeAction(botId, options) {
|
|
108
|
+
try {
|
|
109
|
+
const credManager = options._credManager ?? new WebexBotCredentialManager();
|
|
110
|
+
const removed = await credManager.removeBot(botId);
|
|
111
|
+
if (!removed) {
|
|
112
|
+
return { error: `Bot "${botId}" not found. Run "auth list" to see available bots.` };
|
|
113
|
+
}
|
|
114
|
+
return { success: true };
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
return { error: error.message };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export const authCommand = new Command('auth')
|
|
121
|
+
.description('Bot authentication commands')
|
|
122
|
+
.addCommand(new Command('set')
|
|
123
|
+
.description('Set bot token')
|
|
124
|
+
.argument('<token>', 'Bot token')
|
|
125
|
+
.option('--bot <id>', 'Bot identifier for switching later')
|
|
126
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
127
|
+
.action(async (token, opts) => {
|
|
128
|
+
cliOutput(await setAction(token, opts), opts.pretty);
|
|
129
|
+
}))
|
|
130
|
+
.addCommand(new Command('clear')
|
|
131
|
+
.description('Clear all stored credentials')
|
|
132
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
133
|
+
.action(async (opts) => {
|
|
134
|
+
cliOutput(await clearAction(opts), opts.pretty);
|
|
135
|
+
}))
|
|
136
|
+
.addCommand(new Command('status')
|
|
137
|
+
.description('Show authentication status')
|
|
138
|
+
.option('--bot <id>', 'Check specific bot (default: current)')
|
|
139
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
140
|
+
.action(async (opts) => {
|
|
141
|
+
const result = await statusAction(opts);
|
|
142
|
+
console.log(formatOutput(result, opts.pretty));
|
|
143
|
+
if (!result.valid)
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}))
|
|
146
|
+
.addCommand(new Command('list')
|
|
147
|
+
.description('List all stored bots')
|
|
148
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
149
|
+
.action(async (opts) => {
|
|
150
|
+
cliOutput(await listAction(opts), opts.pretty);
|
|
151
|
+
}))
|
|
152
|
+
.addCommand(new Command('use')
|
|
153
|
+
.description('Switch active bot')
|
|
154
|
+
.argument('<bot>', 'Bot ID')
|
|
155
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
156
|
+
.action(async (botId, opts) => {
|
|
157
|
+
cliOutput(await useAction(botId, opts), opts.pretty);
|
|
158
|
+
}))
|
|
159
|
+
.addCommand(new Command('remove')
|
|
160
|
+
.description('Remove a stored bot')
|
|
161
|
+
.argument('<bot>', 'Bot ID')
|
|
162
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
163
|
+
.action(async (botId, opts) => {
|
|
164
|
+
cliOutput(await removeAction(botId, opts), opts.pretty);
|
|
165
|
+
}));
|
|
166
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAqBjE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAa,EAAE,OAAsB;IACnE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QAC1D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAA;QAExC,IAAI,QAAQ,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YAC5B,OAAO,EAAE,KAAK,EAAE,4DAA4D,EAAE,CAAA;QAChF,CAAC;QAED,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,EAAE,IAAI,SAAS,CAAA;QACrD,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,IAAI,KAAK,CAAA;QAE7C,MAAM,WAAW,GAAG,OAAO,CAAC,YAAY,IAAI,IAAI,yBAAyB,EAAE,CAAA;QAC3E,MAAM,WAAW,CAAC,cAAc,CAAC;YAC/B,KAAK;YACL,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,OAA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,CAAA;AAChD,CAAC,CAAC,CACL;KACA,UAAU,CACT,IAAI,OAAO,CAAC,KAAK,CAAC;KACf,WAAW,CAAC,mBAAmB,CAAC;KAChC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC3B,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,IAA0B,EAAE,EAAE;IAC1D,SAAS,CAAC,MAAM,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AACtD,CAAC,CAAC,CACL;KACA,UAAU,CACT,IAAI,OAAO,CAAC,QAAQ,CAAC;KAClB,WAAW,CAAC,qBAAqB,CAAC;KAClC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC3B,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,IAA0B,EAAE,EAAE;IAC1D,SAAS,CAAC,MAAM,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AACzD,CAAC,CAAC,CACL,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import type { BotOption } from './shared.js';
|
|
3
|
+
interface FileResult {
|
|
4
|
+
id?: string;
|
|
5
|
+
roomId?: string;
|
|
6
|
+
files?: string[];
|
|
7
|
+
created?: string;
|
|
8
|
+
downloaded?: string;
|
|
9
|
+
filename?: string;
|
|
10
|
+
contentType?: string;
|
|
11
|
+
size?: number;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function uploadAction(space: string, path: string, options: BotOption & {
|
|
15
|
+
text?: string;
|
|
16
|
+
markdown?: boolean;
|
|
17
|
+
parent?: string;
|
|
18
|
+
}): Promise<FileResult>;
|
|
19
|
+
export declare function downloadAction(contentRef: string, output: string | undefined, options: BotOption): Promise<FileResult>;
|
|
20
|
+
export declare const fileCommand: Command;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/file.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC,UAAU,UAAU;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1E,OAAO,CAAC,UAAU,CAAC,CAoBrB;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,SAAS,GACjB,OAAO,CAAC,UAAU,CAAC,CAiBrB;AAED,eAAO,MAAM,WAAW,SAgCrB,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { basename, resolve } from 'node:path';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { cliOutput } from '../../../shared/utils/cli-output.js';
|
|
5
|
+
import { getClient } from './shared.js';
|
|
6
|
+
export async function uploadAction(space, path, options) {
|
|
7
|
+
try {
|
|
8
|
+
const client = await getClient(options);
|
|
9
|
+
const filePath = resolve(path);
|
|
10
|
+
const content = await readFile(filePath);
|
|
11
|
+
const message = await client.uploadFile(space, { content: new Blob([content]), filename: basename(filePath) }, { text: options.text, markdown: options.markdown, parentId: options.parent });
|
|
12
|
+
return {
|
|
13
|
+
id: message.id,
|
|
14
|
+
roomId: message.roomId,
|
|
15
|
+
files: message.files,
|
|
16
|
+
created: message.created,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return { error: error.message };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export async function downloadAction(contentRef, output, options) {
|
|
24
|
+
try {
|
|
25
|
+
const client = await getClient(options);
|
|
26
|
+
const { data, filename, contentType } = await client.downloadContent(contentRef);
|
|
27
|
+
// When no explicit output is given, confine the server-provided name to cwd.
|
|
28
|
+
const outputPath = output ? resolve(output) : resolve(process.cwd(), basename(filename));
|
|
29
|
+
await writeFile(outputPath, Buffer.from(data));
|
|
30
|
+
return {
|
|
31
|
+
downloaded: outputPath,
|
|
32
|
+
filename,
|
|
33
|
+
contentType,
|
|
34
|
+
size: data.byteLength,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
return { error: error.message };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export const fileCommand = new Command('file')
|
|
42
|
+
.description('File commands')
|
|
43
|
+
.addCommand(new Command('upload')
|
|
44
|
+
.description('Upload a local file to a space')
|
|
45
|
+
.argument('<space>', 'Space/Room ID')
|
|
46
|
+
.argument('<path>', 'Local file path')
|
|
47
|
+
.option('--text <text>', 'Optional message to send with the file')
|
|
48
|
+
.option('--markdown', 'Treat --text as markdown')
|
|
49
|
+
.option('--parent <id>', 'Reply within a thread (parent message ID)')
|
|
50
|
+
.option('--bot <id>', 'Use specific bot')
|
|
51
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
52
|
+
.action(async (space, path, opts) => {
|
|
53
|
+
cliOutput(await uploadAction(space, path, opts), opts.pretty);
|
|
54
|
+
}))
|
|
55
|
+
.addCommand(new Command('download')
|
|
56
|
+
.description('Download a file attachment by content URL or ID')
|
|
57
|
+
.argument('<content>', 'File content URL (from message.files) or content ID')
|
|
58
|
+
.argument('[output]', 'Output path (defaults to original filename)')
|
|
59
|
+
.option('--bot <id>', 'Use specific bot')
|
|
60
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
61
|
+
.action(async (content, output, opts) => {
|
|
62
|
+
cliOutput(await downloadAction(content, output, opts), opts.pretty);
|
|
63
|
+
}));
|
|
64
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAGrD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAcpC,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAa,EACb,IAAY,EACZ,OAA2E;IAE3E,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAA;QACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QAC9B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACxC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,CACrC,KAAK,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,CACL,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { authCommand } from './auth.js';
|
|
2
|
+
export { fileCommand } from './file.js';
|
|
3
|
+
export { listenCommand } from './listen.js';
|
|
4
|
+
export { memberCommand } from './member.js';
|
|
5
|
+
export { messageCommand } from './message.js';
|
|
6
|
+
export { snapshotCommand } from './snapshot.js';
|
|
7
|
+
export { spaceCommand } from './space.js';
|
|
8
|
+
export { userCommand } from './user.js';
|
|
9
|
+
export { whoamiCommand } from './whoami.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { authCommand } from './auth.js';
|
|
2
|
+
export { fileCommand } from './file.js';
|
|
3
|
+
export { listenCommand } from './listen.js';
|
|
4
|
+
export { memberCommand } from './member.js';
|
|
5
|
+
export { messageCommand } from './message.js';
|
|
6
|
+
export { snapshotCommand } from './snapshot.js';
|
|
7
|
+
export { spaceCommand } from './space.js';
|
|
8
|
+
export { userCommand } from './user.js';
|
|
9
|
+
export { whoamiCommand } from './whoami.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import type { WebexBotListenerEventMap } from '../types.js';
|
|
3
|
+
import type { BotOption } from './shared.js';
|
|
4
|
+
type ListenEvent = keyof WebexBotListenerEventMap;
|
|
5
|
+
interface ListenOptions extends BotOption {
|
|
6
|
+
events?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseEvents(events?: string): ListenEvent[];
|
|
9
|
+
export declare function listenAction(options: ListenOptions): Promise<void>;
|
|
10
|
+
export declare const listenCommand: Command;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=listen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listen.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/listen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC,KAAK,WAAW,GAAG,MAAM,wBAAwB,CAAA;AA6BjD,UAAU,aAAc,SAAQ,SAAS;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAOD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE,CAe1D;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BxE;AAED,eAAO,MAAM,aAAa,SAOtB,CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cliOutput } from '../../../shared/utils/cli-output.js';
|
|
3
|
+
import { WebexBotListener } from '../listener.js';
|
|
4
|
+
import { getClient } from './shared.js';
|
|
5
|
+
const SUPPORTED_EVENTS = new Set([
|
|
6
|
+
'message_created',
|
|
7
|
+
'message_updated',
|
|
8
|
+
'message_deleted',
|
|
9
|
+
'membership_created',
|
|
10
|
+
'attachment_action',
|
|
11
|
+
'room_created',
|
|
12
|
+
'room_updated',
|
|
13
|
+
'webex_event',
|
|
14
|
+
'connected',
|
|
15
|
+
'reconnecting',
|
|
16
|
+
'disconnected',
|
|
17
|
+
'error',
|
|
18
|
+
]);
|
|
19
|
+
const DEFAULT_EVENTS = [
|
|
20
|
+
'message_created',
|
|
21
|
+
'message_updated',
|
|
22
|
+
'message_deleted',
|
|
23
|
+
'membership_created',
|
|
24
|
+
'attachment_action',
|
|
25
|
+
'connected',
|
|
26
|
+
'reconnecting',
|
|
27
|
+
'disconnected',
|
|
28
|
+
'error',
|
|
29
|
+
];
|
|
30
|
+
function printEvent(type, payload, pretty) {
|
|
31
|
+
const line = payload === undefined ? { type } : { type, payload };
|
|
32
|
+
console.log(JSON.stringify(line, null, pretty ? 2 : undefined));
|
|
33
|
+
}
|
|
34
|
+
export function parseEvents(events) {
|
|
35
|
+
if (!events)
|
|
36
|
+
return DEFAULT_EVENTS;
|
|
37
|
+
const tokens = events
|
|
38
|
+
.split(',')
|
|
39
|
+
.map((event) => event.trim())
|
|
40
|
+
.filter((event) => event.length > 0);
|
|
41
|
+
const unknown = tokens.filter((event) => !SUPPORTED_EVENTS.has(event));
|
|
42
|
+
if (unknown.length > 0) {
|
|
43
|
+
const supported = [...SUPPORTED_EVENTS].join(', ');
|
|
44
|
+
throw new Error(`Unknown event(s): ${unknown.join(', ')}. Supported events: ${supported}`);
|
|
45
|
+
}
|
|
46
|
+
return tokens;
|
|
47
|
+
}
|
|
48
|
+
export async function listenAction(options) {
|
|
49
|
+
let events;
|
|
50
|
+
try {
|
|
51
|
+
events = parseEvents(options.events);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
cliOutput({ error: error.message }, options.pretty, true);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const client = await getClient(options);
|
|
58
|
+
const listener = new WebexBotListener(client);
|
|
59
|
+
for (const event of events) {
|
|
60
|
+
if (event === 'error') {
|
|
61
|
+
listener.on(event, (error) => printEvent(event, { message: error.message, name: error.name }, options.pretty));
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
listener.on(event, (payload) => printEvent(event, payload, options.pretty));
|
|
65
|
+
}
|
|
66
|
+
process.once('SIGINT', () => {
|
|
67
|
+
void listener.stop().finally(() => process.exit(0));
|
|
68
|
+
});
|
|
69
|
+
try {
|
|
70
|
+
await listener.start();
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
printEvent('error', { message: error.message, name: error.name }, options.pretty);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export const listenCommand = new Command('listen')
|
|
78
|
+
.description('Listen for real-time Webex bot events')
|
|
79
|
+
.option('--events <list>', 'Comma-separated event filter')
|
|
80
|
+
.option('--bot <id>', 'Use specific bot')
|
|
81
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
82
|
+
.action(async (opts) => {
|
|
83
|
+
await listenAction(opts);
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=listen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listen.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/listen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAG9C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAIpC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAc;IAC5C,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,oBAAoB;IACpB,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,aAAa;IACb,WAAW;IACX,cAAc;IACd,cAAc;IACd,OAAO;CACR,CAAC,CAAA;AAEF,MAAM,cAAc,GAAkB;IACpC,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,oBAAoB;IACpB,mBAAmB;IACnB,WAAW;IACX,cAAc;IACd,cAAc;IACd,OAAO;CACR,CAAA;AAMD,SAAS,UAAU,CAAC,IAAY,EAAE,OAAgB,EAAE,MAAgB;IAClE,MAAM,IAAI,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAA;IACjE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;AACjE,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAe;IACzC,IAAI,CAAC,MAAM;QAAE,OAAO,cAAc,CAAA;IAElC,MAAM,MAAM,GAAG,MAAM;SAClB,KAAK,CAAC,GAA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Command } from 'commander';
|
|
2
|
+
import type { BotOption } from './shared.js';
|
|
3
|
+
interface MemberResult {
|
|
4
|
+
members?: Array<{
|
|
5
|
+
id: string;
|
|
6
|
+
personId: string;
|
|
7
|
+
personEmail: string;
|
|
8
|
+
personDisplayName: string;
|
|
9
|
+
isModerator: boolean;
|
|
10
|
+
created: string;
|
|
11
|
+
}>;
|
|
12
|
+
error?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function listAction(space: string, options: BotOption & {
|
|
15
|
+
max?: string;
|
|
16
|
+
}): Promise<MemberResult>;
|
|
17
|
+
export declare const memberCommand: Command;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=member.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/member.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAA;QACV,QAAQ,EAAE,MAAM,CAAA;QAChB,WAAW,EAAE,MAAM,CAAA;QACnB,iBAAiB,EAAE,MAAM,CAAA;QACzB,WAAW,EAAE,OAAO,CAAA;QACpB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAC,CAAA;IACF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAmB5G;AAED,eAAO,MAAM,aAAa,SAUzB,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cliOutput } from '../../../shared/utils/cli-output.js';
|
|
3
|
+
import { getClient } from './shared.js';
|
|
4
|
+
export async function listAction(space, options) {
|
|
5
|
+
try {
|
|
6
|
+
const client = await getClient(options);
|
|
7
|
+
const max = options.max ? parseInt(options.max, 10) : 100;
|
|
8
|
+
const members = await client.listMemberships(space, { max });
|
|
9
|
+
return {
|
|
10
|
+
members: members.map((m) => ({
|
|
11
|
+
id: m.id,
|
|
12
|
+
personId: m.personId,
|
|
13
|
+
personEmail: m.personEmail,
|
|
14
|
+
personDisplayName: m.personDisplayName,
|
|
15
|
+
isModerator: m.isModerator,
|
|
16
|
+
created: m.created,
|
|
17
|
+
})),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return { error: error.message };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export const memberCommand = new Command('member').description('Member commands').addCommand(new Command('list')
|
|
25
|
+
.description('List members of a space')
|
|
26
|
+
.argument('<space>', 'Space ID')
|
|
27
|
+
.option('--max <n>', 'Number of members to retrieve', '100')
|
|
28
|
+
.option('--bot <id>', 'Use specific bot')
|
|
29
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
30
|
+
.action(async (space, opts) => {
|
|
31
|
+
cliOutput(await listAction(space, opts), opts.pretty);
|
|
32
|
+
}));
|
|
33
|
+
//# sourceMappingURL=member.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/member.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAGrD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAcpC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAa,EAAE,OAAqC;IACnF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAA;QACvC,M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AAA;AACvD,CAAC,CAAC,CACL,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import type { BotOption } from './shared.js';
|
|
3
|
+
interface MessageResult {
|
|
4
|
+
id?: string;
|
|
5
|
+
roomId?: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
markdown?: string;
|
|
8
|
+
html?: string;
|
|
9
|
+
personEmail?: string;
|
|
10
|
+
created?: string;
|
|
11
|
+
messages?: Array<{
|
|
12
|
+
id: string;
|
|
13
|
+
roomId: string;
|
|
14
|
+
text?: string;
|
|
15
|
+
personEmail: string;
|
|
16
|
+
created: string;
|
|
17
|
+
}>;
|
|
18
|
+
deleted?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function sendAction(space: string, text: string, options: BotOption & {
|
|
22
|
+
markdown?: boolean;
|
|
23
|
+
parent?: string;
|
|
24
|
+
}): Promise<MessageResult>;
|
|
25
|
+
export declare function replyAction(space: string, parentId: string, text: string, options: BotOption & {
|
|
26
|
+
markdown?: boolean;
|
|
27
|
+
}): Promise<MessageResult>;
|
|
28
|
+
export declare function repliesAction(space: string, parentId: string, options: BotOption & {
|
|
29
|
+
max?: string;
|
|
30
|
+
}): Promise<MessageResult>;
|
|
31
|
+
export declare function dmAction(email: string, text: string, options: BotOption & {
|
|
32
|
+
markdown?: boolean;
|
|
33
|
+
}): Promise<MessageResult>;
|
|
34
|
+
export declare function listAction(space: string, options: BotOption & {
|
|
35
|
+
max?: string;
|
|
36
|
+
}): Promise<MessageResult>;
|
|
37
|
+
export declare function getAction(messageId: string, options: BotOption): Promise<MessageResult>;
|
|
38
|
+
export declare function deleteAction(messageId: string, options: BotOption): Promise<MessageResult>;
|
|
39
|
+
export declare function editAction(messageId: string, space: string, text: string, options: BotOption & {
|
|
40
|
+
markdown?: boolean;
|
|
41
|
+
}): Promise<MessageResult>;
|
|
42
|
+
export declare const messageCommand: Command;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC,UAAU,aAAa;IACrB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,EAAE,EAAE,MAAM,CAAA;QACV,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,WAAW,EAAE,MAAM,CAAA;QACnB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAC,CAAA;IACF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAcD,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3D,OAAO,CAAC,aAAa,CAAC,CASxB;AAED,wBAAsB,WAAW,CAC/B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1C,OAAO,CAAC,aAAa,CAAC,CASxB;AAED,wBAA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