agent-messenger 2.7.0 → 2.9.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/.github/workflows/ci.yml +6 -0
- package/.oxfmtrc.json +13 -1
- package/.oxlintrc.json +10 -1
- package/README.md +1 -12
- package/dist/package.json +59 -58
- package/dist/src/platforms/channeltalk/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/client.js +2 -2
- package/dist/src/platforms/channeltalk/client.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/message.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/snapshot.d.ts +4 -2
- package/dist/src/platforms/channeltalk/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/snapshot.js +86 -31
- package/dist/src/platforms/channeltalk/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.d.ts +9 -23
- package/dist/src/platforms/channeltalk/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.js +109 -341
- package/dist/src/platforms/channeltalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts +1 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.js +4 -4
- package/dist/src/platforms/channeltalkbot/client.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.js +4 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/snapshot.d.ts +3 -1
- package/dist/src/platforms/channeltalkbot/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/snapshot.js +110 -60
- package/dist/src/platforms/channeltalkbot/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.d.ts +1 -0
- package/dist/src/platforms/discord/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.js +48 -34
- package/dist/src/platforms/discord/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/discord/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/whoami.js.map +1 -1
- package/dist/src/platforms/discord/token-extractor.d.ts +2 -10
- package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/discord/token-extractor.js +38 -172
- package/dist/src/platforms/discord/token-extractor.js.map +1 -1
- package/dist/src/platforms/discordbot/client.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/client.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/snapshot.d.ts +2 -0
- package/dist/src/platforms/discordbot/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/commands/snapshot.js +46 -34
- package/dist/src/platforms/discordbot/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/instagram/cli.d.ts.map +1 -1
- package/dist/src/platforms/instagram/cli.js +1 -4
- package/dist/src/platforms/instagram/cli.js.map +1 -1
- package/dist/src/platforms/instagram/client.d.ts.map +1 -1
- package/dist/src/platforms/instagram/client.js +8 -7
- package/dist/src/platforms/instagram/client.js.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.js.map +1 -1
- package/dist/src/platforms/instagram/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/chat.js.map +1 -1
- package/dist/src/platforms/instagram/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/message.js.map +1 -1
- package/dist/src/platforms/instagram/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/shared.js.map +1 -1
- package/dist/src/platforms/instagram/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/instagram/credential-manager.js +1 -1
- package/dist/src/platforms/instagram/credential-manager.js.map +1 -1
- package/dist/src/platforms/instagram/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/ensure-auth.js.map +1 -1
- package/dist/src/platforms/instagram/token-extractor.d.ts +7 -19
- package/dist/src/platforms/instagram/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/instagram/token-extractor.js +44 -270
- package/dist/src/platforms/instagram/token-extractor.js.map +1 -1
- package/dist/src/platforms/instagram/types.d.ts.map +1 -1
- package/dist/src/platforms/instagram/types.js +4 -2
- package/dist/src/platforms/instagram/types.js.map +1 -1
- package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js +18 -4
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js.map +1 -1
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +3 -3
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.js +15 -9
- package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/shared.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/connection.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/connection.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/crypto.js +1 -1
- package/dist/src/platforms/kakaotalk/protocol/crypto.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.js +1 -3
- package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -1
- package/dist/src/platforms/kakaotalk/token-extractor.js +5 -2
- package/dist/src/platforms/kakaotalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/types.js +4 -2
- package/dist/src/platforms/kakaotalk/types.js.map +1 -1
- package/dist/src/platforms/line/cli.d.ts.map +1 -1
- package/dist/src/platforms/line/cli.js +1 -4
- package/dist/src/platforms/line/cli.js.map +1 -1
- package/dist/src/platforms/line/client.d.ts.map +1 -1
- package/dist/src/platforms/line/client.js +5 -13
- package/dist/src/platforms/line/client.js.map +1 -1
- package/dist/src/platforms/line/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/chat.js.map +1 -1
- package/dist/src/platforms/line/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/message.js.map +1 -1
- package/dist/src/platforms/line/listener.js +1 -1
- package/dist/src/platforms/line/listener.js.map +1 -1
- package/dist/src/platforms/slack/cli.d.ts.map +1 -1
- package/dist/src/platforms/slack/cli.js.map +1 -1
- package/dist/src/platforms/slack/client-mappers.d.ts +14 -0
- package/dist/src/platforms/slack/client-mappers.d.ts.map +1 -0
- package/dist/src/platforms/slack/client-mappers.js +245 -0
- package/dist/src/platforms/slack/client-mappers.js.map +1 -0
- package/dist/src/platforms/slack/client.d.ts +0 -1
- package/dist/src/platforms/slack/client.d.ts.map +1 -1
- package/dist/src/platforms/slack/client.js +41 -455
- package/dist/src/platforms/slack/client.js.map +1 -1
- package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/channel.js.map +1 -1
- package/dist/src/platforms/slack/commands/emoji.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/emoji.js +1 -3
- package/dist/src/platforms/slack/commands/emoji.js.map +1 -1
- package/dist/src/platforms/slack/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/message.js.map +1 -1
- package/dist/src/platforms/slack/commands/reminder.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/reminder.js.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.js +75 -55
- package/dist/src/platforms/slack/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/slack/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/user.js.map +1 -1
- package/dist/src/platforms/slack/commands/usergroup.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/usergroup.js.map +1 -1
- package/dist/src/platforms/slack/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/whoami.js.map +1 -1
- package/dist/src/platforms/slack/token-extractor.d.ts +2 -6
- package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/slack/token-extractor.js +35 -229
- package/dist/src/platforms/slack/token-extractor.js.map +1 -1
- package/dist/src/platforms/slackbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/cli.js +1 -1
- package/dist/src/platforms/slackbot/cli.js.map +1 -1
- package/dist/src/platforms/teams/client.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.js +1 -1
- 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 +4 -1
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.d.ts +1 -0
- package/dist/src/platforms/teams/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.js +44 -31
- package/dist/src/platforms/teams/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/teams/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/whoami.js.map +1 -1
- package/dist/src/platforms/teams/token-extractor.d.ts +6 -18
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/teams/token-extractor.js +71 -324
- package/dist/src/platforms/teams/token-extractor.js.map +1 -1
- package/dist/src/platforms/telegram/cli.d.ts.map +1 -1
- package/dist/src/platforms/telegram/cli.js +1 -4
- package/dist/src/platforms/telegram/cli.js.map +1 -1
- package/dist/src/platforms/telegram/client.d.ts.map +1 -1
- package/dist/src/platforms/telegram/client.js.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.js +1 -1
- package/dist/src/platforms/telegram/commands/auth.js.map +1 -1
- package/dist/src/platforms/telegram/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/chat.js.map +1 -1
- package/dist/src/platforms/telegram/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/message.js.map +1 -1
- package/dist/src/platforms/telegram/commands/whoami.js +1 -1
- package/dist/src/platforms/telegram/commands/whoami.js.map +1 -1
- package/dist/src/platforms/telegram/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/telegram/credential-manager.js +6 -2
- package/dist/src/platforms/telegram/credential-manager.js.map +1 -1
- package/dist/src/platforms/telegram/my-telegram-org.js.map +1 -1
- package/dist/src/platforms/webex/cli.d.ts.map +1 -1
- package/dist/src/platforms/webex/cli.js +1 -4
- package/dist/src/platforms/webex/cli.js.map +1 -1
- package/dist/src/platforms/webex/client.d.ts.map +1 -1
- package/dist/src/platforms/webex/client.js +3 -7
- 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 +1 -3
- 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 +1 -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.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.d.ts +1 -0
- package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.js +14 -7
- package/dist/src/platforms/webex/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/webex/commands/space.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/space.js.map +1 -1
- package/dist/src/platforms/webex/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/whoami.js.map +1 -1
- package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/webex/credential-manager.js.map +1 -1
- package/dist/src/platforms/webex/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/ensure-auth.js +1 -3
- package/dist/src/platforms/webex/ensure-auth.js.map +1 -1
- package/dist/src/platforms/webex/index.d.ts +1 -1
- package/dist/src/platforms/webex/index.d.ts.map +1 -1
- package/dist/src/platforms/webex/index.js.map +1 -1
- package/dist/src/platforms/webex/markdown-to-html.js.map +1 -1
- package/dist/src/platforms/webex/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/webex/token-extractor.js +5 -14
- package/dist/src/platforms/webex/token-extractor.js.map +1 -1
- package/dist/src/platforms/wechatbot/client.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/client.js.map +1 -1
- package/dist/src/platforms/wechatbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsapp/cli.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/cli.js +1 -4
- package/dist/src/platforms/whatsapp/cli.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/chat.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/shared.js.map +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.js +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.js.map +1 -1
- package/dist/src/platforms/whatsapp/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/ensure-auth.js.map +1 -1
- package/dist/src/platforms/whatsappbot/client.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/client.js +2 -2
- package/dist/src/platforms/whatsappbot/client.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/auth.js +4 -1
- package/dist/src/platforms/whatsappbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/shared.js.map +1 -1
- package/dist/src/shared/chromium/browsers.d.ts +7 -0
- package/dist/src/shared/chromium/browsers.d.ts.map +1 -0
- package/dist/src/shared/chromium/browsers.js +89 -0
- package/dist/src/shared/chromium/browsers.js.map +1 -0
- package/dist/src/shared/chromium/cookie-reader.d.ts +20 -0
- package/dist/src/shared/chromium/cookie-reader.d.ts.map +1 -0
- package/dist/src/shared/chromium/cookie-reader.js +99 -0
- package/dist/src/shared/chromium/cookie-reader.js.map +1 -0
- package/dist/src/shared/chromium/decryptor.d.ts +42 -0
- package/dist/src/shared/chromium/decryptor.d.ts.map +1 -0
- package/dist/src/shared/chromium/decryptor.js +205 -0
- package/dist/src/shared/chromium/decryptor.js.map +1 -0
- package/dist/src/shared/chromium/index.d.ts +6 -0
- package/dist/src/shared/chromium/index.d.ts.map +1 -0
- package/dist/src/shared/chromium/index.js +4 -0
- package/dist/src/shared/chromium/index.js.map +1 -0
- package/dist/src/shared/chromium/types.d.ts +11 -0
- package/dist/src/shared/chromium/types.d.ts.map +1 -0
- package/dist/src/shared/chromium/types.js +2 -0
- package/dist/src/shared/chromium/types.js.map +1 -0
- package/dist/src/shared/utils/derived-key-cache.d.ts +1 -1
- package/dist/src/shared/utils/derived-key-cache.d.ts.map +1 -1
- package/dist/src/shared/utils/linux-keyring.js +4 -1
- package/dist/src/shared/utils/linux-keyring.js.map +1 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.d.ts.map +1 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.js +6 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.js.map +1 -1
- package/dist/src/tui/adapters/telegram-adapter.js +1 -1
- package/dist/src/tui/adapters/telegram-adapter.js.map +1 -1
- package/dist/src/tui/adapters/webex-adapter.js +1 -1
- package/dist/src/tui/adapters/webex-adapter.js.map +1 -1
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +112 -23
- package/dist/src/tui/app.js.map +1 -1
- package/dist/src/tui/utils.d.ts.map +1 -1
- package/dist/src/tui/utils.js +11 -13
- package/dist/src/tui/utils.js.map +1 -1
- package/dist/src/tui/views/channel-picker.d.ts.map +1 -1
- package/dist/src/tui/views/channel-picker.js.map +1 -1
- package/dist/src/tui/views/workspace-picker.d.ts.map +1 -1
- package/dist/src/tui/views/workspace-picker.js.map +1 -1
- package/docs/content/docs/agent-skills.mdx +0 -10
- package/docs/content/docs/cli/channeltalk.mdx +42 -30
- package/docs/content/docs/cli/channeltalkbot.mdx +23 -13
- package/docs/content/docs/cli/discord.mdx +23 -7
- package/docs/content/docs/cli/discordbot.mdx +23 -7
- package/docs/content/docs/cli/instagram.mdx +4 -4
- package/docs/content/docs/cli/kakaotalk.mdx +9 -8
- package/docs/content/docs/cli/line.mdx +14 -14
- package/docs/content/docs/cli/slack.mdx +24 -7
- package/docs/content/docs/cli/teams.mdx +24 -8
- package/docs/content/docs/cli/webex.mdx +34 -21
- package/docs/content/docs/cli/wechatbot.mdx +12 -11
- package/docs/content/docs/cli/whatsapp.mdx +5 -4
- package/docs/content/docs/cli/whatsappbot.mdx +11 -11
- package/docs/content/docs/index.mdx +7 -7
- package/docs/content/docs/meta.json +1 -9
- package/docs/content/docs/sdk/channeltalk.mdx +5 -6
- package/docs/content/docs/sdk/channeltalkbot.mdx +6 -12
- package/docs/content/docs/sdk/discord.mdx +36 -43
- package/docs/content/docs/sdk/instagram.mdx +18 -18
- package/docs/content/docs/sdk/kakaotalk.mdx +27 -18
- package/docs/content/docs/sdk/line.mdx +8 -13
- package/docs/content/docs/sdk/meta.json +14 -1
- package/docs/content/docs/sdk/slack.mdx +36 -42
- package/docs/content/docs/sdk/teams.mdx +2 -8
- package/docs/content/docs/sdk/webex.mdx +2 -12
- package/docs/content/docs/sdk/wechatbot.mdx +1 -5
- package/docs/content/docs/sdk/whatsapp.mdx +10 -19
- package/docs/content/docs/sdk/whatsappbot.mdx +2 -10
- package/docs/content/docs/tui.mdx +23 -23
- package/docs/src/app/page.tsx +353 -108
- package/e2e/channeltalkbot.e2e.test.ts +1 -5
- package/e2e/config.ts +6 -2
- package/package.json +59 -58
- package/scripts/prepublish.ts +1 -3
- package/skills/agent-channeltalk/SKILL.md +19 -9
- package/skills/agent-channeltalk/references/common-patterns.md +10 -9
- package/skills/agent-channeltalkbot/SKILL.md +19 -9
- package/skills/agent-channeltalkbot/references/common-patterns.md +10 -9
- package/skills/agent-discord/SKILL.md +18 -9
- package/skills/agent-discord/references/common-patterns.md +8 -7
- package/skills/agent-discordbot/SKILL.md +18 -9
- 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 +19 -10
- package/skills/agent-slack/references/common-patterns.md +4 -7
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +18 -9
- package/skills/agent-teams/references/common-patterns.md +9 -7
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +13 -4
- package/skills/agent-webex/references/common-patterns.md +8 -2
- 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/channeltalk/client.test.ts +116 -29
- package/src/platforms/channeltalk/client.ts +26 -6
- package/src/platforms/channeltalk/commands/auth.test.ts +5 -5
- package/src/platforms/channeltalk/commands/auth.ts +19 -5
- package/src/platforms/channeltalk/commands/message.test.ts +2 -6
- package/src/platforms/channeltalk/commands/message.ts +5 -1
- package/src/platforms/channeltalk/commands/snapshot.test.ts +77 -30
- package/src/platforms/channeltalk/commands/snapshot.ts +112 -34
- package/src/platforms/channeltalk/ensure-auth.test.ts +20 -17
- package/src/platforms/channeltalk/ensure-auth.ts +6 -7
- package/src/platforms/channeltalk/index.ts +0 -1
- package/src/platforms/channeltalk/token-extractor.test.ts +33 -25
- package/src/platforms/channeltalk/token-extractor.ts +120 -372
- package/src/platforms/channeltalkbot/client.test.ts +1 -3
- package/src/platforms/channeltalkbot/client.ts +39 -13
- package/src/platforms/channeltalkbot/commands/auth.test.ts +3 -1
- package/src/platforms/channeltalkbot/commands/auth.ts +4 -1
- package/src/platforms/channeltalkbot/commands/bot.test.ts +13 -5
- package/src/platforms/channeltalkbot/commands/message.test.ts +12 -6
- package/src/platforms/channeltalkbot/commands/shared.ts +6 -2
- package/src/platforms/channeltalkbot/commands/snapshot.test.ts +43 -13
- package/src/platforms/channeltalkbot/commands/snapshot.ts +131 -64
- package/src/platforms/channeltalkbot/credential-manager.test.ts +1 -1
- package/src/platforms/channeltalkbot/index.test.ts +0 -2
- package/src/platforms/channeltalkbot/index.ts +0 -1
- package/src/platforms/discord/commands/auth.test.ts +6 -4
- package/src/platforms/discord/commands/auth.ts +14 -14
- package/src/platforms/discord/commands/snapshot.test.ts +1 -1
- package/src/platforms/discord/commands/snapshot.ts +58 -42
- package/src/platforms/discord/commands/whoami.test.ts +2 -4
- package/src/platforms/discord/commands/whoami.ts +2 -0
- package/src/platforms/discord/ensure-auth.test.ts +5 -3
- package/src/platforms/discord/index.ts +0 -1
- package/src/platforms/discord/listener.test.ts +7 -1
- package/src/platforms/discord/token-extractor.test.ts +18 -12
- package/src/platforms/discord/token-extractor.ts +46 -190
- package/src/platforms/discordbot/client.ts +1 -4
- package/src/platforms/discordbot/commands/auth.test.ts +3 -1
- package/src/platforms/discordbot/commands/channel.test.ts +3 -1
- package/src/platforms/discordbot/commands/message.test.ts +3 -1
- package/src/platforms/discordbot/commands/server.test.ts +3 -1
- package/src/platforms/discordbot/commands/snapshot.test.ts +43 -19
- package/src/platforms/discordbot/commands/snapshot.ts +54 -37
- package/src/platforms/discordbot/commands/thread.test.ts +3 -1
- package/src/platforms/discordbot/commands/user.test.ts +3 -1
- package/src/platforms/instagram/cli.ts +1 -4
- package/src/platforms/instagram/client.test.ts +3 -8
- package/src/platforms/instagram/client.ts +39 -34
- package/src/platforms/instagram/commands/auth.test.ts +13 -12
- package/src/platforms/instagram/commands/auth.ts +136 -71
- package/src/platforms/instagram/commands/chat.test.ts +21 -24
- package/src/platforms/instagram/commands/chat.ts +2 -0
- package/src/platforms/instagram/commands/message.test.ts +29 -24
- package/src/platforms/instagram/commands/message.ts +3 -4
- package/src/platforms/instagram/commands/shared.ts +2 -5
- package/src/platforms/instagram/commands/whoami.test.ts +4 -6
- package/src/platforms/instagram/credential-manager.ts +2 -6
- package/src/platforms/instagram/ensure-auth.test.ts +1 -4
- package/src/platforms/instagram/ensure-auth.ts +6 -3
- package/src/platforms/instagram/listener.test.ts +7 -3
- package/src/platforms/instagram/token-extractor.test.ts +4 -16
- package/src/platforms/instagram/token-extractor.ts +55 -309
- package/src/platforms/instagram/types.test.ts +2 -6
- package/src/platforms/instagram/types.ts +4 -2
- package/src/platforms/kakaotalk/auth/kakao-login.ts +30 -8
- package/src/platforms/kakaotalk/client.test.ts +37 -25
- package/src/platforms/kakaotalk/client.ts +23 -12
- package/src/platforms/kakaotalk/commands/auth.test.ts +6 -18
- package/src/platforms/kakaotalk/commands/auth.ts +101 -47
- package/src/platforms/kakaotalk/commands/chat.test.ts +8 -11
- package/src/platforms/kakaotalk/commands/message.test.ts +15 -24
- package/src/platforms/kakaotalk/commands/shared.ts +1 -0
- package/src/platforms/kakaotalk/commands/whoami.test.ts +6 -10
- package/src/platforms/kakaotalk/credential-manager.test.ts +1 -4
- package/src/platforms/kakaotalk/index.test.ts +1 -0
- package/src/platforms/kakaotalk/index.ts +0 -2
- package/src/platforms/kakaotalk/listener.test.ts +7 -1
- package/src/platforms/kakaotalk/protocol/connection.ts +4 -1
- package/src/platforms/kakaotalk/protocol/crypto.ts +1 -1
- package/src/platforms/kakaotalk/protocol/session.ts +12 -6
- package/src/platforms/kakaotalk/token-extractor.ts +5 -5
- package/src/platforms/kakaotalk/types.ts +8 -7
- package/src/platforms/line/cli.ts +1 -4
- package/src/platforms/line/client.ts +12 -20
- package/src/platforms/line/commands/auth.test.ts +2 -1
- package/src/platforms/line/commands/chat.test.ts +2 -1
- package/src/platforms/line/commands/chat.ts +1 -4
- package/src/platforms/line/commands/friend.test.ts +2 -1
- package/src/platforms/line/commands/message.test.ts +2 -1
- package/src/platforms/line/commands/message.ts +2 -9
- package/src/platforms/line/commands/whoami.test.ts +2 -1
- package/src/platforms/line/credential-manager.test.ts +1 -2
- package/src/platforms/line/index.test.ts +1 -0
- package/src/platforms/line/listener.ts +1 -1
- package/src/platforms/line/types.test.ts +1 -0
- package/src/platforms/slack/cli.ts +3 -1
- package/src/platforms/slack/client-mappers.ts +297 -0
- package/src/platforms/slack/client.test.ts +532 -17
- package/src/platforms/slack/client.ts +69 -458
- package/src/platforms/slack/commands/channel.ts +1 -4
- package/src/platforms/slack/commands/emoji.test.ts +6 -4
- package/src/platforms/slack/commands/emoji.ts +20 -22
- package/src/platforms/slack/commands/message.ts +6 -1
- package/src/platforms/slack/commands/pin.test.ts +14 -12
- package/src/platforms/slack/commands/reminder.ts +7 -6
- package/src/platforms/slack/commands/snapshot.test.ts +63 -8
- package/src/platforms/slack/commands/snapshot.ts +98 -66
- package/src/platforms/slack/commands/user.ts +6 -1
- package/src/platforms/slack/commands/usergroup.test.ts +3 -3
- package/src/platforms/slack/commands/usergroup.ts +10 -7
- package/src/platforms/slack/commands/whoami.test.ts +1 -1
- package/src/platforms/slack/commands/whoami.ts +2 -0
- package/src/platforms/slack/index.ts +0 -2
- package/src/platforms/slack/listener.test.ts +1 -0
- package/src/platforms/slack/token-extractor.test.ts +7 -12
- package/src/platforms/slack/token-extractor.ts +47 -255
- package/src/platforms/slackbot/cli.ts +8 -1
- package/src/platforms/slackbot/commands/auth.test.ts +3 -1
- package/src/platforms/teams/client.ts +1 -1
- package/src/platforms/teams/commands/auth.test.ts +1 -1
- package/src/platforms/teams/commands/auth.ts +4 -1
- package/src/platforms/teams/commands/snapshot.test.ts +1 -1
- package/src/platforms/teams/commands/snapshot.ts +53 -38
- package/src/platforms/teams/commands/whoami.test.ts +2 -4
- package/src/platforms/teams/commands/whoami.ts +2 -0
- package/src/platforms/teams/index.ts +0 -1
- package/src/platforms/teams/token-extractor.ts +82 -350
- package/src/platforms/telegram/app-config.test.ts +1 -0
- package/src/platforms/telegram/chat-utils.test.ts +5 -1
- package/src/platforms/telegram/cli.ts +2 -4
- package/src/platforms/telegram/client.test.ts +16 -3
- package/src/platforms/telegram/client.ts +14 -4
- package/src/platforms/telegram/commands/auth.test.ts +1 -0
- package/src/platforms/telegram/commands/auth.ts +3 -4
- package/src/platforms/telegram/commands/chat.test.ts +2 -5
- package/src/platforms/telegram/commands/chat.ts +1 -0
- package/src/platforms/telegram/commands/message.test.ts +2 -5
- package/src/platforms/telegram/commands/message.ts +1 -0
- package/src/platforms/telegram/commands/shared.test.ts +1 -0
- package/src/platforms/telegram/commands/whoami.test.ts +5 -7
- package/src/platforms/telegram/commands/whoami.ts +1 -1
- package/src/platforms/telegram/credential-manager.test.ts +1 -0
- package/src/platforms/telegram/credential-manager.ts +11 -2
- package/src/platforms/telegram/my-telegram-org.ts +6 -2
- package/src/platforms/telegram/types.test.ts +1 -0
- package/src/platforms/webex/app-config.test.ts +1 -0
- package/src/platforms/webex/cli.ts +1 -4
- package/src/platforms/webex/client.test.ts +4 -12
- package/src/platforms/webex/client.ts +14 -52
- package/src/platforms/webex/commands/auth.test.ts +7 -1
- package/src/platforms/webex/commands/auth.ts +12 -15
- package/src/platforms/webex/commands/member.test.ts +1 -3
- package/src/platforms/webex/commands/member.ts +14 -19
- package/src/platforms/webex/commands/message.ts +4 -15
- package/src/platforms/webex/commands/snapshot.test.ts +42 -4
- package/src/platforms/webex/commands/snapshot.ts +19 -11
- package/src/platforms/webex/commands/space.test.ts +3 -3
- package/src/platforms/webex/commands/space.ts +2 -9
- package/src/platforms/webex/commands/whoami.test.ts +12 -5
- package/src/platforms/webex/commands/whoami.ts +2 -0
- package/src/platforms/webex/credential-manager.ts +11 -2
- package/src/platforms/webex/ensure-auth.ts +1 -3
- package/src/platforms/webex/index.ts +1 -7
- package/src/platforms/webex/markdown-to-html.test.ts +6 -18
- package/src/platforms/webex/markdown-to-html.ts +8 -8
- package/src/platforms/webex/token-extractor.ts +6 -29
- package/src/platforms/wechatbot/client.test.ts +6 -2
- package/src/platforms/wechatbot/client.ts +6 -1
- package/src/platforms/wechatbot/commands/auth.test.ts +3 -7
- package/src/platforms/wechatbot/commands/message.test.ts +1 -4
- package/src/platforms/wechatbot/commands/message.ts +5 -1
- package/src/platforms/wechatbot/commands/template.test.ts +1 -4
- package/src/platforms/wechatbot/commands/user.test.ts +2 -7
- package/src/platforms/whatsapp/cli.ts +1 -4
- package/src/platforms/whatsapp/commands/auth.test.ts +19 -22
- package/src/platforms/whatsapp/commands/chat.test.ts +21 -24
- package/src/platforms/whatsapp/commands/chat.ts +2 -0
- package/src/platforms/whatsapp/commands/message.test.ts +22 -24
- package/src/platforms/whatsapp/commands/message.ts +3 -5
- package/src/platforms/whatsapp/commands/shared.ts +2 -5
- package/src/platforms/whatsapp/commands/whoami.test.ts +2 -2
- package/src/platforms/whatsapp/credential-manager.ts +2 -6
- package/src/platforms/whatsapp/ensure-auth.test.ts +1 -4
- package/src/platforms/whatsapp/ensure-auth.ts +14 -6
- package/src/platforms/whatsapp/index.ts +0 -2
- package/src/platforms/whatsappbot/client.test.ts +13 -7
- package/src/platforms/whatsappbot/client.ts +18 -4
- package/src/platforms/whatsappbot/commands/auth.ts +4 -1
- package/src/platforms/whatsappbot/commands/message.test.ts +12 -2
- package/src/platforms/whatsappbot/commands/message.ts +16 -3
- package/src/platforms/whatsappbot/commands/shared.ts +3 -1
- package/src/platforms/whatsappbot/commands/whoami.test.ts +1 -3
- package/src/platforms/whatsappbot/index.ts +0 -2
- package/src/shared/chromium/browsers.test.ts +274 -0
- package/src/shared/chromium/browsers.ts +86 -0
- package/src/shared/chromium/cookie-reader.test.ts +274 -0
- package/src/shared/chromium/cookie-reader.ts +111 -0
- package/src/shared/chromium/decryptor.test.ts +449 -0
- package/src/shared/chromium/decryptor.ts +227 -0
- package/src/shared/chromium/index.ts +11 -0
- package/src/shared/chromium/types.ts +11 -0
- package/src/shared/utils/derived-key-cache.ts +1 -1
- package/src/shared/utils/linux-keyring.ts +4 -4
- package/src/tui/adapters/kakaotalk-adapter.ts +6 -1
- package/src/tui/adapters/telegram-adapter.ts +1 -1
- package/src/tui/adapters/webex-adapter.ts +1 -1
- package/src/tui/app.ts +149 -59
- package/src/tui/utils.test.ts +144 -145
- package/src/tui/utils.ts +27 -29
- package/src/tui/views/channel-picker.ts +1 -1
- package/src/tui/views/workspace-picker.ts +1 -1
package/src/tui/utils.test.ts
CHANGED
|
@@ -1,149 +1,148 @@
|
|
|
1
|
-
import { describe, test, expect } from
|
|
2
|
-
import { formatTimestamp, truncate, fuzzyMatch, stripHtml } from "./utils";
|
|
1
|
+
import { describe, test, expect } from 'bun:test'
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
import { formatTimestamp, truncate, fuzzyMatch, stripHtml } from './utils'
|
|
4
|
+
|
|
5
|
+
describe('formatTimestamp', () => {
|
|
5
6
|
test("today's date returns HH:MM", () => {
|
|
6
|
-
const now = new Date()
|
|
7
|
-
const epochSeconds = (now.getTime() / 1000).toFixed(6)
|
|
8
|
-
const result = formatTimestamp(epochSeconds)
|
|
9
|
-
expect(result).toMatch(/^\d{2}:\d{2}$/)
|
|
10
|
-
})
|
|
7
|
+
const now = new Date()
|
|
8
|
+
const epochSeconds = (now.getTime() / 1000).toFixed(6)
|
|
9
|
+
const result = formatTimestamp(epochSeconds)
|
|
10
|
+
expect(result).toMatch(/^\d{2}:\d{2}$/)
|
|
11
|
+
})
|
|
11
12
|
|
|
12
13
|
test("yesterday's date returns MM/DD HH:MM", () => {
|
|
13
|
-
const yesterday = new Date()
|
|
14
|
-
yesterday.setDate(yesterday.getDate() - 1)
|
|
15
|
-
const epochSeconds = (yesterday.getTime() / 1000).toFixed(6)
|
|
16
|
-
const result = formatTimestamp(epochSeconds)
|
|
17
|
-
expect(result).toMatch(/^\d{2}\/\d{2} \d{2}:\d{2}$/)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
test(
|
|
21
|
-
const now = new Date()
|
|
22
|
-
const iso = now.toISOString()
|
|
23
|
-
const result = formatTimestamp(iso)
|
|
24
|
-
expect(result).toMatch(/^\d{2}:\d{2}$/)
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
test(
|
|
28
|
-
const result = formatTimestamp(
|
|
29
|
-
expect(result).toMatch(/^\d{2}\/\d{2} \d{2}:\d{2}$/)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
test(
|
|
33
|
-
expect(formatTimestamp(
|
|
34
|
-
expect(formatTimestamp(
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
test(
|
|
38
|
-
const now = new Date()
|
|
39
|
-
const slackTs = `${Math.floor(now.getTime() / 1000)}.123456
|
|
40
|
-
const result = formatTimestamp(slackTs)
|
|
41
|
-
expect(result).toMatch(/^\d{2}:\d{2}$/)
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
describe(
|
|
46
|
-
test(
|
|
47
|
-
expect(truncate(
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
test(
|
|
51
|
-
expect(truncate(
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
test(
|
|
55
|
-
expect(truncate(
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
test(
|
|
59
|
-
expect(truncate(
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
test(
|
|
63
|
-
expect(truncate(
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
test(
|
|
67
|
-
expect(truncate(
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
test(
|
|
71
|
-
expect(truncate(
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
describe(
|
|
76
|
-
test(
|
|
77
|
-
expect(fuzzyMatch(
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
test(
|
|
81
|
-
expect(fuzzyMatch(
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
test(
|
|
85
|
-
expect(fuzzyMatch(
|
|
86
|
-
expect(fuzzyMatch(
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
test(
|
|
90
|
-
expect(fuzzyMatch(
|
|
91
|
-
expect(fuzzyMatch(
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
test(
|
|
95
|
-
expect(fuzzyMatch(
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
test(
|
|
99
|
-
expect(fuzzyMatch(
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
test(
|
|
103
|
-
expect(fuzzyMatch(
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
describe(
|
|
108
|
-
test(
|
|
109
|
-
expect(stripHtml(
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
test(
|
|
113
|
-
expect(stripHtml(
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
test(
|
|
117
|
-
expect(stripHtml(
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
test(
|
|
121
|
-
expect(stripHtml(
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
test(
|
|
125
|
-
expect(stripHtml('say "hello"')).toBe('say "hello"')
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
test(
|
|
129
|
-
expect(stripHtml(
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
test(
|
|
133
|
-
expect(stripHtml(
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
test(
|
|
137
|
-
expect(stripHtml(
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
test(
|
|
141
|
-
expect(stripHtml(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
149
|
-
});
|
|
14
|
+
const yesterday = new Date()
|
|
15
|
+
yesterday.setDate(yesterday.getDate() - 1)
|
|
16
|
+
const epochSeconds = (yesterday.getTime() / 1000).toFixed(6)
|
|
17
|
+
const result = formatTimestamp(epochSeconds)
|
|
18
|
+
expect(result).toMatch(/^\d{2}\/\d{2} \d{2}:\d{2}$/)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('ISO 8601 string for today returns HH:MM', () => {
|
|
22
|
+
const now = new Date()
|
|
23
|
+
const iso = now.toISOString()
|
|
24
|
+
const result = formatTimestamp(iso)
|
|
25
|
+
expect(result).toMatch(/^\d{2}:\d{2}$/)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test('ISO 8601 string for past date returns MM/DD HH:MM', () => {
|
|
29
|
+
const result = formatTimestamp('2024-03-15T10:30:00Z')
|
|
30
|
+
expect(result).toMatch(/^\d{2}\/\d{2} \d{2}:\d{2}$/)
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('invalid string returns original', () => {
|
|
34
|
+
expect(formatTimestamp('not-a-date')).toBe('not-a-date')
|
|
35
|
+
expect(formatTimestamp('abc123')).toBe('abc123')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('Slack-style epoch with microseconds', () => {
|
|
39
|
+
const now = new Date()
|
|
40
|
+
const slackTs = `${Math.floor(now.getTime() / 1000)}.123456`
|
|
41
|
+
const result = formatTimestamp(slackTs)
|
|
42
|
+
expect(result).toMatch(/^\d{2}:\d{2}$/)
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
describe('truncate', () => {
|
|
47
|
+
test('short string returned unchanged', () => {
|
|
48
|
+
expect(truncate('hello', 10)).toBe('hello')
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test('exact length returned unchanged', () => {
|
|
52
|
+
expect(truncate('hello', 5)).toBe('hello')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('long string gets truncated with ellipsis', () => {
|
|
56
|
+
expect(truncate('hello world', 8)).toBe('hello...')
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
test('maxLen of 3 truncates without ellipsis', () => {
|
|
60
|
+
expect(truncate('hello', 3)).toBe('hel')
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test('maxLen of 1 truncates without ellipsis', () => {
|
|
64
|
+
expect(truncate('hello', 1)).toBe('h')
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('maxLen of 0 returns empty string', () => {
|
|
68
|
+
expect(truncate('hello', 0)).toBe('')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
test('maxLen of 4 adds ellipsis', () => {
|
|
72
|
+
expect(truncate('hello', 4)).toBe('h...')
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
describe('fuzzyMatch', () => {
|
|
77
|
+
test('exact match returns true', () => {
|
|
78
|
+
expect(fuzzyMatch('general', 'general')).toBe(true)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
test('partial match in order returns true', () => {
|
|
82
|
+
expect(fuzzyMatch('gnrl', 'general')).toBe(true)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
test('case insensitive match', () => {
|
|
86
|
+
expect(fuzzyMatch('GNRL', 'general')).toBe(true)
|
|
87
|
+
expect(fuzzyMatch('gnrl', 'GENERAL')).toBe(true)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
test('empty query returns true', () => {
|
|
91
|
+
expect(fuzzyMatch('', 'anything')).toBe(true)
|
|
92
|
+
expect(fuzzyMatch('', '')).toBe(true)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
test('no match returns false', () => {
|
|
96
|
+
expect(fuzzyMatch('xyz', 'general')).toBe(false)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
test('characters out of order returns false', () => {
|
|
100
|
+
expect(fuzzyMatch('lrng', 'general')).toBe(false)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('query longer than text returns false', () => {
|
|
104
|
+
expect(fuzzyMatch('generalgeneral', 'general')).toBe(false)
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
describe('stripHtml', () => {
|
|
109
|
+
test('removes simple tags', () => {
|
|
110
|
+
expect(stripHtml('<p>hello</p>')).toBe('hello')
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
test('removes nested tags', () => {
|
|
114
|
+
expect(stripHtml('<div><p><strong>hello</strong></p></div>')).toBe('hello')
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
test('decodes &', () => {
|
|
118
|
+
expect(stripHtml('a & b')).toBe('a & b')
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
test('decodes < and >', () => {
|
|
122
|
+
expect(stripHtml('<tag>')).toBe('<tag>')
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
test('decodes "', () => {
|
|
126
|
+
expect(stripHtml('say "hello"')).toBe('say "hello"')
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
test('decodes '', () => {
|
|
130
|
+
expect(stripHtml('it's')).toBe("it's")
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
test('collapses multiple whitespace', () => {
|
|
134
|
+
expect(stripHtml('hello world')).toBe('hello world')
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
test('trims leading and trailing whitespace', () => {
|
|
138
|
+
expect(stripHtml(' hello ')).toBe('hello')
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
test('handles multiple entities and tags together', () => {
|
|
142
|
+
expect(stripHtml('<p>Hello & <strong>World</strong></p>')).toBe('Hello & World')
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
test('whitespace from tag removal is collapsed', () => {
|
|
146
|
+
expect(stripHtml('<p>hello</p> <p>world</p>')).toBe('hello world')
|
|
147
|
+
})
|
|
148
|
+
})
|
package/src/tui/utils.ts
CHANGED
|
@@ -1,58 +1,56 @@
|
|
|
1
1
|
export function formatTimestamp(ts: string): string {
|
|
2
|
-
let date: Date
|
|
2
|
+
let date: Date
|
|
3
3
|
|
|
4
4
|
if (/^\d+(\.\d+)?$/.test(ts)) {
|
|
5
|
-
date = new Date(parseFloat(ts) * 1000)
|
|
5
|
+
date = new Date(parseFloat(ts) * 1000)
|
|
6
6
|
} else {
|
|
7
|
-
date = new Date(ts)
|
|
7
|
+
date = new Date(ts)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
if (isNaN(date.getTime())) {
|
|
11
|
-
return ts
|
|
11
|
+
return ts
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const now = new Date()
|
|
14
|
+
const now = new Date()
|
|
15
15
|
const isToday =
|
|
16
|
-
date.getFullYear() === now.getFullYear() &&
|
|
17
|
-
date.getMonth() === now.getMonth() &&
|
|
18
|
-
date.getDate() === now.getDate();
|
|
16
|
+
date.getFullYear() === now.getFullYear() && date.getMonth() === now.getMonth() && date.getDate() === now.getDate()
|
|
19
17
|
|
|
20
|
-
const hh = String(date.getHours()).padStart(2,
|
|
21
|
-
const mm = String(date.getMinutes()).padStart(2,
|
|
18
|
+
const hh = String(date.getHours()).padStart(2, '0')
|
|
19
|
+
const mm = String(date.getMinutes()).padStart(2, '0')
|
|
22
20
|
|
|
23
21
|
if (isToday) {
|
|
24
|
-
return `${hh}:${mm}
|
|
22
|
+
return `${hh}:${mm}`
|
|
25
23
|
}
|
|
26
24
|
|
|
27
|
-
const month = String(date.getMonth() + 1).padStart(2,
|
|
28
|
-
const day = String(date.getDate()).padStart(2,
|
|
29
|
-
return `${month}/${day} ${hh}:${mm}
|
|
25
|
+
const month = String(date.getMonth() + 1).padStart(2, '0')
|
|
26
|
+
const day = String(date.getDate()).padStart(2, '0')
|
|
27
|
+
return `${month}/${day} ${hh}:${mm}`
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
export function truncate(text: string, maxLen: number): string {
|
|
33
|
-
if (text.length <= maxLen) return text
|
|
34
|
-
if (maxLen < 4) return text.slice(0, maxLen)
|
|
35
|
-
return text.slice(0, maxLen - 3) +
|
|
31
|
+
if (text.length <= maxLen) return text
|
|
32
|
+
if (maxLen < 4) return text.slice(0, maxLen)
|
|
33
|
+
return text.slice(0, maxLen - 3) + '...'
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
export function fuzzyMatch(query: string, text: string): boolean {
|
|
39
|
-
if (query.length === 0) return true
|
|
40
|
-
const lowerQuery = query.toLowerCase()
|
|
41
|
-
const lowerText = text.toLowerCase()
|
|
42
|
-
let qi = 0
|
|
37
|
+
if (query.length === 0) return true
|
|
38
|
+
const lowerQuery = query.toLowerCase()
|
|
39
|
+
const lowerText = text.toLowerCase()
|
|
40
|
+
let qi = 0
|
|
43
41
|
for (let ti = 0; ti < lowerText.length && qi < lowerQuery.length; ti++) {
|
|
44
|
-
if (lowerText[ti] === lowerQuery[qi]) qi
|
|
42
|
+
if (lowerText[ti] === lowerQuery[qi]) qi++
|
|
45
43
|
}
|
|
46
|
-
return qi === lowerQuery.length
|
|
44
|
+
return qi === lowerQuery.length
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
export function stripHtml(content: string): string {
|
|
50
|
-
const stripped = content.replace(/<[^>]*>/g,
|
|
48
|
+
const stripped = content.replace(/<[^>]*>/g, '')
|
|
51
49
|
const decoded = stripped
|
|
52
|
-
.replace(/&/g,
|
|
53
|
-
.replace(/</g,
|
|
54
|
-
.replace(/>/g,
|
|
50
|
+
.replace(/&/g, '&')
|
|
51
|
+
.replace(/</g, '<')
|
|
52
|
+
.replace(/>/g, '>')
|
|
55
53
|
.replace(/"/g, '"')
|
|
56
|
-
.replace(/'/g, "'")
|
|
57
|
-
return decoded.replace(/\s+/g,
|
|
54
|
+
.replace(/'/g, "'")
|
|
55
|
+
return decoded.replace(/\s+/g, ' ').trim()
|
|
58
56
|
}
|