agent-messenger 2.20.4 → 2.21.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.
Files changed (115) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +8 -5
  3. package/bun.lock +2 -2
  4. package/dist/package.json +10 -2
  5. package/dist/src/cli.d.ts.map +1 -1
  6. package/dist/src/cli.js +3 -0
  7. package/dist/src/cli.js.map +1 -1
  8. package/dist/src/platforms/webexbot/cli.d.ts +5 -0
  9. package/dist/src/platforms/webexbot/cli.d.ts.map +1 -0
  10. package/dist/src/platforms/webexbot/cli.js +30 -0
  11. package/dist/src/platforms/webexbot/cli.js.map +1 -0
  12. package/dist/src/platforms/webexbot/client.d.ts +41 -0
  13. package/dist/src/platforms/webexbot/client.d.ts.map +1 -0
  14. package/dist/src/platforms/webexbot/client.js +66 -0
  15. package/dist/src/platforms/webexbot/client.js.map +1 -0
  16. package/dist/src/platforms/webexbot/commands/auth.d.ts +28 -0
  17. package/dist/src/platforms/webexbot/commands/auth.d.ts.map +1 -0
  18. package/dist/src/platforms/webexbot/commands/auth.js +166 -0
  19. package/dist/src/platforms/webexbot/commands/auth.js.map +1 -0
  20. package/dist/src/platforms/webexbot/commands/index.d.ts +7 -0
  21. package/dist/src/platforms/webexbot/commands/index.d.ts.map +1 -0
  22. package/dist/src/platforms/webexbot/commands/index.js +7 -0
  23. package/dist/src/platforms/webexbot/commands/index.js.map +1 -0
  24. package/dist/src/platforms/webexbot/commands/listen.d.ts +12 -0
  25. package/dist/src/platforms/webexbot/commands/listen.d.ts.map +1 -0
  26. package/dist/src/platforms/webexbot/commands/listen.js +85 -0
  27. package/dist/src/platforms/webexbot/commands/listen.js.map +1 -0
  28. package/dist/src/platforms/webexbot/commands/member.d.ts +19 -0
  29. package/dist/src/platforms/webexbot/commands/member.d.ts.map +1 -0
  30. package/dist/src/platforms/webexbot/commands/member.js +33 -0
  31. package/dist/src/platforms/webexbot/commands/member.js.map +1 -0
  32. package/dist/src/platforms/webexbot/commands/message.d.ts +37 -0
  33. package/dist/src/platforms/webexbot/commands/message.d.ts.map +1 -0
  34. package/dist/src/platforms/webexbot/commands/message.js +142 -0
  35. package/dist/src/platforms/webexbot/commands/message.js.map +1 -0
  36. package/dist/src/platforms/webexbot/commands/shared.d.ts +9 -0
  37. package/dist/src/platforms/webexbot/commands/shared.d.ts.map +1 -0
  38. package/dist/src/platforms/webexbot/commands/shared.js +13 -0
  39. package/dist/src/platforms/webexbot/commands/shared.js.map +1 -0
  40. package/dist/src/platforms/webexbot/commands/space.d.ts +28 -0
  41. package/dist/src/platforms/webexbot/commands/space.d.ts.map +1 -0
  42. package/dist/src/platforms/webexbot/commands/space.js +61 -0
  43. package/dist/src/platforms/webexbot/commands/space.js.map +1 -0
  44. package/dist/src/platforms/webexbot/commands/whoami.d.ts +16 -0
  45. package/dist/src/platforms/webexbot/commands/whoami.d.ts.map +1 -0
  46. package/dist/src/platforms/webexbot/commands/whoami.js +29 -0
  47. package/dist/src/platforms/webexbot/commands/whoami.js.map +1 -0
  48. package/dist/src/platforms/webexbot/credential-manager.d.ts +17 -0
  49. package/dist/src/platforms/webexbot/credential-manager.d.ts.map +1 -0
  50. package/dist/src/platforms/webexbot/credential-manager.js +120 -0
  51. package/dist/src/platforms/webexbot/credential-manager.js.map +1 -0
  52. package/dist/src/platforms/webexbot/index.d.ts +9 -0
  53. package/dist/src/platforms/webexbot/index.d.ts.map +1 -0
  54. package/dist/src/platforms/webexbot/index.js +6 -0
  55. package/dist/src/platforms/webexbot/index.js.map +1 -0
  56. package/dist/src/platforms/webexbot/listener.d.ts +44 -0
  57. package/dist/src/platforms/webexbot/listener.d.ts.map +1 -0
  58. package/dist/src/platforms/webexbot/listener.js +214 -0
  59. package/dist/src/platforms/webexbot/listener.js.map +1 -0
  60. package/dist/src/platforms/webexbot/types.d.ts +60 -0
  61. package/dist/src/platforms/webexbot/types.d.ts.map +1 -0
  62. package/dist/src/platforms/webexbot/types.js +28 -0
  63. package/dist/src/platforms/webexbot/types.js.map +1 -0
  64. package/dist/src/platforms/webexbot/wdm-discovery.d.ts +4 -0
  65. package/dist/src/platforms/webexbot/wdm-discovery.d.ts.map +1 -0
  66. package/dist/src/platforms/webexbot/wdm-discovery.js +36 -0
  67. package/dist/src/platforms/webexbot/wdm-discovery.js.map +1 -0
  68. package/docs/content/docs/cli/meta.json +1 -0
  69. package/docs/content/docs/cli/webexbot.mdx +290 -0
  70. package/docs/content/docs/sdk/meta.json +1 -0
  71. package/docs/content/docs/sdk/webexbot.mdx +340 -0
  72. package/docs/src/app/page.tsx +115 -19
  73. package/package.json +10 -2
  74. package/skills/agent-channeltalk/SKILL.md +1 -1
  75. package/skills/agent-channeltalkbot/SKILL.md +1 -1
  76. package/skills/agent-discord/SKILL.md +1 -1
  77. package/skills/agent-discordbot/SKILL.md +1 -1
  78. package/skills/agent-instagram/SKILL.md +1 -1
  79. package/skills/agent-kakaotalk/SKILL.md +1 -1
  80. package/skills/agent-line/SKILL.md +1 -1
  81. package/skills/agent-slack/SKILL.md +1 -1
  82. package/skills/agent-slackbot/SKILL.md +1 -1
  83. package/skills/agent-teams/SKILL.md +1 -1
  84. package/skills/agent-telegram/SKILL.md +1 -1
  85. package/skills/agent-telegrambot/SKILL.md +1 -1
  86. package/skills/agent-webex/SKILL.md +1 -1
  87. package/skills/agent-webexbot/SKILL.md +361 -0
  88. package/skills/agent-webexbot/references/authentication.md +225 -0
  89. package/skills/agent-webexbot/references/common-patterns.md +590 -0
  90. package/skills/agent-wechatbot/SKILL.md +1 -1
  91. package/skills/agent-whatsapp/SKILL.md +1 -1
  92. package/skills/agent-whatsappbot/SKILL.md +1 -1
  93. package/src/cli.ts +4 -0
  94. package/src/platforms/webex/typings/webex-message-handler.d.ts +360 -29
  95. package/src/platforms/webexbot/cli.ts +42 -0
  96. package/src/platforms/webexbot/client.ts +87 -0
  97. package/src/platforms/webexbot/commands/auth.test.ts +185 -0
  98. package/src/platforms/webexbot/commands/auth.ts +210 -0
  99. package/src/platforms/webexbot/commands/index.ts +6 -0
  100. package/src/platforms/webexbot/commands/listen.test.ts +20 -0
  101. package/src/platforms/webexbot/commands/listen.ts +104 -0
  102. package/src/platforms/webexbot/commands/member.ts +51 -0
  103. package/src/platforms/webexbot/commands/message.ts +197 -0
  104. package/src/platforms/webexbot/commands/shared.ts +22 -0
  105. package/src/platforms/webexbot/commands/space.ts +88 -0
  106. package/src/platforms/webexbot/commands/whoami.ts +43 -0
  107. package/src/platforms/webexbot/credential-manager.test.ts +182 -0
  108. package/src/platforms/webexbot/credential-manager.ts +149 -0
  109. package/src/platforms/webexbot/index.ts +8 -0
  110. package/src/platforms/webexbot/listener.test.ts +234 -0
  111. package/src/platforms/webexbot/listener.ts +255 -0
  112. package/src/platforms/webexbot/types.test.ts +87 -0
  113. package/src/platforms/webexbot/types.ts +72 -0
  114. package/src/platforms/webexbot/wdm-discovery.test.ts +97 -0
  115. package/src/platforms/webexbot/wdm-discovery.ts +43 -0
