agent-messenger 2.23.2 → 2.23.3
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/dist/package.json +1 -1
- package/dist/src/platforms/webex/client.d.ts.map +1 -1
- package/dist/src/platforms/webex/client.js +28 -16
- package/dist/src/platforms/webex/client.js.map +1 -1
- package/dist/src/platforms/webex/commands/auth.js +1 -2
- package/dist/src/platforms/webex/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/commands/member.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/member.js +2 -3
- package/dist/src/platforms/webex/commands/member.js.map +1 -1
- package/dist/src/platforms/webex/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/message.js +2 -3
- package/dist/src/platforms/webex/commands/message.js.map +1 -1
- package/dist/src/platforms/webex/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/whoami.js +2 -3
- package/dist/src/platforms/webex/commands/whoami.js.map +1 -1
- package/dist/src/platforms/webex/id-normalizer.d.ts +4 -0
- package/dist/src/platforms/webex/id-normalizer.d.ts.map +1 -1
- package/dist/src/platforms/webex/id-normalizer.js +87 -21
- package/dist/src/platforms/webex/id-normalizer.js.map +1 -1
- package/dist/src/platforms/webex/types.d.ts +20 -0
- package/dist/src/platforms/webex/types.d.ts.map +1 -1
- package/dist/src/platforms/webex/types.js +10 -0
- package/dist/src/platforms/webex/types.js.map +1 -1
- package/dist/src/platforms/webexbot/commands/file.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/commands/file.js +2 -3
- package/dist/src/platforms/webexbot/commands/file.js.map +1 -1
- package/dist/src/platforms/webexbot/commands/member.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/commands/member.js +2 -3
- package/dist/src/platforms/webexbot/commands/member.js.map +1 -1
- package/dist/src/platforms/webexbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/commands/message.js +6 -7
- package/dist/src/platforms/webexbot/commands/message.js.map +1 -1
- package/dist/src/platforms/webexbot/commands/snapshot.js +1 -1
- package/dist/src/platforms/webexbot/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/webexbot/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/commands/user.js +3 -4
- package/dist/src/platforms/webexbot/commands/user.js.map +1 -1
- package/dist/src/platforms/webexbot/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/webexbot/commands/whoami.js +2 -3
- package/dist/src/platforms/webexbot/commands/whoami.js.map +1 -1
- package/dist/src/tui/adapters/webex-adapter.js +2 -2
- package/dist/src/tui/adapters/webex-adapter.js.map +1 -1
- 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 +1 -1
- package/skills/agent-webexbot/SKILL.md +1 -1
- package/skills/agent-wechatbot/SKILL.md +1 -1
- package/skills/agent-whatsapp/SKILL.md +1 -1
- package/skills/agent-whatsappbot/SKILL.md +1 -1
- package/src/platforms/webex/client.ts +36 -16
- package/src/platforms/webex/commands/auth.ts +3 -3
- package/src/platforms/webex/commands/member.test.ts +6 -0
- package/src/platforms/webex/commands/member.ts +2 -3
- package/src/platforms/webex/commands/message.test.ts +6 -0
- package/src/platforms/webex/commands/message.ts +2 -3
- package/src/platforms/webex/commands/whoami.test.ts +2 -0
- package/src/platforms/webex/commands/whoami.ts +2 -3
- package/src/platforms/webex/id-normalizer.test.ts +245 -2
- package/src/platforms/webex/id-normalizer.ts +92 -21
- package/src/platforms/webex/listener.test.ts +3 -0
- package/src/platforms/webex/types.test.ts +20 -0
- package/src/platforms/webex/types.ts +20 -0
- package/src/platforms/webex/typings/webex-message-handler.d.ts +40 -2
- package/src/platforms/webexbot/commands/file.ts +2 -3
- package/src/platforms/webexbot/commands/member.ts +2 -3
- package/src/platforms/webexbot/commands/message.ts +6 -7
- package/src/platforms/webexbot/commands/snapshot.ts +1 -1
- package/src/platforms/webexbot/commands/user.test.ts +4 -0
- package/src/platforms/webexbot/commands/user.ts +3 -4
- package/src/platforms/webexbot/commands/whoami.ts +2 -3
- package/src/tui/adapters/webex-adapter.ts +2 -2
|
@@ -29,9 +29,9 @@ export class WebexAdapter {
|
|
|
29
29
|
return messages
|
|
30
30
|
.map((msg) => ({
|
|
31
31
|
id: msg.id,
|
|
32
|
-
ref:
|
|
32
|
+
ref: msg.ref,
|
|
33
33
|
channelId: msg.roomId,
|
|
34
|
-
channelRef:
|
|
34
|
+
channelRef: msg.roomRef,
|
|
35
35
|
author: msg.personEmail,
|
|
36
36
|
content: msg.text ?? '',
|
|
37
37
|
timestamp: msg.created,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webex-adapter.js","sourceRoot":"","sources":["../../../../src/tui/adapters/webex-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAEzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAA;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AAIvD,MAAM,OAAO,YAAY;IACd,IAAI,GAAG,OAAO,CAAA;IAEf,MAAM,GAAuB,IAAI,CAAA;IACjC,WAAW,GAAkB,IAAI,CAAA;IAEzC,KAAK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AC,QAAQ,EACf,MAAM,CAAC,SAAS,EAChB,QAAQ,EACR,YAAY,CACb,CAAA;QACD,MAAM,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;QAEpC,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAA;QAChC,MAAM,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;QACjD,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAA;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;QAEvC,EAAE,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW,GAAG,CAAC,CAAA;IACxE,CAAC;IAEO,YAAY;QAClB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;QACvD,CAAC;IACH,CAAC;CACF;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,OAAO,GACX,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAC3B,CAAC,CAAC,SAAS,GAAG,GAAG;QACjB,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO;YAC5B,CAAC,CAAC,aAAa,GAAG,GAAG;YACrB,CAAC,CAAC,aAAa,GAAG,GAAG,CAAA;IAC3B,IAAI,CAAC,OAAO,CAAC,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-messenger",
|
|
3
|
-
"version": "2.23.
|
|
3
|
+
"version": "2.23.3",
|
|
4
4
|
"description": "Multi-platform messaging CLI for AI agents (Slack, Discord, Teams, Webex, Telegram, Telegram Bot, WhatsApp, LINE, Instagram, KakaoTalk, Channel Talk)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-channeltalk
|
|
3
3
|
description: Interact with Channel Talk using extracted desktop app or browser credentials - read chats, send messages, search messages, manage groups
|
|
4
|
-
version: 2.23.
|
|
4
|
+
version: 2.23.3
|
|
5
5
|
allowed-tools: Bash(agent-channeltalk:*)
|
|
6
6
|
metadata:
|
|
7
7
|
openclaw:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-webexbot
|
|
3
3
|
description: Interact with Cisco Webex using bot tokens - send messages, reply in threads, upload and download files, look up people, read spaces, manage memberships, stream real-time events
|
|
4
|
-
version: 2.23.
|
|
4
|
+
version: 2.23.3
|
|
5
5
|
allowed-tools: Bash(agent-webexbot:*)
|
|
6
6
|
metadata:
|
|
7
7
|
openclaw:
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { WebexCredentialManager } from './credential-manager'
|
|
2
2
|
import { WebexEncryptionService } from './encryption'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
decodeWebexId,
|
|
5
|
+
normalizeSdkMembership,
|
|
6
|
+
normalizeSdkMessage,
|
|
7
|
+
normalizeSdkPerson,
|
|
8
|
+
toRestId,
|
|
9
|
+
} from './id-normalizer'
|
|
4
10
|
import { KmsKeyProvider } from './kms-key-provider'
|
|
5
11
|
import { escapeHtml, markdownToHtml, stripMarkdown } from './markdown-to-html'
|
|
6
12
|
import type { WebexConfig, WebexMembership, WebexMessage, WebexPerson, WebexSpace } from './types'
|
|
@@ -216,15 +222,24 @@ export class WebexClient {
|
|
|
216
222
|
async testAuth(): Promise<WebexPerson> {
|
|
217
223
|
if (this.useInternalAPI) {
|
|
218
224
|
try {
|
|
219
|
-
return await this.request<WebexPerson>('GET', '/people/me')
|
|
225
|
+
return normalizeSdkPerson(await this.request<WebexPerson>('GET', '/people/me'))
|
|
220
226
|
} catch (err) {
|
|
221
227
|
const isAuthError = err instanceof WebexError && (err.code === 'http_401' || err.code === 'http_403')
|
|
222
228
|
if (!isAuthError) throw err
|
|
223
229
|
await this.testAuthInternal()
|
|
224
|
-
return {
|
|
230
|
+
return normalizeSdkPerson({
|
|
231
|
+
id: '',
|
|
232
|
+
ref: '',
|
|
233
|
+
emails: [],
|
|
234
|
+
displayName: '',
|
|
235
|
+
orgId: '',
|
|
236
|
+
orgRef: '',
|
|
237
|
+
type: 'person',
|
|
238
|
+
created: '',
|
|
239
|
+
})
|
|
225
240
|
}
|
|
226
241
|
}
|
|
227
|
-
return this.request<WebexPerson>('GET', '/people/me')
|
|
242
|
+
return normalizeSdkPerson(await this.request<WebexPerson>('GET', '/people/me'))
|
|
228
243
|
}
|
|
229
244
|
|
|
230
245
|
private async testAuthInternal(): Promise<void> {
|
|
@@ -324,7 +339,7 @@ export class WebexClient {
|
|
|
324
339
|
else body.text = text
|
|
325
340
|
if (resolvedOptions?.parentId) body.parentId = resolvedOptions.parentId
|
|
326
341
|
if (resolvedOptions?.files?.length) body.files = resolvedOptions.files
|
|
327
|
-
return this.request<WebexMessage>('POST', '/messages', body)
|
|
342
|
+
return normalizeSdkMessage(await this.request<WebexMessage>('POST', '/messages', body))
|
|
328
343
|
}
|
|
329
344
|
|
|
330
345
|
private get useInternalAPI(): boolean {
|
|
@@ -376,15 +391,18 @@ export class WebexClient {
|
|
|
376
391
|
}
|
|
377
392
|
}
|
|
378
393
|
|
|
379
|
-
return {
|
|
394
|
+
return normalizeSdkMessage({
|
|
380
395
|
id: this.normalizeMessageId(a.id),
|
|
396
|
+
ref: '',
|
|
381
397
|
roomId,
|
|
398
|
+
roomRef: '',
|
|
382
399
|
roomType: 'group' as const,
|
|
383
400
|
text,
|
|
384
401
|
personId: this.normalizePersonId(a.actor?.entryUUID ?? a.actor?.id ?? ''),
|
|
402
|
+
personRef: '',
|
|
385
403
|
personEmail: a.actor?.emailAddress ?? '',
|
|
386
404
|
created: a.published,
|
|
387
|
-
}
|
|
405
|
+
})
|
|
388
406
|
}
|
|
389
407
|
|
|
390
408
|
private async buildEncryptedObject(
|
|
@@ -469,7 +487,7 @@ export class WebexClient {
|
|
|
469
487
|
const body = options?.markdown
|
|
470
488
|
? { toPersonEmail: personEmail, markdown: text }
|
|
471
489
|
: { toPersonEmail: personEmail, text }
|
|
472
|
-
return this.request<WebexMessage>('POST', '/messages', body)
|
|
490
|
+
return normalizeSdkMessage(await this.request<WebexMessage>('POST', '/messages', body))
|
|
473
491
|
}
|
|
474
492
|
|
|
475
493
|
private async findDirectRoomByEmail(email: string): Promise<string | null> {
|
|
@@ -505,7 +523,7 @@ export class WebexClient {
|
|
|
505
523
|
if (resolvedOptions?.mentionedPeople) params.set('mentionedPeople', resolvedOptions.mentionedPeople)
|
|
506
524
|
if (resolvedOptions?.parentId) params.set('parentId', resolvedOptions.parentId)
|
|
507
525
|
const data = await this.request<{ items: WebexMessage[] }>('GET', `/messages?${params}`)
|
|
508
|
-
return data.items
|
|
526
|
+
return data.items.map(normalizeSdkMessage)
|
|
509
527
|
}
|
|
510
528
|
|
|
511
529
|
async getMessage(messageId: string): Promise<WebexMessage> {
|
|
@@ -521,7 +539,7 @@ export class WebexClient {
|
|
|
521
539
|
const roomId = convId ? Buffer.from(`ciscospark://urn:TEAM:unknown/ROOM/${convId}`).toString('base64') : ''
|
|
522
540
|
return this.activityToMessage(activity, roomId)
|
|
523
541
|
}
|
|
524
|
-
return this.request<WebexMessage>('GET', `/messages/${this.resolveMessageId(messageId)}`)
|
|
542
|
+
return normalizeSdkMessage(await this.request<WebexMessage>('GET', `/messages/${this.resolveMessageId(messageId)}`))
|
|
525
543
|
}
|
|
526
544
|
|
|
527
545
|
async deleteMessage(messageId: string): Promise<void> {
|
|
@@ -588,7 +606,9 @@ export class WebexClient {
|
|
|
588
606
|
return this.activityToMessage(result, resolvedRoomId)
|
|
589
607
|
}
|
|
590
608
|
const body = options?.markdown ? { roomId: resolvedRoomId, markdown: text } : { roomId: resolvedRoomId, text }
|
|
591
|
-
return
|
|
609
|
+
return normalizeSdkMessage(
|
|
610
|
+
await this.request<WebexMessage>('PUT', `/messages/${this.resolveMessageId(messageId)}`, body),
|
|
611
|
+
)
|
|
592
612
|
}
|
|
593
613
|
|
|
594
614
|
async listPeople(options?: { email?: string; displayName?: string; max?: number }): Promise<WebexPerson[]> {
|
|
@@ -599,7 +619,7 @@ export class WebexClient {
|
|
|
599
619
|
const query = params.toString()
|
|
600
620
|
const path = query ? `/people?${query}` : '/people'
|
|
601
621
|
const data = await this.request<{ items: WebexPerson[] }>('GET', path)
|
|
602
|
-
return data.items
|
|
622
|
+
return data.items.map(normalizeSdkPerson)
|
|
603
623
|
}
|
|
604
624
|
|
|
605
625
|
async getPerson(personId: string): Promise<WebexPerson> {
|
|
@@ -610,14 +630,14 @@ export class WebexClient {
|
|
|
610
630
|
}
|
|
611
631
|
return person
|
|
612
632
|
}
|
|
613
|
-
return this.request<WebexPerson>('GET', `/people/${await this.resolvePersonId(personId)}`)
|
|
633
|
+
return normalizeSdkPerson(await this.request<WebexPerson>('GET', `/people/${await this.resolvePersonId(personId)}`))
|
|
614
634
|
}
|
|
615
635
|
|
|
616
636
|
async listMyMemberships(options?: { max?: number }): Promise<WebexMembership[]> {
|
|
617
637
|
const params = new URLSearchParams()
|
|
618
638
|
params.set('max', String(options?.max ?? 100))
|
|
619
639
|
const data = await this.request<{ items: WebexMembership[] }>('GET', `/memberships?${params}`)
|
|
620
|
-
return data.items
|
|
640
|
+
return data.items.map(normalizeSdkMembership)
|
|
621
641
|
}
|
|
622
642
|
|
|
623
643
|
async listMemberships(roomId: string, options?: { max?: number }): Promise<WebexMembership[]> {
|
|
@@ -626,7 +646,7 @@ export class WebexClient {
|
|
|
626
646
|
params.set('roomId', resolvedRoomId)
|
|
627
647
|
if (options?.max) params.set('max', String(options.max))
|
|
628
648
|
const data = await this.request<{ items: WebexMembership[] }>('GET', `/memberships?${params}`)
|
|
629
|
-
return data.items
|
|
649
|
+
return data.items.map(normalizeSdkMembership)
|
|
630
650
|
}
|
|
631
651
|
|
|
632
652
|
async uploadFile(
|
|
@@ -654,7 +674,7 @@ export class WebexClient {
|
|
|
654
674
|
const errorBody = (await response.json().catch(() => null)) as { message?: string } | null
|
|
655
675
|
throw new WebexError(errorBody?.message ?? `HTTP ${response.status}`, `http_${response.status}`)
|
|
656
676
|
}
|
|
657
|
-
return response.json() as
|
|
677
|
+
return normalizeSdkMessage((await response.json()) as WebexMessage)
|
|
658
678
|
}
|
|
659
679
|
|
|
660
680
|
private async lookupRoomId(uuid: string, fallback: string): Promise<string> {
|
|
@@ -12,9 +12,9 @@ import { info, debug, error as stderrError } from '@/shared/utils/stderr'
|
|
|
12
12
|
import { getWebexAppCredentials } from '../app-config'
|
|
13
13
|
import { WebexClient } from '../client'
|
|
14
14
|
import { WebexCredentialManager } from '../credential-manager'
|
|
15
|
-
import { toRef } from '../id-normalizer'
|
|
16
15
|
import { loginWithPassword, WEB_CLIENT_ID, WEB_CLIENT_SECRET } from '../password-login'
|
|
17
16
|
import { WebexTokenExtractor } from '../token-extractor'
|
|
17
|
+
import type { WebexPerson } from '../types'
|
|
18
18
|
import { WebexError } from '../types'
|
|
19
19
|
|
|
20
20
|
interface ResolvedCredentials {
|
|
@@ -22,8 +22,8 @@ interface ResolvedCredentials {
|
|
|
22
22
|
clientSecret: string
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function formatAuthUser(person:
|
|
26
|
-
return { id: person.id, ref:
|
|
25
|
+
function formatAuthUser(person: WebexPerson) {
|
|
26
|
+
return { id: person.id, ref: person.ref, displayName: person.displayName, emails: person.emails }
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
async function openBrowser(url: string): Promise<void> {
|
|
@@ -12,8 +12,11 @@ const person2Id = restId('PEOPLE', 'person-2')
|
|
|
12
12
|
const mockMembers = [
|
|
13
13
|
{
|
|
14
14
|
id: member1Id,
|
|
15
|
+
ref: 'person-1:room-1',
|
|
15
16
|
roomId: 'room-1',
|
|
17
|
+
roomRef: 'room-1',
|
|
16
18
|
personId: person1Id,
|
|
19
|
+
personRef: 'person-1',
|
|
17
20
|
personEmail: 'alice@example.com',
|
|
18
21
|
personDisplayName: 'Alice',
|
|
19
22
|
isModerator: true,
|
|
@@ -21,8 +24,11 @@ const mockMembers = [
|
|
|
21
24
|
},
|
|
22
25
|
{
|
|
23
26
|
id: member2Id,
|
|
27
|
+
ref: 'person-2:room-1',
|
|
24
28
|
roomId: 'room-1',
|
|
29
|
+
roomRef: 'room-1',
|
|
25
30
|
personId: person2Id,
|
|
31
|
+
personRef: 'person-2',
|
|
26
32
|
personEmail: 'bob@example.com',
|
|
27
33
|
personDisplayName: 'Bob',
|
|
28
34
|
isModerator: false,
|
|
@@ -4,7 +4,6 @@ import { handleError } from '@/shared/utils/error-handler'
|
|
|
4
4
|
import { formatOutput } from '@/shared/utils/output'
|
|
5
5
|
|
|
6
6
|
import { WebexClient } from '../client'
|
|
7
|
-
import { toRef } from '../id-normalizer'
|
|
8
7
|
|
|
9
8
|
export async function listAction(spaceId: string, options: { limit?: number; pretty?: boolean }): Promise<void> {
|
|
10
9
|
try {
|
|
@@ -13,9 +12,9 @@ export async function listAction(spaceId: string, options: { limit?: number; pre
|
|
|
13
12
|
|
|
14
13
|
const output = members.map((m) => ({
|
|
15
14
|
id: m.id,
|
|
16
|
-
ref:
|
|
15
|
+
ref: m.ref,
|
|
17
16
|
personId: m.personId,
|
|
18
|
-
personRef:
|
|
17
|
+
personRef: m.personRef,
|
|
19
18
|
personEmail: m.personEmail,
|
|
20
19
|
personDisplayName: m.personDisplayName,
|
|
21
20
|
isModerator: m.isModerator,
|
|
@@ -11,22 +11,28 @@ const personId = toRestId('person_789', 'PEOPLE')
|
|
|
11
11
|
|
|
12
12
|
const mockMessage = {
|
|
13
13
|
id: messageId,
|
|
14
|
+
ref: 'msg_123',
|
|
14
15
|
roomId,
|
|
16
|
+
roomRef: 'space_456',
|
|
15
17
|
roomType: 'group' as const,
|
|
16
18
|
text: 'Hello world',
|
|
17
19
|
html: '<p>Hello <a href="https://example.com">world</a></p>',
|
|
18
20
|
personId,
|
|
21
|
+
personRef: 'person_789',
|
|
19
22
|
personEmail: 'user@example.com',
|
|
20
23
|
created: '2025-01-29T10:00:00.000Z',
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
const mockMessage2 = {
|
|
24
27
|
id: message2Id,
|
|
28
|
+
ref: 'msg_124',
|
|
25
29
|
roomId,
|
|
30
|
+
roomRef: 'space_456',
|
|
26
31
|
roomType: 'group' as const,
|
|
27
32
|
text: 'Second message',
|
|
28
33
|
html: '<p>Second message</p>',
|
|
29
34
|
personId,
|
|
35
|
+
personRef: 'person_789',
|
|
30
36
|
personEmail: 'user@example.com',
|
|
31
37
|
created: '2025-01-29T10:01:00.000Z',
|
|
32
38
|
}
|
|
@@ -4,15 +4,14 @@ import { handleError } from '@/shared/utils/error-handler'
|
|
|
4
4
|
import { formatOutput } from '@/shared/utils/output'
|
|
5
5
|
|
|
6
6
|
import { WebexClient } from '../client'
|
|
7
|
-
import { toRef } from '../id-normalizer'
|
|
8
7
|
import type { WebexMessage } from '../types'
|
|
9
8
|
|
|
10
9
|
function formatMessageOutput(message: WebexMessage) {
|
|
11
10
|
return {
|
|
12
11
|
id: message.id,
|
|
13
|
-
ref:
|
|
12
|
+
ref: message.ref,
|
|
14
13
|
roomId: message.roomId,
|
|
15
|
-
roomRef:
|
|
14
|
+
roomRef: message.roomRef,
|
|
16
15
|
text: message.text,
|
|
17
16
|
html: message.html,
|
|
18
17
|
personEmail: message.personEmail,
|
|
@@ -10,6 +10,7 @@ const personId = toRestId('person-123', 'PEOPLE')
|
|
|
10
10
|
|
|
11
11
|
const mockUser = {
|
|
12
12
|
id: personId,
|
|
13
|
+
ref: 'person-123',
|
|
13
14
|
emails: ['test@example.com'],
|
|
14
15
|
displayName: 'Test User',
|
|
15
16
|
nickName: 'Testy',
|
|
@@ -17,6 +18,7 @@ const mockUser = {
|
|
|
17
18
|
lastName: 'User',
|
|
18
19
|
avatar: 'https://example.com/avatar.jpg',
|
|
19
20
|
orgId,
|
|
21
|
+
orgRef: 'org-123',
|
|
20
22
|
type: 'person' as const,
|
|
21
23
|
created: '2024-01-01T00:00:00.000Z',
|
|
22
24
|
}
|
|
@@ -4,7 +4,6 @@ import { handleError } from '@/shared/utils/error-handler'
|
|
|
4
4
|
import { formatOutput } from '@/shared/utils/output'
|
|
5
5
|
|
|
6
6
|
import { WebexClient } from '../client'
|
|
7
|
-
import { toRef } from '../id-normalizer'
|
|
8
7
|
|
|
9
8
|
export async function whoamiAction(options: { pretty?: boolean }): Promise<void> {
|
|
10
9
|
try {
|
|
@@ -13,7 +12,7 @@ export async function whoamiAction(options: { pretty?: boolean }): Promise<void>
|
|
|
13
12
|
|
|
14
13
|
const output = {
|
|
15
14
|
id: user.id,
|
|
16
|
-
ref:
|
|
15
|
+
ref: user.ref,
|
|
17
16
|
emails: user.emails,
|
|
18
17
|
displayName: user.displayName,
|
|
19
18
|
nickName: user.nickName,
|
|
@@ -21,7 +20,7 @@ export async function whoamiAction(options: { pretty?: boolean }): Promise<void>
|
|
|
21
20
|
lastName: user.lastName,
|
|
22
21
|
avatar: user.avatar,
|
|
23
22
|
orgId: user.orgId,
|
|
24
|
-
orgRef:
|
|
23
|
+
orgRef: user.orgRef,
|
|
25
24
|
type: user.type,
|
|
26
25
|
}
|
|
27
26
|
console.log(formatOutput(output, options.pretty))
|