agent-messenger 2.9.0 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/dist/package.json +1 -1
- package/dist/src/platforms/teams/client.d.ts +9 -1
- package/dist/src/platforms/teams/client.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.js +69 -18
- package/dist/src/platforms/teams/client.js.map +1 -1
- package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/auth.js +7 -2
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/commands/channel.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/channel.js +18 -3
- package/dist/src/platforms/teams/commands/channel.js.map +1 -1
- package/dist/src/platforms/teams/commands/file.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/file.js +18 -3
- package/dist/src/platforms/teams/commands/file.js.map +1 -1
- package/dist/src/platforms/teams/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/message.js +24 -4
- package/dist/src/platforms/teams/commands/message.js.map +1 -1
- package/dist/src/platforms/teams/commands/reaction.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/reaction.js +12 -2
- package/dist/src/platforms/teams/commands/reaction.js.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.js +6 -1
- package/dist/src/platforms/teams/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/teams/commands/team.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/team.js +6 -1
- package/dist/src/platforms/teams/commands/team.js.map +1 -1
- package/dist/src/platforms/teams/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/user.js +18 -3
- package/dist/src/platforms/teams/commands/user.js.map +1 -1
- package/dist/src/platforms/teams/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/whoami.js +6 -1
- package/dist/src/platforms/teams/commands/whoami.js.map +1 -1
- package/dist/src/platforms/teams/credential-manager.d.ts +3 -1
- package/dist/src/platforms/teams/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/teams/credential-manager.js +6 -1
- package/dist/src/platforms/teams/credential-manager.js.map +1 -1
- package/dist/src/platforms/teams/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/teams/ensure-auth.js +7 -2
- package/dist/src/platforms/teams/ensure-auth.js.map +1 -1
- package/dist/src/platforms/teams/token-extractor.d.ts +3 -1
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/teams/token-extractor.js +67 -10
- package/dist/src/platforms/teams/token-extractor.js.map +1 -1
- package/dist/src/platforms/teams/types.d.ts +17 -0
- package/dist/src/platforms/teams/types.d.ts.map +1 -1
- package/dist/src/platforms/teams/types.js +2 -0
- package/dist/src/platforms/teams/types.js.map +1 -1
- package/dist/src/platforms/webex/client.d.ts +3 -0
- package/dist/src/platforms/webex/client.d.ts.map +1 -1
- package/dist/src/platforms/webex/client.js +58 -13
- package/dist/src/platforms/webex/client.js.map +1 -1
- package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/auth.js +61 -10
- package/dist/src/platforms/webex/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/webex/credential-manager.js +18 -6
- package/dist/src/platforms/webex/credential-manager.js.map +1 -1
- package/dist/src/platforms/webex/encryption.d.ts.map +1 -1
- package/dist/src/platforms/webex/encryption.js +3 -1
- package/dist/src/platforms/webex/encryption.js.map +1 -1
- package/dist/src/platforms/webex/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/ensure-auth.js +10 -2
- package/dist/src/platforms/webex/ensure-auth.js.map +1 -1
- package/dist/src/platforms/webex/token-extractor.d.ts +1 -0
- package/dist/src/platforms/webex/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/webex/token-extractor.js +21 -4
- package/dist/src/platforms/webex/token-extractor.js.map +1 -1
- package/e2e/webex.e2e.test.ts +57 -0
- package/package.json +1 -1
- package/skills/agent-channeltalk/SKILL.md +1 -1
- package/skills/agent-channeltalkbot/SKILL.md +1 -1
- package/skills/agent-discord/SKILL.md +1 -1
- package/skills/agent-discordbot/SKILL.md +1 -1
- package/skills/agent-instagram/SKILL.md +1 -1
- package/skills/agent-kakaotalk/SKILL.md +1 -1
- package/skills/agent-line/SKILL.md +1 -1
- package/skills/agent-slack/SKILL.md +1 -1
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +1 -1
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-webex/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/teams/client.test.ts +34 -30
- package/src/platforms/teams/client.ts +92 -20
- package/src/platforms/teams/commands/auth.test.ts +6 -2
- package/src/platforms/teams/commands/auth.ts +7 -2
- package/src/platforms/teams/commands/channel.test.ts +6 -6
- package/src/platforms/teams/commands/channel.ts +18 -3
- package/src/platforms/teams/commands/file.ts +18 -3
- package/src/platforms/teams/commands/message.ts +24 -4
- package/src/platforms/teams/commands/reaction.ts +12 -2
- package/src/platforms/teams/commands/snapshot.ts +6 -1
- package/src/platforms/teams/commands/team.test.ts +2 -2
- package/src/platforms/teams/commands/team.ts +6 -1
- package/src/platforms/teams/commands/user.ts +18 -3
- package/src/platforms/teams/commands/whoami.ts +6 -1
- package/src/platforms/teams/credential-manager.test.ts +25 -0
- package/src/platforms/teams/credential-manager.ts +13 -3
- package/src/platforms/teams/ensure-auth.test.ts +6 -1
- package/src/platforms/teams/ensure-auth.ts +7 -2
- package/src/platforms/teams/token-extractor.ts +77 -12
- package/src/platforms/teams/types.test.ts +17 -0
- package/src/platforms/teams/types.ts +6 -0
- package/src/platforms/webex/client.test.ts +157 -13
- package/src/platforms/webex/client.ts +64 -15
- package/src/platforms/webex/commands/auth.test.ts +122 -1
- package/src/platforms/webex/commands/auth.ts +72 -17
- package/src/platforms/webex/credential-manager.test.ts +63 -0
- package/src/platforms/webex/credential-manager.ts +22 -8
- package/src/platforms/webex/encryption.test.ts +54 -0
- package/src/platforms/webex/encryption.ts +3 -1
- package/src/platforms/webex/ensure-auth.ts +10 -2
- package/src/platforms/webex/token-extractor.test.ts +32 -3
- package/src/platforms/webex/token-extractor.ts +26 -5
|
@@ -216,12 +216,41 @@ describe('WebexTokenExtractor', () => {
|
|
|
216
216
|
expect(result).not.toBeNull()
|
|
217
217
|
})
|
|
218
218
|
|
|
219
|
-
test('
|
|
219
|
+
test('prefers token with latest expiry across profiles', async () => {
|
|
220
220
|
const dir1 = createLevelDBDir(tempDir, 'Default')
|
|
221
221
|
const dir2 = createLevelDBDir(tempDir, 'Profile 1')
|
|
222
222
|
|
|
223
|
-
const
|
|
224
|
-
|
|
223
|
+
const expiredToken = makeWebexStorageJson({
|
|
224
|
+
accessToken: 'expired-token-longer-than-twenty-chars-xx',
|
|
225
|
+
expires: Date.now() - 3600000,
|
|
226
|
+
})
|
|
227
|
+
const freshToken = makeWebexStorageJson({
|
|
228
|
+
accessToken: 'fresh-token-longer-than-twenty-chars-xxx',
|
|
229
|
+
expires: Date.now() + 3600000,
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
writeFileSync(join(dir1, '000003.log'), expiredToken)
|
|
233
|
+
writeFileSync(join(dir2, '000003.log'), freshToken)
|
|
234
|
+
|
|
235
|
+
const extractor = new WebexTokenExtractor('darwin', undefined, tempDir)
|
|
236
|
+
const result = await extractor.extract()
|
|
237
|
+
|
|
238
|
+
expect(result!.accessToken).toBe('fresh-token-longer-than-twenty-chars-xxx')
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
test('returns first token when all have same expiry', async () => {
|
|
242
|
+
const dir1 = createLevelDBDir(tempDir, 'Default')
|
|
243
|
+
const dir2 = createLevelDBDir(tempDir, 'Profile 1')
|
|
244
|
+
|
|
245
|
+
const expires = Date.now() + 3600000
|
|
246
|
+
const token1 = makeWebexStorageJson({
|
|
247
|
+
accessToken: 'first-valid-token-longer-than-twenty-chars',
|
|
248
|
+
expires,
|
|
249
|
+
})
|
|
250
|
+
const token2 = makeWebexStorageJson({
|
|
251
|
+
accessToken: 'second-valid-token-longer-than-twenty-chars',
|
|
252
|
+
expires,
|
|
253
|
+
})
|
|
225
254
|
|
|
226
255
|
writeFileSync(join(dir1, '000003.log'), token1)
|
|
227
256
|
writeFileSync(join(dir2, '000003.log'), token2)
|
|
@@ -160,25 +160,46 @@ export class WebexTokenExtractor {
|
|
|
160
160
|
return null
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
let best: { token: ExtractedWebexToken; source: string } | null = null
|
|
164
|
+
|
|
163
165
|
for (const leveldbDir of profileDirs) {
|
|
164
166
|
this.debug(`Scanning: ${leveldbDir}`)
|
|
165
167
|
|
|
166
168
|
const result = (await this.scanViaClassicLevelCopy(leveldbDir)) ?? this.scanRawFiles(leveldbDir)
|
|
167
169
|
|
|
168
170
|
if (result?.token) {
|
|
169
|
-
this.debug(`Found token in: ${leveldbDir}`)
|
|
170
|
-
|
|
171
171
|
const token = result.token
|
|
172
172
|
if (result.encryptionKeys.size > 0) {
|
|
173
173
|
token.encryptionKeys = result.encryptionKeys
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
|
|
176
|
+
this.debug(
|
|
177
|
+
`Found token in: ${leveldbDir} (expires: ${token.expiresAt ? new Date(token.expiresAt).toISOString() : 'unknown'}, length: ${token.accessToken.length})`,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
if (!best || this.isTokenFresher(token, best.token)) {
|
|
181
|
+
best = { token, source: leveldbDir }
|
|
182
|
+
}
|
|
177
183
|
}
|
|
178
184
|
}
|
|
179
185
|
|
|
180
|
-
|
|
181
|
-
|
|
186
|
+
if (!best) {
|
|
187
|
+
this.debug('No Webex tokens found in any browser profile')
|
|
188
|
+
return null
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
this.debug(`Selected token from: ${best.source}`)
|
|
192
|
+
return best.token
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
private isTokenFresher(candidate: ExtractedWebexToken, current: ExtractedWebexToken): boolean {
|
|
196
|
+
const candidateExpiry = candidate.expiresAt ?? 0
|
|
197
|
+
const currentExpiry = current.expiresAt ?? 0
|
|
198
|
+
if (candidateExpiry > 0 && currentExpiry > 0) {
|
|
199
|
+
return candidateExpiry > currentExpiry
|
|
200
|
+
}
|
|
201
|
+
if (candidateExpiry > 0 && currentExpiry === 0) return true
|
|
202
|
+
return false
|
|
182
203
|
}
|
|
183
204
|
|
|
184
205
|
private async scanViaClassicLevelCopy(dbPath: string): Promise<ScanResult | null> {
|