agent-messenger 2.21.0 → 2.23.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 +21 -0
- package/dist/package.json +1 -1
- package/dist/src/platforms/webex/client.d.ts +25 -0
- package/dist/src/platforms/webex/client.d.ts.map +1 -1
- package/dist/src/platforms/webex/client.js +115 -5
- package/dist/src/platforms/webex/client.js.map +1 -1
- package/dist/src/platforms/webex/commands/auth.d.ts +9 -1
- package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/auth.js +141 -25
- package/dist/src/platforms/webex/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/webex/credential-manager.js +8 -4
- package/dist/src/platforms/webex/credential-manager.js.map +1 -1
- package/dist/src/platforms/webex/id-normalizer.d.ts +19 -0
- package/dist/src/platforms/webex/id-normalizer.d.ts.map +1 -0
- package/dist/src/platforms/webex/id-normalizer.js +60 -0
- package/dist/src/platforms/webex/id-normalizer.js.map +1 -0
- package/dist/src/platforms/webex/index.d.ts +4 -0
- package/dist/src/platforms/webex/index.d.ts.map +1 -1
- package/dist/src/platforms/webex/index.js +2 -0
- package/dist/src/platforms/webex/index.js.map +1 -1
- package/dist/src/platforms/webex/listener.d.ts +61 -0
- package/dist/src/platforms/webex/listener.d.ts.map +1 -0
- package/dist/src/platforms/webex/listener.js +222 -0
- package/dist/src/platforms/webex/listener.js.map +1 -0
- package/dist/src/platforms/webex/password-login.d.ts +18 -0
- package/dist/src/platforms/webex/password-login.d.ts.map +1 -0
- package/dist/src/platforms/webex/password-login.js +259 -0
- package/dist/src/platforms/webex/password-login.js.map +1 -0
- package/dist/src/platforms/webex/types.d.ts +2 -1
- package/dist/src/platforms/webex/types.d.ts.map +1 -1
- package/dist/src/platforms/webex/types.js +1 -1
- package/dist/src/platforms/webex/types.js.map +1 -1
- package/dist/src/platforms/webex/wdm-discovery.d.ts.map +1 -0
- package/dist/src/platforms/{webexbot → webex}/wdm-discovery.js +3 -3
- package/dist/src/platforms/webex/wdm-discovery.js.map +1 -0
- package/dist/src/platforms/webexbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/cli.js +4 -1
- package/dist/src/platforms/webexbot/cli.js.map +1 -1
- package/dist/src/platforms/webexbot/client.d.ts +24 -0
- package/dist/src/platforms/webexbot/client.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/client.js +81 -5
- package/dist/src/platforms/webexbot/client.js.map +1 -1
- 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 +3 -0
- package/dist/src/platforms/webexbot/commands/index.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/commands/index.js +3 -0
- package/dist/src/platforms/webexbot/commands/index.js.map +1 -1
- package/dist/src/platforms/webexbot/commands/message.d.ts +7 -0
- package/dist/src/platforms/webexbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/commands/message.js +52 -1
- package/dist/src/platforms/webexbot/commands/message.js.map +1 -1
- 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/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/index.d.ts +2 -0
- package/dist/src/platforms/webexbot/index.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/index.js +1 -0
- package/dist/src/platforms/webexbot/index.js.map +1 -1
- package/dist/src/platforms/webexbot/listener.d.ts +3 -41
- package/dist/src/platforms/webexbot/listener.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/listener.js +13 -208
- package/dist/src/platforms/webexbot/listener.js.map +1 -1
- package/dist/src/platforms/webexbot/types.d.ts +1 -18
- package/dist/src/platforms/webexbot/types.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/types.js.map +1 -1
- package/docs/content/docs/cli/webex.mdx +38 -12
- package/docs/content/docs/cli/webexbot.mdx +2 -0
- package/docs/content/docs/sdk/webexbot.mdx +18 -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 +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 +76 -22
- package/skills/agent-webex/references/authentication.md +55 -14
- package/skills/agent-webex/references/common-patterns.md +5 -2
- package/skills/agent-webexbot/SKILL.md +60 -5
- package/skills/agent-webexbot/references/common-patterns.md +118 -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/platforms/webex/cli.test.ts +31 -1
- package/src/platforms/webex/client.test.ts +67 -0
- package/src/platforms/webex/client.ts +136 -7
- package/src/platforms/webex/commands/auth.test.ts +189 -28
- package/src/platforms/webex/commands/auth.ts +194 -35
- package/src/platforms/webex/credential-manager.test.ts +40 -0
- package/src/platforms/webex/credential-manager.ts +7 -4
- package/src/platforms/webex/id-normalizer.test.ts +207 -0
- package/src/platforms/webex/id-normalizer.ts +76 -0
- package/src/platforms/webex/index.test.ts +6 -0
- package/src/platforms/webex/index.ts +4 -0
- package/src/platforms/webex/listener.test.ts +243 -0
- package/src/platforms/webex/listener.ts +285 -0
- package/src/platforms/webex/password-login.test.ts +193 -0
- package/src/platforms/webex/password-login.ts +332 -0
- package/src/platforms/webex/types.test.ts +16 -0
- package/src/platforms/webex/types.ts +2 -2
- package/src/platforms/{webexbot → webex}/wdm-discovery.ts +3 -3
- package/src/platforms/webexbot/cli.ts +6 -0
- package/src/platforms/webexbot/client.test.ts +322 -0
- package/src/platforms/webexbot/client.ts +104 -7
- package/src/platforms/webexbot/commands/file.ts +104 -0
- package/src/platforms/webexbot/commands/index.ts +3 -0
- package/src/platforms/webexbot/commands/message.ts +68 -2
- package/src/platforms/webexbot/commands/snapshot.ts +60 -0
- package/src/platforms/webexbot/commands/user.test.ts +77 -0
- package/src/platforms/webexbot/commands/user.ts +98 -0
- package/src/platforms/webexbot/index.ts +2 -0
- package/src/platforms/webexbot/listener.test.ts +37 -224
- package/src/platforms/webexbot/listener.ts +18 -250
- package/src/platforms/webexbot/types.ts +2 -23
- package/dist/src/platforms/webexbot/wdm-discovery.d.ts.map +0 -1
- package/dist/src/platforms/webexbot/wdm-discovery.js.map +0 -1
- /package/dist/src/platforms/{webexbot → webex}/wdm-discovery.d.ts +0 -0
- /package/src/platforms/{webexbot → webex}/wdm-discovery.test.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import pkg from '../../../package.json' with { type: 'json' };
|
|
4
|
-
import { authCommand, listenCommand, memberCommand, messageCommand, spaceCommand, whoamiCommand, } from './commands/index.js';
|
|
4
|
+
import { authCommand, fileCommand, listenCommand, memberCommand, messageCommand, snapshotCommand, spaceCommand, userCommand, whoamiCommand, } from './commands/index.js';
|
|
5
5
|
const program = new Command();
|
|
6
6
|
program
|
|
7
7
|
.name('agent-webexbot')
|
|
@@ -24,6 +24,9 @@ program.addCommand(whoamiCommand);
|
|
|
24
24
|
program.addCommand(messageCommand);
|
|
25
25
|
program.addCommand(spaceCommand);
|
|
26
26
|
program.addCommand(memberCommand);
|
|
27
|
+
program.addCommand(userCommand);
|
|
28
|
+
program.addCommand(fileCommand);
|
|
29
|
+
program.addCommand(snapshotCommand);
|
|
27
30
|
program.addCommand(listenCommand);
|
|
28
31
|
program.parseAsync(process.argv);
|
|
29
32
|
export default program;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../../src/platforms/webexbot/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,GAAG,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAC7D,OAAO,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,aAAa,GACd,MAAM,kBAAkB,CAAA;AAEzB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,gBAAgB,CAAC;KACtB,WAAW,CAAC,qDAAqD,CAAC;KAClE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;KACpB,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC;KACrC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC1D,IAAI,KAAK,KAAK,SAAS;YAAE,SAAQ;QACjC,MAAM,MAAM,GAAG,SAAS,CAAC,oBAAoB,CAAC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AE,EAAE;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAC1D,IAAI,KAAK,KAAK,SAAS;YAAE,SAAQ;QACjC,MAAM,MAAM,GAAG,SAAS,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAA;QAClD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACjD,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAA;AAEJ,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;AACjC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;AAClC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;AAChC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;AACjC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;AAC/B,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;AACnC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;AAEjC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAEhC,eAAe,OAAO,CAAA"}
|
|
@@ -2,6 +2,8 @@ import type { WebexMembership, WebexMessage, WebexPerson, WebexSpace } from '../
|
|
|
2
2
|
export declare class WebexBotClient {
|
|
3
3
|
private client;
|
|
4
4
|
private token;
|
|
5
|
+
private clusteredRoomIds;
|
|
6
|
+
private roomIdLookups;
|
|
5
7
|
login(credentials?: {
|
|
6
8
|
token: string;
|
|
7
9
|
}): Promise<this>;
|
|
@@ -14,12 +16,18 @@ export declare class WebexBotClient {
|
|
|
14
16
|
getSpace(spaceId: string): Promise<WebexSpace>;
|
|
15
17
|
sendMessage(roomId: string, text: string, options?: {
|
|
16
18
|
markdown?: boolean;
|
|
19
|
+
parentId?: string;
|
|
20
|
+
files?: string[];
|
|
17
21
|
}): Promise<WebexMessage>;
|
|
18
22
|
sendDirectMessage(personEmail: string, text: string, options?: {
|
|
19
23
|
markdown?: boolean;
|
|
20
24
|
}): Promise<WebexMessage>;
|
|
21
25
|
listMessages(roomId: string, options?: {
|
|
22
26
|
max?: number;
|
|
27
|
+
parentId?: string;
|
|
28
|
+
}): Promise<WebexMessage[]>;
|
|
29
|
+
listReplies(roomId: string, parentId: string, options?: {
|
|
30
|
+
max?: number;
|
|
23
31
|
}): Promise<WebexMessage[]>;
|
|
24
32
|
getMessage(messageId: string): Promise<WebexMessage>;
|
|
25
33
|
deleteMessage(messageId: string): Promise<void>;
|
|
@@ -31,11 +39,27 @@ export declare class WebexBotClient {
|
|
|
31
39
|
displayName?: string;
|
|
32
40
|
max?: number;
|
|
33
41
|
}): Promise<WebexPerson[]>;
|
|
42
|
+
getPerson(personId: string): Promise<WebexPerson>;
|
|
34
43
|
listMyMemberships(options?: {
|
|
35
44
|
max?: number;
|
|
36
45
|
}): Promise<WebexMembership[]>;
|
|
37
46
|
listMemberships(roomId: string, options?: {
|
|
38
47
|
max?: number;
|
|
39
48
|
}): Promise<WebexMembership[]>;
|
|
49
|
+
uploadFile(roomId: string, file: {
|
|
50
|
+
content: Blob;
|
|
51
|
+
filename: string;
|
|
52
|
+
}, options?: {
|
|
53
|
+
text?: string;
|
|
54
|
+
markdown?: boolean;
|
|
55
|
+
parentId?: string;
|
|
56
|
+
}): Promise<WebexMessage>;
|
|
57
|
+
downloadContent(contentRef: string): Promise<{
|
|
58
|
+
data: ArrayBuffer;
|
|
59
|
+
filename: string;
|
|
60
|
+
contentType: string;
|
|
61
|
+
}>;
|
|
62
|
+
private resolveRoomId;
|
|
63
|
+
private lookupRoomId;
|
|
40
64
|
}
|
|
41
65
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/platforms/webexbot/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/platforms/webexbot/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAmB5F,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,KAAK,CAAsB;IAMnC,OAAO,CAAC,gBAAgB,CAA4B;IACpD,OAAO,CAAC,aAAa,CAAqC;IAEpD,KAAK,CAAC,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB3D,QAAQ,IAAI,MAAM;IAOZ,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;IAIhC,UAAU,CAAC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAI5E,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAI9C,WAAW,CACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GACpE,OAAO,CAAC,YAAY,CAAC;IAIlB,iBAAiB,CAAC,WAAW,EAAE,MAAM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C,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAIvF,UAAU,CACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EACzC,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GACjE,OAAO,CAAC,YAAY,CAAC;IAIlB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;YAIlG,aAAa;YAqBb,YAAY;CAqB3B"}
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import { WebexClient } from '../webex/client.js';
|
|
2
2
|
import { WebexBotError } from './types.js';
|
|
3
|
+
// Webex REST ids are base64(url) of `ciscospark://<cluster>/<TYPE>/<uuid>`; the
|
|
4
|
+
// cluster correction needs all three parts, not just the <uuid> `fromRestId` returns.
|
|
5
|
+
function decodeWebexId(restId) {
|
|
6
|
+
if (!restId)
|
|
7
|
+
return null;
|
|
8
|
+
const decoded = Buffer.from(restId, 'base64').toString('utf-8');
|
|
9
|
+
const match = decoded.match(/^ciscospark:\/\/([^/]+)\/([^/]+)\/(.+)$/);
|
|
10
|
+
if (!match)
|
|
11
|
+
return null;
|
|
12
|
+
return { cluster: match[1], type: match[2], uuid: match[3] };
|
|
13
|
+
}
|
|
3
14
|
export class WebexBotClient {
|
|
4
15
|
client = new WebexClient();
|
|
5
16
|
token = null;
|
|
17
|
+
// The listener flattens room ids to `ciscospark://us/ROOM/<uuid>`, but team/group
|
|
18
|
+
// rooms live on `ciscospark://urn:TEAM:<cluster>/ROOM/<uuid>` — a cluster the bare
|
|
19
|
+
// uuid cannot recover. Cache the real clustered id per uuid and dedupe concurrent
|
|
20
|
+
// lookups so a burst of calls triggers a single `listSpaces`.
|
|
21
|
+
clusteredRoomIds = new Map();
|
|
22
|
+
roomIdLookups = new Map();
|
|
6
23
|
async login(credentials) {
|
|
7
24
|
if (credentials) {
|
|
8
25
|
if (!credentials.token) {
|
|
@@ -33,34 +50,93 @@ export class WebexBotClient {
|
|
|
33
50
|
return this.client.listSpaces(options);
|
|
34
51
|
}
|
|
35
52
|
async getSpace(spaceId) {
|
|
36
|
-
return this.client.getSpace(spaceId);
|
|
53
|
+
return this.client.getSpace(await this.resolveRoomId(spaceId));
|
|
37
54
|
}
|
|
38
55
|
async sendMessage(roomId, text, options) {
|
|
39
|
-
return this.client.sendMessage(roomId, text, options);
|
|
56
|
+
return this.client.sendMessage(await this.resolveRoomId(roomId), text, options);
|
|
40
57
|
}
|
|
41
58
|
async sendDirectMessage(personEmail, text, options) {
|
|
42
59
|
return this.client.sendDirectMessage(personEmail, text, options);
|
|
43
60
|
}
|
|
44
61
|
async listMessages(roomId, options) {
|
|
45
|
-
|
|
62
|
+
const resolvedRoomId = await this.resolveRoomId(roomId);
|
|
63
|
+
const space = await this.client.getSpace(resolvedRoomId);
|
|
64
|
+
const messageOptions = space.type === 'group' ? { ...options, mentionedPeople: 'me' } : options;
|
|
65
|
+
return this.client.listMessages(resolvedRoomId, messageOptions);
|
|
66
|
+
}
|
|
67
|
+
async listReplies(roomId, parentId, options) {
|
|
68
|
+
return this.client.listMessages(await this.resolveRoomId(roomId), { ...options, parentId });
|
|
46
69
|
}
|
|
47
70
|
async getMessage(messageId) {
|
|
71
|
+
// MESSAGE ids carry their parent room's cluster, which the bare-UUID normalizer
|
|
72
|
+
// also flattens to `us`. Correcting that needs the room context, which a lone
|
|
73
|
+
// messageId does not provide; room-keyed calls (the reported failures) are
|
|
74
|
+
// corrected via resolveRoomId instead.
|
|
48
75
|
return this.client.getMessage(messageId);
|
|
49
76
|
}
|
|
50
77
|
async deleteMessage(messageId) {
|
|
51
78
|
return this.client.deleteMessage(messageId);
|
|
52
79
|
}
|
|
53
80
|
async editMessage(messageId, roomId, text, options) {
|
|
54
|
-
return this.client.editMessage(messageId, roomId, text, options);
|
|
81
|
+
return this.client.editMessage(messageId, await this.resolveRoomId(roomId), text, options);
|
|
55
82
|
}
|
|
56
83
|
async listPeople(options) {
|
|
57
84
|
return this.client.listPeople(options);
|
|
58
85
|
}
|
|
86
|
+
async getPerson(personId) {
|
|
87
|
+
return this.client.getPerson(personId);
|
|
88
|
+
}
|
|
59
89
|
async listMyMemberships(options) {
|
|
60
90
|
return this.client.listMyMemberships(options);
|
|
61
91
|
}
|
|
62
92
|
async listMemberships(roomId, options) {
|
|
63
|
-
return this.client.listMemberships(roomId, options);
|
|
93
|
+
return this.client.listMemberships(await this.resolveRoomId(roomId), options);
|
|
94
|
+
}
|
|
95
|
+
async uploadFile(roomId, file, options) {
|
|
96
|
+
return this.client.uploadFile(await this.resolveRoomId(roomId), file, options);
|
|
97
|
+
}
|
|
98
|
+
async downloadContent(contentRef) {
|
|
99
|
+
return this.client.downloadContent(contentRef);
|
|
100
|
+
}
|
|
101
|
+
async resolveRoomId(roomId) {
|
|
102
|
+
const decoded = decodeWebexId(roomId);
|
|
103
|
+
// Already cluster-qualified or undecodable: nothing to correct.
|
|
104
|
+
if (!decoded || decoded.cluster.startsWith('urn:'))
|
|
105
|
+
return roomId;
|
|
106
|
+
const { uuid } = decoded;
|
|
107
|
+
const cached = this.clusteredRoomIds.get(uuid);
|
|
108
|
+
if (cached)
|
|
109
|
+
return cached;
|
|
110
|
+
const inFlight = this.roomIdLookups.get(uuid);
|
|
111
|
+
if (inFlight)
|
|
112
|
+
return inFlight;
|
|
113
|
+
const lookup = this.lookupRoomId(uuid, roomId);
|
|
114
|
+
this.roomIdLookups.set(uuid, lookup);
|
|
115
|
+
try {
|
|
116
|
+
return await lookup;
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
this.roomIdLookups.delete(uuid);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async lookupRoomId(uuid, fallback) {
|
|
123
|
+
try {
|
|
124
|
+
// Page through every room the bot belongs to (largest page size, following
|
|
125
|
+
// `Link` pages), stopping as soon as the trailing UUID matches.
|
|
126
|
+
for await (const room of this.client.iterateSpaces({ max: 1000 })) {
|
|
127
|
+
if (decodeWebexId(room.id)?.uuid === uuid) {
|
|
128
|
+
this.clusteredRoomIds.set(uuid, room.id);
|
|
129
|
+
return room.id;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Network/auth failure: fail open to the un-corrected id rather than block the call.
|
|
135
|
+
return fallback;
|
|
136
|
+
}
|
|
137
|
+
console.warn(`[webexbot] Could not resolve clustered room id for ${uuid}; falling back to the un-clustered id. ` +
|
|
138
|
+
'Room-scoped calls may fail if this room lives on a non-default Webex cluster.');
|
|
139
|
+
return fallback;
|
|
64
140
|
}
|
|
65
141
|
}
|
|
66
142
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/platforms/webexbot/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/platforms/webexbot/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAQvC,gFAAgF;AAChF,sFAAsF;AACtF,SAAS,aAAa,CAAC,MAAc;IACnC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IACxB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,C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IAAI,EAAE,MAAM,CAAC,CAAA;QACpC,IAAI,CAAC;YACH,OAAO,MAAM,MAAM,CAAA;QACrB,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,QAAgB;QACvD,IAAI,CAAC;YACH,2EAA2E;YAC3E,gEAAgE;YAChE,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;gBAClE,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,KAAK,IAAI,EAAE,CAAC;oBAC1C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;oBACxC,OAAO,IAAI,CAAC,EAAE,CAAA;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,qFAAqF;YACrF,OAAO,QAAQ,CAAA;QACjB,CAAC;QAED,OAAO,CAAC,IAAI,CACV,sDAAsD,IAAI,yCAAyC;YACjG,+EAA+E,CAClF,CAAA;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF"}
|
|
@@ -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,GAA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cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AACrE,CAAC,CAAC,CACL,CAAA"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export { authCommand } from './auth.js';
|
|
2
|
+
export { fileCommand } from './file.js';
|
|
2
3
|
export { listenCommand } from './listen.js';
|
|
3
4
|
export { memberCommand } from './member.js';
|
|
4
5
|
export { messageCommand } from './message.js';
|
|
6
|
+
export { snapshotCommand } from './snapshot.js';
|
|
5
7
|
export { spaceCommand } from './space.js';
|
|
8
|
+
export { userCommand } from './user.js';
|
|
6
9
|
export { whoamiCommand } from './whoami.js';
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA"}
|
|
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"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export { authCommand } from './auth.js';
|
|
2
|
+
export { fileCommand } from './file.js';
|
|
2
3
|
export { listenCommand } from './listen.js';
|
|
3
4
|
export { memberCommand } from './member.js';
|
|
4
5
|
export { messageCommand } from './message.js';
|
|
6
|
+
export { snapshotCommand } from './snapshot.js';
|
|
5
7
|
export { spaceCommand } from './space.js';
|
|
8
|
+
export { userCommand } from './user.js';
|
|
6
9
|
export { whoamiCommand } from './whoami.js';
|
|
7
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA"}
|
|
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"}
|
|
@@ -20,6 +20,13 @@ interface MessageResult {
|
|
|
20
20
|
}
|
|
21
21
|
export declare function sendAction(space: string, text: string, options: BotOption & {
|
|
22
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;
|
|
23
30
|
}): Promise<MessageResult>;
|
|
24
31
|
export declare function dmAction(email: string, text: string, options: BotOption & {
|
|
25
32
|
markdown?: boolean;
|
|
@@ -1 +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,IA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kBxB;AAED,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1C,OAAO,CAAC,aAAa,CAAC,CASxB;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAkB7G;AAED,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAS7F;AAED,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAShG;AAED,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1C,OAAO,CAAC,aAAa,CAAC,CASxB;AAED,eAAO,MAAM,cAAc,SA+FxB,CAAA"}
|
|
@@ -15,13 +15,42 @@ function formatMessage(message) {
|
|
|
15
15
|
export async function sendAction(space, text, options) {
|
|
16
16
|
try {
|
|
17
17
|
const client = await getClient(options);
|
|
18
|
-
const message = await client.sendMessage(space, text, { markdown: options.markdown });
|
|
18
|
+
const message = await client.sendMessage(space, text, { markdown: options.markdown, parentId: options.parent });
|
|
19
19
|
return formatMessage(message);
|
|
20
20
|
}
|
|
21
21
|
catch (error) {
|
|
22
22
|
return { error: error.message };
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
export async function replyAction(space, parentId, text, options) {
|
|
26
|
+
try {
|
|
27
|
+
const client = await getClient(options);
|
|
28
|
+
const message = await client.sendMessage(space, text, { markdown: options.markdown, parentId });
|
|
29
|
+
return formatMessage(message);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return { error: error.message };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export async function repliesAction(space, parentId, options) {
|
|
36
|
+
try {
|
|
37
|
+
const client = await getClient(options);
|
|
38
|
+
const max = options.max ? parseInt(options.max, 10) : 50;
|
|
39
|
+
const messages = await client.listReplies(space, parentId, { max });
|
|
40
|
+
return {
|
|
41
|
+
messages: messages.map((msg) => ({
|
|
42
|
+
id: msg.id,
|
|
43
|
+
roomId: msg.roomId,
|
|
44
|
+
text: msg.text,
|
|
45
|
+
personEmail: msg.personEmail,
|
|
46
|
+
created: msg.created,
|
|
47
|
+
})),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return { error: error.message };
|
|
52
|
+
}
|
|
53
|
+
}
|
|
25
54
|
export async function dmAction(email, text, options) {
|
|
26
55
|
try {
|
|
27
56
|
const client = await getClient(options);
|
|
@@ -88,10 +117,32 @@ export const messageCommand = new Command('message')
|
|
|
88
117
|
.argument('<space>', 'Space/Room ID')
|
|
89
118
|
.argument('<text>', 'Message text')
|
|
90
119
|
.option('--markdown', 'Send as markdown')
|
|
120
|
+
.option('--parent <id>', 'Reply within a thread (parent message ID)')
|
|
91
121
|
.option('--bot <id>', 'Use specific bot')
|
|
92
122
|
.option('--pretty', 'Pretty print JSON output')
|
|
93
123
|
.action(async (space, text, opts) => {
|
|
94
124
|
cliOutput(await sendAction(space, text, opts), opts.pretty);
|
|
125
|
+
}))
|
|
126
|
+
.addCommand(new Command('reply')
|
|
127
|
+
.description('Reply to a message in a thread')
|
|
128
|
+
.argument('<space>', 'Space/Room ID')
|
|
129
|
+
.argument('<parent>', 'Parent message ID')
|
|
130
|
+
.argument('<text>', 'Reply text')
|
|
131
|
+
.option('--markdown', 'Send as markdown')
|
|
132
|
+
.option('--bot <id>', 'Use specific bot')
|
|
133
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
134
|
+
.action(async (space, parent, text, opts) => {
|
|
135
|
+
cliOutput(await replyAction(space, parent, text, opts), opts.pretty);
|
|
136
|
+
}))
|
|
137
|
+
.addCommand(new Command('replies')
|
|
138
|
+
.description('List replies in a thread')
|
|
139
|
+
.argument('<space>', 'Space/Room ID')
|
|
140
|
+
.argument('<parent>', 'Parent message ID')
|
|
141
|
+
.option('--max <n>', 'Number of replies to fetch', '50')
|
|
142
|
+
.option('--bot <id>', 'Use specific bot')
|
|
143
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
144
|
+
.action(async (space, parent, opts) => {
|
|
145
|
+
cliOutput(await repliesAction(space, parent, opts), opts.pretty);
|
|
95
146
|
}))
|
|
96
147
|
.addCommand(new Command('dm')
|
|
97
148
|
.description('Send a direct message by recipient email')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAIrD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAqBpC,SAAS,aAAa,CAAC,OAAqB;IAC1C,OAAO;QACL,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAA;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,KAAa,EACb,IAAY,EACZ,OAA2C;IAE3C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,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KAC9B,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;KACpC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;KACtC,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC;KACxC,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC;KACxC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,SAAiB,EAAE,KAAa,EAAE,IAAY,EAAE,IAAwC,EAAE,EAAE;IACzG,SAAS,CAAC,MAAM,UAAU,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AACxE,CAAC,CAAC,CACL,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import type { BotOption } from './shared.js';
|
|
3
|
+
interface SnapshotResult {
|
|
4
|
+
bot?: {
|
|
5
|
+
id: string;
|
|
6
|
+
displayName: string;
|
|
7
|
+
emails: string[];
|
|
8
|
+
};
|
|
9
|
+
spaces?: Array<{
|
|
10
|
+
id: string;
|
|
11
|
+
title: string;
|
|
12
|
+
type?: 'group' | 'direct';
|
|
13
|
+
lastActivity?: string;
|
|
14
|
+
}>;
|
|
15
|
+
hint?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function snapshotAction(options: BotOption & {
|
|
19
|
+
full?: boolean;
|
|
20
|
+
max?: string;
|
|
21
|
+
}): Promise<SnapshotResult>;
|
|
22
|
+
export declare const snapshotCommand: Command;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC,UAAU,cAAc;IACtB,GAAG,CAAC,EAAE;QACJ,EAAE,EAAE,MAAM,CAAA;QACV,WAAW,EAAE,MAAM,CAAA;QACnB,MAAM,EAAE,MAAM,EAAE,CAAA;KACjB,CAAA;IACD,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;QACzB,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAC,CAAA;IACF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,SAAS,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CA0BnH;AAED,eAAO,MAAM,eAAe,SAQxB,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { cliOutput } from '../../../shared/utils/cli-output.js';
|
|
3
|
+
import { getClient } from './shared.js';
|
|
4
|
+
export async function snapshotAction(options) {
|
|
5
|
+
try {
|
|
6
|
+
const client = await getClient(options);
|
|
7
|
+
const max = options.max ? parseInt(options.max, 10) : 100;
|
|
8
|
+
const [me, spaces] = await Promise.all([client.testAuth(), client.listSpaces({ max })]);
|
|
9
|
+
const result = {
|
|
10
|
+
bot: {
|
|
11
|
+
id: me.id,
|
|
12
|
+
displayName: me.displayName,
|
|
13
|
+
emails: me.emails,
|
|
14
|
+
},
|
|
15
|
+
spaces: options.full
|
|
16
|
+
? spaces.map((s) => ({ id: s.id, title: s.title, type: s.type, lastActivity: s.lastActivity }))
|
|
17
|
+
: spaces.map((s) => ({ id: s.id, title: s.title })),
|
|
18
|
+
};
|
|
19
|
+
if (!options.full) {
|
|
20
|
+
result.hint = "Use 'message list <space>' for messages, 'space info <space>' for details.";
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return { error: error.message };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export const snapshotCommand = new Command('snapshot')
|
|
29
|
+
.description('Workspace overview for AI agents (brief by default, --full for details)')
|
|
30
|
+
.option('--full', 'Include full space details')
|
|
31
|
+
.option('--max <n>', 'Number of spaces to retrieve', '100')
|
|
32
|
+
.option('--bot <id>', 'Use specific bot')
|
|
33
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
34
|
+
.action(async (opts) => {
|
|
35
|
+
cliOutput(await snapshotAction(opts), opts.pretty);
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/snapshot.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;AAkBpC,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAAqD;IACxF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAA;QACvC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;QAEzD,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,C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EAAE;IACnE,SAAS,CAAC,MAAM,cAAc,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AACpD,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import type { BotOption } from './shared.js';
|
|
3
|
+
interface UserResult {
|
|
4
|
+
id?: string;
|
|
5
|
+
emails?: string[];
|
|
6
|
+
displayName?: string;
|
|
7
|
+
nickName?: string;
|
|
8
|
+
firstName?: string;
|
|
9
|
+
lastName?: string;
|
|
10
|
+
avatar?: string;
|
|
11
|
+
orgId?: string;
|
|
12
|
+
type?: 'person' | 'bot';
|
|
13
|
+
created?: string;
|
|
14
|
+
users?: Array<{
|
|
15
|
+
id: string;
|
|
16
|
+
emails: string[];
|
|
17
|
+
displayName: string;
|
|
18
|
+
type: 'person' | 'bot';
|
|
19
|
+
}>;
|
|
20
|
+
error?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function listAction(options: BotOption & {
|
|
23
|
+
email?: string;
|
|
24
|
+
displayName?: string;
|
|
25
|
+
max?: string;
|
|
26
|
+
}): Promise<UserResult>;
|
|
27
|
+
export declare function infoAction(personId: string, options: BotOption): Promise<UserResult>;
|
|
28
|
+
export declare const userCommand: Command;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC,UAAU,UAAU;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAA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