agent-messenger 2.0.0 → 2.1.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/marketplace.json +14 -1
- package/.claude-plugin/plugin.json +4 -2
- package/README.md +33 -29
- package/dist/package.json +10 -2
- 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/app-config.d.ts +7 -0
- package/dist/src/platforms/webex/app-config.d.ts.map +1 -0
- package/dist/src/platforms/webex/app-config.js +20 -0
- package/dist/src/platforms/webex/app-config.js.map +1 -0
- package/dist/src/platforms/webex/cli.d.ts +5 -0
- package/dist/src/platforms/webex/cli.d.ts.map +1 -0
- package/dist/src/platforms/webex/cli.js +32 -0
- package/dist/src/platforms/webex/cli.js.map +1 -0
- package/dist/src/platforms/webex/client.d.ts +45 -0
- package/dist/src/platforms/webex/client.d.ts.map +1 -0
- package/dist/src/platforms/webex/client.js +175 -0
- package/dist/src/platforms/webex/client.js.map +1 -0
- package/dist/src/platforms/webex/commands/auth.d.ts +15 -0
- package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/auth.js +124 -0
- package/dist/src/platforms/webex/commands/auth.js.map +1 -0
- package/dist/src/platforms/webex/commands/index.d.ts +6 -0
- package/dist/src/platforms/webex/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/index.js +6 -0
- package/dist/src/platforms/webex/commands/index.js.map +1 -0
- package/dist/src/platforms/webex/commands/member.d.ts +7 -0
- package/dist/src/platforms/webex/commands/member.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/member.js +34 -0
- package/dist/src/platforms/webex/commands/member.js.map +1 -0
- package/dist/src/platforms/webex/commands/message.d.ts +26 -0
- package/dist/src/platforms/webex/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/message.js +153 -0
- package/dist/src/platforms/webex/commands/message.js.map +1 -0
- package/dist/src/platforms/webex/commands/snapshot.d.ts +9 -0
- package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/snapshot.js +72 -0
- package/dist/src/platforms/webex/commands/snapshot.js.map +1 -0
- package/dist/src/platforms/webex/commands/space.d.ts +11 -0
- package/dist/src/platforms/webex/commands/space.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/space.js +59 -0
- package/dist/src/platforms/webex/commands/space.js.map +1 -0
- package/dist/src/platforms/webex/credential-manager.d.ts +23 -0
- package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/webex/credential-manager.js +148 -0
- package/dist/src/platforms/webex/credential-manager.js.map +1 -0
- package/dist/src/platforms/webex/ensure-auth.d.ts +2 -0
- package/dist/src/platforms/webex/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/webex/ensure-auth.js +20 -0
- package/dist/src/platforms/webex/ensure-auth.js.map +1 -0
- package/dist/src/platforms/webex/index.d.ts +6 -0
- package/dist/src/platforms/webex/index.d.ts.map +1 -0
- package/dist/src/platforms/webex/index.js +5 -0
- package/dist/src/platforms/webex/index.js.map +1 -0
- package/dist/src/platforms/webex/types.d.ts +124 -0
- package/dist/src/platforms/webex/types.d.ts.map +1 -0
- package/dist/src/platforms/webex/types.js +63 -0
- package/dist/src/platforms/webex/types.js.map +1 -0
- package/dist/src/tui/adapters/webex-adapter.d.ts +14 -0
- package/dist/src/tui/adapters/webex-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/webex-adapter.js +79 -0
- package/dist/src/tui/adapters/webex-adapter.js.map +1 -0
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +2 -0
- package/dist/src/tui/app.js.map +1 -1
- package/docs/content/docs/cli/meta.json +1 -0
- package/docs/content/docs/cli/webex.mdx +291 -0
- package/docs/content/docs/sdk/meta.json +1 -1
- package/docs/content/docs/sdk/webex.mdx +260 -0
- package/docs/content/docs/tui.mdx +4 -3
- package/docs/src/app/page.tsx +2 -2
- package/package.json +10 -2
- 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-webex/SKILL.md +386 -0
- package/skills/agent-webex/references/authentication.md +318 -0
- package/skills/agent-webex/references/common-patterns.md +723 -0
- package/skills/agent-webex/templates/monitor-space.sh +165 -0
- package/skills/agent-webex/templates/post-message.sh +170 -0
- 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/app-config.test.ts +98 -0
- package/src/platforms/webex/app-config.ts +31 -0
- package/src/platforms/webex/cli.test.ts +58 -0
- package/src/platforms/webex/cli.ts +39 -0
- package/src/platforms/webex/client.test.ts +429 -0
- package/src/platforms/webex/client.ts +247 -0
- package/src/platforms/webex/commands/auth.test.ts +222 -0
- package/src/platforms/webex/commands/auth.ts +180 -0
- package/src/platforms/webex/commands/index.ts +5 -0
- package/src/platforms/webex/commands/member.test.ts +103 -0
- package/src/platforms/webex/commands/member.ts +45 -0
- package/src/platforms/webex/commands/message.test.ts +231 -0
- package/src/platforms/webex/commands/message.ts +204 -0
- package/src/platforms/webex/commands/snapshot.test.ts +96 -0
- package/src/platforms/webex/commands/snapshot.ts +91 -0
- package/src/platforms/webex/commands/space.test.ts +206 -0
- package/src/platforms/webex/commands/space.ts +74 -0
- package/src/platforms/webex/credential-manager.test.ts +314 -0
- package/src/platforms/webex/credential-manager.ts +197 -0
- package/src/platforms/webex/ensure-auth.test.ts +85 -0
- package/src/platforms/webex/ensure-auth.ts +19 -0
- package/src/platforms/webex/index.test.ts +25 -0
- package/src/platforms/webex/index.ts +17 -0
- package/src/platforms/webex/types.test.ts +307 -0
- package/src/platforms/webex/types.ts +127 -0
- package/src/tui/adapters/webex-adapter.ts +103 -0
- package/src/tui/app.ts +2 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { handleError } from '../../../shared/utils/error-handler.js';
|
|
3
|
+
import { formatOutput } from '../../../shared/utils/output.js';
|
|
4
|
+
import { getWebexAppCredentials } from '../app-config.js';
|
|
5
|
+
import { WebexClient } from '../client.js';
|
|
6
|
+
import { WebexCredentialManager } from '../credential-manager.js';
|
|
7
|
+
async function openBrowser(url) {
|
|
8
|
+
const { exec } = await import('node:child_process');
|
|
9
|
+
const command = process.platform === 'darwin'
|
|
10
|
+
? `open "${url}"`
|
|
11
|
+
: process.platform === 'win32'
|
|
12
|
+
? `start "" "${url}"`
|
|
13
|
+
: `xdg-open "${url}"`;
|
|
14
|
+
exec(command);
|
|
15
|
+
}
|
|
16
|
+
async function resolveClientCredentials(options) {
|
|
17
|
+
// 1. CLI flags
|
|
18
|
+
if (options.clientId || options.clientSecret) {
|
|
19
|
+
if (!options.clientId || !options.clientSecret) {
|
|
20
|
+
throw new Error('Both --client-id and --client-secret must be provided together.');
|
|
21
|
+
}
|
|
22
|
+
return { clientId: options.clientId, clientSecret: options.clientSecret };
|
|
23
|
+
}
|
|
24
|
+
// 2. Env vars → 3. Built-in defaults (always resolves)
|
|
25
|
+
return getWebexAppCredentials();
|
|
26
|
+
}
|
|
27
|
+
export async function loginAction(options) {
|
|
28
|
+
try {
|
|
29
|
+
const credManager = new WebexCredentialManager();
|
|
30
|
+
if (options.token) {
|
|
31
|
+
const client = await new WebexClient().login({ token: options.token });
|
|
32
|
+
const person = await client.testAuth();
|
|
33
|
+
await credManager.saveConfig({
|
|
34
|
+
accessToken: options.token,
|
|
35
|
+
refreshToken: '',
|
|
36
|
+
expiresAt: 0,
|
|
37
|
+
tokenType: 'manual',
|
|
38
|
+
});
|
|
39
|
+
console.log(formatOutput({
|
|
40
|
+
user: { id: person.id, displayName: person.displayName, emails: person.emails },
|
|
41
|
+
authenticated: true,
|
|
42
|
+
}, options.pretty));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const { clientId, clientSecret } = await resolveClientCredentials(options);
|
|
46
|
+
const device = await credManager.requestDeviceCode(clientId);
|
|
47
|
+
console.error(`Open this URL and enter the code: ${device.verificationUri}`);
|
|
48
|
+
console.error(`Code: ${device.userCode}`);
|
|
49
|
+
console.error('');
|
|
50
|
+
await openBrowser(device.verificationUriComplete);
|
|
51
|
+
console.error('Waiting for authorization...');
|
|
52
|
+
const config = await credManager.pollDeviceToken(device.deviceCode, device.interval, device.expiresIn, clientId, clientSecret);
|
|
53
|
+
await credManager.saveConfig({ ...config, clientId, clientSecret, tokenType: 'oauth' });
|
|
54
|
+
const client = await new WebexClient().login({ token: config.accessToken });
|
|
55
|
+
const person = await client.testAuth();
|
|
56
|
+
console.log(formatOutput({
|
|
57
|
+
user: { id: person.id, displayName: person.displayName, emails: person.emails },
|
|
58
|
+
authenticated: true,
|
|
59
|
+
}, options.pretty));
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
handleError(error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export async function statusAction(options) {
|
|
66
|
+
try {
|
|
67
|
+
const credManager = new WebexCredentialManager();
|
|
68
|
+
const config = await credManager.loadConfig();
|
|
69
|
+
const token = await credManager.getToken(config?.clientId, config?.clientSecret);
|
|
70
|
+
if (!token) {
|
|
71
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth login" first.' }, options.pretty));
|
|
72
|
+
process.exit(1);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const client = await new WebexClient().login({ token });
|
|
77
|
+
const person = await client.testAuth();
|
|
78
|
+
console.log(formatOutput({
|
|
79
|
+
authenticated: true,
|
|
80
|
+
user: { id: person.id, displayName: person.displayName, emails: person.emails },
|
|
81
|
+
}, options.pretty));
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
console.log(formatOutput({ authenticated: false, user: null }, options.pretty));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
handleError(error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export async function logoutAction(options) {
|
|
92
|
+
try {
|
|
93
|
+
const credManager = new WebexCredentialManager();
|
|
94
|
+
const config = await credManager.loadConfig();
|
|
95
|
+
if (!config) {
|
|
96
|
+
console.log(formatOutput({ error: 'Not authenticated. Run "auth login" first.' }, options.pretty));
|
|
97
|
+
process.exit(1);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
await credManager.clearCredentials();
|
|
101
|
+
console.log(formatOutput({ removed: 'webex', success: true }, options.pretty));
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
handleError(error);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export const authCommand = new Command('auth')
|
|
108
|
+
.description('Authentication commands')
|
|
109
|
+
.addCommand(new Command('login')
|
|
110
|
+
.description('Login to Webex')
|
|
111
|
+
.option('--token <token>', 'Use a bot token or personal access token directly')
|
|
112
|
+
.option('--client-id <id>', 'Webex Integration client ID')
|
|
113
|
+
.option('--client-secret <secret>', 'Webex Integration client secret')
|
|
114
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
115
|
+
.action(loginAction))
|
|
116
|
+
.addCommand(new Command('status')
|
|
117
|
+
.description('Show authentication status')
|
|
118
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
119
|
+
.action(statusAction))
|
|
120
|
+
.addCommand(new Command('logout')
|
|
121
|
+
.description('Logout from Webex')
|
|
122
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
123
|
+
.action(logoutAction));
|
|
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AAgB,EAAE,CAAA;QACpC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAChF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAc,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,yBAAyB,CAAC;KACtC,UAAU,CACT,IAAI,OAAO,CAAC,OAAO,CAAC;KACjB,WAAW,CAAC,gBAAgB,CAAC;KAC7B,MAAM,CAAC,iBAAiB,EAAE,mDAAmD,CAAC;KAC9E,MAAM,CAAC,kBAAkB,EAAE,6BAA6B,CAAC;KACzD,MAAM,CAAC,0BAA0B,EAAE,iCAAiC,CAAC;KACrE,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,WAAW,CAAC,CACvB;KACA,UAAU,CACT,IAAI,OAAO,CAAC,QAAQ,CAAC;KAClB,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CACxB;KACA,UAAU,CACT,IAAI,OAAO,CAAC,QAAQ,CAAC;KAClB,WAAW,CAAC,mBAAmB,CAAC;KAChC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CACxB,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { authCommand } from './auth.js';
|
|
2
|
+
export { memberCommand } from './member.js';
|
|
3
|
+
export { messageCommand } from './message.js';
|
|
4
|
+
export { snapshotAction, snapshotCommand } from './snapshot.js';
|
|
5
|
+
export { spaceCommand } from './space.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { authCommand } from './auth.js';
|
|
2
|
+
export { memberCommand } from './member.js';
|
|
3
|
+
export { messageCommand } from './message.js';
|
|
4
|
+
export { snapshotAction, snapshotCommand } from './snapshot.js';
|
|
5
|
+
export { spaceCommand } from './space.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/member.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,eAAO,MAAM,aAAa,SAcvB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { handleError } from '../../../shared/utils/error-handler.js';
|
|
3
|
+
import { formatOutput } from '../../../shared/utils/output.js';
|
|
4
|
+
import { WebexClient } from '../client.js';
|
|
5
|
+
export async function listAction(spaceId, options) {
|
|
6
|
+
try {
|
|
7
|
+
const client = await new WebexClient().login();
|
|
8
|
+
const members = await client.listMemberships(spaceId, { max: options.limit });
|
|
9
|
+
const output = members.map((m) => ({
|
|
10
|
+
id: m.id,
|
|
11
|
+
personId: m.personId,
|
|
12
|
+
personEmail: m.personEmail,
|
|
13
|
+
personDisplayName: m.personDisplayName,
|
|
14
|
+
isModerator: m.isModerator,
|
|
15
|
+
created: m.created,
|
|
16
|
+
}));
|
|
17
|
+
console.log(formatOutput(output, options.pretty));
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
handleError(error);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const memberCommand = new Command('member')
|
|
24
|
+
.description('Member commands')
|
|
25
|
+
.addCommand(new Command('list')
|
|
26
|
+
.description('List members of a space')
|
|
27
|
+
.argument('<space-id>', 'Space ID')
|
|
28
|
+
.option('--limit <n>', 'Number of members to retrieve', '100')
|
|
29
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
30
|
+
.action((spaceId, options) => listAction(spaceId, {
|
|
31
|
+
limit: parseInt(options.limit, 10),
|
|
32
|
+
pretty: options.pretty,
|
|
33
|
+
})));
|
|
34
|
+
//# sourceMappingURL=member.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"member.js","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/member.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OA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AAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC3B,UAAU,CAAC,OAAO,EAAE;IAClB,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,MAAM;CACvB,CAAC,CACH,CACJ,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export declare function sendAction(spaceId: string, text: string, options: {
|
|
3
|
+
markdown?: boolean;
|
|
4
|
+
pretty?: boolean;
|
|
5
|
+
}): Promise<void>;
|
|
6
|
+
export declare function listAction(spaceId: string, options: {
|
|
7
|
+
limit?: number;
|
|
8
|
+
pretty?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare function getAction(messageId: string, options: {
|
|
11
|
+
pretty?: boolean;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
export declare function deleteAction(messageId: string, options: {
|
|
14
|
+
force?: boolean;
|
|
15
|
+
pretty?: boolean;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
export declare function editAction(messageId: string, spaceId: string, text: string, options: {
|
|
18
|
+
markdown?: boolean;
|
|
19
|
+
pretty?: boolean;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
export declare function dmAction(email: string, text: string, options: {
|
|
22
|
+
markdown?: boolean;
|
|
23
|
+
pretty?: boolean;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
export declare const messageCommand: Command;
|
|
26
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAChD,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5C,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,SAAS,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5B,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7C,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAChD,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAChD,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED,eAAO,MAAM,cAAc,SAyDxB,CAAA"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { handleError } from '../../../shared/utils/error-handler.js';
|
|
3
|
+
import { formatOutput } from '../../../shared/utils/output.js';
|
|
4
|
+
import { WebexClient } from '../client.js';
|
|
5
|
+
export async function sendAction(spaceId, text, options) {
|
|
6
|
+
try {
|
|
7
|
+
const client = await new WebexClient().login();
|
|
8
|
+
const message = await client.sendMessage(spaceId, text, { markdown: options.markdown });
|
|
9
|
+
const output = {
|
|
10
|
+
id: message.id,
|
|
11
|
+
roomId: message.roomId,
|
|
12
|
+
text: message.text,
|
|
13
|
+
personEmail: message.personEmail,
|
|
14
|
+
created: message.created,
|
|
15
|
+
};
|
|
16
|
+
console.log(formatOutput(output, options.pretty));
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
handleError(error);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function listAction(spaceId, options) {
|
|
23
|
+
try {
|
|
24
|
+
const client = await new WebexClient().login();
|
|
25
|
+
const limit = options.limit ?? 50;
|
|
26
|
+
const messages = await client.listMessages(spaceId, { max: limit });
|
|
27
|
+
const output = messages.map((msg) => ({
|
|
28
|
+
id: msg.id,
|
|
29
|
+
roomId: msg.roomId,
|
|
30
|
+
text: msg.text,
|
|
31
|
+
personEmail: msg.personEmail,
|
|
32
|
+
created: msg.created,
|
|
33
|
+
}));
|
|
34
|
+
console.log(formatOutput(output, options.pretty));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
handleError(error);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export async function getAction(messageId, options) {
|
|
41
|
+
try {
|
|
42
|
+
const client = await new WebexClient().login();
|
|
43
|
+
const message = await client.getMessage(messageId);
|
|
44
|
+
const output = {
|
|
45
|
+
id: message.id,
|
|
46
|
+
roomId: message.roomId,
|
|
47
|
+
text: message.text,
|
|
48
|
+
personEmail: message.personEmail,
|
|
49
|
+
created: message.created,
|
|
50
|
+
};
|
|
51
|
+
console.log(formatOutput(output, options.pretty));
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
handleError(error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export async function deleteAction(messageId, options) {
|
|
58
|
+
try {
|
|
59
|
+
if (!options.force) {
|
|
60
|
+
console.log(formatOutput({ warning: 'Use --force to confirm deletion', messageId }, options.pretty));
|
|
61
|
+
process.exit(0);
|
|
62
|
+
}
|
|
63
|
+
const client = await new WebexClient().login();
|
|
64
|
+
await client.deleteMessage(messageId);
|
|
65
|
+
console.log(formatOutput({ deleted: messageId }, options.pretty));
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
handleError(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export async function editAction(messageId, spaceId, text, options) {
|
|
72
|
+
try {
|
|
73
|
+
const client = await new WebexClient().login();
|
|
74
|
+
const message = await client.editMessage(messageId, spaceId, text, {
|
|
75
|
+
markdown: options.markdown,
|
|
76
|
+
});
|
|
77
|
+
const output = {
|
|
78
|
+
id: message.id,
|
|
79
|
+
roomId: message.roomId,
|
|
80
|
+
text: message.text,
|
|
81
|
+
personEmail: message.personEmail,
|
|
82
|
+
created: message.created,
|
|
83
|
+
};
|
|
84
|
+
console.log(formatOutput(output, options.pretty));
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
handleError(error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export async function dmAction(email, text, options) {
|
|
91
|
+
try {
|
|
92
|
+
const client = await new WebexClient().login();
|
|
93
|
+
const message = await client.sendDirectMessage(email, text, { markdown: options.markdown });
|
|
94
|
+
const output = {
|
|
95
|
+
id: message.id,
|
|
96
|
+
roomId: message.roomId,
|
|
97
|
+
text: message.text,
|
|
98
|
+
personEmail: message.personEmail,
|
|
99
|
+
created: message.created,
|
|
100
|
+
};
|
|
101
|
+
console.log(formatOutput(output, options.pretty));
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
handleError(error);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export const messageCommand = new Command('message')
|
|
108
|
+
.description('Message commands')
|
|
109
|
+
.addCommand(new Command('send')
|
|
110
|
+
.description('Send message to a space')
|
|
111
|
+
.argument('<space-id>', 'Space/Room ID')
|
|
112
|
+
.argument('<text>', 'Message text')
|
|
113
|
+
.option('--markdown', 'Send as markdown')
|
|
114
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
115
|
+
.action(sendAction))
|
|
116
|
+
.addCommand(new Command('dm')
|
|
117
|
+
.description('Send a direct message by email')
|
|
118
|
+
.argument('<email>', 'Recipient email address')
|
|
119
|
+
.argument('<text>', 'Message text')
|
|
120
|
+
.option('--markdown', 'Send as markdown')
|
|
121
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
122
|
+
.action(dmAction))
|
|
123
|
+
.addCommand(new Command('list')
|
|
124
|
+
.description('List messages from a space')
|
|
125
|
+
.argument('<space-id>', 'Space/Room ID')
|
|
126
|
+
.option('--limit <n>', 'Number of messages to retrieve', '50')
|
|
127
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
128
|
+
.action((spaceId, options) => {
|
|
129
|
+
return listAction(spaceId, {
|
|
130
|
+
limit: parseInt(options.limit, 10),
|
|
131
|
+
pretty: options.pretty,
|
|
132
|
+
});
|
|
133
|
+
}))
|
|
134
|
+
.addCommand(new Command('get')
|
|
135
|
+
.description('Get a single message by ID')
|
|
136
|
+
.argument('<message-id>', 'Message ID')
|
|
137
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
138
|
+
.action(getAction))
|
|
139
|
+
.addCommand(new Command('delete')
|
|
140
|
+
.description('Delete a message')
|
|
141
|
+
.argument('<message-id>', 'Message ID')
|
|
142
|
+
.option('--force', 'Skip confirmation')
|
|
143
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
144
|
+
.action(deleteAction))
|
|
145
|
+
.addCommand(new Command('edit')
|
|
146
|
+
.description('Edit a message')
|
|
147
|
+
.argument('<message-id>', 'Message ID')
|
|
148
|
+
.argument('<space-id>', 'Space/Room ID (required by Webex API)')
|
|
149
|
+
.argument('<text>', 'New message text')
|
|
150
|
+
.option('--markdown', 'Send as markdown')
|
|
151
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
152
|
+
.action(editAction));
|
|
153
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAGvC,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAe,EACf,IAAY,EACZ,OAAiD;IAEjD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,WAAW,EAAE,CAAC,KAAK,EAAE,CAAA;QAC9C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;QAEvF,MAAM,MAAM,GAAG;YACb,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAA;QAED,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IACnD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAc,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAe,EACf,OAA6C;IAE7C,IAAI,CAAC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C,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAC;KACtC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CACxB;KACA,UAAU,CACT,IAAI,OAAO,CAAC,MAAM,CAAC;KAChB,WAAW,CAAC,gBAAgB,CAAC;KAC7B,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC;KACtC,QAAQ,CAAC,YAAY,EAAE,uCAAuC,CAAC;KAC/D,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;KACtC,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC;KACxC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,UAAU,CAAC,CACtB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export declare function snapshotAction(options: {
|
|
3
|
+
spacesOnly?: boolean;
|
|
4
|
+
membersOnly?: boolean;
|
|
5
|
+
limit?: number;
|
|
6
|
+
pretty?: boolean;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export declare const snapshotCommand: Command;
|
|
9
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+DhB;AAED,eAAO,MAAM,eAAe,SAaxB,CAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { parallelMap } from '../../../shared/utils/concurrency.js';
|
|
3
|
+
import { handleError } from '../../../shared/utils/error-handler.js';
|
|
4
|
+
import { formatOutput } from '../../../shared/utils/output.js';
|
|
5
|
+
import { WebexClient } from '../client.js';
|
|
6
|
+
export async function snapshotAction(options) {
|
|
7
|
+
try {
|
|
8
|
+
const client = await new WebexClient().login();
|
|
9
|
+
const messageLimit = options.limit || 20;
|
|
10
|
+
const snapshot = {};
|
|
11
|
+
if (!options.membersOnly) {
|
|
12
|
+
const spaces = await client.listSpaces({ max: 50 });
|
|
13
|
+
snapshot.spaces = spaces.map((s) => ({
|
|
14
|
+
id: s.id,
|
|
15
|
+
title: s.title,
|
|
16
|
+
type: s.type,
|
|
17
|
+
lastActivity: s.lastActivity,
|
|
18
|
+
}));
|
|
19
|
+
if (!options.spacesOnly) {
|
|
20
|
+
const spaceMessages = await parallelMap(spaces, async (space) => {
|
|
21
|
+
const messages = await client.listMessages(space.id, { max: messageLimit });
|
|
22
|
+
return messages.map((msg) => ({
|
|
23
|
+
...msg,
|
|
24
|
+
space_title: space.title,
|
|
25
|
+
}));
|
|
26
|
+
}, 5);
|
|
27
|
+
snapshot.recent_messages = spaceMessages.flat().map((msg) => ({
|
|
28
|
+
space_id: msg.roomId,
|
|
29
|
+
space_title: msg.space_title,
|
|
30
|
+
id: msg.id,
|
|
31
|
+
author: msg.personEmail,
|
|
32
|
+
text: msg.text || msg.markdown || '',
|
|
33
|
+
created: msg.created,
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!options.spacesOnly) {
|
|
38
|
+
// Get members for the first few spaces (avoid massive API calls)
|
|
39
|
+
const spaces = await client.listSpaces({ max: 10 });
|
|
40
|
+
const spaceMembers = await parallelMap(spaces, async (space) => {
|
|
41
|
+
const members = await client.listMemberships(space.id, { max: 100 });
|
|
42
|
+
return members.map((m) => ({
|
|
43
|
+
space_id: space.id,
|
|
44
|
+
space_title: space.title,
|
|
45
|
+
personEmail: m.personEmail,
|
|
46
|
+
personDisplayName: m.personDisplayName,
|
|
47
|
+
isModerator: m.isModerator,
|
|
48
|
+
}));
|
|
49
|
+
}, 5);
|
|
50
|
+
snapshot.members = spaceMembers.flat();
|
|
51
|
+
}
|
|
52
|
+
console.log(formatOutput(snapshot, options.pretty));
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
handleError(error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export const snapshotCommand = new Command('snapshot')
|
|
59
|
+
.description('Get comprehensive workspace state for AI agents')
|
|
60
|
+
.option('--spaces-only', 'Include only spaces (exclude messages and members)')
|
|
61
|
+
.option('--members-only', 'Include only members (exclude spaces and messages)')
|
|
62
|
+
.option('--limit <n>', 'Number of recent messages per space (default: 20)', '20')
|
|
63
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
64
|
+
.action(async (options) => {
|
|
65
|
+
await snapshotAction({
|
|
66
|
+
spacesOnly: options.spacesOnly,
|
|
67
|
+
membersOnly: options.membersOnly,
|
|
68
|
+
limit: parseInt(options.limit, 10),
|
|
69
|
+
pretty: options.pretty,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAGvC,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAKpC;IACC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG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iDAAiD,CAAC;KAC9D,MAAM,CAAC,eAAe,EAAE,oDAAoD,CAAC;KAC7E,MAAM,CAAC,gBAAgB,EAAE,oDAAoD,CAAC;KAC9E,MAAM,CAAC,aAAa,EAAE,mDAAmD,EAAE,IAAI,CAAC;KAChF,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxB,MAAM,cAAc,CAAC;QACnB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QAClC,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export declare function listAction(options: {
|
|
3
|
+
type?: string;
|
|
4
|
+
limit?: number;
|
|
5
|
+
pretty?: boolean;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
export declare function infoAction(spaceId: string, options: {
|
|
8
|
+
pretty?: boolean;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare const spaceCommand: Command;
|
|
11
|
+
//# sourceMappingURL=space.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,wBAAsB,UAAU,CAAC,OAAO,EAAE;IACxC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAehB;AAED,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC5B,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,eAAO,MAAM,YAAY,SAsBtB,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { handleError } from '../../../shared/utils/error-handler.js';
|
|
3
|
+
import { formatOutput } from '../../../shared/utils/output.js';
|
|
4
|
+
import { WebexClient } from '../client.js';
|
|
5
|
+
export async function listAction(options) {
|
|
6
|
+
try {
|
|
7
|
+
const client = await new WebexClient().login();
|
|
8
|
+
const spaces = await client.listSpaces({ type: options.type, max: options.limit });
|
|
9
|
+
const output = spaces.map((s) => ({
|
|
10
|
+
id: s.id,
|
|
11
|
+
title: s.title,
|
|
12
|
+
type: s.type,
|
|
13
|
+
lastActivity: s.lastActivity,
|
|
14
|
+
created: s.created,
|
|
15
|
+
}));
|
|
16
|
+
console.log(formatOutput(output, options.pretty));
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
handleError(error);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function infoAction(spaceId, options) {
|
|
23
|
+
try {
|
|
24
|
+
const client = await new WebexClient().login();
|
|
25
|
+
const space = await client.getSpace(spaceId);
|
|
26
|
+
const output = {
|
|
27
|
+
id: space.id,
|
|
28
|
+
title: space.title,
|
|
29
|
+
type: space.type,
|
|
30
|
+
isLocked: space.isLocked,
|
|
31
|
+
teamId: space.teamId || null,
|
|
32
|
+
lastActivity: space.lastActivity,
|
|
33
|
+
created: space.created,
|
|
34
|
+
creatorId: space.creatorId,
|
|
35
|
+
};
|
|
36
|
+
console.log(formatOutput(output, options.pretty));
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
handleError(error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const spaceCommand = new Command('space')
|
|
43
|
+
.description('Space commands')
|
|
44
|
+
.addCommand(new Command('list')
|
|
45
|
+
.description('List spaces')
|
|
46
|
+
.option('--type <type>', 'Filter by type (group or direct)')
|
|
47
|
+
.option('--limit <n>', 'Number of spaces to retrieve', '50')
|
|
48
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
49
|
+
.action((options) => listAction({
|
|
50
|
+
type: options.type,
|
|
51
|
+
limit: parseInt(options.limit, 10),
|
|
52
|
+
pretty: options.pretty,
|
|
53
|
+
})))
|
|
54
|
+
.addCommand(new Command('info')
|
|
55
|
+
.description('Get space details')
|
|
56
|
+
.argument('<space-id>', 'Space ID')
|
|
57
|
+
.option('--pretty', 'Pretty print JSON output')
|
|
58
|
+
.action(infoAction));
|
|
59
|
+
//# sourceMappingURL=space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.js","sourceRoot":"","sources":["../../../../../src/platforms/webex/commands/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAIhC;IACC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAI,WAAW,EAAE,CAAC,KAAK,EAAE,CAAA;QAC9C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;QAClF,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChC,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,YAAY,EAAE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AE,kCAAkC,CAAC;KAC3D,MAAM,CAAC,aAAa,EAAE,8BAA8B,EAAE,IAAI,CAAC;KAC3D,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAClB,UAAU,CAAC;IACT,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,MAAM;CACvB,CAAC,CACH,CACJ;KACA,UAAU,CACT,IAAI,OAAO,CAAC,MAAM,CAAC;KAChB,WAAW,CAAC,mBAAmB,CAAC;KAChC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;KAClC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,UAAU,CAAC,CACtB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WebexConfig } from './types.js';
|
|
2
|
+
declare const OAUTH_SCOPES = "spark:all";
|
|
3
|
+
export { OAUTH_SCOPES };
|
|
4
|
+
export declare class WebexCredentialManager {
|
|
5
|
+
private configDir;
|
|
6
|
+
private credentialsPath;
|
|
7
|
+
constructor(configDir?: string);
|
|
8
|
+
loadConfig(): Promise<WebexConfig | null>;
|
|
9
|
+
saveConfig(config: WebexConfig): Promise<void>;
|
|
10
|
+
getToken(clientId?: string, clientSecret?: string): Promise<string | null>;
|
|
11
|
+
refreshToken(refreshToken: string, clientId: string, clientSecret: string): Promise<WebexConfig | null>;
|
|
12
|
+
requestDeviceCode(clientId: string, scopes?: string): Promise<{
|
|
13
|
+
deviceCode: string;
|
|
14
|
+
userCode: string;
|
|
15
|
+
verificationUri: string;
|
|
16
|
+
verificationUriComplete: string;
|
|
17
|
+
expiresIn: number;
|
|
18
|
+
interval: number;
|
|
19
|
+
}>;
|
|
20
|
+
pollDeviceToken(deviceCode: string, interval: number, expiresIn: number, clientId: string, clientSecret?: string): Promise<WebexConfig>;
|
|
21
|
+
clearCredentials(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=credential-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-manager.d.ts","sourceRoot":"","sources":["../../../../src/platforms/webex/credential-manager.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAM1C,QAAA,MAAM,YAAY,cAAc,CAAA;AAEhC,OAAO,EAAE,YAAY,EAAE,CAAA;AAEvB,qBAAa,sBAAsB;IACjC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,eAAe,CAAQ;gBAEnB,SAAS,CAAC,EAAE,MAAM;IAKxB,UAAU,IAAI,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAQzC,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAoB1E,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAkCvG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAClE,UAAU,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,MAAM,CAAA;QAChB,eAAe,EAAE,MAAM,CAAA;QACvB,uBAAuB,EAAE,MAAM,CAAA;QAC/B,SAAS,EAAE,MAAM,CAAA;QACjB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAC;IAkCI,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EA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