@@ -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,CAA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CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE;QAC1B,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IACrD,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAA;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,UAAU,CAAC,OAAO,EAAE,EAAE,OAAO,EAAG,KAAe,CAAC,OAAO,EAAE,IAAI,EAAG,KAAe,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;QACvG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC,iBAAiB,EAAE,8BAA8B,CAAC;KACzD,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC;KACxC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,IAAmB,EAAE,EAAE;IACpC,MAAM,YAAY,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { 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,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;QACzD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,CAAA;QAE5D,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC3B,EAAE,EAAE,CAAC,CAAC,EAAE;gBACR,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,WAAW,EAAE,CAAC,CAAC,WAAW;gBAC1B,iBAAiB,EAAE,CAAC,CAAC,iBAAiB;gBACtC,WAAW,EAAE,CAAC,CAAC,WAAW;gBAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC;SACJ,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAA;IAC5C,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAC1F,IAAI,OAAO,CAAC,MAAM,CAAC;KAChB,WAAW,CAAC,yBAAyB,CAAC;KACtC,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;KAC/B,MAAM,CAAC,WAAW,EAAE,+BAA+B,EAAE,KAAK,CAAC;KAC3D,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC;KACxC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,IAAkC,EAAE,EAAE;IAClE,SAAS,CAAC,MAAM,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AACvD,CAAC,CAAC,CACL,CAAA"}
@@ -0,0 +1,37 @@
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
+ }): Promise<MessageResult>;
24
+ export declare function dmAction(email: string, text: string, options: BotOption & {
25
+ markdown?: boolean;
26
+ }): Promise<MessageResult>;
27
+ export declare function listAction(space: string, options: BotOption & {
28
+ max?: string;
29
+ }): Promise<MessageResult>;
30
+ export declare function getAction(messageId: string, options: BotOption): Promise<MessageResult>;
31
+ export declare function deleteAction(messageId: string, options: BotOption): Promise<MessageResult>;
32
+ export declare function editAction(messageId: string, space: string, text: string, options: BotOption & {
33
+ markdown?: boolean;
34
+ }): Promise<MessageResult>;
35
+ export declare const messageCommand: Command;
36
+ export {};
37
+ //# 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,CAAA;CAAE,GAC1C,OAAO,CAAC,aAAa,CAAC,CASxB;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,SAqExB,CAAA"}
@@ -0,0 +1,142 @@
1
+ import { Command } from 'commander';
2
+ import { cliOutput } from '../../../shared/utils/cli-output.js';
3
+ import { getClient } from './shared.js';
4
+ function formatMessage(message) {
5
+ return {
6
+ id: message.id,
7
+ roomId: message.roomId,
8
+ text: message.text,
9
+ markdown: message.markdown,
10
+ html: message.html,
11
+ personEmail: message.personEmail,
12
+ created: message.created,
13
+ };
14
+ }
15
+ export async function sendAction(space, text, options) {
16
+ try {
17
+ const client = await getClient(options);
18
+ const message = await client.sendMessage(space, text, { markdown: options.markdown });
19
+ return formatMessage(message);
20
+ }
21
+ catch (error) {
22
+ return { error: error.message };
23
+ }
24
+ }
25
+ export async function dmAction(email, text, options) {
26
+ try {
27
+ const client = await getClient(options);
28
+ const message = await client.sendDirectMessage(email, text, { markdown: options.markdown });
29
+ return formatMessage(message);
30
+ }
31
+ catch (error) {
32
+ return { error: error.message };
33
+ }
34
+ }
35
+ export async function listAction(space, options) {
36
+ try {
37
+ const client = await getClient(options);
38
+ const max = options.max ? parseInt(options.max, 10) : 50;
39
+ const messages = await client.listMessages(space, { 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
+ }
54
+ export async function getAction(messageId, options) {
55
+ try {
56
+ const client = await getClient(options);
57
+ const message = await client.getMessage(messageId);
58
+ return formatMessage(message);
59
+ }
60
+ catch (error) {
61
+ return { error: error.message };
62
+ }
63
+ }
64
+ export async function deleteAction(messageId, options) {
65
+ try {
66
+ const client = await getClient(options);
67
+ await client.deleteMessage(messageId);
68
+ return { deleted: messageId };
69
+ }
70
+ catch (error) {
71
+ return { error: error.message };
72
+ }
73
+ }
74
+ export async function editAction(messageId, space, text, options) {
75
+ try {
76
+ const client = await getClient(options);
77
+ const message = await client.editMessage(messageId, space, text, { markdown: options.markdown });
78
+ return formatMessage(message);
79
+ }
80
+ catch (error) {
81
+ return { error: error.message };
82
+ }
83
+ }
84
+ export const messageCommand = new Command('message')
85
+ .description('Message commands')
86
+ .addCommand(new Command('send')
87
+ .description('Send a message to a space')
88
+ .argument('<space>', 'Space/Room ID')
89
+ .argument('<text>', 'Message text')
90
+ .option('--markdown', 'Send as markdown')
91
+ .option('--bot <id>', 'Use specific bot')
92
+ .option('--pretty', 'Pretty print JSON output')
93
+ .action(async (space, text, opts) => {
94
+ cliOutput(await sendAction(space, text, opts), opts.pretty);
95
+ }))
96
+ .addCommand(new Command('dm')
97
+ .description('Send a direct message by recipient email')
98
+ .argument('<email>', 'Recipient email address')
99
+ .argument('<text>', 'Message text')
100
+ .option('--markdown', 'Send as markdown')
101
+ .option('--bot <id>', 'Use specific bot')
102
+ .option('--pretty', 'Pretty print JSON output')
103
+ .action(async (email, text, opts) => {
104
+ cliOutput(await dmAction(email, text, opts), opts.pretty);
105
+ }))
106
+ .addCommand(new Command('list')
107
+ .description('List messages in a space')
108
+ .argument('<space>', 'Space/Room ID')
109
+ .option('--max <n>', 'Number of messages to fetch', '50')
110
+ .option('--bot <id>', 'Use specific bot')
111
+ .option('--pretty', 'Pretty print JSON output')
112
+ .action(async (space, opts) => {
113
+ cliOutput(await listAction(space, opts), opts.pretty);
114
+ }))
115
+ .addCommand(new Command('get')
116
+ .description('Get a single message')
117
+ .argument('<id>', 'Message ID')
118
+ .option('--bot <id>', 'Use specific bot')
119
+ .option('--pretty', 'Pretty print JSON output')
120
+ .action(async (messageId, opts) => {
121
+ cliOutput(await getAction(messageId, opts), opts.pretty);
122
+ }))
123
+ .addCommand(new Command('delete')
124
+ .description('Delete a message')
125
+ .argument('<id>', 'Message ID')
126
+ .option('--bot <id>', 'Use specific bot')
127
+ .option('--pretty', 'Pretty print JSON output')
128
+ .action(async (messageId, opts) => {
129
+ cliOutput(await deleteAction(messageId, opts), opts.pretty);
130
+ }))
131
+ .addCommand(new Command('edit')
132
+ .description('Edit a message')
133
+ .argument('<id>', 'Message ID')
134
+ .argument('<space>', 'Space/Room ID')
135
+ .argument('<text>', 'New message text')
136
+ .option('--markdown', 'Send as markdown')
137
+ .option('--bot <id>', 'Use specific bot')
138
+ .option('--pretty', 'Pretty print JSON output')
139
+ .action(async (messageId, space, text, opts) => {
140
+ cliOutput(await editAction(messageId, space, text, opts), opts.pretty);
141
+ }));
142
+ //# sourceMappingURL=message.js.map
@@ -0,0 +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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SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AAC1D,CAAC,CAAC,CACL;KACA,UAAU,CACT,IAAI,OAAO,CAAC,QAAQ,CAAC;KAClB,WAAW,CAAC,kBAAkB,CAAC;KAC/B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;KAC9B,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC;KACxC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,SAAiB,EAAE,IAAe,EAAE,EAAE;IACnD,SAAS,CAAC,MAAM,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AAC7D,CAAC,CAAC,CACL;KACA,UAAU,CACT,IAAI,OAAO,CAAC,MAAM,CAAC;KAChB,WAAW,CAAC,gBAAgB,CAAC;KAC7B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;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,9 @@
1
+ import { WebexBotClient } from '../client.js';
2
+ import { WebexBotCredentialManager } from '../credential-manager.js';
3
+ export interface BotOption {
4
+ bot?: string;
5
+ pretty?: boolean;
6
+ _credManager?: WebexBotCredentialManager;
7
+ }
8
+ export declare function getClient(options: BotOption): Promise<WebexBotClient>;
9
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/shared.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAEjE,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,YAAY,CAAC,EAAE,yBAAyB,CAAA;CACzC;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAU3E"}
@@ -0,0 +1,13 @@
1
+ import { formatOutput } from '../../../shared/utils/output.js';
2
+ import { WebexBotClient } from '../client.js';
3
+ import { WebexBotCredentialManager } from '../credential-manager.js';
4
+ export async function getClient(options) {
5
+ const credManager = options._credManager ?? new WebexBotCredentialManager();
6
+ const creds = await credManager.getCredentials(options.bot);
7
+ if (!creds) {
8
+ console.log(formatOutput({ error: 'No credentials. Run "auth set <token>" first.' }, options.pretty));
9
+ process.exit(1);
10
+ }
11
+ return new WebexBotClient().login({ token: creds.token });
12
+ }
13
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AAQjE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAkB;IAChD,MAAM,WAAW,GAAG,OAAO,CAAC,YAAY,IAAI,IAAI,yBAAyB,EAAE,CAAA;IAC3E,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAE3D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,+CAA+C,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;QACrG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,OAAO,IAAI,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;AAC3D,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { Command } from 'commander';
2
+ import type { BotOption } from './shared.js';
3
+ interface SpaceResult {
4
+ id?: string;
5
+ title?: string;
6
+ type?: 'group' | 'direct';
7
+ isLocked?: boolean;
8
+ teamId?: string | null;
9
+ lastActivity?: string;
10
+ created?: string;
11
+ creatorId?: string;
12
+ spaces?: Array<{
13
+ id: string;
14
+ title: string;
15
+ type: 'group' | 'direct';
16
+ lastActivity: string;
17
+ created: string;
18
+ }>;
19
+ error?: string;
20
+ }
21
+ export declare function listAction(options: BotOption & {
22
+ max?: string;
23
+ type?: string;
24
+ }): Promise<SpaceResult>;
25
+ export declare function infoAction(spaceId: string, options: BotOption): Promise<SpaceResult>;
26
+ export declare const spaceCommand: Command;
27
+ export {};
28
+ //# sourceMappingURL=space.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC,UAAU,WAAW;IACnB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;QACxB,YAAY,EAAE,MAAM,CAAA;QACpB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAC,CAAA;IACF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,SAAS,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAkB3G;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAiB1F;AAED,eAAO,MAAM,YAAY,SAsBtB,CAAA"}
@@ -0,0 +1,61 @@
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(options) {
5
+ try {
6
+ const client = await getClient(options);
7
+ const max = options.max ? parseInt(options.max, 10) : 50;
8
+ const spaces = await client.listSpaces({ type: options.type, max });
9
+ return {
10
+ spaces: spaces.map((s) => ({
11
+ id: s.id,
12
+ title: s.title,
13
+ type: s.type,
14
+ lastActivity: s.lastActivity,
15
+ created: s.created,
16
+ })),
17
+ };
18
+ }
19
+ catch (error) {
20
+ return { error: error.message };
21
+ }
22
+ }
23
+ export async function infoAction(spaceId, options) {
24
+ try {
25
+ const client = await getClient(options);
26
+ const space = await client.getSpace(spaceId);
27
+ return {
28
+ id: space.id,
29
+ title: space.title,
30
+ type: space.type,
31
+ isLocked: space.isLocked,
32
+ teamId: space.teamId || null,
33
+ lastActivity: space.lastActivity,
34
+ created: space.created,
35
+ creatorId: space.creatorId,
36
+ };
37
+ }
38
+ catch (error) {
39
+ return { error: error.message };
40
+ }
41
+ }
42
+ export const spaceCommand = new Command('space')
43
+ .description('Space commands')
44
+ .addCommand(new Command('list')
45
+ .description('List spaces')
46
+ .option('--max <n>', 'Number of spaces to retrieve', '50')
47
+ .option('--type <type>', 'Filter by type (group or direct)')
48
+ .option('--bot <id>', 'Use specific bot')
49
+ .option('--pretty', 'Pretty print JSON output')
50
+ .action(async (opts) => {
51
+ cliOutput(await listAction(opts), opts.pretty);
52
+ }))
53
+ .addCommand(new Command('info')
54
+ .description('Get space details')
55
+ .argument('<id>', 'Space ID')
56
+ .option('--bot <id>', 'Use specific bot')
57
+ .option('--pretty', 'Pretty print JSON output')
58
+ .action(async (spaceId, opts) => {
59
+ cliOutput(await infoAction(spaceId, opts), opts.pretty);
60
+ }));
61
+ //# sourceMappingURL=space.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/space.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;AAqBpC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAoD;IACnF,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,EAAE,CAAA;QACxD,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AAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,gBAAgB,CAAC;KAC7B,UAAU,CACT,IAAI,OAAO,CAAC,MAAM,CAAC;KAChB,WAAW,CAAC,aAAa,CAAC;KAC1B,MAAM,CAAC,WAAW,EAAE,8BAA8B,EAAE,IAAI,CAAC;KACzD,MAAM,CAAC,eAAe,EAAE,kCAAkC,CAAC;KAC3D,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC;KACxC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,IAAiD,EAAE,EAAE;IAClE,SAAS,CAAC,MAAM,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AAChD,CAAC,CAAC,CACL;KACA,UAAU,CACT,IAAI,OAAO,CAAC,MAAM,CAAC;KAChB,WAAW,CAAC,mBAAmB,CAAC;KAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;KAC5B,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC;KACxC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,IAAe,EAAE,EAAE;IACjD,SAAS,CAAC,MAAM,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AACzD,CAAC,CAAC,CACL,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { Command } from 'commander';
2
+ import type { BotOption } from './shared.js';
3
+ interface WhoamiResult {
4
+ id?: string;
5
+ emails?: string[];
6
+ displayName?: string;
7
+ avatar?: string;
8
+ orgId?: string;
9
+ type?: 'person' | 'bot';
10
+ created?: string;
11
+ error?: string;
12
+ }
13
+ export declare function whoamiAction(options: BotOption): Promise<WhoamiResult>;
14
+ export declare const whoamiCommand: Command;
15
+ export {};
16
+ //# sourceMappingURL=whoami.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGzC,UAAU,YAAY;IACpB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAgB5E;AAED,eAAO,MAAM,aAAa,SAMtB,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { Command } from 'commander';
2
+ import { cliOutput } from '../../../shared/utils/cli-output.js';
3
+ import { getClient } from './shared.js';
4
+ export async function whoamiAction(options) {
5
+ try {
6
+ const client = await getClient(options);
7
+ const info = await client.testAuth();
8
+ return {
9
+ id: info.id,
10
+ emails: info.emails,
11
+ displayName: info.displayName,
12
+ avatar: info.avatar,
13
+ orgId: info.orgId,
14
+ type: info.type,
15
+ created: info.created,
16
+ };
17
+ }
18
+ catch (error) {
19
+ return { error: error.message };
20
+ }
21
+ }
22
+ export const whoamiCommand = new Command('whoami')
23
+ .description('Show current authenticated bot')
24
+ .option('--bot <id>', 'Bot ID to use')
25
+ .option('--pretty', 'Pretty print JSON output')
26
+ .action(async (opts) => {
27
+ cliOutput(await whoamiAction(opts), opts.pretty);
28
+ });
29
+ //# sourceMappingURL=whoami.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../../../src/platforms/webexbot/commands/whoami.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;AAapC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAkB;IACnD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,CAAA;QACvC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAA;QACpC,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAA;IAC5C,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,gCAAgC,CAAC;KAC7C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC;KACrC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,IAAe,EAAE,EAAE;IAChC,SAAS,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;AAClD,CAAC,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ import type { WebexBotConfig, WebexBotCredentials } from './types.js';
2
+ export declare class WebexBotCredentialManager {
3
+ private configDir;
4
+ private credentialsPath;
5
+ constructor(configDir?: string);
6
+ load(): Promise<WebexBotConfig>;
7
+ save(config: WebexBotConfig): Promise<void>;
8
+ getCredentials(botId?: string): Promise<WebexBotCredentials | null>;
9
+ setCredentials(creds: WebexBotCredentials): Promise<void>;
10
+ removeBot(botId: string): Promise<boolean>;
11
+ setCurrent(botId: string): Promise<boolean>;
12
+ listAll(): Promise<Array<WebexBotCredentials & {
13
+ is_current: boolean;
14
+ }>>;
15
+ clearCredentials(): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=credential-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-manager.d.ts","sourceRoot":"","sources":["../../../../src/platforms/webexbot/credential-manager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAGlE,qBAAa,yBAAyB;IACpC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,eAAe,CAAQ;gBAEnB,SAAS,CAAC,EAAE,MAAM;IAKxB,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC;IAqB/B,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3C,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAqCnE,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBzD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAiB1C,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe3C,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,mBAAmB,GAAG;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAgBxE,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAGxC"}