@pleaseai/agent 0.1.16 → 0.1.17
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/.output/nitro.json +15 -0
- package/.output/public/_nuxt/1IbcHhBU.js +1 -0
- package/.output/public/_nuxt/BTF_RZdZ.js +1 -0
- package/.output/public/_nuxt/Bh-tMwKs.js +30 -0
- package/.output/public/_nuxt/BsKcI3-e.js +1 -0
- package/.output/public/_nuxt/BzSBlrMF.js +1 -0
- package/.output/public/_nuxt/C3iS5Uhb.js +1 -0
- package/.output/public/_nuxt/D32OC87-.js +1 -0
- package/.output/public/_nuxt/DYb-jmio.js +7 -0
- package/.output/public/_nuxt/DeqoUPGn.js +1 -0
- package/.output/public/_nuxt/DoaBpHko.js +1 -0
- package/.output/public/_nuxt/builds/latest.json +1 -0
- package/.output/public/_nuxt/builds/meta/748a2baa-57b8-4080-8fea-335bbddd248e.json +1 -0
- package/.output/public/_nuxt/cCUm7iY-.js +1 -0
- package/.output/public/_nuxt/d0DDPc3x.js +1 -0
- package/.output/public/_nuxt/entry.uBXQoLs_.css +1 -0
- package/.output/public/_nuxt/error-404.CpAx3mXP.css +1 -0
- package/.output/public/_nuxt/error-500.VGk_v7xu.css +1 -0
- package/.output/public/_nuxt/nOjN_vKW.js +1 -0
- package/.output/server/chunks/_/error-500.mjs +19 -0
- package/.output/server/chunks/_/error-500.mjs.map +1 -0
- package/.output/server/chunks/_/icons.mjs +5939 -0
- package/.output/server/chunks/_/icons.mjs.map +1 -0
- package/.output/server/chunks/build/Alert-BgLL0z9r.mjs +477 -0
- package/.output/server/chunks/build/Alert-BgLL0z9r.mjs.map +1 -0
- package/.output/server/chunks/build/Badge-BnQthhyg.mjs +782 -0
- package/.output/server/chunks/build/Badge-BnQthhyg.mjs.map +1 -0
- package/.output/server/chunks/build/Card-m9yESRg-.mjs +421 -0
- package/.output/server/chunks/build/Card-m9yESRg-.mjs.map +1 -0
- package/.output/server/chunks/build/Separator-D2l1Gitd.mjs +341 -0
- package/.output/server/chunks/build/Separator-D2l1Gitd.mjs.map +1 -0
- package/.output/server/chunks/build/_id_-B-peNi7y.mjs +357 -0
- package/.output/server/chunks/build/_id_-B-peNi7y.mjs.map +1 -0
- package/.output/server/chunks/build/_identifier_-u8aQI-B5.mjs +593 -0
- package/.output/server/chunks/build/_identifier_-u8aQI-B5.mjs.map +1 -0
- package/.output/server/chunks/build/client.precomputed.mjs +4 -0
- package/.output/server/chunks/build/client.precomputed.mjs.map +1 -0
- package/.output/server/chunks/build/dashboard-DRFqbhzu.mjs +13977 -0
- package/.output/server/chunks/build/dashboard-DRFqbhzu.mjs.map +1 -0
- package/.output/server/chunks/build/error-404-Boq1zV4r.mjs +112 -0
- package/.output/server/chunks/build/error-404-Boq1zV4r.mjs.map +1 -0
- package/.output/server/chunks/build/error-404-styles.O8g5ZWuT.mjs +8 -0
- package/.output/server/chunks/build/error-404-styles.O8g5ZWuT.mjs.map +1 -0
- package/.output/server/chunks/build/error-500-BAbnx-7I.mjs +95 -0
- package/.output/server/chunks/build/error-500-BAbnx-7I.mjs.map +1 -0
- package/.output/server/chunks/build/error-500-styles.kmF6Dijn.mjs +8 -0
- package/.output/server/chunks/build/error-500-styles.kmF6Dijn.mjs.map +1 -0
- package/.output/server/chunks/build/format-Cs0yxEHy.mjs +75 -0
- package/.output/server/chunks/build/format-Cs0yxEHy.mjs.map +1 -0
- package/.output/server/chunks/build/index-BAy5ojFe.mjs +5479 -0
- package/.output/server/chunks/build/index-BAy5ojFe.mjs.map +1 -0
- package/.output/server/chunks/build/login-DPXKXUwG.mjs +981 -0
- package/.output/server/chunks/build/login-DPXKXUwG.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +53539 -0
- package/.output/server/chunks/build/server.mjs.map +1 -0
- package/.output/server/chunks/build/styles.mjs +10 -0
- package/.output/server/chunks/build/styles.mjs.map +1 -0
- package/.output/server/chunks/routes/api/auth/_...all_.mjs +34 -0
- package/.output/server/chunks/routes/api/auth/_...all_.mjs.map +1 -0
- package/.output/server/chunks/routes/api/v1/_identifier_.get.mjs +111 -0
- package/.output/server/chunks/routes/api/v1/_identifier_.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/v1/refresh.post.mjs +40 -0
- package/.output/server/chunks/routes/api/v1/refresh.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/v1/sessions/_sessionId/messages.get.mjs +52 -0
- package/.output/server/chunks/routes/api/v1/sessions/_sessionId/messages.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/v1/state.get.mjs +89 -0
- package/.output/server/chunks/routes/api/v1/state.get.mjs.map +1 -0
- package/.output/server/chunks/routes/api/webhooks/github.post.mjs +189 -0
- package/.output/server/chunks/routes/api/webhooks/github.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/webhooks/slack.post.mjs +70 -0
- package/.output/server/chunks/routes/api/webhooks/slack.post.mjs.map +1 -0
- package/.output/server/chunks/routes/renderer.mjs +483 -0
- package/.output/server/chunks/routes/renderer.mjs.map +1 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
- package/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
- package/.output/server/index.mjs +9920 -0
- package/.output/server/index.mjs.map +1 -0
- package/.output/server/node_modules/.nitro/eventemitter3@4.0.7/index.js +336 -0
- package/.output/server/node_modules/.nitro/eventemitter3@4.0.7/package.json +56 -0
- package/.output/server/node_modules/.nitro/eventemitter3@5.0.4/index.js +336 -0
- package/.output/server/node_modules/.nitro/eventemitter3@5.0.4/package.json +62 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/cli.js +14798 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/package.json +58 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +61 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/COPYING +3 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/arm64-linux/rg +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/arm64-win32/rg.exe +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/x64-darwin/rg +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/x64-linux/rg +0 -0
- package/.output/server/node_modules/@anthropic-ai/claude-agent-sdk/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/.output/server/node_modules/@babel/parser/lib/index.js +14582 -0
- package/.output/server/node_modules/@babel/parser/package.json +50 -0
- package/.output/server/node_modules/@better-auth/core/dist/api/index.mjs +34 -0
- package/.output/server/node_modules/@better-auth/core/dist/async_hooks/index.mjs +22 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/endpoint-context.mjs +32 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/global.mjs +38 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/index.mjs +6 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/request-state.mjs +50 -0
- package/.output/server/node_modules/@better-auth/core/dist/context/transaction.mjs +96 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/factory.mjs +725 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-default-field-name.mjs +39 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-default-model-name.mjs +33 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.mjs +40 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-field-name.mjs +34 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-id-field.mjs +68 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/get-model-name.mjs +24 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/index.mjs +27 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/adapter/utils.mjs +39 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/get-tables.mjs +267 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/index.mjs +9 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/account.mjs +20 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/rate-limit.mjs +12 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/session.mjs +15 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/shared.mjs +12 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/user.mjs +14 -0
- package/.output/server/node_modules/@better-auth/core/dist/db/schema/verification.mjs +13 -0
- package/.output/server/node_modules/@better-auth/core/dist/env/color-depth.mjs +89 -0
- package/.output/server/node_modules/@better-auth/core/dist/env/env-impl.mjs +83 -0
- package/.output/server/node_modules/@better-auth/core/dist/env/index.mjs +5 -0
- package/.output/server/node_modules/@better-auth/core/dist/env/logger.mjs +82 -0
- package/.output/server/node_modules/@better-auth/core/dist/error/codes.mjs +57 -0
- package/.output/server/node_modules/@better-auth/core/dist/error/index.mjs +30 -0
- package/.output/server/node_modules/@better-auth/core/dist/index.mjs +1 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/client-credentials-token.mjs +67 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/create-authorization-url.mjs +44 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/index.mjs +8 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/refresh-access-token.mjs +76 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/utils.mjs +28 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/validate-authorization-code.mjs +83 -0
- package/.output/server/node_modules/@better-auth/core/dist/oauth2/verify.mjs +96 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/apple.mjs +105 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/atlassian.mjs +84 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/cognito.mjs +166 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/discord.mjs +65 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/dropbox.mjs +76 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/facebook.mjs +121 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/figma.mjs +87 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/github.mjs +97 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/gitlab.mjs +83 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/google.mjs +113 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/huggingface.mjs +76 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/index.mjs +79 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/kakao.mjs +73 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/kick.mjs +72 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/line.mjs +114 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/linear.mjs +89 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/linkedin.mjs +77 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/microsoft-entra-id.mjs +140 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/naver.mjs +68 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/notion.mjs +76 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/paybin.mjs +86 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/paypal.mjs +145 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/polar.mjs +74 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/railway.mjs +78 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/reddit.mjs +84 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/roblox.mjs +60 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/salesforce.mjs +92 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/slack.mjs +69 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/spotify.mjs +72 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/tiktok.mjs +63 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/twitch.mjs +79 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/twitter.mjs +88 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/vercel.mjs +62 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/vk.mjs +84 -0
- package/.output/server/node_modules/@better-auth/core/dist/social-providers/zoom.mjs +73 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/db.mjs +17 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/deprecate.mjs +18 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/error-codes.mjs +12 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/fetch-metadata.mjs +8 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/id.mjs +10 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/ip.mjs +119 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/json.mjs +45 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/string.mjs +8 -0
- package/.output/server/node_modules/@better-auth/core/dist/utils/url.mjs +33 -0
- package/.output/server/node_modules/@better-auth/core/package.json +169 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/dist/bun-sqlite-dialect-C8OaCWSL.mjs +156 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/dist/d1-sqlite-dialect-sYHNqBte.mjs +117 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/dist/index.mjs +381 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/dist/node-sqlite-dialect.mjs +156 -0
- package/.output/server/node_modules/@better-auth/kysely-adapter/package.json +62 -0
- package/.output/server/node_modules/@better-auth/memory-adapter/dist/index.mjs +218 -0
- package/.output/server/node_modules/@better-auth/memory-adapter/package.json +54 -0
- package/.output/server/node_modules/@better-auth/telemetry/dist/node.mjs +489 -0
- package/.output/server/node_modules/@better-auth/telemetry/package.json +62 -0
- package/.output/server/node_modules/@better-auth/utils/dist/base32.mjs +101 -0
- package/.output/server/node_modules/@better-auth/utils/dist/base64.mjs +77 -0
- package/.output/server/node_modules/@better-auth/utils/dist/binary.mjs +14 -0
- package/.output/server/node_modules/@better-auth/utils/dist/hash.mjs +29 -0
- package/.output/server/node_modules/@better-auth/utils/dist/hex.mjs +38 -0
- package/.output/server/node_modules/@better-auth/utils/dist/hmac.mjs +56 -0
- package/.output/server/node_modules/@better-auth/utils/dist/index.mjs +8 -0
- package/.output/server/node_modules/@better-auth/utils/dist/otp.mjs +88 -0
- package/.output/server/node_modules/@better-auth/utils/dist/random.mjs +53 -0
- package/.output/server/node_modules/@better-auth/utils/package.json +84 -0
- package/.output/server/node_modules/@better-fetch/fetch/dist/index.js +709 -0
- package/.output/server/node_modules/@better-fetch/fetch/package.json +46 -0
- package/.output/server/node_modules/@chat-adapter/github/dist/index.js +1080 -0
- package/.output/server/node_modules/@chat-adapter/github/package.json +59 -0
- package/.output/server/node_modules/@chat-adapter/shared/dist/index.js +245 -0
- package/.output/server/node_modules/@chat-adapter/shared/package.json +49 -0
- package/.output/server/node_modules/@chat-adapter/slack/dist/index.js +3442 -0
- package/.output/server/node_modules/@chat-adapter/slack/package.json +56 -0
- package/.output/server/node_modules/@iconify/utils/lib/colors/index.js +292 -0
- package/.output/server/node_modules/@iconify/utils/lib/colors/keywords.js +702 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/common.js +76 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/format.js +40 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/icon.js +52 -0
- package/.output/server/node_modules/@iconify/utils/lib/css/icons.js +133 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/bool.js +20 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/defaults.js +15 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/flip.js +18 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/merge.js +18 -0
- package/.output/server/node_modules/@iconify/utils/lib/customisations/rotate.js +31 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/cleanup.js +80 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/convert.js +102 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/data.js +29 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/format.js +60 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/parse.js +50 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/base.js +204 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/create.js +35 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/numbers.js +134 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/similar.js +167 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/tree.js +81 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/find.js +94 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/replace.js +28 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/components.js +78 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/missing.js +68 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/name.js +47 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/parse.js +105 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/similar.js +38 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/tree.js +94 -0
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/variations.js +64 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/defaults.js +26 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/merge.js +18 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/name.js +58 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/square.js +34 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon/transformations.js +13 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/convert-info.js +126 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/expand.js +21 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icon.js +27 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icons.js +38 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/minify.js +93 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/parse.js +48 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/tree.js +24 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate-basic.js +44 -0
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate.js +125 -0
- package/.output/server/node_modules/@iconify/utils/lib/index.js +53 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/custom.js +32 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/loader.js +28 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/modern.js +42 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/utils.js +63 -0
- package/.output/server/node_modules/@iconify/utils/lib/misc/objects.js +27 -0
- package/.output/server/node_modules/@iconify/utils/lib/misc/strings.js +27 -0
- package/.output/server/node_modules/@iconify/utils/lib/misc/title.js +10 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/build.js +115 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/defs.js +32 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.js +15 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/html.js +10 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/id.js +42 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/inner-html.js +23 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/parse.js +69 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/pretty.js +55 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/size.js +28 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/trim.js +8 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/url.js +23 -0
- package/.output/server/node_modules/@iconify/utils/lib/svg/viewbox.js +9 -0
- package/.output/server/node_modules/@iconify/utils/package.json +118 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/hrana.js +341 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/http.js +232 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/node.js +23 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/sql_cache.js +87 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/sqlite3.js +476 -0
- package/.output/server/node_modules/@libsql/client/lib-esm/ws.js +359 -0
- package/.output/server/node_modules/@libsql/client/package.json +123 -0
- package/.output/server/node_modules/@libsql/core/lib-esm/api.js +29 -0
- package/.output/server/node_modules/@libsql/core/lib-esm/config.js +138 -0
- package/.output/server/node_modules/@libsql/core/lib-esm/uri.js +120 -0
- package/.output/server/node_modules/@libsql/core/lib-esm/util.js +55 -0
- package/.output/server/node_modules/@libsql/core/package.json +91 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/batch.js +271 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/byte_queue.js +45 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/client.js +13 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/cursor.js +2 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/describe.js +8 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/index.js +4 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/json/decode.js +59 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/json/encode.js +72 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/protobuf/decode.js +150 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/protobuf/encode.js +95 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/encoding/protobuf/util.js +6 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/errors.js +102 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/client.js +126 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/cursor.js +138 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/json_decode.js +62 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/json_encode.js +55 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/protobuf_decode.js +44 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/protobuf_encode.js +78 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/http/stream.js +368 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/id_alloc.js +47 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/index.js +42 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/libsql_url.js +75 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/queue.js +26 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/queue_microtask.js +13 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/result.js +48 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/shared/json_decode.js +106 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/shared/json_encode.js +71 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/shared/protobuf_decode.js +115 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/shared/protobuf_encode.js +85 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/sql.js +46 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/stmt.js +76 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/stream.js +57 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/util.js +4 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/value.js +83 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/client.js +318 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/cursor.js +80 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/json_decode.js +74 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/json_encode.js +77 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/protobuf_decode.js +60 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/protobuf_encode.js +115 -0
- package/.output/server/node_modules/@libsql/hrana-client/lib-esm/ws/stream.js +211 -0
- package/.output/server/node_modules/@libsql/hrana-client/package.json +60 -0
- package/.output/server/node_modules/@libsql/isomorphic-ws/package.json +53 -0
- package/.output/server/node_modules/@libsql/isomorphic-ws/web.mjs +11 -0
- package/.output/server/node_modules/@libsql/linux-x64-gnu/index.node +0 -0
- package/.output/server/node_modules/@libsql/linux-x64-gnu/package.json +36 -0
- package/.output/server/node_modules/@neon-rs/load/dist/index.js +102 -0
- package/.output/server/node_modules/@neon-rs/load/package.json +37 -0
- package/.output/server/node_modules/@noble/ciphers/_arx.js +258 -0
- package/.output/server/node_modules/@noble/ciphers/_poly1305.js +319 -0
- package/.output/server/node_modules/@noble/ciphers/chacha.js +385 -0
- package/.output/server/node_modules/@noble/ciphers/package.json +81 -0
- package/.output/server/node_modules/@noble/ciphers/utils.js +343 -0
- package/.output/server/node_modules/@noble/hashes/_md.js +147 -0
- package/.output/server/node_modules/@noble/hashes/_u64.js +67 -0
- package/.output/server/node_modules/@noble/hashes/hkdf.js +84 -0
- package/.output/server/node_modules/@noble/hashes/hmac.js +90 -0
- package/.output/server/node_modules/@noble/hashes/package.json +93 -0
- package/.output/server/node_modules/@noble/hashes/pbkdf2.js +97 -0
- package/.output/server/node_modules/@noble/hashes/scrypt.js +216 -0
- package/.output/server/node_modules/@noble/hashes/sha2.js +397 -0
- package/.output/server/node_modules/@noble/hashes/sha3.js +254 -0
- package/.output/server/node_modules/@noble/hashes/utils.js +242 -0
- package/.output/server/node_modules/@octokit/auth-app/dist-node/index.js +490 -0
- package/.output/server/node_modules/@octokit/auth-app/package.json +59 -0
- package/.output/server/node_modules/@octokit/auth-oauth-app/dist-bundle/index.js +94 -0
- package/.output/server/node_modules/@octokit/auth-oauth-app/package.json +56 -0
- package/.output/server/node_modules/@octokit/auth-oauth-device/dist-bundle/index.js +138 -0
- package/.output/server/node_modules/@octokit/auth-oauth-device/package.json +53 -0
- package/.output/server/node_modules/@octokit/auth-oauth-user/dist-bundle/index.js +208 -0
- package/.output/server/node_modules/@octokit/auth-oauth-user/package.json +56 -0
- package/.output/server/node_modules/@octokit/auth-token/dist-bundle/index.js +55 -0
- package/.output/server/node_modules/@octokit/auth-token/package.json +50 -0
- package/.output/server/node_modules/@octokit/core/dist-src/index.js +141 -0
- package/.output/server/node_modules/@octokit/core/dist-src/version.js +4 -0
- package/.output/server/node_modules/@octokit/core/package.json +67 -0
- package/.output/server/node_modules/@octokit/endpoint/dist-bundle/index.js +346 -0
- package/.output/server/node_modules/@octokit/endpoint/package.json +50 -0
- package/.output/server/node_modules/@octokit/graphql/dist-bundle/index.js +129 -0
- package/.output/server/node_modules/@octokit/graphql/package.json +55 -0
- package/.output/server/node_modules/@octokit/oauth-authorization-url/dist-src/index.js +42 -0
- package/.output/server/node_modules/@octokit/oauth-authorization-url/package.json +43 -0
- package/.output/server/node_modules/@octokit/oauth-methods/dist-bundle/index.js +317 -0
- package/.output/server/node_modules/@octokit/oauth-methods/package.json +54 -0
- package/.output/server/node_modules/@octokit/plugin-paginate-rest/dist-bundle/index.js +415 -0
- package/.output/server/node_modules/@octokit/plugin-paginate-rest/package.json +59 -0
- package/.output/server/node_modules/@octokit/plugin-request-log/dist-src/index.js +26 -0
- package/.output/server/node_modules/@octokit/plugin-request-log/dist-src/version.js +4 -0
- package/.output/server/node_modules/@octokit/plugin-request-log/package.json +51 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/endpoints-to-methods.js +126 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/generated/endpoints.js +2294 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js +22 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js +5 -0
- package/.output/server/node_modules/@octokit/plugin-rest-endpoint-methods/package.json +58 -0
- package/.output/server/node_modules/@octokit/request/dist-bundle/index.js +203 -0
- package/.output/server/node_modules/@octokit/request/package.json +57 -0
- package/.output/server/node_modules/@octokit/request-error/dist-src/index.js +41 -0
- package/.output/server/node_modules/@octokit/request-error/package.json +50 -0
- package/.output/server/node_modules/@octokit/rest/dist-src/index.js +15 -0
- package/.output/server/node_modules/@octokit/rest/dist-src/version.js +4 -0
- package/.output/server/node_modules/@octokit/rest/package.json +76 -0
- package/.output/server/node_modules/@octokit/webhooks/dist-bundle/index.js +871 -0
- package/.output/server/node_modules/@octokit/webhooks/package.json +54 -0
- package/.output/server/node_modules/@octokit/webhooks-methods/dist-node/index.js +65 -0
- package/.output/server/node_modules/@octokit/webhooks-methods/package.json +53 -0
- package/.output/server/node_modules/@slack/logger/dist/index.js +94 -0
- package/.output/server/node_modules/@slack/logger/package.json +43 -0
- package/.output/server/node_modules/@slack/types/dist/block-kit/block-elements.js +4 -0
- package/.output/server/node_modules/@slack/types/dist/block-kit/blocks.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/block-kit/composition-objects.js +4 -0
- package/.output/server/node_modules/@slack/types/dist/block-kit/extensions.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/calls.js +6 -0
- package/.output/server/node_modules/@slack/types/dist/chunk.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/dialog.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/app.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/assistant.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/call.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/channel.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/dnd.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/email.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/emoji.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/file.js +4 -0
- package/.output/server/node_modules/@slack/types/dist/events/function.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/grid-migration.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/group.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/im.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/index.js +43 -0
- package/.output/server/node_modules/@slack/types/dist/events/invite.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/link-shared.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/member.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/message-metadata.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/message.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/pin.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/reaction.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/shared-channel.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/star.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/steps-from-apps.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/subteam.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/team.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/token.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/events/user.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/index.js +28 -0
- package/.output/server/node_modules/@slack/types/dist/message-attachments.js +3 -0
- package/.output/server/node_modules/@slack/types/dist/message-metadata.js +27 -0
- package/.output/server/node_modules/@slack/types/dist/views.js +3 -0
- package/.output/server/node_modules/@slack/types/package.json +47 -0
- package/.output/server/node_modules/@slack/web-api/dist/WebClient.js +818 -0
- package/.output/server/node_modules/@slack/web-api/dist/chat-stream.js +170 -0
- package/.output/server/node_modules/@slack/web-api/dist/errors.js +80 -0
- package/.output/server/node_modules/@slack/web-api/dist/file-upload.js +358 -0
- package/.output/server/node_modules/@slack/web-api/dist/helpers.js +14 -0
- package/.output/server/node_modules/@slack/web-api/dist/index.js +39 -0
- package/.output/server/node_modules/@slack/web-api/dist/instrument.js +75 -0
- package/.output/server/node_modules/@slack/web-api/dist/logger.js +29 -0
- package/.output/server/node_modules/@slack/web-api/dist/methods.js +1647 -0
- package/.output/server/node_modules/@slack/web-api/dist/retry-policies.js +34 -0
- package/.output/server/node_modules/@slack/web-api/dist/types/request/index.js +3 -0
- package/.output/server/node_modules/@slack/web-api/dist/types/response/index.js +3 -0
- package/.output/server/node_modules/@slack/web-api/package.json +76 -0
- package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6763 -0
- package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
- package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +689 -0
- package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1413 -0
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
- package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1877 -0
- package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
- package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6828 -0
- package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
- package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1795 -0
- package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +883 -0
- package/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
- package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +604 -0
- package/.output/server/node_modules/@vue/shared/package.json +47 -0
- package/.output/server/node_modules/@workflow/serde/dist/index.js +30 -0
- package/.output/server/node_modules/@workflow/serde/package.json +35 -0
- package/.output/server/node_modules/asynckit/index.js +6 -0
- package/.output/server/node_modules/asynckit/lib/abort.js +29 -0
- package/.output/server/node_modules/asynckit/lib/async.js +34 -0
- package/.output/server/node_modules/asynckit/lib/defer.js +26 -0
- package/.output/server/node_modules/asynckit/lib/iterate.js +75 -0
- package/.output/server/node_modules/asynckit/lib/state.js +37 -0
- package/.output/server/node_modules/asynckit/lib/terminator.js +29 -0
- package/.output/server/node_modules/asynckit/package.json +63 -0
- package/.output/server/node_modules/asynckit/parallel.js +43 -0
- package/.output/server/node_modules/asynckit/serial.js +17 -0
- package/.output/server/node_modules/asynckit/serialOrdered.js +75 -0
- package/.output/server/node_modules/axios/dist/node/axios.cjs +5643 -0
- package/.output/server/node_modules/axios/package.json +226 -0
- package/.output/server/node_modules/bail/index.js +12 -0
- package/.output/server/node_modules/bail/package.json +73 -0
- package/.output/server/node_modules/before-after-hook/index.js +45 -0
- package/.output/server/node_modules/before-after-hook/lib/add.js +46 -0
- package/.output/server/node_modules/before-after-hook/lib/register.js +27 -0
- package/.output/server/node_modules/before-after-hook/lib/remove.js +19 -0
- package/.output/server/node_modules/before-after-hook/package.json +54 -0
- package/.output/server/node_modules/better-auth/dist/_virtual/_rolldown/runtime.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/adapters/kysely-adapter/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/api/index.mjs +208 -0
- package/.output/server/node_modules/better-auth/dist/api/middlewares/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/api/middlewares/origin-check.mjs +140 -0
- package/.output/server/node_modules/better-auth/dist/api/rate-limiter/index.mjs +204 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/account.mjs +496 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/callback.mjs +179 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/email-verification.mjs +299 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/error.mjs +386 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/index.mjs +14 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/ok.mjs +30 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/password.mjs +199 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/session.mjs +489 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/sign-in.mjs +271 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/sign-out.mjs +33 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/sign-up.mjs +270 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/update-session.mjs +55 -0
- package/.output/server/node_modules/better-auth/dist/api/routes/update-user.mjs +500 -0
- package/.output/server/node_modules/better-auth/dist/api/state/oauth.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/api/state/should-session-refresh.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/api/to-auth-endpoints.mjs +197 -0
- package/.output/server/node_modules/better-auth/dist/auth/base.mjs +69 -0
- package/.output/server/node_modules/better-auth/dist/auth/full.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/auth/trusted-origins.mjs +31 -0
- package/.output/server/node_modules/better-auth/dist/client/broadcast-channel.mjs +46 -0
- package/.output/server/node_modules/better-auth/dist/client/config.mjs +108 -0
- package/.output/server/node_modules/better-auth/dist/client/fetch-plugins.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/client/focus-manager.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/client/index.mjs +22 -0
- package/.output/server/node_modules/better-auth/dist/client/online-manager.mjs +35 -0
- package/.output/server/node_modules/better-auth/dist/client/parser.mjs +73 -0
- package/.output/server/node_modules/better-auth/dist/client/plugins/index.mjs +31 -0
- package/.output/server/node_modules/better-auth/dist/client/plugins/infer-plugin.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/client/proxy.mjs +80 -0
- package/.output/server/node_modules/better-auth/dist/client/query.mjs +99 -0
- package/.output/server/node_modules/better-auth/dist/client/session-atom.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/client/session-refresh.mjs +137 -0
- package/.output/server/node_modules/better-auth/dist/client/vanilla.mjs +20 -0
- package/.output/server/node_modules/better-auth/dist/client/vue/index.mjs +38 -0
- package/.output/server/node_modules/better-auth/dist/client/vue/vue-store.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/context/create-context.mjs +229 -0
- package/.output/server/node_modules/better-auth/dist/context/helpers.mjs +95 -0
- package/.output/server/node_modules/better-auth/dist/context/init.mjs +22 -0
- package/.output/server/node_modules/better-auth/dist/context/secret-utils.mjs +56 -0
- package/.output/server/node_modules/better-auth/dist/cookies/cookie-utils.mjs +109 -0
- package/.output/server/node_modules/better-auth/dist/cookies/index.mjs +264 -0
- package/.output/server/node_modules/better-auth/dist/cookies/session-store.mjs +200 -0
- package/.output/server/node_modules/better-auth/dist/crypto/buffer.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/crypto/index.mjs +72 -0
- package/.output/server/node_modules/better-auth/dist/crypto/jwt.mjs +144 -0
- package/.output/server/node_modules/better-auth/dist/crypto/password.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/crypto/random.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/db/adapter-base.mjs +28 -0
- package/.output/server/node_modules/better-auth/dist/db/adapter-kysely.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/db/field-converter.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/db/get-migration.mjs +341 -0
- package/.output/server/node_modules/better-auth/dist/db/get-schema.mjs +39 -0
- package/.output/server/node_modules/better-auth/dist/db/index.mjs +35 -0
- package/.output/server/node_modules/better-auth/dist/db/internal-adapter.mjs +638 -0
- package/.output/server/node_modules/better-auth/dist/db/schema.mjs +127 -0
- package/.output/server/node_modules/better-auth/dist/db/to-zod.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/db/verification-token-storage.mjs +28 -0
- package/.output/server/node_modules/better-auth/dist/db/with-hooks.mjs +159 -0
- package/.output/server/node_modules/better-auth/dist/index.mjs +27 -0
- package/.output/server/node_modules/better-auth/dist/oauth2/link-account.mjs +143 -0
- package/.output/server/node_modules/better-auth/dist/oauth2/state.mjs +51 -0
- package/.output/server/node_modules/better-auth/dist/oauth2/utils.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/plugins/access/access.mjs +46 -0
- package/.output/server/node_modules/better-auth/dist/plugins/access/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/plugins/additional-fields/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/access/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/access/statement.mjs +54 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/admin.mjs +95 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/client.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/error-codes.mjs +30 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/has-permission.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/routes.mjs +847 -0
- package/.output/server/node_modules/better-auth/dist/plugins/admin/schema.mjs +34 -0
- package/.output/server/node_modules/better-auth/dist/plugins/anonymous/client.mjs +22 -0
- package/.output/server/node_modules/better-auth/dist/plugins/anonymous/error-codes.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/plugins/anonymous/index.mjs +160 -0
- package/.output/server/node_modules/better-auth/dist/plugins/anonymous/schema.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/bearer/index.mjs +83 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/constants.mjs +22 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/error-codes.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/index.mjs +63 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/utils.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/captchafox.mjs +28 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +30 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/h-captcha.mjs +28 -0
- package/.output/server/node_modules/better-auth/dist/plugins/captcha/verify-handlers/index.mjs +6 -0
- package/.output/server/node_modules/better-auth/dist/plugins/custom-session/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/custom-session/index.mjs +78 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/client.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/error-codes.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/index.mjs +50 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/routes.mjs +510 -0
- package/.output/server/node_modules/better-auth/dist/plugins/device-authorization/schema.mjs +57 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/client.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/error-codes.mjs +12 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/index.mjs +146 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/otp-token.mjs +29 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/routes.mjs +803 -0
- package/.output/server/node_modules/better-auth/dist/plugins/email-otp/utils.mjs +17 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/client.mjs +14 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/error-codes.mjs +17 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/index.mjs +145 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/auth0.mjs +45 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/gumroad.mjs +60 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/hubspot.mjs +60 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/index.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/keycloak.mjs +45 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/line.mjs +91 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +66 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/okta.mjs +45 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/patreon.mjs +59 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/providers/slack.mjs +61 -0
- package/.output/server/node_modules/better-auth/dist/plugins/generic-oauth/routes.mjs +411 -0
- package/.output/server/node_modules/better-auth/dist/plugins/haveibeenpwned/index.mjs +57 -0
- package/.output/server/node_modules/better-auth/dist/plugins/index.mjs +50 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/adapter.mjs +27 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/client.mjs +19 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/index.mjs +202 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/schema.mjs +23 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/sign.mjs +67 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/utils.mjs +64 -0
- package/.output/server/node_modules/better-auth/dist/plugins/jwt/verify.mjs +48 -0
- package/.output/server/node_modules/better-auth/dist/plugins/last-login-method/client.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/plugins/last-login-method/index.mjs +78 -0
- package/.output/server/node_modules/better-auth/dist/plugins/magic-link/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/magic-link/index.mjs +177 -0
- package/.output/server/node_modules/better-auth/dist/plugins/magic-link/utils.mjs +12 -0
- package/.output/server/node_modules/better-auth/dist/plugins/mcp/authorize.mjs +133 -0
- package/.output/server/node_modules/better-auth/dist/plugins/mcp/index.mjs +718 -0
- package/.output/server/node_modules/better-auth/dist/plugins/multi-session/client.mjs +20 -0
- package/.output/server/node_modules/better-auth/dist/plugins/multi-session/error-codes.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/plugins/multi-session/index.mjs +171 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oauth-proxy/index.mjs +306 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oauth-proxy/utils.mjs +51 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/authorize.mjs +203 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/error.mjs +27 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/index.mjs +1093 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/schema.mjs +132 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/utils/prompt.mjs +19 -0
- package/.output/server/node_modules/better-auth/dist/plugins/oidc-provider/utils.mjs +15 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-tap/client.mjs +188 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-tap/index.mjs +95 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-time-token/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-time-token/index.mjs +82 -0
- package/.output/server/node_modules/better-auth/dist/plugins/one-time-token/utils.mjs +12 -0
- package/.output/server/node_modules/better-auth/dist/plugins/open-api/generator.mjs +315 -0
- package/.output/server/node_modules/better-auth/dist/plugins/open-api/index.mjs +67 -0
- package/.output/server/node_modules/better-auth/dist/plugins/open-api/logo.mjs +15 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/access/index.mjs +3 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/access/statement.mjs +81 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/adapter.mjs +624 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/call.mjs +19 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/client.mjs +107 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/error-codes.mjs +66 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/has-permission.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/index.mjs +5 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/organization.mjs +428 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/permission.mjs +16 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-access-control.mjs +678 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-invites.mjs +551 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-members.mjs +466 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-org.mjs +423 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/routes/crud-team.mjs +676 -0
- package/.output/server/node_modules/better-auth/dist/plugins/organization/schema.mjs +68 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/client.mjs +20 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/error-codes.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/index.mjs +49 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/routes.mjs +472 -0
- package/.output/server/node_modules/better-auth/dist/plugins/phone-number/schema.mjs +20 -0
- package/.output/server/node_modules/better-auth/dist/plugins/siwe/client.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/plugins/siwe/index.mjs +204 -0
- package/.output/server/node_modules/better-auth/dist/plugins/siwe/schema.mjs +32 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/auth-helpers.mjs +31 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/cookie-builder.mjs +58 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/db-helpers.mjs +69 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/factories.mjs +42 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/index.mjs +89 -0
- package/.output/server/node_modules/better-auth/dist/plugins/test-utils/otp-sink.mjs +23 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/backup-codes/index.mjs +277 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/client.mjs +37 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/constant.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/error-code.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/index.mjs +234 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/otp/index.mjs +199 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/schema.mjs +36 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/totp/index.mjs +157 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/utils.mjs +12 -0
- package/.output/server/node_modules/better-auth/dist/plugins/two-factor/verify-two-factor.mjs +85 -0
- package/.output/server/node_modules/better-auth/dist/plugins/username/client.mjs +18 -0
- package/.output/server/node_modules/better-auth/dist/plugins/username/error-codes.mjs +17 -0
- package/.output/server/node_modules/better-auth/dist/plugins/username/index.mjs +234 -0
- package/.output/server/node_modules/better-auth/dist/plugins/username/schema.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/state.mjs +107 -0
- package/.output/server/node_modules/better-auth/dist/utils/boolean.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/utils/constants.mjs +6 -0
- package/.output/server/node_modules/better-auth/dist/utils/date.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/utils/get-request-ip.mjs +23 -0
- package/.output/server/node_modules/better-auth/dist/utils/hashing.mjs +21 -0
- package/.output/server/node_modules/better-auth/dist/utils/hide-metadata.mjs +6 -0
- package/.output/server/node_modules/better-auth/dist/utils/index.mjs +6 -0
- package/.output/server/node_modules/better-auth/dist/utils/is-api-error.mjs +11 -0
- package/.output/server/node_modules/better-auth/dist/utils/is-atom.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/utils/is-promise.mjs +8 -0
- package/.output/server/node_modules/better-auth/dist/utils/middleware-response.mjs +9 -0
- package/.output/server/node_modules/better-auth/dist/utils/password.mjs +26 -0
- package/.output/server/node_modules/better-auth/dist/utils/plugin-helper.mjs +17 -0
- package/.output/server/node_modules/better-auth/dist/utils/shim.mjs +24 -0
- package/.output/server/node_modules/better-auth/dist/utils/time.mjs +100 -0
- package/.output/server/node_modules/better-auth/dist/utils/url.mjs +198 -0
- package/.output/server/node_modules/better-auth/dist/utils/wildcard.mjs +108 -0
- package/.output/server/node_modules/better-auth/package.json +617 -0
- package/.output/server/node_modules/better-call/dist/context.mjs +103 -0
- package/.output/server/node_modules/better-call/dist/cookies.mjs +84 -0
- package/.output/server/node_modules/better-call/dist/crypto.mjs +36 -0
- package/.output/server/node_modules/better-call/dist/endpoint.mjs +70 -0
- package/.output/server/node_modules/better-call/dist/error.mjs +133 -0
- package/.output/server/node_modules/better-call/dist/index.mjs +10 -0
- package/.output/server/node_modules/better-call/dist/middleware.mjs +52 -0
- package/.output/server/node_modules/better-call/dist/openapi.mjs +189 -0
- package/.output/server/node_modules/better-call/dist/router.mjs +117 -0
- package/.output/server/node_modules/better-call/dist/to-response.mjs +96 -0
- package/.output/server/node_modules/better-call/dist/utils.mjs +82 -0
- package/.output/server/node_modules/better-call/dist/validator.mjs +57 -0
- package/.output/server/node_modules/better-call/package.json +96 -0
- package/.output/server/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/.output/server/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/.output/server/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/.output/server/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/.output/server/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/.output/server/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/.output/server/node_modules/ccount/index.js +27 -0
- package/.output/server/node_modules/ccount/package.json +71 -0
- package/.output/server/node_modules/character-entities/index.js +2132 -0
- package/.output/server/node_modules/character-entities/package.json +78 -0
- package/.output/server/node_modules/chat/dist/chunk-JW7GYSMH.js +1106 -0
- package/.output/server/node_modules/chat/dist/index.js +3466 -0
- package/.output/server/node_modules/chat/package.json +72 -0
- package/.output/server/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/.output/server/node_modules/combined-stream/package.json +25 -0
- package/.output/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
- package/.output/server/node_modules/consola/dist/core.mjs +512 -0
- package/.output/server/node_modules/consola/dist/index.mjs +651 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
- package/.output/server/node_modules/consola/package.json +136 -0
- package/.output/server/node_modules/cross-fetch/dist/node-ponyfill.js +22 -0
- package/.output/server/node_modules/cross-fetch/package.json +129 -0
- package/.output/server/node_modules/debug/package.json +64 -0
- package/.output/server/node_modules/debug/src/browser.js +272 -0
- package/.output/server/node_modules/debug/src/common.js +292 -0
- package/.output/server/node_modules/debug/src/index.js +10 -0
- package/.output/server/node_modules/debug/src/node.js +263 -0
- package/.output/server/node_modules/decode-named-character-reference/index.js +19 -0
- package/.output/server/node_modules/decode-named-character-reference/package.json +90 -0
- package/.output/server/node_modules/defu/dist/defu.mjs +69 -0
- package/.output/server/node_modules/defu/package.json +43 -0
- package/.output/server/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/.output/server/node_modules/delayed-stream/package.json +27 -0
- package/.output/server/node_modules/detect-libc/lib/detect-libc.js +279 -0
- package/.output/server/node_modules/detect-libc/lib/filesystem.js +41 -0
- package/.output/server/node_modules/detect-libc/lib/process.js +19 -0
- package/.output/server/node_modules/detect-libc/package.json +40 -0
- package/.output/server/node_modules/devalue/index.js +4 -0
- package/.output/server/node_modules/devalue/package.json +37 -0
- package/.output/server/node_modules/devalue/src/base64.js +110 -0
- package/.output/server/node_modules/devalue/src/constants.js +7 -0
- package/.output/server/node_modules/devalue/src/parse.js +265 -0
- package/.output/server/node_modules/devalue/src/stringify.js +350 -0
- package/.output/server/node_modules/devalue/src/uneval.js +490 -0
- package/.output/server/node_modules/devalue/src/utils.js +148 -0
- package/.output/server/node_modules/devlop/lib/default.js +9 -0
- package/.output/server/node_modules/devlop/package.json +80 -0
- package/.output/server/node_modules/dunder-proto/get.js +30 -0
- package/.output/server/node_modules/dunder-proto/package.json +76 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode-codepoint.js +77 -0
- package/.output/server/node_modules/entities/dist/commonjs/decode.js +568 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-html.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/generated/decode-data-xml.js +7 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/bin-trie-flags.js +21 -0
- package/.output/server/node_modules/entities/dist/commonjs/internal/decode-shared.js +31 -0
- package/.output/server/node_modules/entities/dist/commonjs/package.json +3 -0
- package/.output/server/node_modules/entities/package.json +120 -0
- package/.output/server/node_modules/es-define-property/index.js +14 -0
- package/.output/server/node_modules/es-define-property/package.json +81 -0
- package/.output/server/node_modules/es-errors/eval.js +4 -0
- package/.output/server/node_modules/es-errors/index.js +4 -0
- package/.output/server/node_modules/es-errors/package.json +80 -0
- package/.output/server/node_modules/es-errors/range.js +4 -0
- package/.output/server/node_modules/es-errors/ref.js +4 -0
- package/.output/server/node_modules/es-errors/syntax.js +4 -0
- package/.output/server/node_modules/es-errors/type.js +4 -0
- package/.output/server/node_modules/es-errors/uri.js +4 -0
- package/.output/server/node_modules/es-object-atoms/index.js +4 -0
- package/.output/server/node_modules/es-object-atoms/package.json +80 -0
- package/.output/server/node_modules/es-set-tostringtag/index.js +35 -0
- package/.output/server/node_modules/es-set-tostringtag/package.json +78 -0
- package/.output/server/node_modules/escape-string-regexp/index.js +11 -0
- package/.output/server/node_modules/escape-string-regexp/package.json +40 -0
- package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
- package/.output/server/node_modules/estree-walker/package.json +37 -0
- package/.output/server/node_modules/extend/index.js +117 -0
- package/.output/server/node_modules/extend/package.json +42 -0
- package/.output/server/node_modules/fast-content-type-parse/index.js +169 -0
- package/.output/server/node_modules/fast-content-type-parse/package.json +74 -0
- package/.output/server/node_modules/follow-redirects/debug.js +15 -0
- package/.output/server/node_modules/follow-redirects/index.js +686 -0
- package/.output/server/node_modules/follow-redirects/package.json +58 -0
- package/.output/server/node_modules/form-data/lib/form_data.js +494 -0
- package/.output/server/node_modules/form-data/lib/populate.js +10 -0
- package/.output/server/node_modules/form-data/package.json +82 -0
- package/.output/server/node_modules/function-bind/implementation.js +84 -0
- package/.output/server/node_modules/function-bind/index.js +5 -0
- package/.output/server/node_modules/function-bind/package.json +87 -0
- package/.output/server/node_modules/get-intrinsic/index.js +378 -0
- package/.output/server/node_modules/get-intrinsic/package.json +97 -0
- package/.output/server/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/.output/server/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/.output/server/node_modules/get-proto/index.js +27 -0
- package/.output/server/node_modules/get-proto/package.json +81 -0
- package/.output/server/node_modules/gopd/gOPD.js +4 -0
- package/.output/server/node_modules/gopd/index.js +15 -0
- package/.output/server/node_modules/gopd/package.json +77 -0
- package/.output/server/node_modules/has-symbols/index.js +14 -0
- package/.output/server/node_modules/has-symbols/package.json +111 -0
- package/.output/server/node_modules/has-symbols/shams.js +45 -0
- package/.output/server/node_modules/has-tostringtag/package.json +108 -0
- package/.output/server/node_modules/has-tostringtag/shams.js +8 -0
- package/.output/server/node_modules/hasown/index.js +8 -0
- package/.output/server/node_modules/hasown/package.json +92 -0
- package/.output/server/node_modules/hookable/dist/index.mjs +266 -0
- package/.output/server/node_modules/hookable/package.json +53 -0
- package/.output/server/node_modules/is-electron/index.js +21 -0
- package/.output/server/node_modules/is-electron/package.json +34 -0
- package/.output/server/node_modules/is-plain-obj/index.js +8 -0
- package/.output/server/node_modules/is-plain-obj/package.json +41 -0
- package/.output/server/node_modules/is-stream/index.js +28 -0
- package/.output/server/node_modules/is-stream/package.json +42 -0
- package/.output/server/node_modules/jose/dist/webapi/index.js +32 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +159 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +167 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
- package/.output/server/node_modules/jose/dist/webapi/jwe/general/encrypt.js +182 -0
- package/.output/server/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
- package/.output/server/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
- package/.output/server/node_modules/jose/dist/webapi/jwks/local.js +119 -0
- package/.output/server/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/flattened/sign.js +89 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/flattened/verify.js +110 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/general/sign.js +70 -0
- package/.output/server/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/encrypt.js +101 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
- package/.output/server/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
- package/.output/server/node_modules/jose/dist/webapi/key/export.js +11 -0
- package/.output/server/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
- package/.output/server/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
- package/.output/server/node_modules/jose/dist/webapi/key/import.js +57 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/aesgcmkw.js +15 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/base64.js +22 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/content_encryption.js +217 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/crypto_key.js +136 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/deflate.js +44 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/helpers.js +19 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/jwk_to_key.js +107 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/key_management.js +186 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/normalize_key.js +166 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/pbes2kw.js +39 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/signing.js +68 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/type_checks.js +40 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
- package/.output/server/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
- package/.output/server/node_modules/jose/dist/webapi/util/base64url.js +30 -0
- package/.output/server/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
- package/.output/server/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
- package/.output/server/node_modules/jose/dist/webapi/util/errors.js +99 -0
- package/.output/server/node_modules/jose/package.json +200 -0
- package/.output/server/node_modules/js-base64/base64.mjs +301 -0
- package/.output/server/node_modules/js-base64/package.json +43 -0
- package/.output/server/node_modules/js-yaml/dist/js-yaml.mjs +3856 -0
- package/.output/server/node_modules/js-yaml/package.json +66 -0
- package/.output/server/node_modules/json-with-bigint/json-with-bigint.js +154 -0
- package/.output/server/node_modules/json-with-bigint/package.json +31 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/database-introspector.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/dialect-adapter-base.js +21 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/dialect-adapter.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/dialect.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-adapter.js +25 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-dialect-config.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-dialect.js +62 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-driver.js +356 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-introspector.js +107 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mssql/mssql-query-compiler.js +80 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-adapter.js +25 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-dialect-config.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-dialect.js +53 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-driver.js +177 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-introspector.js +76 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/mysql/mysql-query-compiler.js +68 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-adapter.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-dialect-config.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-dialect.js +53 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-driver.js +131 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-introspector.js +97 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/postgres/postgres-query-compiler.js +8 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-adapter.js +20 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-dialect-config.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-dialect.js +48 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-driver.js +110 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-introspector.js +91 -0
- package/.output/server/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-query-compiler.js +34 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/connection-provider.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/database-connection.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/default-connection-provider.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/driver.js +19 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/dummy-driver.js +80 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/runtime-driver.js +162 -0
- package/.output/server/node_modules/kysely/dist/esm/driver/single-connection-provider.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/dynamic/dynamic-reference-builder.js +32 -0
- package/.output/server/node_modules/kysely/dist/esm/dynamic/dynamic-table-builder.js +41 -0
- package/.output/server/node_modules/kysely/dist/esm/dynamic/dynamic.js +129 -0
- package/.output/server/node_modules/kysely/dist/esm/expression/expression-builder.js +125 -0
- package/.output/server/node_modules/kysely/dist/esm/expression/expression-wrapper.js +128 -0
- package/.output/server/node_modules/kysely/dist/esm/expression/expression.js +12 -0
- package/.output/server/node_modules/kysely/dist/esm/index.js +212 -0
- package/.output/server/node_modules/kysely/dist/esm/kysely.js +917 -0
- package/.output/server/node_modules/kysely/dist/esm/migration/file-migration-provider.js +49 -0
- package/.output/server/node_modules/kysely/dist/esm/migration/migrator.js +608 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/add-column-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/add-constraint-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/add-index-node.js +29 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/aggregate-function-node.js +56 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/alias-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/alter-column-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/alter-table-node.js +30 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/and-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/binary-operation-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/case-node.js +40 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/cast-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/check-constraint-node.js +20 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/collate-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/column-definition-node.js +40 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/column-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/column-update-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/common-table-expression-name-node.js +21 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/common-table-expression-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/constraint-node.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-index-node.js +29 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-schema-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-table-node.js +54 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-type-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/create-view-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/data-type-node.js +83 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/default-insert-value-node.js +15 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/default-value-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/delete-query-node.js +50 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-column-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-constraint-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-index-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-schema-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-table-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-type-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/drop-view-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/explain-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/fetch-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/foreign-key-constraint-node.js +28 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/from-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/function-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/generated-node.js +29 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/group-by-item-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/group-by-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/having-node.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/identifier-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/insert-query-node.js +29 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/join-node.js +35 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/json-operator-chain-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/json-path-leg-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/json-path-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/json-reference-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/limit-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/list-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/matched-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/merge-query-node.js +43 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/modify-column-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/offset-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/on-conflict-node.js +66 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/on-duplicate-key-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/on-node.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operation-node-source.js +5 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operation-node-transformer.js +926 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operation-node-visitor.js +112 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operation-node.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/operator-node.js +100 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/or-action-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/or-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/order-by-item-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/order-by-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/output-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/over-node.js +33 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/parens-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/partition-by-item-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/partition-by-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/primary-key-constraint-node.js +30 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/primitive-value-list-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/query-node.js +100 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/raw-node.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/reference-node.js +25 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/references-node.js +36 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/refresh-materialized-view-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/rename-column-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/rename-constraint-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/returning-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/schemable-identifier-node.js +24 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/select-all-node.js +15 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/select-modifier-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/select-query-node.js +127 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/selection-node.js +30 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/set-operation-node.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/simple-reference-expression-node.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/table-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/top-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/tuple-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/unary-operation-node.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/unique-constraint-node.js +28 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/update-query-node.js +48 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/using-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/value-list-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/value-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/values-node.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/when-node.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/where-node.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/operation-node/with-node.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/package.json +1 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/binary-operation-parser.js +68 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/data-type-parser.js +12 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/default-value-parser.js +8 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/expression-parser.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/fetch-parser.js +15 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/group-by-parser.js +9 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/identifier-parser.js +20 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/insert-values-parser.js +62 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/join-parser.js +28 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/merge-parser.js +28 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/on-commit-action-parse.js +8 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/on-modify-action-parser.js +8 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/order-by-parser.js +67 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/parse-utils.js +33 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/partition-by-parser.js +6 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/reference-parser.js +95 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/savepoint-parser.js +9 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/select-parser.js +47 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/set-operation-parser.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/table-parser.js +49 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/top-parser.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/unary-operation-parser.js +13 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/update-set-parser.js +23 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/value-parser.js +33 -0
- package/.output/server/node_modules/kysely/dist/esm/parser/with-parser.js +31 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/camel-case/camel-case-plugin.js +119 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/camel-case/camel-case-transformer.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/camel-case/camel-case.js +108 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/deduplicate-joins/deduplicate-joins-plugin.js +16 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/deduplicate-joins/deduplicate-joins-transformer.js +39 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.js +159 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.js +26 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists.js +63 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/immediate-value/immediate-value-plugin.js +19 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/immediate-value/immediate-value-transformer.js +20 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/kysely-plugin.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/noop-plugin.js +9 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/parse-json-results/parse-json-results-plugin.js +104 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/with-schema/with-schema-plugin.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/plugin/with-schema/with-schema-transformer.js +197 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/aggregate-function-builder.js +238 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/case-builder.js +73 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/cte-builder.js +34 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/delete-query-builder.js +501 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/delete-result.js +7 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/function-module.js +60 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/having-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/insert-query-builder.js +1157 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/insert-result.js +50 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/join-builder.js +48 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/json-path-builder.js +195 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/merge-query-builder.js +624 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/merge-result.js +7 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/no-result-error.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/on-conflict-builder.js +254 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/order-by-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/order-by-item-builder.js +72 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/output-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/over-builder.js +37 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/returning-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/select-query-builder.js +374 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/update-query-builder.js +510 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/update-result.js +18 -0
- package/.output/server/node_modules/kysely/dist/esm/query-builder/where-interface.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-compiler/compiled-query.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/query-compiler/default-query-compiler.js +1395 -0
- package/.output/server/node_modules/kysely/dist/esm/query-compiler/query-compiler.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-creator.js +619 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/default-query-executor.js +37 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/noop-query-executor.js +34 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/query-executor-base.js +59 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/query-executor-provider.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/query-executor/query-executor.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/raw-builder/raw-builder.js +84 -0
- package/.output/server/node_modules/kysely/dist/esm/raw-builder/sql.js +82 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-column-builder.js +70 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-add-foreign-key-constraint-builder.js +64 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-add-index-builder.js +162 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-builder.js +263 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-drop-constraint-builder.js +56 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/alter-table-executor.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/check-constraint-builder.js +17 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/column-definition-builder.js +597 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-index-builder.js +199 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-schema-builder.js +31 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-table-builder.js +408 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-type-builder.js +40 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/create-view-builder.js +95 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-index-builder.js +54 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-schema-builder.js +41 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-table-builder.js +41 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-type-builder.js +33 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/drop-view-builder.js +49 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/foreign-key-constraint-builder.js +45 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/primary-key-constraint-builder.js +34 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/refresh-materialized-view-builder.js +72 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/schema.js +325 -0
- package/.output/server/node_modules/kysely/dist/esm/schema/unique-constraint-builder.js +42 -0
- package/.output/server/node_modules/kysely/dist/esm/util/column-type.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/util/compilable.js +5 -0
- package/.output/server/node_modules/kysely/dist/esm/util/deferred.js +25 -0
- package/.output/server/node_modules/kysely/dist/esm/util/explainable.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/util/infer-result.js +2 -0
- package/.output/server/node_modules/kysely/dist/esm/util/log-once.js +13 -0
- package/.output/server/node_modules/kysely/dist/esm/util/log.js +56 -0
- package/.output/server/node_modules/kysely/dist/esm/util/object-utils.js +141 -0
- package/.output/server/node_modules/kysely/dist/esm/util/performance-now.js +10 -0
- package/.output/server/node_modules/kysely/dist/esm/util/provide-controlled-connection.js +22 -0
- package/.output/server/node_modules/kysely/dist/esm/util/query-id.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/util/random-string.js +75 -0
- package/.output/server/node_modules/kysely/dist/esm/util/require-all-props.js +39 -0
- package/.output/server/node_modules/kysely/dist/esm/util/stack-trace-utils.js +14 -0
- package/.output/server/node_modules/kysely/dist/esm/util/streamable.js +2 -0
- package/.output/server/node_modules/kysely/package.json +144 -0
- package/.output/server/node_modules/libsql/auth.js +22 -0
- package/.output/server/node_modules/libsql/index.js +441 -0
- package/.output/server/node_modules/libsql/package.json +92 -0
- package/.output/server/node_modules/libsql/sqlite-error.js +21 -0
- package/.output/server/node_modules/liquidjs/dist/liquid.node.js +4992 -0
- package/.output/server/node_modules/liquidjs/package.json +168 -0
- package/.output/server/node_modules/longest-streak/index.js +36 -0
- package/.output/server/node_modules/longest-streak/package.json +73 -0
- package/.output/server/node_modules/markdown-table/index.js +393 -0
- package/.output/server/node_modules/markdown-table/package.json +77 -0
- package/.output/server/node_modules/math-intrinsics/abs.js +4 -0
- package/.output/server/node_modules/math-intrinsics/floor.js +4 -0
- package/.output/server/node_modules/math-intrinsics/isNaN.js +6 -0
- package/.output/server/node_modules/math-intrinsics/max.js +4 -0
- package/.output/server/node_modules/math-intrinsics/min.js +4 -0
- package/.output/server/node_modules/math-intrinsics/package.json +86 -0
- package/.output/server/node_modules/math-intrinsics/pow.js +4 -0
- package/.output/server/node_modules/math-intrinsics/round.js +4 -0
- package/.output/server/node_modules/math-intrinsics/sign.js +11 -0
- package/.output/server/node_modules/mdast-util-find-and-replace/index.js +11 -0
- package/.output/server/node_modules/mdast-util-find-and-replace/lib/index.js +261 -0
- package/.output/server/node_modules/mdast-util-find-and-replace/package.json +85 -0
- package/.output/server/node_modules/mdast-util-from-markdown/index.js +2 -0
- package/.output/server/node_modules/mdast-util-from-markdown/lib/index.js +1177 -0
- package/.output/server/node_modules/mdast-util-from-markdown/package.json +99 -0
- package/.output/server/node_modules/mdast-util-gfm/index.js +2 -0
- package/.output/server/node_modules/mdast-util-gfm/lib/index.js +63 -0
- package/.output/server/node_modules/mdast-util-gfm/package.json +125 -0
- package/.output/server/node_modules/mdast-util-gfm-autolink-literal/index.js +4 -0
- package/.output/server/node_modules/mdast-util-gfm-autolink-literal/lib/index.js +280 -0
- package/.output/server/node_modules/mdast-util-gfm-autolink-literal/package.json +106 -0
- package/.output/server/node_modules/mdast-util-gfm-footnote/index.js +2 -0
- package/.output/server/node_modules/mdast-util-gfm-footnote/lib/index.js +212 -0
- package/.output/server/node_modules/mdast-util-gfm-footnote/package.json +111 -0
- package/.output/server/node_modules/mdast-util-gfm-strikethrough/index.js +5 -0
- package/.output/server/node_modules/mdast-util-gfm-strikethrough/lib/index.js +106 -0
- package/.output/server/node_modules/mdast-util-gfm-strikethrough/package.json +99 -0
- package/.output/server/node_modules/mdast-util-gfm-table/index.js +2 -0
- package/.output/server/node_modules/mdast-util-gfm-table/lib/index.js +300 -0
- package/.output/server/node_modules/mdast-util-gfm-table/package.json +101 -0
- package/.output/server/node_modules/mdast-util-gfm-task-list-item/index.js +4 -0
- package/.output/server/node_modules/mdast-util-gfm-task-list-item/lib/index.js +141 -0
- package/.output/server/node_modules/mdast-util-gfm-task-list-item/package.json +90 -0
- package/.output/server/node_modules/mdast-util-phrasing/index.js +1 -0
- package/.output/server/node_modules/mdast-util-phrasing/lib/index.js +45 -0
- package/.output/server/node_modules/mdast-util-phrasing/package.json +78 -0
- package/.output/server/node_modules/mdast-util-to-markdown/index.js +3 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/configure.js +79 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +29 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/break.js +30 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/code.js +75 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/definition.js +76 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +69 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/heading.js +75 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/html.js +20 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +63 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/image.js +82 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/index.js +45 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +76 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +63 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/link.js +114 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +62 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/list.js +100 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +20 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/root.js +23 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/strong.js +69 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/text.js +15 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/index.js +187 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/join.js +39 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/unsafe.js +146 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/association.js +33 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +38 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +21 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +24 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +84 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +125 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js +11 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +82 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +22 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +34 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +34 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +35 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +41 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/safe.js +174 -0
- package/.output/server/node_modules/mdast-util-to-markdown/lib/util/track.js +55 -0
- package/.output/server/node_modules/mdast-util-to-markdown/package.json +132 -0
- package/.output/server/node_modules/mdast-util-to-string/index.js +5 -0
- package/.output/server/node_modules/mdast-util-to-string/lib/index.js +108 -0
- package/.output/server/node_modules/mdast-util-to-string/package.json +78 -0
- package/.output/server/node_modules/micromark/index.js +60 -0
- package/.output/server/node_modules/micromark/lib/compile.js +1060 -0
- package/.output/server/node_modules/micromark/lib/constructs.js +85 -0
- package/.output/server/node_modules/micromark/lib/create-tokenizer.js +611 -0
- package/.output/server/node_modules/micromark/lib/initialize/content.js +79 -0
- package/.output/server/node_modules/micromark/lib/initialize/document.js +362 -0
- package/.output/server/node_modules/micromark/lib/initialize/flow.js +58 -0
- package/.output/server/node_modules/micromark/lib/initialize/text.js +212 -0
- package/.output/server/node_modules/micromark/lib/parse.js +56 -0
- package/.output/server/node_modules/micromark/lib/postprocess.js +18 -0
- package/.output/server/node_modules/micromark/lib/preprocess.js +115 -0
- package/.output/server/node_modules/micromark/package.json +100 -0
- package/.output/server/node_modules/micromark-core-commonmark/index.js +22 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/attention.js +241 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/autolink.js +233 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/blank-line.js +61 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/block-quote.js +143 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/character-escape.js +64 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/character-reference.js +149 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/code-fenced.js +460 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/code-indented.js +177 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/code-text.js +225 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/content.js +163 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/definition.js +254 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/hard-break-escape.js +60 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/heading-atx.js +195 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/html-flow.js +876 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/html-text.js +678 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/label-end.js +560 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/label-start-image.js +102 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/label-start-link.js +55 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/line-ending.js +33 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/list.js +213 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/setext-underline.js +185 -0
- package/.output/server/node_modules/micromark-core-commonmark/lib/thematic-break.js +102 -0
- package/.output/server/node_modules/micromark-core-commonmark/package.json +74 -0
- package/.output/server/node_modules/micromark-extension-gfm/index.js +69 -0
- package/.output/server/node_modules/micromark-extension-gfm/package.json +107 -0
- package/.output/server/node_modules/micromark-extension-gfm-autolink-literal/index.js +2 -0
- package/.output/server/node_modules/micromark-extension-gfm-autolink-literal/lib/html.js +60 -0
- package/.output/server/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js +854 -0
- package/.output/server/node_modules/micromark-extension-gfm-autolink-literal/package.json +116 -0
- package/.output/server/node_modules/micromark-extension-gfm-footnote/index.js +3 -0
- package/.output/server/node_modules/micromark-extension-gfm-footnote/lib/html.js +154 -0
- package/.output/server/node_modules/micromark-extension-gfm-footnote/lib/syntax.js +485 -0
- package/.output/server/node_modules/micromark-extension-gfm-footnote/package.json +132 -0
- package/.output/server/node_modules/micromark-extension-gfm-strikethrough/index.js +3 -0
- package/.output/server/node_modules/micromark-extension-gfm-strikethrough/lib/html.js +26 -0
- package/.output/server/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js +142 -0
- package/.output/server/node_modules/micromark-extension-gfm-strikethrough/package.json +129 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/index.js +2 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/lib/edit-map.js +202 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/lib/html.js +130 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/lib/infer.js +52 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/lib/syntax.js +819 -0
- package/.output/server/node_modules/micromark-extension-gfm-table/package.json +128 -0
- package/.output/server/node_modules/micromark-extension-gfm-tagfilter/index.js +1 -0
- package/.output/server/node_modules/micromark-extension-gfm-tagfilter/lib/index.js +51 -0
- package/.output/server/node_modules/micromark-extension-gfm-tagfilter/package.json +82 -0
- package/.output/server/node_modules/micromark-extension-gfm-task-list-item/index.js +2 -0
- package/.output/server/node_modules/micromark-extension-gfm-task-list-item/lib/html.js +29 -0
- package/.output/server/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js +158 -0
- package/.output/server/node_modules/micromark-extension-gfm-task-list-item/package.json +131 -0
- package/.output/server/node_modules/micromark-factory-destination/index.js +206 -0
- package/.output/server/node_modules/micromark-factory-destination/package.json +57 -0
- package/.output/server/node_modules/micromark-factory-label/index.js +148 -0
- package/.output/server/node_modules/micromark-factory-label/package.json +60 -0
- package/.output/server/node_modules/micromark-factory-space/index.js +64 -0
- package/.output/server/node_modules/micromark-factory-space/package.json +55 -0
- package/.output/server/node_modules/micromark-factory-title/index.js +158 -0
- package/.output/server/node_modules/micromark-factory-title/package.json +58 -0
- package/.output/server/node_modules/micromark-factory-whitespace/index.js +44 -0
- package/.output/server/node_modules/micromark-factory-whitespace/package.json +57 -0
- package/.output/server/node_modules/micromark-util-character/index.js +246 -0
- package/.output/server/node_modules/micromark-util-character/package.json +57 -0
- package/.output/server/node_modules/micromark-util-chunked/index.js +81 -0
- package/.output/server/node_modules/micromark-util-chunked/package.json +57 -0
- package/.output/server/node_modules/micromark-util-classify-character/index.js +27 -0
- package/.output/server/node_modules/micromark-util-classify-character/package.json +59 -0
- package/.output/server/node_modules/micromark-util-combine-extensions/index.js +143 -0
- package/.output/server/node_modules/micromark-util-combine-extensions/package.json +52 -0
- package/.output/server/node_modules/micromark-util-decode-numeric-character-reference/index.js +32 -0
- package/.output/server/node_modules/micromark-util-decode-numeric-character-reference/package.json +59 -0
- package/.output/server/node_modules/micromark-util-decode-string/index.js +45 -0
- package/.output/server/node_modules/micromark-util-decode-string/package.json +63 -0
- package/.output/server/node_modules/micromark-util-encode/index.js +33 -0
- package/.output/server/node_modules/micromark-util-encode/package.json +47 -0
- package/.output/server/node_modules/micromark-util-html-tag-name/index.js +93 -0
- package/.output/server/node_modules/micromark-util-html-tag-name/package.json +47 -0
- package/.output/server/node_modules/micromark-util-normalize-identifier/index.js +33 -0
- package/.output/server/node_modules/micromark-util-normalize-identifier/package.json +58 -0
- package/.output/server/node_modules/micromark-util-resolve-all/index.js +32 -0
- package/.output/server/node_modules/micromark-util-resolve-all/package.json +48 -0
- package/.output/server/node_modules/micromark-util-sanitize-uri/index.js +107 -0
- package/.output/server/node_modules/micromark-util-sanitize-uri/package.json +59 -0
- package/.output/server/node_modules/micromark-util-subtokenize/index.js +228 -0
- package/.output/server/node_modules/micromark-util-subtokenize/lib/splice-buffer.js +251 -0
- package/.output/server/node_modules/micromark-util-subtokenize/package.json +60 -0
- package/.output/server/node_modules/mime-db/db.json +8519 -0
- package/.output/server/node_modules/mime-db/index.js +12 -0
- package/.output/server/node_modules/mime-db/package.json +60 -0
- package/.output/server/node_modules/mime-types/index.js +188 -0
- package/.output/server/node_modules/mime-types/package.json +44 -0
- package/.output/server/node_modules/ms/index.js +162 -0
- package/.output/server/node_modules/ms/package.json +38 -0
- package/.output/server/node_modules/nanostores/atom/index.js +94 -0
- package/.output/server/node_modules/nanostores/clean-stores/index.js +18 -0
- package/.output/server/node_modules/nanostores/computed/index.js +65 -0
- package/.output/server/node_modules/nanostores/deep-map/index.js +30 -0
- package/.output/server/node_modules/nanostores/deep-map/path.js +64 -0
- package/.output/server/node_modules/nanostores/effect/index.js +21 -0
- package/.output/server/node_modules/nanostores/index.js +24 -0
- package/.output/server/node_modules/nanostores/keep-mount/index.js +3 -0
- package/.output/server/node_modules/nanostores/lifecycle/index.js +160 -0
- package/.output/server/node_modules/nanostores/listen-keys/index.js +14 -0
- package/.output/server/node_modules/nanostores/map/index.js +23 -0
- package/.output/server/node_modules/nanostores/map-creator/index.js +38 -0
- package/.output/server/node_modules/nanostores/package.json +34 -0
- package/.output/server/node_modules/nanostores/task/index.js +35 -0
- package/.output/server/node_modules/nanostores/warn/index.js +12 -0
- package/.output/server/node_modules/node-fetch/lib/index.js +1787 -0
- package/.output/server/node_modules/node-fetch/package.json +89 -0
- package/.output/server/node_modules/p-finally/index.js +15 -0
- package/.output/server/node_modules/p-finally/package.json +42 -0
- package/.output/server/node_modules/p-queue/dist/index.js +279 -0
- package/.output/server/node_modules/p-queue/dist/lower-bound.js +21 -0
- package/.output/server/node_modules/p-queue/dist/priority-queue.js +32 -0
- package/.output/server/node_modules/p-queue/package.json +92 -0
- package/.output/server/node_modules/p-retry/index.js +85 -0
- package/.output/server/node_modules/p-retry/package.json +51 -0
- package/.output/server/node_modules/p-timeout/index.js +57 -0
- package/.output/server/node_modules/p-timeout/package.json +45 -0
- package/.output/server/node_modules/perfect-debounce/dist/index.mjs +89 -0
- package/.output/server/node_modules/perfect-debounce/package.json +41 -0
- package/.output/server/node_modules/promise-limit/index.js +88 -0
- package/.output/server/node_modules/promise-limit/package.json +39 -0
- package/.output/server/node_modules/proxy-from-env/index.js +108 -0
- package/.output/server/node_modules/proxy-from-env/package.json +34 -0
- package/.output/server/node_modules/remark-gfm/index.js +2 -0
- package/.output/server/node_modules/remark-gfm/lib/index.js +41 -0
- package/.output/server/node_modules/remark-gfm/package.json +125 -0
- package/.output/server/node_modules/remark-parse/index.js +2 -0
- package/.output/server/node_modules/remark-parse/lib/index.js +43 -0
- package/.output/server/node_modules/remark-parse/package.json +72 -0
- package/.output/server/node_modules/remark-stringify/index.js +2 -0
- package/.output/server/node_modules/remark-stringify/lib/index.js +42 -0
- package/.output/server/node_modules/remark-stringify/package.json +71 -0
- package/.output/server/node_modules/remend/dist/index.js +22 -0
- package/.output/server/node_modules/remend/package.json +41 -0
- package/.output/server/node_modules/retry/index.js +1 -0
- package/.output/server/node_modules/retry/lib/retry.js +100 -0
- package/.output/server/node_modules/retry/lib/retry_operation.js +162 -0
- package/.output/server/node_modules/retry/package.json +36 -0
- package/.output/server/node_modules/rou3/dist/index.mjs +265 -0
- package/.output/server/node_modules/rou3/package.json +47 -0
- package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
- package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
- package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
- package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
- package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
- package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
- package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
- package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
- package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
- package/.output/server/node_modules/source-map-js/package.json +71 -0
- package/.output/server/node_modules/source-map-js/source-map.js +8 -0
- package/.output/server/node_modules/supports-color/index.js +202 -0
- package/.output/server/node_modules/supports-color/package.json +64 -0
- package/.output/server/node_modules/tailwindcss/dist/chunk-X4GG3EDV.mjs +1 -0
- package/.output/server/node_modules/tailwindcss/dist/colors.mjs +1 -0
- package/.output/server/node_modules/tailwindcss/package.json +89 -0
- package/.output/server/node_modules/toad-cache/dist/toad-cache.mjs +852 -0
- package/.output/server/node_modules/toad-cache/package.json +82 -0
- package/.output/server/node_modules/tr46/index.js +193 -0
- package/.output/server/node_modules/tr46/lib/mappingTable.json +1 -0
- package/.output/server/node_modules/tr46/package.json +31 -0
- package/.output/server/node_modules/trough/index.js +9 -0
- package/.output/server/node_modules/trough/lib/index.js +206 -0
- package/.output/server/node_modules/trough/package.json +77 -0
- package/.output/server/node_modules/ufo/dist/index.mjs +645 -0
- package/.output/server/node_modules/ufo/package.json +48 -0
- package/.output/server/node_modules/unhead/dist/index.mjs +9 -0
- package/.output/server/node_modules/unhead/dist/parser.mjs +508 -0
- package/.output/server/node_modules/unhead/dist/plugins.mjs +101 -0
- package/.output/server/node_modules/unhead/dist/scripts.mjs +30 -0
- package/.output/server/node_modules/unhead/dist/server.mjs +180 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.0eF0fa-Y.mjs +236 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.B5FWS6X0.mjs +207 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BYvz9V1x.mjs +43 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.BnoAbrHA.mjs +269 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.CbpEuj3y.mjs +71 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Chhckluj.mjs +166 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.Ct24BOby.mjs +182 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead._ybhDo-G.mjs +44 -0
- package/.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
- package/.output/server/node_modules/unhead/dist/utils.mjs +5 -0
- package/.output/server/node_modules/unhead/package.json +105 -0
- package/.output/server/node_modules/unified/index.js +2 -0
- package/.output/server/node_modules/unified/lib/callable-instance.js +44 -0
- package/.output/server/node_modules/unified/lib/index.js +1323 -0
- package/.output/server/node_modules/unified/package.json +120 -0
- package/.output/server/node_modules/unist-util-is/index.js +7 -0
- package/.output/server/node_modules/unist-util-is/lib/index.js +296 -0
- package/.output/server/node_modules/unist-util-is/package.json +103 -0
- package/.output/server/node_modules/unist-util-stringify-position/index.js +1 -0
- package/.output/server/node_modules/unist-util-stringify-position/lib/index.js +84 -0
- package/.output/server/node_modules/unist-util-stringify-position/package.json +80 -0
- package/.output/server/node_modules/unist-util-visit/index.js +2 -0
- package/.output/server/node_modules/unist-util-visit/lib/index.js +312 -0
- package/.output/server/node_modules/unist-util-visit/package.json +108 -0
- package/.output/server/node_modules/unist-util-visit-parents/index.js +2 -0
- package/.output/server/node_modules/unist-util-visit-parents/lib/color.node.js +7 -0
- package/.output/server/node_modules/unist-util-visit-parents/lib/index.js +399 -0
- package/.output/server/node_modules/unist-util-visit-parents/package.json +106 -0
- package/.output/server/node_modules/universal-github-app-jwt/index.js +42 -0
- package/.output/server/node_modules/universal-github-app-jwt/lib/crypto-node.js +15 -0
- package/.output/server/node_modules/universal-github-app-jwt/lib/get-token.js +66 -0
- package/.output/server/node_modules/universal-github-app-jwt/lib/utils.js +85 -0
- package/.output/server/node_modules/universal-github-app-jwt/package.json +62 -0
- package/.output/server/node_modules/universal-user-agent/index.js +13 -0
- package/.output/server/node_modules/universal-user-agent/package.json +28 -0
- package/.output/server/node_modules/vfile/index.js +2 -0
- package/.output/server/node_modules/vfile/lib/index.js +643 -0
- package/.output/server/node_modules/vfile/lib/minpath.js +1 -0
- package/.output/server/node_modules/vfile/lib/minproc.js +1 -0
- package/.output/server/node_modules/vfile/lib/minurl.js +2 -0
- package/.output/server/node_modules/vfile/lib/minurl.shared.js +31 -0
- package/.output/server/node_modules/vfile/package.json +134 -0
- package/.output/server/node_modules/vfile-message/index.js +5 -0
- package/.output/server/node_modules/vfile-message/lib/index.js +314 -0
- package/.output/server/node_modules/vfile-message/package.json +80 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
- package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
- package/.output/server/node_modules/vue/index.js +7 -0
- package/.output/server/node_modules/vue/index.mjs +1 -0
- package/.output/server/node_modules/vue/package.json +112 -0
- package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
- package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +301 -0
- package/.output/server/node_modules/vue-bundle-renderer/package.json +55 -0
- package/.output/server/node_modules/webidl-conversions/lib/index.js +189 -0
- package/.output/server/node_modules/webidl-conversions/package.json +23 -0
- package/.output/server/node_modules/whatwg-url/lib/URL-impl.js +200 -0
- package/.output/server/node_modules/whatwg-url/lib/URL.js +196 -0
- package/.output/server/node_modules/whatwg-url/lib/public-api.js +11 -0
- package/.output/server/node_modules/whatwg-url/lib/url-state-machine.js +1297 -0
- package/.output/server/node_modules/whatwg-url/lib/utils.js +20 -0
- package/.output/server/node_modules/whatwg-url/package.json +32 -0
- package/.output/server/node_modules/zod/index.js +4 -0
- package/.output/server/node_modules/zod/package.json +135 -0
- package/.output/server/node_modules/zod/v4/classic/checks.js +1 -0
- package/.output/server/node_modules/zod/v4/classic/coerce.js +17 -0
- package/.output/server/node_modules/zod/v4/classic/compat.js +31 -0
- package/.output/server/node_modules/zod/v4/classic/errors.js +48 -0
- package/.output/server/node_modules/zod/v4/classic/external.js +20 -0
- package/.output/server/node_modules/zod/v4/classic/from-json-schema.js +584 -0
- package/.output/server/node_modules/zod/v4/classic/iso.js +30 -0
- package/.output/server/node_modules/zod/v4/classic/package.json +6 -0
- package/.output/server/node_modules/zod/v4/classic/parse.js +15 -0
- package/.output/server/node_modules/zod/v4/classic/schemas.js +1157 -0
- package/.output/server/node_modules/zod/v4/core/api.js +1082 -0
- package/.output/server/node_modules/zod/v4/core/checks.js +575 -0
- package/.output/server/node_modules/zod/v4/core/core.js +76 -0
- package/.output/server/node_modules/zod/v4/core/doc.js +35 -0
- package/.output/server/node_modules/zod/v4/core/errors.js +182 -0
- package/.output/server/node_modules/zod/v4/core/index.js +16 -0
- package/.output/server/node_modules/zod/v4/core/json-schema-generator.js +95 -0
- package/.output/server/node_modules/zod/v4/core/json-schema-processors.js +605 -0
- package/.output/server/node_modules/zod/v4/core/json-schema.js +1 -0
- package/.output/server/node_modules/zod/v4/core/package.json +6 -0
- package/.output/server/node_modules/zod/v4/core/parse.js +93 -0
- package/.output/server/node_modules/zod/v4/core/regexes.js +133 -0
- package/.output/server/node_modules/zod/v4/core/registries.js +51 -0
- package/.output/server/node_modules/zod/v4/core/schemas.js +2093 -0
- package/.output/server/node_modules/zod/v4/core/to-json-schema.js +437 -0
- package/.output/server/node_modules/zod/v4/core/util.js +651 -0
- package/.output/server/node_modules/zod/v4/core/versions.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/ar.js +106 -0
- package/.output/server/node_modules/zod/v4/locales/az.js +105 -0
- package/.output/server/node_modules/zod/v4/locales/be.js +156 -0
- package/.output/server/node_modules/zod/v4/locales/bg.js +120 -0
- package/.output/server/node_modules/zod/v4/locales/ca.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/cs.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/da.js +115 -0
- package/.output/server/node_modules/zod/v4/locales/de.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/en.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/eo.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/es.js +132 -0
- package/.output/server/node_modules/zod/v4/locales/fa.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/fi.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/fr-CA.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/fr.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/he.js +214 -0
- package/.output/server/node_modules/zod/v4/locales/hu.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/hy.js +147 -0
- package/.output/server/node_modules/zod/v4/locales/id.js +106 -0
- package/.output/server/node_modules/zod/v4/locales/index.js +49 -0
- package/.output/server/node_modules/zod/v4/locales/is.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/it.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/ja.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/ka.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/kh.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/km.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/ko.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/lt.js +203 -0
- package/.output/server/node_modules/zod/v4/locales/mk.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/ms.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/nl.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/no.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/ota.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/package.json +6 -0
- package/.output/server/node_modules/zod/v4/locales/pl.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/ps.js +114 -0
- package/.output/server/node_modules/zod/v4/locales/pt.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/ru.js +156 -0
- package/.output/server/node_modules/zod/v4/locales/sl.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/sv.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/ta.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/th.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/tr.js +105 -0
- package/.output/server/node_modules/zod/v4/locales/ua.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/uk.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/ur.js +110 -0
- package/.output/server/node_modules/zod/v4/locales/uz.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/vi.js +108 -0
- package/.output/server/node_modules/zod/v4/locales/yo.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/zh-CN.js +109 -0
- package/.output/server/node_modules/zod/v4/locales/zh-TW.js +107 -0
- package/.output/server/node_modules/zwitch/index.js +118 -0
- package/.output/server/node_modules/zwitch/package.json +72 -0
- package/.output/server/package.json +190 -0
- package/README.md +122 -97
- package/dist/index.js +8329 -8305
- package/package.json +6 -1
|
@@ -0,0 +1,3442 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
3
|
+
import { createHmac, timingSafeEqual } from "crypto";
|
|
4
|
+
import {
|
|
5
|
+
AdapterRateLimitError,
|
|
6
|
+
AuthenticationError,
|
|
7
|
+
extractCard,
|
|
8
|
+
extractFiles,
|
|
9
|
+
NetworkError,
|
|
10
|
+
toBuffer,
|
|
11
|
+
ValidationError
|
|
12
|
+
} from "@chat-adapter/shared";
|
|
13
|
+
import { WebClient } from "@slack/web-api";
|
|
14
|
+
import {
|
|
15
|
+
ConsoleLogger,
|
|
16
|
+
convertEmojiPlaceholders,
|
|
17
|
+
defaultEmojiResolver,
|
|
18
|
+
isJSX,
|
|
19
|
+
Message,
|
|
20
|
+
parseMarkdown as parseMarkdown2,
|
|
21
|
+
StreamingMarkdownRenderer,
|
|
22
|
+
toModalElement
|
|
23
|
+
} from "chat";
|
|
24
|
+
|
|
25
|
+
// src/cards.ts
|
|
26
|
+
import {
|
|
27
|
+
createEmojiConverter,
|
|
28
|
+
mapButtonStyle,
|
|
29
|
+
cardToFallbackText as sharedCardToFallbackText
|
|
30
|
+
} from "@chat-adapter/shared";
|
|
31
|
+
import { cardChildToFallbackText, tableElementToAscii } from "chat";
|
|
32
|
+
var convertEmoji = createEmojiConverter("slack");
|
|
33
|
+
function cardToBlockKit(card) {
|
|
34
|
+
const blocks = [];
|
|
35
|
+
if (card.title) {
|
|
36
|
+
blocks.push({
|
|
37
|
+
type: "header",
|
|
38
|
+
text: {
|
|
39
|
+
type: "plain_text",
|
|
40
|
+
text: convertEmoji(card.title),
|
|
41
|
+
emoji: true
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
if (card.subtitle) {
|
|
46
|
+
blocks.push({
|
|
47
|
+
type: "context",
|
|
48
|
+
elements: [
|
|
49
|
+
{
|
|
50
|
+
type: "mrkdwn",
|
|
51
|
+
text: convertEmoji(card.subtitle)
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (card.imageUrl) {
|
|
57
|
+
blocks.push({
|
|
58
|
+
type: "image",
|
|
59
|
+
image_url: card.imageUrl,
|
|
60
|
+
alt_text: card.title || "Card image"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const state = { usedNativeTable: false };
|
|
64
|
+
for (const child of card.children) {
|
|
65
|
+
const childBlocks = convertChildToBlocks(child, state);
|
|
66
|
+
blocks.push(...childBlocks);
|
|
67
|
+
}
|
|
68
|
+
return blocks;
|
|
69
|
+
}
|
|
70
|
+
function convertChildToBlocks(child, state) {
|
|
71
|
+
switch (child.type) {
|
|
72
|
+
case "text":
|
|
73
|
+
return [convertTextToBlock(child)];
|
|
74
|
+
case "image":
|
|
75
|
+
return [convertImageToBlock(child)];
|
|
76
|
+
case "divider":
|
|
77
|
+
return [convertDividerToBlock(child)];
|
|
78
|
+
case "actions":
|
|
79
|
+
return [convertActionsToBlock(child)];
|
|
80
|
+
case "section":
|
|
81
|
+
return convertSectionToBlocks(child, state);
|
|
82
|
+
case "fields":
|
|
83
|
+
return [convertFieldsToBlock(child)];
|
|
84
|
+
case "link":
|
|
85
|
+
return [convertLinkToBlock(child)];
|
|
86
|
+
case "table":
|
|
87
|
+
return convertTableToBlocks(child, state);
|
|
88
|
+
default: {
|
|
89
|
+
const text = cardChildToFallbackText(child);
|
|
90
|
+
if (text) {
|
|
91
|
+
return [{ type: "section", text: { type: "mrkdwn", text } }];
|
|
92
|
+
}
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function markdownToMrkdwn(text) {
|
|
98
|
+
return text.replace(/\*\*(.+?)\*\*/g, "*$1*");
|
|
99
|
+
}
|
|
100
|
+
function convertTextToBlock(element) {
|
|
101
|
+
const text = markdownToMrkdwn(convertEmoji(element.content));
|
|
102
|
+
let formattedText = text;
|
|
103
|
+
if (element.style === "bold") {
|
|
104
|
+
formattedText = `*${text}*`;
|
|
105
|
+
} else if (element.style === "muted") {
|
|
106
|
+
return {
|
|
107
|
+
type: "context",
|
|
108
|
+
elements: [{ type: "mrkdwn", text }]
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
type: "section",
|
|
113
|
+
text: {
|
|
114
|
+
type: "mrkdwn",
|
|
115
|
+
text: formattedText
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function convertLinkToBlock(element) {
|
|
120
|
+
return {
|
|
121
|
+
type: "section",
|
|
122
|
+
text: {
|
|
123
|
+
type: "mrkdwn",
|
|
124
|
+
text: `<${element.url}|${convertEmoji(element.label)}>`
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function convertImageToBlock(element) {
|
|
129
|
+
return {
|
|
130
|
+
type: "image",
|
|
131
|
+
image_url: element.url,
|
|
132
|
+
alt_text: element.alt || "Image"
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function convertDividerToBlock(_element) {
|
|
136
|
+
return { type: "divider" };
|
|
137
|
+
}
|
|
138
|
+
function convertActionsToBlock(element) {
|
|
139
|
+
const elements = element.children.map((child) => {
|
|
140
|
+
if (child.type === "link-button") {
|
|
141
|
+
return convertLinkButtonToElement(child);
|
|
142
|
+
}
|
|
143
|
+
if (child.type === "select") {
|
|
144
|
+
return convertSelectToElement(child);
|
|
145
|
+
}
|
|
146
|
+
if (child.type === "radio_select") {
|
|
147
|
+
return convertRadioSelectToElement(child);
|
|
148
|
+
}
|
|
149
|
+
return convertButtonToElement(child);
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
type: "actions",
|
|
153
|
+
elements
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function convertButtonToElement(button) {
|
|
157
|
+
const element = {
|
|
158
|
+
type: "button",
|
|
159
|
+
text: {
|
|
160
|
+
type: "plain_text",
|
|
161
|
+
text: convertEmoji(button.label),
|
|
162
|
+
emoji: true
|
|
163
|
+
},
|
|
164
|
+
action_id: button.id
|
|
165
|
+
};
|
|
166
|
+
if (button.value) {
|
|
167
|
+
element.value = button.value;
|
|
168
|
+
}
|
|
169
|
+
const style = mapButtonStyle(button.style, "slack");
|
|
170
|
+
if (style) {
|
|
171
|
+
element.style = style;
|
|
172
|
+
}
|
|
173
|
+
return element;
|
|
174
|
+
}
|
|
175
|
+
function convertLinkButtonToElement(button) {
|
|
176
|
+
const element = {
|
|
177
|
+
type: "button",
|
|
178
|
+
text: {
|
|
179
|
+
type: "plain_text",
|
|
180
|
+
text: convertEmoji(button.label),
|
|
181
|
+
emoji: true
|
|
182
|
+
},
|
|
183
|
+
action_id: `link-${button.url.slice(0, 200)}`,
|
|
184
|
+
url: button.url
|
|
185
|
+
};
|
|
186
|
+
const style = mapButtonStyle(button.style, "slack");
|
|
187
|
+
if (style) {
|
|
188
|
+
element.style = style;
|
|
189
|
+
}
|
|
190
|
+
return element;
|
|
191
|
+
}
|
|
192
|
+
function convertSelectToElement(select) {
|
|
193
|
+
const options = select.options.map((opt) => {
|
|
194
|
+
const option = {
|
|
195
|
+
text: { type: "plain_text", text: convertEmoji(opt.label) },
|
|
196
|
+
value: opt.value
|
|
197
|
+
};
|
|
198
|
+
if (opt.description) {
|
|
199
|
+
option.description = {
|
|
200
|
+
type: "plain_text",
|
|
201
|
+
text: convertEmoji(opt.description)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return option;
|
|
205
|
+
});
|
|
206
|
+
const element = {
|
|
207
|
+
type: "static_select",
|
|
208
|
+
action_id: select.id,
|
|
209
|
+
options
|
|
210
|
+
};
|
|
211
|
+
if (select.placeholder) {
|
|
212
|
+
element.placeholder = {
|
|
213
|
+
type: "plain_text",
|
|
214
|
+
text: convertEmoji(select.placeholder)
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
if (select.initialOption) {
|
|
218
|
+
const initialOpt = options.find((o) => o.value === select.initialOption);
|
|
219
|
+
if (initialOpt) {
|
|
220
|
+
element.initial_option = initialOpt;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return element;
|
|
224
|
+
}
|
|
225
|
+
function convertRadioSelectToElement(radioSelect) {
|
|
226
|
+
const limitedOptions = radioSelect.options.slice(0, 10);
|
|
227
|
+
const options = limitedOptions.map((opt) => {
|
|
228
|
+
const option = {
|
|
229
|
+
text: { type: "mrkdwn", text: convertEmoji(opt.label) },
|
|
230
|
+
value: opt.value
|
|
231
|
+
};
|
|
232
|
+
if (opt.description) {
|
|
233
|
+
option.description = {
|
|
234
|
+
type: "mrkdwn",
|
|
235
|
+
text: convertEmoji(opt.description)
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
return option;
|
|
239
|
+
});
|
|
240
|
+
const element = {
|
|
241
|
+
type: "radio_buttons",
|
|
242
|
+
action_id: radioSelect.id,
|
|
243
|
+
options
|
|
244
|
+
};
|
|
245
|
+
if (radioSelect.initialOption) {
|
|
246
|
+
const initialOpt = options.find(
|
|
247
|
+
(o) => o.value === radioSelect.initialOption
|
|
248
|
+
);
|
|
249
|
+
if (initialOpt) {
|
|
250
|
+
element.initial_option = initialOpt;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return element;
|
|
254
|
+
}
|
|
255
|
+
function convertTableToBlocks(element, state) {
|
|
256
|
+
const MAX_ROWS = 100;
|
|
257
|
+
const MAX_COLS = 20;
|
|
258
|
+
if (state.usedNativeTable || element.rows.length > MAX_ROWS || element.headers.length > MAX_COLS) {
|
|
259
|
+
return [
|
|
260
|
+
{
|
|
261
|
+
type: "section",
|
|
262
|
+
text: {
|
|
263
|
+
type: "mrkdwn",
|
|
264
|
+
text: `\`\`\`
|
|
265
|
+
${tableElementToAscii(element.headers, element.rows)}
|
|
266
|
+
\`\`\``
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
];
|
|
270
|
+
}
|
|
271
|
+
state.usedNativeTable = true;
|
|
272
|
+
const headerRow = element.headers.map((header) => ({
|
|
273
|
+
type: "raw_text",
|
|
274
|
+
text: convertEmoji(header)
|
|
275
|
+
}));
|
|
276
|
+
const dataRows = element.rows.map(
|
|
277
|
+
(row) => row.map((cell) => ({
|
|
278
|
+
type: "raw_text",
|
|
279
|
+
text: convertEmoji(cell)
|
|
280
|
+
}))
|
|
281
|
+
);
|
|
282
|
+
return [
|
|
283
|
+
{
|
|
284
|
+
type: "table",
|
|
285
|
+
rows: [headerRow, ...dataRows]
|
|
286
|
+
}
|
|
287
|
+
];
|
|
288
|
+
}
|
|
289
|
+
function convertSectionToBlocks(element, state) {
|
|
290
|
+
const blocks = [];
|
|
291
|
+
for (const child of element.children) {
|
|
292
|
+
blocks.push(...convertChildToBlocks(child, state));
|
|
293
|
+
}
|
|
294
|
+
return blocks;
|
|
295
|
+
}
|
|
296
|
+
function convertFieldsToBlock(element) {
|
|
297
|
+
const fields = [];
|
|
298
|
+
for (const field of element.children) {
|
|
299
|
+
fields.push({
|
|
300
|
+
type: "mrkdwn",
|
|
301
|
+
text: `*${markdownToMrkdwn(convertEmoji(field.label))}*
|
|
302
|
+
${markdownToMrkdwn(convertEmoji(field.value))}`
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
type: "section",
|
|
307
|
+
fields
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function cardToFallbackText(card) {
|
|
311
|
+
return sharedCardToFallbackText(card, {
|
|
312
|
+
boldFormat: "*",
|
|
313
|
+
lineBreak: "\n",
|
|
314
|
+
platform: "slack"
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/crypto.ts
|
|
319
|
+
import crypto from "crypto";
|
|
320
|
+
var ALGORITHM = "aes-256-gcm";
|
|
321
|
+
var IV_LENGTH = 12;
|
|
322
|
+
var AUTH_TAG_LENGTH = 16;
|
|
323
|
+
var HEX_KEY_PATTERN = /^[0-9a-fA-F]{64}$/;
|
|
324
|
+
function encryptToken(plaintext, key) {
|
|
325
|
+
const iv = crypto.randomBytes(IV_LENGTH);
|
|
326
|
+
const cipher = crypto.createCipheriv(ALGORITHM, key, iv, {
|
|
327
|
+
authTagLength: AUTH_TAG_LENGTH
|
|
328
|
+
});
|
|
329
|
+
const ciphertext = Buffer.concat([
|
|
330
|
+
cipher.update(plaintext, "utf8"),
|
|
331
|
+
cipher.final()
|
|
332
|
+
]);
|
|
333
|
+
const tag = cipher.getAuthTag();
|
|
334
|
+
return {
|
|
335
|
+
iv: iv.toString("base64"),
|
|
336
|
+
data: ciphertext.toString("base64"),
|
|
337
|
+
tag: tag.toString("base64")
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
function decryptToken(encrypted, key) {
|
|
341
|
+
const iv = Buffer.from(encrypted.iv, "base64");
|
|
342
|
+
const ciphertext = Buffer.from(encrypted.data, "base64");
|
|
343
|
+
const tag = Buffer.from(encrypted.tag, "base64");
|
|
344
|
+
const decipher = crypto.createDecipheriv(ALGORITHM, key, iv, {
|
|
345
|
+
authTagLength: AUTH_TAG_LENGTH
|
|
346
|
+
});
|
|
347
|
+
decipher.setAuthTag(tag);
|
|
348
|
+
return Buffer.concat([
|
|
349
|
+
decipher.update(ciphertext),
|
|
350
|
+
decipher.final()
|
|
351
|
+
]).toString("utf8");
|
|
352
|
+
}
|
|
353
|
+
function isEncryptedTokenData(value) {
|
|
354
|
+
if (!value || typeof value !== "object") {
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
const obj = value;
|
|
358
|
+
return typeof obj.iv === "string" && typeof obj.data === "string" && typeof obj.tag === "string";
|
|
359
|
+
}
|
|
360
|
+
function decodeKey(rawKey) {
|
|
361
|
+
const trimmed = rawKey.trim();
|
|
362
|
+
const isHex = HEX_KEY_PATTERN.test(trimmed);
|
|
363
|
+
const key = Buffer.from(trimmed, isHex ? "hex" : "base64");
|
|
364
|
+
if (key.length !== 32) {
|
|
365
|
+
throw new Error(
|
|
366
|
+
`Encryption key must decode to exactly 32 bytes (received ${key.length}). Use a 64-char hex string or 44-char base64 string.`
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
return key;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// src/markdown.ts
|
|
373
|
+
import {
|
|
374
|
+
BaseFormatConverter,
|
|
375
|
+
getNodeChildren,
|
|
376
|
+
isBlockquoteNode,
|
|
377
|
+
isCodeNode,
|
|
378
|
+
isDeleteNode,
|
|
379
|
+
isEmphasisNode,
|
|
380
|
+
isInlineCodeNode,
|
|
381
|
+
isLinkNode,
|
|
382
|
+
isListNode,
|
|
383
|
+
isParagraphNode,
|
|
384
|
+
isStrongNode,
|
|
385
|
+
isTableNode,
|
|
386
|
+
isTextNode,
|
|
387
|
+
parseMarkdown,
|
|
388
|
+
tableToAscii
|
|
389
|
+
} from "chat";
|
|
390
|
+
var SlackFormatConverter = class extends BaseFormatConverter {
|
|
391
|
+
/**
|
|
392
|
+
* Convert @mentions to Slack format in plain text.
|
|
393
|
+
* @name → <@name>
|
|
394
|
+
*/
|
|
395
|
+
convertMentionsToSlack(text) {
|
|
396
|
+
return text.replace(/(?<!<)@(\w+)/g, "<@$1>");
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Override renderPostable to convert @mentions in plain strings.
|
|
400
|
+
*/
|
|
401
|
+
renderPostable(message) {
|
|
402
|
+
if (typeof message === "string") {
|
|
403
|
+
return this.convertMentionsToSlack(message);
|
|
404
|
+
}
|
|
405
|
+
if ("raw" in message) {
|
|
406
|
+
return this.convertMentionsToSlack(message.raw);
|
|
407
|
+
}
|
|
408
|
+
if ("markdown" in message) {
|
|
409
|
+
return this.fromAst(parseMarkdown(message.markdown));
|
|
410
|
+
}
|
|
411
|
+
if ("ast" in message) {
|
|
412
|
+
return this.fromAst(message.ast);
|
|
413
|
+
}
|
|
414
|
+
return "";
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Render an AST to Slack mrkdwn format.
|
|
418
|
+
*/
|
|
419
|
+
fromAst(ast) {
|
|
420
|
+
return this.fromAstWithNodeConverter(
|
|
421
|
+
ast,
|
|
422
|
+
(node) => this.nodeToMrkdwn(node)
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Parse Slack mrkdwn into an AST.
|
|
427
|
+
*/
|
|
428
|
+
toAst(mrkdwn) {
|
|
429
|
+
let markdown = mrkdwn;
|
|
430
|
+
markdown = markdown.replace(/<@([A-Z0-9_]+)\|([^>]+)>/g, "@$2");
|
|
431
|
+
markdown = markdown.replace(/<@([A-Z0-9_]+)>/g, "@$1");
|
|
432
|
+
markdown = markdown.replace(/<#[A-Z0-9_]+\|([^>]+)>/g, "#$1");
|
|
433
|
+
markdown = markdown.replace(/<#([A-Z0-9_]+)>/g, "#$1");
|
|
434
|
+
markdown = markdown.replace(/<(https?:\/\/[^|>]+)\|([^>]+)>/g, "[$2]($1)");
|
|
435
|
+
markdown = markdown.replace(/<(https?:\/\/[^>]+)>/g, "$1");
|
|
436
|
+
markdown = markdown.replace(/(?<![_*\\])\*([^*\n]+)\*(?![_*])/g, "**$1**");
|
|
437
|
+
markdown = markdown.replace(/(?<!~)~([^~\n]+)~(?!~)/g, "~~$1~~");
|
|
438
|
+
return parseMarkdown(markdown);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Convert AST to Slack blocks, using a native table block for the first table.
|
|
442
|
+
* Returns null if the AST contains no tables (caller should use regular text).
|
|
443
|
+
* Slack allows at most one table block per message; additional tables use ASCII.
|
|
444
|
+
*/
|
|
445
|
+
toBlocksWithTable(ast) {
|
|
446
|
+
const hasTable = ast.children.some((node) => isTableNode(node));
|
|
447
|
+
if (!hasTable) {
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
const blocks = [];
|
|
451
|
+
let usedNativeTable = false;
|
|
452
|
+
let textBuffer = [];
|
|
453
|
+
const flushText = () => {
|
|
454
|
+
if (textBuffer.length > 0) {
|
|
455
|
+
const text = textBuffer.join("\n\n");
|
|
456
|
+
if (text.trim()) {
|
|
457
|
+
blocks.push({
|
|
458
|
+
type: "section",
|
|
459
|
+
text: { type: "mrkdwn", text }
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
textBuffer = [];
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
for (const child of ast.children) {
|
|
466
|
+
const node = child;
|
|
467
|
+
if (isTableNode(node)) {
|
|
468
|
+
flushText();
|
|
469
|
+
if (usedNativeTable) {
|
|
470
|
+
blocks.push({
|
|
471
|
+
type: "section",
|
|
472
|
+
text: {
|
|
473
|
+
type: "mrkdwn",
|
|
474
|
+
text: `\`\`\`
|
|
475
|
+
${tableToAscii(node)}
|
|
476
|
+
\`\`\``
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
} else {
|
|
480
|
+
blocks.push(
|
|
481
|
+
mdastTableToSlackBlock(node, this.nodeToMrkdwn.bind(this))
|
|
482
|
+
);
|
|
483
|
+
usedNativeTable = true;
|
|
484
|
+
}
|
|
485
|
+
} else {
|
|
486
|
+
textBuffer.push(this.nodeToMrkdwn(node));
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
flushText();
|
|
490
|
+
return blocks;
|
|
491
|
+
}
|
|
492
|
+
nodeToMrkdwn(node) {
|
|
493
|
+
if (isParagraphNode(node)) {
|
|
494
|
+
return getNodeChildren(node).map((child) => this.nodeToMrkdwn(child)).join("");
|
|
495
|
+
}
|
|
496
|
+
if (isTextNode(node)) {
|
|
497
|
+
return node.value.replace(/(?<!<)@(\w+)/g, "<@$1>");
|
|
498
|
+
}
|
|
499
|
+
if (isStrongNode(node)) {
|
|
500
|
+
const content = getNodeChildren(node).map((child) => this.nodeToMrkdwn(child)).join("");
|
|
501
|
+
return `*${content}*`;
|
|
502
|
+
}
|
|
503
|
+
if (isEmphasisNode(node)) {
|
|
504
|
+
const content = getNodeChildren(node).map((child) => this.nodeToMrkdwn(child)).join("");
|
|
505
|
+
return `_${content}_`;
|
|
506
|
+
}
|
|
507
|
+
if (isDeleteNode(node)) {
|
|
508
|
+
const content = getNodeChildren(node).map((child) => this.nodeToMrkdwn(child)).join("");
|
|
509
|
+
return `~${content}~`;
|
|
510
|
+
}
|
|
511
|
+
if (isInlineCodeNode(node)) {
|
|
512
|
+
return `\`${node.value}\``;
|
|
513
|
+
}
|
|
514
|
+
if (isCodeNode(node)) {
|
|
515
|
+
return `\`\`\`${node.lang || ""}
|
|
516
|
+
${node.value}
|
|
517
|
+
\`\`\``;
|
|
518
|
+
}
|
|
519
|
+
if (isLinkNode(node)) {
|
|
520
|
+
const linkText = getNodeChildren(node).map((child) => this.nodeToMrkdwn(child)).join("");
|
|
521
|
+
return `<${node.url}|${linkText}>`;
|
|
522
|
+
}
|
|
523
|
+
if (isBlockquoteNode(node)) {
|
|
524
|
+
return getNodeChildren(node).map((child) => `> ${this.nodeToMrkdwn(child)}`).join("\n");
|
|
525
|
+
}
|
|
526
|
+
if (isListNode(node)) {
|
|
527
|
+
return this.renderList(node, 0, (child) => this.nodeToMrkdwn(child), "\u2022");
|
|
528
|
+
}
|
|
529
|
+
if (node.type === "break") {
|
|
530
|
+
return "\n";
|
|
531
|
+
}
|
|
532
|
+
if (node.type === "thematicBreak") {
|
|
533
|
+
return "---";
|
|
534
|
+
}
|
|
535
|
+
if (isTableNode(node)) {
|
|
536
|
+
return `\`\`\`
|
|
537
|
+
${tableToAscii(node)}
|
|
538
|
+
\`\`\``;
|
|
539
|
+
}
|
|
540
|
+
return this.defaultNodeToText(node, (child) => this.nodeToMrkdwn(child));
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
function mdastTableToSlackBlock(node, cellConverter) {
|
|
544
|
+
const rows = [];
|
|
545
|
+
for (const row of node.children) {
|
|
546
|
+
const cells = getNodeChildren(row).map((cell) => ({
|
|
547
|
+
type: "raw_text",
|
|
548
|
+
text: getNodeChildren(cell).map(cellConverter).join("")
|
|
549
|
+
}));
|
|
550
|
+
rows.push(cells);
|
|
551
|
+
}
|
|
552
|
+
const block = { type: "table", rows };
|
|
553
|
+
if (node.align) {
|
|
554
|
+
const columnSettings = node.align.map(
|
|
555
|
+
(a) => ({
|
|
556
|
+
align: a || "left"
|
|
557
|
+
})
|
|
558
|
+
);
|
|
559
|
+
block.column_settings = columnSettings;
|
|
560
|
+
}
|
|
561
|
+
return block;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// src/modals.ts
|
|
565
|
+
function encodeModalMetadata(meta) {
|
|
566
|
+
if (!(meta.contextId || meta.privateMetadata)) {
|
|
567
|
+
return void 0;
|
|
568
|
+
}
|
|
569
|
+
return JSON.stringify({ c: meta.contextId, m: meta.privateMetadata });
|
|
570
|
+
}
|
|
571
|
+
function decodeModalMetadata(raw) {
|
|
572
|
+
if (!raw) {
|
|
573
|
+
return {};
|
|
574
|
+
}
|
|
575
|
+
try {
|
|
576
|
+
const parsed = JSON.parse(raw);
|
|
577
|
+
if (typeof parsed === "object" && parsed !== null && ("c" in parsed || "m" in parsed)) {
|
|
578
|
+
return {
|
|
579
|
+
contextId: parsed.c || void 0,
|
|
580
|
+
privateMetadata: parsed.m || void 0
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
} catch {
|
|
584
|
+
}
|
|
585
|
+
return { contextId: raw };
|
|
586
|
+
}
|
|
587
|
+
function modalToSlackView(modal, contextId) {
|
|
588
|
+
return {
|
|
589
|
+
type: "modal",
|
|
590
|
+
callback_id: modal.callbackId,
|
|
591
|
+
title: { type: "plain_text", text: modal.title.slice(0, 24) },
|
|
592
|
+
submit: modal.submitLabel ? { type: "plain_text", text: modal.submitLabel } : { type: "plain_text", text: "Submit" },
|
|
593
|
+
close: modal.closeLabel ? { type: "plain_text", text: modal.closeLabel } : { type: "plain_text", text: "Cancel" },
|
|
594
|
+
notify_on_close: modal.notifyOnClose,
|
|
595
|
+
private_metadata: contextId,
|
|
596
|
+
blocks: modal.children.map(modalChildToBlock)
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
function modalChildToBlock(child) {
|
|
600
|
+
switch (child.type) {
|
|
601
|
+
case "text_input":
|
|
602
|
+
return textInputToBlock(child);
|
|
603
|
+
case "select":
|
|
604
|
+
return selectToBlock(child);
|
|
605
|
+
case "radio_select":
|
|
606
|
+
return radioSelectToBlock(child);
|
|
607
|
+
case "text":
|
|
608
|
+
return convertTextToBlock(child);
|
|
609
|
+
case "fields":
|
|
610
|
+
return convertFieldsToBlock(child);
|
|
611
|
+
default:
|
|
612
|
+
throw new Error(
|
|
613
|
+
`Unknown modal child type: ${child.type}`
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
function textInputToBlock(input) {
|
|
618
|
+
const element = {
|
|
619
|
+
type: "plain_text_input",
|
|
620
|
+
action_id: input.id,
|
|
621
|
+
multiline: input.multiline ?? false
|
|
622
|
+
};
|
|
623
|
+
if (input.placeholder) {
|
|
624
|
+
element.placeholder = { type: "plain_text", text: input.placeholder };
|
|
625
|
+
}
|
|
626
|
+
if (input.initialValue) {
|
|
627
|
+
element.initial_value = input.initialValue;
|
|
628
|
+
}
|
|
629
|
+
if (input.maxLength) {
|
|
630
|
+
element.max_length = input.maxLength;
|
|
631
|
+
}
|
|
632
|
+
return {
|
|
633
|
+
type: "input",
|
|
634
|
+
block_id: input.id,
|
|
635
|
+
optional: input.optional ?? false,
|
|
636
|
+
label: { type: "plain_text", text: input.label },
|
|
637
|
+
element
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
function selectToBlock(select) {
|
|
641
|
+
const options = select.options.map((opt) => {
|
|
642
|
+
const option = {
|
|
643
|
+
text: { type: "plain_text", text: opt.label },
|
|
644
|
+
value: opt.value
|
|
645
|
+
};
|
|
646
|
+
if (opt.description) {
|
|
647
|
+
option.description = { type: "plain_text", text: opt.description };
|
|
648
|
+
}
|
|
649
|
+
return option;
|
|
650
|
+
});
|
|
651
|
+
const element = {
|
|
652
|
+
type: "static_select",
|
|
653
|
+
action_id: select.id,
|
|
654
|
+
options
|
|
655
|
+
};
|
|
656
|
+
if (select.placeholder) {
|
|
657
|
+
element.placeholder = { type: "plain_text", text: select.placeholder };
|
|
658
|
+
}
|
|
659
|
+
if (select.initialOption) {
|
|
660
|
+
const initialOpt = options.find(
|
|
661
|
+
(o) => o.value === select.initialOption
|
|
662
|
+
);
|
|
663
|
+
if (initialOpt) {
|
|
664
|
+
element.initial_option = initialOpt;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return {
|
|
668
|
+
type: "input",
|
|
669
|
+
block_id: select.id,
|
|
670
|
+
optional: select.optional ?? false,
|
|
671
|
+
label: { type: "plain_text", text: select.label },
|
|
672
|
+
element
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
function radioSelectToBlock(radioSelect) {
|
|
676
|
+
const limitedOptions = radioSelect.options.slice(0, 10);
|
|
677
|
+
const options = limitedOptions.map((opt) => {
|
|
678
|
+
const option = {
|
|
679
|
+
text: { type: "mrkdwn", text: opt.label },
|
|
680
|
+
value: opt.value
|
|
681
|
+
};
|
|
682
|
+
if (opt.description) {
|
|
683
|
+
option.description = { type: "mrkdwn", text: opt.description };
|
|
684
|
+
}
|
|
685
|
+
return option;
|
|
686
|
+
});
|
|
687
|
+
const element = {
|
|
688
|
+
type: "radio_buttons",
|
|
689
|
+
action_id: radioSelect.id,
|
|
690
|
+
options
|
|
691
|
+
};
|
|
692
|
+
if (radioSelect.initialOption) {
|
|
693
|
+
const initialOpt = options.find(
|
|
694
|
+
(o) => o.value === radioSelect.initialOption
|
|
695
|
+
);
|
|
696
|
+
if (initialOpt) {
|
|
697
|
+
element.initial_option = initialOpt;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return {
|
|
701
|
+
type: "input",
|
|
702
|
+
block_id: radioSelect.id,
|
|
703
|
+
optional: radioSelect.optional ?? false,
|
|
704
|
+
label: { type: "plain_text", text: radioSelect.label },
|
|
705
|
+
element
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
// src/index.ts
|
|
710
|
+
var SLACK_USER_ID_PATTERN = /^[A-Z0-9_]+$/;
|
|
711
|
+
var SLACK_USER_ID_EXACT_PATTERN = /^U[A-Z0-9]+$/;
|
|
712
|
+
function findNextMention(text) {
|
|
713
|
+
const atIdx = text.indexOf("<@");
|
|
714
|
+
const hashIdx = text.indexOf("<#");
|
|
715
|
+
if (atIdx === -1) {
|
|
716
|
+
return hashIdx;
|
|
717
|
+
}
|
|
718
|
+
if (hashIdx === -1) {
|
|
719
|
+
return atIdx;
|
|
720
|
+
}
|
|
721
|
+
return Math.min(atIdx, hashIdx);
|
|
722
|
+
}
|
|
723
|
+
var SLACK_MESSAGE_URL_PATTERN = /^https?:\/\/[^/]+\.slack\.com\/archives\/([A-Z0-9]+)\/p(\d+)(?:\?.*)?$/;
|
|
724
|
+
var SlackAdapter = class _SlackAdapter {
|
|
725
|
+
name = "slack";
|
|
726
|
+
userName;
|
|
727
|
+
client;
|
|
728
|
+
signingSecret;
|
|
729
|
+
defaultBotToken;
|
|
730
|
+
chat = null;
|
|
731
|
+
logger;
|
|
732
|
+
_botUserId = null;
|
|
733
|
+
_botId = null;
|
|
734
|
+
// Bot app ID (B_xxx) - different from user ID
|
|
735
|
+
formatConverter = new SlackFormatConverter();
|
|
736
|
+
static USER_CACHE_TTL_MS = 8 * 24 * 60 * 60 * 1e3;
|
|
737
|
+
// 8 days
|
|
738
|
+
static CHANNEL_CACHE_TTL_MS = 8 * 24 * 60 * 60 * 1e3;
|
|
739
|
+
// 8 days
|
|
740
|
+
static REVERSE_INDEX_TTL_MS = 8 * 24 * 60 * 60 * 1e3;
|
|
741
|
+
// 8 days
|
|
742
|
+
// Multi-workspace support
|
|
743
|
+
clientId;
|
|
744
|
+
clientSecret;
|
|
745
|
+
encryptionKey;
|
|
746
|
+
installationKeyPrefix;
|
|
747
|
+
requestContext = new AsyncLocalStorage();
|
|
748
|
+
/** Bot user ID (e.g., U_BOT_123) used for mention detection */
|
|
749
|
+
get botUserId() {
|
|
750
|
+
const ctx = this.requestContext.getStore();
|
|
751
|
+
if (ctx?.botUserId) {
|
|
752
|
+
return ctx.botUserId;
|
|
753
|
+
}
|
|
754
|
+
return this._botUserId || void 0;
|
|
755
|
+
}
|
|
756
|
+
constructor(config = {}) {
|
|
757
|
+
const signingSecret = config.signingSecret ?? process.env.SLACK_SIGNING_SECRET;
|
|
758
|
+
if (!signingSecret) {
|
|
759
|
+
throw new ValidationError(
|
|
760
|
+
"slack",
|
|
761
|
+
"signingSecret is required. Set SLACK_SIGNING_SECRET or provide it in config."
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
const zeroConfig = !(config.signingSecret || config.botToken || config.clientId || config.clientSecret);
|
|
765
|
+
const botToken = config.botToken ?? (zeroConfig ? process.env.SLACK_BOT_TOKEN : void 0);
|
|
766
|
+
this.client = new WebClient(botToken);
|
|
767
|
+
this.signingSecret = signingSecret;
|
|
768
|
+
this.defaultBotToken = botToken;
|
|
769
|
+
this.logger = config.logger ?? new ConsoleLogger("info").child("slack");
|
|
770
|
+
this.userName = config.userName || "bot";
|
|
771
|
+
this._botUserId = config.botUserId || null;
|
|
772
|
+
this.clientId = config.clientId ?? (zeroConfig ? process.env.SLACK_CLIENT_ID : void 0);
|
|
773
|
+
this.clientSecret = config.clientSecret ?? (zeroConfig ? process.env.SLACK_CLIENT_SECRET : void 0);
|
|
774
|
+
this.installationKeyPrefix = config.installationKeyPrefix ?? "slack:installation";
|
|
775
|
+
const encryptionKey = config.encryptionKey ?? process.env.SLACK_ENCRYPTION_KEY;
|
|
776
|
+
if (encryptionKey) {
|
|
777
|
+
this.encryptionKey = decodeKey(encryptionKey);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Get the current bot token for API calls.
|
|
782
|
+
* Checks request context (multi-workspace) → default token (single-workspace) → throws.
|
|
783
|
+
*/
|
|
784
|
+
getToken() {
|
|
785
|
+
const ctx = this.requestContext.getStore();
|
|
786
|
+
if (ctx?.token) {
|
|
787
|
+
return ctx.token;
|
|
788
|
+
}
|
|
789
|
+
if (this.defaultBotToken) {
|
|
790
|
+
return this.defaultBotToken;
|
|
791
|
+
}
|
|
792
|
+
throw new AuthenticationError(
|
|
793
|
+
"slack",
|
|
794
|
+
"No bot token available. In multi-workspace mode, ensure the webhook is being processed."
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Add the current token to API call options.
|
|
799
|
+
* Workaround for Slack WebClient types not including `token` in per-method args.
|
|
800
|
+
*/
|
|
801
|
+
// biome-ignore lint/suspicious/noExplicitAny: Slack types don't include token in method args
|
|
802
|
+
withToken(options) {
|
|
803
|
+
return { ...options, token: this.getToken() };
|
|
804
|
+
}
|
|
805
|
+
async initialize(chat) {
|
|
806
|
+
this.chat = chat;
|
|
807
|
+
if (this.defaultBotToken && !this._botUserId) {
|
|
808
|
+
try {
|
|
809
|
+
const authResult = await this.client.auth.test(this.withToken({}));
|
|
810
|
+
this._botUserId = authResult.user_id;
|
|
811
|
+
this._botId = authResult.bot_id || null;
|
|
812
|
+
if (authResult.user) {
|
|
813
|
+
this.userName = authResult.user;
|
|
814
|
+
}
|
|
815
|
+
this.logger.info("Slack auth completed", {
|
|
816
|
+
botUserId: this._botUserId,
|
|
817
|
+
botId: this._botId
|
|
818
|
+
});
|
|
819
|
+
} catch (error) {
|
|
820
|
+
this.logger.warn("Could not fetch bot user ID", { error });
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
if (!this.defaultBotToken) {
|
|
824
|
+
this.logger.info("Slack adapter initialized in multi-workspace mode");
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
// ===========================================================================
|
|
828
|
+
// Multi-workspace installation management
|
|
829
|
+
// ===========================================================================
|
|
830
|
+
installationKey(teamId) {
|
|
831
|
+
return `${this.installationKeyPrefix}:${teamId}`;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* Save a Slack workspace installation.
|
|
835
|
+
* Call this from your OAuth callback route after a successful installation.
|
|
836
|
+
*/
|
|
837
|
+
async setInstallation(teamId, installation) {
|
|
838
|
+
if (!this.chat) {
|
|
839
|
+
throw new ValidationError(
|
|
840
|
+
"slack",
|
|
841
|
+
"Adapter not initialized. Ensure chat.initialize() has been called first."
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
const state = this.chat.getState();
|
|
845
|
+
const key = this.installationKey(teamId);
|
|
846
|
+
const dataToStore = this.encryptionKey ? {
|
|
847
|
+
...installation,
|
|
848
|
+
botToken: encryptToken(installation.botToken, this.encryptionKey)
|
|
849
|
+
} : installation;
|
|
850
|
+
await state.set(key, dataToStore);
|
|
851
|
+
this.logger.info("Slack installation saved", {
|
|
852
|
+
teamId,
|
|
853
|
+
teamName: installation.teamName
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Retrieve a Slack workspace installation.
|
|
858
|
+
*/
|
|
859
|
+
async getInstallation(teamId) {
|
|
860
|
+
if (!this.chat) {
|
|
861
|
+
throw new ValidationError(
|
|
862
|
+
"slack",
|
|
863
|
+
"Adapter not initialized. Ensure chat.initialize() has been called first."
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
const state = this.chat.getState();
|
|
867
|
+
const key = this.installationKey(teamId);
|
|
868
|
+
const stored = await state.get(key);
|
|
869
|
+
if (!stored) {
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
if (this.encryptionKey && isEncryptedTokenData(stored.botToken)) {
|
|
873
|
+
return {
|
|
874
|
+
...stored,
|
|
875
|
+
botToken: decryptToken(
|
|
876
|
+
stored.botToken,
|
|
877
|
+
this.encryptionKey
|
|
878
|
+
)
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
return stored;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Handle the Slack OAuth V2 callback.
|
|
885
|
+
* Accepts the incoming request, extracts the authorization code,
|
|
886
|
+
* exchanges it for tokens, and saves the installation.
|
|
887
|
+
*/
|
|
888
|
+
async handleOAuthCallback(request) {
|
|
889
|
+
if (!(this.clientId && this.clientSecret)) {
|
|
890
|
+
throw new ValidationError(
|
|
891
|
+
"slack",
|
|
892
|
+
"clientId and clientSecret are required for OAuth. Pass them in createSlackAdapter()."
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
const url = new URL(request.url);
|
|
896
|
+
const code = url.searchParams.get("code");
|
|
897
|
+
if (!code) {
|
|
898
|
+
throw new ValidationError(
|
|
899
|
+
"slack",
|
|
900
|
+
"Missing 'code' query parameter in OAuth callback request."
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
const redirectUri = url.searchParams.get("redirect_uri") ?? void 0;
|
|
904
|
+
const result = await this.client.oauth.v2.access({
|
|
905
|
+
client_id: this.clientId,
|
|
906
|
+
client_secret: this.clientSecret,
|
|
907
|
+
code,
|
|
908
|
+
redirect_uri: redirectUri
|
|
909
|
+
});
|
|
910
|
+
if (!(result.ok && result.access_token && result.team?.id)) {
|
|
911
|
+
throw new AuthenticationError(
|
|
912
|
+
"slack",
|
|
913
|
+
`Slack OAuth failed: ${result.error || "missing access_token or team.id"}`
|
|
914
|
+
);
|
|
915
|
+
}
|
|
916
|
+
const teamId = result.team.id;
|
|
917
|
+
const installation = {
|
|
918
|
+
botToken: result.access_token,
|
|
919
|
+
botUserId: result.bot_user_id,
|
|
920
|
+
teamName: result.team.name
|
|
921
|
+
};
|
|
922
|
+
await this.setInstallation(teamId, installation);
|
|
923
|
+
return { teamId, installation };
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Remove a Slack workspace installation.
|
|
927
|
+
*/
|
|
928
|
+
async deleteInstallation(teamId) {
|
|
929
|
+
if (!this.chat) {
|
|
930
|
+
throw new ValidationError(
|
|
931
|
+
"slack",
|
|
932
|
+
"Adapter not initialized. Ensure chat.initialize() has been called first."
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
const state = this.chat.getState();
|
|
936
|
+
await state.delete(this.installationKey(teamId));
|
|
937
|
+
this.logger.info("Slack installation deleted", { teamId });
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Run a function with a specific bot token in context.
|
|
941
|
+
* Use this for operations outside webhook handling (cron jobs, workflows).
|
|
942
|
+
*/
|
|
943
|
+
withBotToken(token, fn) {
|
|
944
|
+
return this.requestContext.run({ token }, fn);
|
|
945
|
+
}
|
|
946
|
+
// ===========================================================================
|
|
947
|
+
// Private helpers
|
|
948
|
+
// ===========================================================================
|
|
949
|
+
/**
|
|
950
|
+
* Resolve the bot token for a team from the state adapter.
|
|
951
|
+
*/
|
|
952
|
+
async resolveTokenForTeam(teamId) {
|
|
953
|
+
try {
|
|
954
|
+
const installation = await this.getInstallation(teamId);
|
|
955
|
+
if (installation) {
|
|
956
|
+
return {
|
|
957
|
+
token: installation.botToken,
|
|
958
|
+
botUserId: installation.botUserId
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
this.logger.warn("No installation found for team", { teamId });
|
|
962
|
+
return null;
|
|
963
|
+
} catch (error) {
|
|
964
|
+
this.logger.error("Failed to resolve token for team", {
|
|
965
|
+
teamId,
|
|
966
|
+
error
|
|
967
|
+
});
|
|
968
|
+
return null;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Extract team_id from an interactive payload (form-urlencoded).
|
|
973
|
+
*/
|
|
974
|
+
extractTeamIdFromInteractive(body) {
|
|
975
|
+
try {
|
|
976
|
+
const params = new URLSearchParams(body);
|
|
977
|
+
const payloadStr = params.get("payload");
|
|
978
|
+
if (!payloadStr) {
|
|
979
|
+
return null;
|
|
980
|
+
}
|
|
981
|
+
const payload = JSON.parse(payloadStr);
|
|
982
|
+
return payload.team?.id || payload.team_id || null;
|
|
983
|
+
} catch {
|
|
984
|
+
return null;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Look up user info from Slack API with caching via state adapter.
|
|
989
|
+
* Returns display name and real name, or falls back to user ID.
|
|
990
|
+
*/
|
|
991
|
+
async lookupUser(userId) {
|
|
992
|
+
const cacheKey = `slack:user:${userId}`;
|
|
993
|
+
if (this.chat) {
|
|
994
|
+
const cached = await this.chat.getState().get(cacheKey);
|
|
995
|
+
if (cached) {
|
|
996
|
+
return { displayName: cached.displayName, realName: cached.realName };
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
try {
|
|
1000
|
+
const result = await this.client.users.info(
|
|
1001
|
+
this.withToken({ user: userId })
|
|
1002
|
+
);
|
|
1003
|
+
const user = result.user;
|
|
1004
|
+
const displayName = user?.profile?.display_name || user?.profile?.real_name || user?.real_name || user?.name || userId;
|
|
1005
|
+
const realName = user?.real_name || user?.profile?.real_name || displayName;
|
|
1006
|
+
if (this.chat) {
|
|
1007
|
+
await this.chat.getState().set(
|
|
1008
|
+
cacheKey,
|
|
1009
|
+
{ displayName, realName },
|
|
1010
|
+
_SlackAdapter.USER_CACHE_TTL_MS
|
|
1011
|
+
);
|
|
1012
|
+
const normalizedName = displayName.toLowerCase();
|
|
1013
|
+
const reverseKey = `slack:user-by-name:${normalizedName}`;
|
|
1014
|
+
const existing = await this.chat.getState().getList(reverseKey);
|
|
1015
|
+
if (!existing.includes(userId)) {
|
|
1016
|
+
await this.chat.getState().appendToList(reverseKey, userId, {
|
|
1017
|
+
maxLength: 50,
|
|
1018
|
+
ttlMs: _SlackAdapter.REVERSE_INDEX_TTL_MS
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
this.logger.debug("Fetched user info", {
|
|
1023
|
+
userId,
|
|
1024
|
+
displayName,
|
|
1025
|
+
realName
|
|
1026
|
+
});
|
|
1027
|
+
return { displayName, realName };
|
|
1028
|
+
} catch (error) {
|
|
1029
|
+
this.logger.warn("Could not fetch user info", { userId, error });
|
|
1030
|
+
return { displayName: userId, realName: userId };
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Look up channel name from Slack API with caching via state adapter.
|
|
1035
|
+
* Returns channel name, or falls back to channel ID.
|
|
1036
|
+
*/
|
|
1037
|
+
async lookupChannel(channelId) {
|
|
1038
|
+
const cacheKey = `slack:channel:${channelId}`;
|
|
1039
|
+
if (this.chat) {
|
|
1040
|
+
const cached = await this.chat.getState().get(cacheKey);
|
|
1041
|
+
if (cached) {
|
|
1042
|
+
return cached.name;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
try {
|
|
1046
|
+
const result = await this.client.conversations.info(
|
|
1047
|
+
this.withToken({ channel: channelId })
|
|
1048
|
+
);
|
|
1049
|
+
const name = result.channel?.name || channelId;
|
|
1050
|
+
if (this.chat) {
|
|
1051
|
+
await this.chat.getState().set(
|
|
1052
|
+
cacheKey,
|
|
1053
|
+
{ name },
|
|
1054
|
+
_SlackAdapter.CHANNEL_CACHE_TTL_MS
|
|
1055
|
+
);
|
|
1056
|
+
}
|
|
1057
|
+
this.logger.debug("Fetched channel info", { channelId, name });
|
|
1058
|
+
return name;
|
|
1059
|
+
} catch (error) {
|
|
1060
|
+
this.logger.warn("Could not fetch channel info", { channelId, error });
|
|
1061
|
+
return channelId;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
async handleWebhook(request, options) {
|
|
1065
|
+
const body = await request.text();
|
|
1066
|
+
this.logger.debug("Slack webhook raw body", { body });
|
|
1067
|
+
const timestamp = request.headers.get("x-slack-request-timestamp");
|
|
1068
|
+
const signature = request.headers.get("x-slack-signature");
|
|
1069
|
+
if (!this.verifySignature(body, timestamp, signature)) {
|
|
1070
|
+
return new Response("Invalid signature", { status: 401 });
|
|
1071
|
+
}
|
|
1072
|
+
const contentType = request.headers.get("content-type") || "";
|
|
1073
|
+
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
1074
|
+
const params = new URLSearchParams(body);
|
|
1075
|
+
if (params.has("command") && !params.has("payload")) {
|
|
1076
|
+
const teamId = params.get("team_id");
|
|
1077
|
+
if (!this.defaultBotToken && teamId) {
|
|
1078
|
+
const ctx = await this.resolveTokenForTeam(teamId);
|
|
1079
|
+
if (ctx) {
|
|
1080
|
+
return this.requestContext.run(
|
|
1081
|
+
ctx,
|
|
1082
|
+
() => this.handleSlashCommand(params, options)
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
this.logger.warn("Could not resolve token for slash command");
|
|
1086
|
+
}
|
|
1087
|
+
return this.handleSlashCommand(params, options);
|
|
1088
|
+
}
|
|
1089
|
+
if (!this.defaultBotToken) {
|
|
1090
|
+
const teamId = this.extractTeamIdFromInteractive(body);
|
|
1091
|
+
if (teamId) {
|
|
1092
|
+
const ctx = await this.resolveTokenForTeam(teamId);
|
|
1093
|
+
if (ctx) {
|
|
1094
|
+
return this.requestContext.run(
|
|
1095
|
+
ctx,
|
|
1096
|
+
() => this.handleInteractivePayload(body, options)
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
this.logger.warn("Could not resolve token for interactive payload");
|
|
1101
|
+
}
|
|
1102
|
+
return this.handleInteractivePayload(body, options);
|
|
1103
|
+
}
|
|
1104
|
+
let payload;
|
|
1105
|
+
try {
|
|
1106
|
+
payload = JSON.parse(body);
|
|
1107
|
+
} catch {
|
|
1108
|
+
return new Response("Invalid JSON", { status: 400 });
|
|
1109
|
+
}
|
|
1110
|
+
if (payload.type === "url_verification" && payload.challenge) {
|
|
1111
|
+
return Response.json({ challenge: payload.challenge });
|
|
1112
|
+
}
|
|
1113
|
+
if (!this.defaultBotToken && payload.type === "event_callback") {
|
|
1114
|
+
const teamId = payload.team_id;
|
|
1115
|
+
if (teamId) {
|
|
1116
|
+
const ctx = await this.resolveTokenForTeam(teamId);
|
|
1117
|
+
if (ctx) {
|
|
1118
|
+
return this.requestContext.run(ctx, () => {
|
|
1119
|
+
this.processEventPayload(payload, options);
|
|
1120
|
+
return new Response("ok", { status: 200 });
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
this.logger.warn("Could not resolve token for team", { teamId });
|
|
1124
|
+
return new Response("ok", { status: 200 });
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
this.processEventPayload(payload, options);
|
|
1128
|
+
return new Response("ok", { status: 200 });
|
|
1129
|
+
}
|
|
1130
|
+
/** Extract and dispatch events from a validated payload */
|
|
1131
|
+
processEventPayload(payload, options) {
|
|
1132
|
+
if (payload.type === "event_callback" && payload.event) {
|
|
1133
|
+
const event = payload.event;
|
|
1134
|
+
if (event.type === "message" || event.type === "app_mention") {
|
|
1135
|
+
const slackEvent = event;
|
|
1136
|
+
if (!(slackEvent.team || slackEvent.team_id) && payload.team_id) {
|
|
1137
|
+
slackEvent.team_id = payload.team_id;
|
|
1138
|
+
}
|
|
1139
|
+
this.handleMessageEvent(slackEvent, options);
|
|
1140
|
+
} else if (event.type === "reaction_added" || event.type === "reaction_removed") {
|
|
1141
|
+
this.handleReactionEvent(event, options);
|
|
1142
|
+
} else if (event.type === "assistant_thread_started") {
|
|
1143
|
+
this.handleAssistantThreadStarted(
|
|
1144
|
+
event,
|
|
1145
|
+
options
|
|
1146
|
+
);
|
|
1147
|
+
} else if (event.type === "assistant_thread_context_changed") {
|
|
1148
|
+
this.handleAssistantContextChanged(
|
|
1149
|
+
event,
|
|
1150
|
+
options
|
|
1151
|
+
);
|
|
1152
|
+
} else if (event.type === "app_home_opened" && event.tab === "home") {
|
|
1153
|
+
this.handleAppHomeOpened(event, options);
|
|
1154
|
+
} else if (event.type === "member_joined_channel") {
|
|
1155
|
+
this.handleMemberJoinedChannel(
|
|
1156
|
+
event,
|
|
1157
|
+
options
|
|
1158
|
+
);
|
|
1159
|
+
} else if (event.type === "user_change") {
|
|
1160
|
+
this.handleUserChange(event);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Handle Slack interactive payloads (button clicks, view submissions, etc.).
|
|
1166
|
+
* These are sent as form-urlencoded with a `payload` JSON field.
|
|
1167
|
+
*/
|
|
1168
|
+
handleInteractivePayload(body, options) {
|
|
1169
|
+
const params = new URLSearchParams(body);
|
|
1170
|
+
const payloadStr = params.get("payload");
|
|
1171
|
+
if (!payloadStr) {
|
|
1172
|
+
return new Response("Missing payload", { status: 400 });
|
|
1173
|
+
}
|
|
1174
|
+
let payload;
|
|
1175
|
+
try {
|
|
1176
|
+
payload = JSON.parse(payloadStr);
|
|
1177
|
+
} catch {
|
|
1178
|
+
return new Response("Invalid payload JSON", { status: 400 });
|
|
1179
|
+
}
|
|
1180
|
+
switch (payload.type) {
|
|
1181
|
+
case "block_actions":
|
|
1182
|
+
this.handleBlockActions(payload, options);
|
|
1183
|
+
return new Response("", { status: 200 });
|
|
1184
|
+
case "view_submission":
|
|
1185
|
+
return this.handleViewSubmission(payload, options);
|
|
1186
|
+
case "view_closed":
|
|
1187
|
+
this.handleViewClosed(payload, options);
|
|
1188
|
+
return new Response("", { status: 200 });
|
|
1189
|
+
default:
|
|
1190
|
+
return new Response("", { status: 200 });
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Handle Slack slash command payloads.
|
|
1195
|
+
* Slash commands are sent as form-urlencoded with command, text, user_id, channel_id, etc.
|
|
1196
|
+
*/
|
|
1197
|
+
async handleSlashCommand(params, options) {
|
|
1198
|
+
if (!this.chat) {
|
|
1199
|
+
this.logger.warn("Chat instance not initialized, ignoring slash command");
|
|
1200
|
+
return new Response("", { status: 200 });
|
|
1201
|
+
}
|
|
1202
|
+
const command = params.get("command") || "";
|
|
1203
|
+
const text = params.get("text") || "";
|
|
1204
|
+
const userId = params.get("user_id") || "";
|
|
1205
|
+
const channelId = params.get("channel_id") || "";
|
|
1206
|
+
const triggerId = params.get("trigger_id") || void 0;
|
|
1207
|
+
this.logger.debug("Processing Slack slash command", {
|
|
1208
|
+
command,
|
|
1209
|
+
text,
|
|
1210
|
+
userId,
|
|
1211
|
+
channelId,
|
|
1212
|
+
triggerId
|
|
1213
|
+
});
|
|
1214
|
+
const userInfo = await this.lookupUser(userId);
|
|
1215
|
+
const event = {
|
|
1216
|
+
command,
|
|
1217
|
+
text,
|
|
1218
|
+
user: {
|
|
1219
|
+
userId,
|
|
1220
|
+
userName: userInfo.displayName,
|
|
1221
|
+
fullName: userInfo.realName,
|
|
1222
|
+
isBot: false,
|
|
1223
|
+
isMe: false
|
|
1224
|
+
},
|
|
1225
|
+
adapter: this,
|
|
1226
|
+
raw: Object.fromEntries(params),
|
|
1227
|
+
triggerId,
|
|
1228
|
+
channelId: channelId ? `slack:${channelId}` : ""
|
|
1229
|
+
};
|
|
1230
|
+
this.chat.processSlashCommand(event, options);
|
|
1231
|
+
return new Response("", { status: 200 });
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Handle block_actions payload (button clicks in Block Kit).
|
|
1235
|
+
*/
|
|
1236
|
+
handleBlockActions(payload, options) {
|
|
1237
|
+
if (!this.chat) {
|
|
1238
|
+
this.logger.warn("Chat instance not initialized, ignoring action");
|
|
1239
|
+
return;
|
|
1240
|
+
}
|
|
1241
|
+
const channel = payload.channel?.id || payload.container?.channel_id;
|
|
1242
|
+
const messageTs = payload.message?.ts || payload.container?.message_ts;
|
|
1243
|
+
const threadTs = payload.message?.thread_ts || payload.container?.thread_ts || messageTs;
|
|
1244
|
+
const isViewAction = payload.container?.type === "view";
|
|
1245
|
+
if (!(isViewAction || channel)) {
|
|
1246
|
+
this.logger.warn("Missing channel in block_actions", { channel });
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
const threadId = channel && (threadTs || messageTs) ? this.encodeThreadId({
|
|
1250
|
+
channel,
|
|
1251
|
+
threadTs: threadTs || messageTs || ""
|
|
1252
|
+
}) : "";
|
|
1253
|
+
const isEphemeral = payload.container?.is_ephemeral === true;
|
|
1254
|
+
const responseUrl = payload.response_url;
|
|
1255
|
+
const messageId = isEphemeral && responseUrl && messageTs ? this.encodeEphemeralMessageId(messageTs, responseUrl, payload.user.id) : messageTs || "";
|
|
1256
|
+
for (const action of payload.actions) {
|
|
1257
|
+
const actionValue = action.selected_option?.value ?? action.value;
|
|
1258
|
+
const actionEvent = {
|
|
1259
|
+
actionId: action.action_id,
|
|
1260
|
+
value: actionValue,
|
|
1261
|
+
user: {
|
|
1262
|
+
userId: payload.user.id,
|
|
1263
|
+
userName: payload.user.username || payload.user.name || "unknown",
|
|
1264
|
+
fullName: payload.user.name || payload.user.username || "unknown",
|
|
1265
|
+
isBot: false,
|
|
1266
|
+
isMe: false
|
|
1267
|
+
},
|
|
1268
|
+
messageId,
|
|
1269
|
+
threadId,
|
|
1270
|
+
adapter: this,
|
|
1271
|
+
raw: payload,
|
|
1272
|
+
triggerId: payload.trigger_id
|
|
1273
|
+
};
|
|
1274
|
+
this.logger.debug("Processing Slack block action", {
|
|
1275
|
+
actionId: action.action_id,
|
|
1276
|
+
value: action.value,
|
|
1277
|
+
messageId: messageTs,
|
|
1278
|
+
threadId,
|
|
1279
|
+
triggerId: payload.trigger_id
|
|
1280
|
+
});
|
|
1281
|
+
this.chat.processAction(actionEvent, options);
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
async handleViewSubmission(payload, options) {
|
|
1285
|
+
if (!this.chat) {
|
|
1286
|
+
this.logger.warn(
|
|
1287
|
+
"Chat instance not initialized, ignoring view submission"
|
|
1288
|
+
);
|
|
1289
|
+
return new Response("", { status: 200 });
|
|
1290
|
+
}
|
|
1291
|
+
const values = {};
|
|
1292
|
+
for (const blockValues of Object.values(payload.view.state.values)) {
|
|
1293
|
+
for (const [actionId, input] of Object.entries(blockValues)) {
|
|
1294
|
+
values[actionId] = input.value ?? input.selected_option?.value ?? "";
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
const { contextId, privateMetadata } = decodeModalMetadata(
|
|
1298
|
+
payload.view.private_metadata || void 0
|
|
1299
|
+
);
|
|
1300
|
+
const event = {
|
|
1301
|
+
callbackId: payload.view.callback_id,
|
|
1302
|
+
viewId: payload.view.id,
|
|
1303
|
+
values,
|
|
1304
|
+
privateMetadata,
|
|
1305
|
+
user: {
|
|
1306
|
+
userId: payload.user.id,
|
|
1307
|
+
userName: payload.user.username || payload.user.name || "unknown",
|
|
1308
|
+
fullName: payload.user.name || payload.user.username || "unknown",
|
|
1309
|
+
isBot: false,
|
|
1310
|
+
isMe: false
|
|
1311
|
+
},
|
|
1312
|
+
adapter: this,
|
|
1313
|
+
raw: payload
|
|
1314
|
+
};
|
|
1315
|
+
const response = await this.chat.processModalSubmit(
|
|
1316
|
+
event,
|
|
1317
|
+
contextId,
|
|
1318
|
+
options
|
|
1319
|
+
);
|
|
1320
|
+
if (response) {
|
|
1321
|
+
const slackResponse = this.modalResponseToSlack(response, contextId);
|
|
1322
|
+
return new Response(JSON.stringify(slackResponse), {
|
|
1323
|
+
status: 200,
|
|
1324
|
+
headers: { "Content-Type": "application/json" }
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
return new Response("", { status: 200 });
|
|
1328
|
+
}
|
|
1329
|
+
handleViewClosed(payload, options) {
|
|
1330
|
+
if (!this.chat) {
|
|
1331
|
+
this.logger.warn("Chat instance not initialized, ignoring view closed");
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
const { contextId, privateMetadata } = decodeModalMetadata(
|
|
1335
|
+
payload.view.private_metadata || void 0
|
|
1336
|
+
);
|
|
1337
|
+
const event = {
|
|
1338
|
+
callbackId: payload.view.callback_id,
|
|
1339
|
+
viewId: payload.view.id,
|
|
1340
|
+
privateMetadata,
|
|
1341
|
+
user: {
|
|
1342
|
+
userId: payload.user.id,
|
|
1343
|
+
userName: payload.user.username || payload.user.name || "unknown",
|
|
1344
|
+
fullName: payload.user.name || payload.user.username || "unknown",
|
|
1345
|
+
isBot: false,
|
|
1346
|
+
isMe: false
|
|
1347
|
+
},
|
|
1348
|
+
adapter: this,
|
|
1349
|
+
raw: payload
|
|
1350
|
+
};
|
|
1351
|
+
this.chat.processModalClose(event, contextId, options);
|
|
1352
|
+
}
|
|
1353
|
+
modalResponseToSlack(response, contextId) {
|
|
1354
|
+
switch (response.action) {
|
|
1355
|
+
case "close":
|
|
1356
|
+
return {};
|
|
1357
|
+
case "errors":
|
|
1358
|
+
return { response_action: "errors", errors: response.errors };
|
|
1359
|
+
case "update": {
|
|
1360
|
+
const modal = this.convertModalJSX(response.modal);
|
|
1361
|
+
const metadata = encodeModalMetadata({
|
|
1362
|
+
contextId,
|
|
1363
|
+
privateMetadata: modal.privateMetadata
|
|
1364
|
+
});
|
|
1365
|
+
const view = modalToSlackView(modal, metadata);
|
|
1366
|
+
return {
|
|
1367
|
+
response_action: "update",
|
|
1368
|
+
view
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
case "push": {
|
|
1372
|
+
const modal = this.convertModalJSX(response.modal);
|
|
1373
|
+
const metadata = encodeModalMetadata({
|
|
1374
|
+
contextId,
|
|
1375
|
+
privateMetadata: modal.privateMetadata
|
|
1376
|
+
});
|
|
1377
|
+
const view = modalToSlackView(modal, metadata);
|
|
1378
|
+
return {
|
|
1379
|
+
response_action: "push",
|
|
1380
|
+
view
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
default:
|
|
1384
|
+
return {};
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
convertModalJSX(modal) {
|
|
1388
|
+
if (isJSX(modal)) {
|
|
1389
|
+
const converted = toModalElement(modal);
|
|
1390
|
+
if (!converted) {
|
|
1391
|
+
throw new ValidationError(
|
|
1392
|
+
"slack",
|
|
1393
|
+
"Invalid JSX element: must be a Modal element"
|
|
1394
|
+
);
|
|
1395
|
+
}
|
|
1396
|
+
return converted;
|
|
1397
|
+
}
|
|
1398
|
+
return modal;
|
|
1399
|
+
}
|
|
1400
|
+
verifySignature(body, timestamp, signature) {
|
|
1401
|
+
if (!(timestamp && signature)) {
|
|
1402
|
+
return false;
|
|
1403
|
+
}
|
|
1404
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
1405
|
+
if (Math.abs(now - Number.parseInt(timestamp, 10)) > 300) {
|
|
1406
|
+
return false;
|
|
1407
|
+
}
|
|
1408
|
+
const sigBasestring = `v0:${timestamp}:${body}`;
|
|
1409
|
+
const expectedSignature = "v0=" + createHmac("sha256", this.signingSecret).update(sigBasestring).digest("hex");
|
|
1410
|
+
try {
|
|
1411
|
+
return timingSafeEqual(
|
|
1412
|
+
Buffer.from(signature),
|
|
1413
|
+
Buffer.from(expectedSignature)
|
|
1414
|
+
);
|
|
1415
|
+
} catch {
|
|
1416
|
+
return false;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Handle message events from Slack.
|
|
1421
|
+
* Bot message filtering (isMe) is handled centrally by the Chat class.
|
|
1422
|
+
*/
|
|
1423
|
+
handleMessageEvent(event, options) {
|
|
1424
|
+
if (!this.chat) {
|
|
1425
|
+
this.logger.warn("Chat instance not initialized, ignoring event");
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
const ignoredSubtypes = /* @__PURE__ */ new Set([
|
|
1429
|
+
"message_changed",
|
|
1430
|
+
"message_deleted",
|
|
1431
|
+
"message_replied",
|
|
1432
|
+
"channel_join",
|
|
1433
|
+
"channel_leave",
|
|
1434
|
+
"channel_topic",
|
|
1435
|
+
"channel_purpose",
|
|
1436
|
+
"channel_name",
|
|
1437
|
+
"channel_archive",
|
|
1438
|
+
"channel_unarchive",
|
|
1439
|
+
"group_join",
|
|
1440
|
+
"group_leave",
|
|
1441
|
+
"group_topic",
|
|
1442
|
+
"group_purpose",
|
|
1443
|
+
"group_name",
|
|
1444
|
+
"group_archive",
|
|
1445
|
+
"group_unarchive",
|
|
1446
|
+
"ekm_access_denied",
|
|
1447
|
+
"tombstone"
|
|
1448
|
+
]);
|
|
1449
|
+
if (event.subtype && ignoredSubtypes.has(event.subtype)) {
|
|
1450
|
+
this.logger.debug("Ignoring message subtype", {
|
|
1451
|
+
subtype: event.subtype
|
|
1452
|
+
});
|
|
1453
|
+
return;
|
|
1454
|
+
}
|
|
1455
|
+
if (!(event.channel && event.ts)) {
|
|
1456
|
+
this.logger.debug("Ignoring event without channel or ts", {
|
|
1457
|
+
channel: event.channel,
|
|
1458
|
+
ts: event.ts
|
|
1459
|
+
});
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
const isDM = event.channel_type === "im";
|
|
1463
|
+
const threadTs = isDM ? event.thread_ts || "" : event.thread_ts || event.ts;
|
|
1464
|
+
const threadId = this.encodeThreadId({
|
|
1465
|
+
channel: event.channel,
|
|
1466
|
+
threadTs
|
|
1467
|
+
});
|
|
1468
|
+
const isMention = event.type === "app_mention";
|
|
1469
|
+
const factory = async () => {
|
|
1470
|
+
const msg = await this.parseSlackMessage(event, threadId);
|
|
1471
|
+
if (isMention) {
|
|
1472
|
+
msg.isMention = true;
|
|
1473
|
+
}
|
|
1474
|
+
return msg;
|
|
1475
|
+
};
|
|
1476
|
+
this.chat.processMessage(this, threadId, factory, options);
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Handle reaction events from Slack (reaction_added, reaction_removed).
|
|
1480
|
+
*/
|
|
1481
|
+
async handleReactionEvent(event, options) {
|
|
1482
|
+
if (!this.chat) {
|
|
1483
|
+
this.logger.warn("Chat instance not initialized, ignoring reaction");
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
if (event.item.type !== "message") {
|
|
1487
|
+
this.logger.debug("Ignoring reaction to non-message item", {
|
|
1488
|
+
itemType: event.item.type
|
|
1489
|
+
});
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
let parentTs = event.item.ts;
|
|
1493
|
+
try {
|
|
1494
|
+
const result = await this.client.conversations.replies(
|
|
1495
|
+
this.withToken({
|
|
1496
|
+
channel: event.item.channel,
|
|
1497
|
+
ts: event.item.ts,
|
|
1498
|
+
limit: 1
|
|
1499
|
+
})
|
|
1500
|
+
);
|
|
1501
|
+
const firstMessage = result.messages?.[0];
|
|
1502
|
+
if (firstMessage?.thread_ts) {
|
|
1503
|
+
parentTs = firstMessage.thread_ts;
|
|
1504
|
+
}
|
|
1505
|
+
} catch (error) {
|
|
1506
|
+
this.logger.warn(
|
|
1507
|
+
"Failed to resolve parent thread for reaction, using message ts",
|
|
1508
|
+
{
|
|
1509
|
+
error: String(error),
|
|
1510
|
+
channel: event.item.channel,
|
|
1511
|
+
ts: event.item.ts
|
|
1512
|
+
}
|
|
1513
|
+
);
|
|
1514
|
+
}
|
|
1515
|
+
const threadId = this.encodeThreadId({
|
|
1516
|
+
channel: event.item.channel,
|
|
1517
|
+
threadTs: parentTs
|
|
1518
|
+
});
|
|
1519
|
+
const messageId = event.item.ts;
|
|
1520
|
+
const rawEmoji = event.reaction;
|
|
1521
|
+
const normalizedEmoji = defaultEmojiResolver.fromSlack(rawEmoji);
|
|
1522
|
+
const ctx = this.requestContext.getStore();
|
|
1523
|
+
const isMe = ctx?.botUserId && event.user === ctx.botUserId || this._botUserId !== null && event.user === this._botUserId || this._botId !== null && event.user === this._botId;
|
|
1524
|
+
const reactionEvent = {
|
|
1525
|
+
emoji: normalizedEmoji,
|
|
1526
|
+
rawEmoji,
|
|
1527
|
+
added: event.type === "reaction_added",
|
|
1528
|
+
user: {
|
|
1529
|
+
userId: event.user,
|
|
1530
|
+
userName: event.user,
|
|
1531
|
+
// Will be resolved below if possible
|
|
1532
|
+
fullName: event.user,
|
|
1533
|
+
isBot: false,
|
|
1534
|
+
// Users add reactions, not bots typically
|
|
1535
|
+
isMe
|
|
1536
|
+
},
|
|
1537
|
+
messageId,
|
|
1538
|
+
threadId,
|
|
1539
|
+
raw: event
|
|
1540
|
+
};
|
|
1541
|
+
this.chat.processReaction({ ...reactionEvent, adapter: this }, options);
|
|
1542
|
+
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Handle assistant_thread_started events from Slack's Assistants API.
|
|
1545
|
+
* Fires when a user opens a new assistant thread (DM with the bot).
|
|
1546
|
+
*/
|
|
1547
|
+
handleAssistantThreadStarted(event, options) {
|
|
1548
|
+
if (!this.chat) {
|
|
1549
|
+
this.logger.warn(
|
|
1550
|
+
"Chat instance not initialized, ignoring assistant_thread_started"
|
|
1551
|
+
);
|
|
1552
|
+
return;
|
|
1553
|
+
}
|
|
1554
|
+
if (!event.assistant_thread) {
|
|
1555
|
+
this.logger.warn(
|
|
1556
|
+
"Malformed assistant_thread_started: missing assistant_thread"
|
|
1557
|
+
);
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
const { channel_id, thread_ts, user_id, context } = event.assistant_thread;
|
|
1561
|
+
const threadId = this.encodeThreadId({
|
|
1562
|
+
channel: channel_id,
|
|
1563
|
+
threadTs: thread_ts
|
|
1564
|
+
});
|
|
1565
|
+
this.chat.processAssistantThreadStarted(
|
|
1566
|
+
{
|
|
1567
|
+
threadId,
|
|
1568
|
+
userId: user_id,
|
|
1569
|
+
channelId: channel_id,
|
|
1570
|
+
threadTs: thread_ts,
|
|
1571
|
+
context: {
|
|
1572
|
+
channelId: context.channel_id,
|
|
1573
|
+
teamId: context.team_id,
|
|
1574
|
+
enterpriseId: context.enterprise_id,
|
|
1575
|
+
threadEntryPoint: context.thread_entry_point,
|
|
1576
|
+
forceSearch: context.force_search
|
|
1577
|
+
},
|
|
1578
|
+
adapter: this
|
|
1579
|
+
},
|
|
1580
|
+
options
|
|
1581
|
+
);
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Handle assistant_thread_context_changed events from Slack's Assistants API.
|
|
1585
|
+
* Fires when a user navigates to a different channel with the assistant panel open.
|
|
1586
|
+
*/
|
|
1587
|
+
handleAssistantContextChanged(event, options) {
|
|
1588
|
+
if (!this.chat) {
|
|
1589
|
+
this.logger.warn(
|
|
1590
|
+
"Chat instance not initialized, ignoring assistant_thread_context_changed"
|
|
1591
|
+
);
|
|
1592
|
+
return;
|
|
1593
|
+
}
|
|
1594
|
+
if (!event.assistant_thread) {
|
|
1595
|
+
this.logger.warn(
|
|
1596
|
+
"Malformed assistant_thread_context_changed: missing assistant_thread"
|
|
1597
|
+
);
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
const { channel_id, thread_ts, user_id, context } = event.assistant_thread;
|
|
1601
|
+
const threadId = this.encodeThreadId({
|
|
1602
|
+
channel: channel_id,
|
|
1603
|
+
threadTs: thread_ts
|
|
1604
|
+
});
|
|
1605
|
+
this.chat.processAssistantContextChanged(
|
|
1606
|
+
{
|
|
1607
|
+
threadId,
|
|
1608
|
+
userId: user_id,
|
|
1609
|
+
channelId: channel_id,
|
|
1610
|
+
threadTs: thread_ts,
|
|
1611
|
+
context: {
|
|
1612
|
+
channelId: context.channel_id,
|
|
1613
|
+
teamId: context.team_id,
|
|
1614
|
+
enterpriseId: context.enterprise_id,
|
|
1615
|
+
threadEntryPoint: context.thread_entry_point,
|
|
1616
|
+
forceSearch: context.force_search
|
|
1617
|
+
},
|
|
1618
|
+
adapter: this
|
|
1619
|
+
},
|
|
1620
|
+
options
|
|
1621
|
+
);
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Handle app_home_opened events from Slack.
|
|
1625
|
+
* Fires when a user opens the bot's Home tab.
|
|
1626
|
+
*/
|
|
1627
|
+
handleAppHomeOpened(event, options) {
|
|
1628
|
+
if (!this.chat) {
|
|
1629
|
+
this.logger.warn(
|
|
1630
|
+
"Chat instance not initialized, ignoring app_home_opened"
|
|
1631
|
+
);
|
|
1632
|
+
return;
|
|
1633
|
+
}
|
|
1634
|
+
this.chat.processAppHomeOpened(
|
|
1635
|
+
{
|
|
1636
|
+
userId: event.user,
|
|
1637
|
+
channelId: event.channel,
|
|
1638
|
+
adapter: this
|
|
1639
|
+
},
|
|
1640
|
+
options
|
|
1641
|
+
);
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Handle member_joined_channel events from Slack.
|
|
1645
|
+
* Fires when a user (including the bot) joins a channel.
|
|
1646
|
+
*/
|
|
1647
|
+
handleMemberJoinedChannel(event, options) {
|
|
1648
|
+
if (!this.chat) {
|
|
1649
|
+
this.logger.warn(
|
|
1650
|
+
"Chat instance not initialized, ignoring member_joined_channel"
|
|
1651
|
+
);
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1654
|
+
this.chat.processMemberJoinedChannel(
|
|
1655
|
+
{
|
|
1656
|
+
userId: event.user,
|
|
1657
|
+
channelId: this.encodeThreadId({
|
|
1658
|
+
channel: event.channel,
|
|
1659
|
+
threadTs: ""
|
|
1660
|
+
}),
|
|
1661
|
+
inviterId: event.inviter,
|
|
1662
|
+
adapter: this
|
|
1663
|
+
},
|
|
1664
|
+
options
|
|
1665
|
+
);
|
|
1666
|
+
}
|
|
1667
|
+
async handleUserChange(event) {
|
|
1668
|
+
if (!this.chat) {
|
|
1669
|
+
return;
|
|
1670
|
+
}
|
|
1671
|
+
try {
|
|
1672
|
+
await this.chat.getState().delete(`slack:user:${event.user.id}`);
|
|
1673
|
+
} catch (error) {
|
|
1674
|
+
this.logger.warn("Failed to invalidate user cache", {
|
|
1675
|
+
userId: event.user.id,
|
|
1676
|
+
error
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Publish a Home tab view for a user.
|
|
1682
|
+
* Slack API: views.publish
|
|
1683
|
+
*/
|
|
1684
|
+
async publishHomeView(userId, view) {
|
|
1685
|
+
await this.client.views.publish(
|
|
1686
|
+
// biome-ignore lint/suspicious/noExplicitAny: view blocks are consumer-defined
|
|
1687
|
+
this.withToken({ user_id: userId, view })
|
|
1688
|
+
);
|
|
1689
|
+
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Set suggested prompts for an assistant thread.
|
|
1692
|
+
* Slack Assistants API: assistant.threads.setSuggestedPrompts
|
|
1693
|
+
*/
|
|
1694
|
+
async setSuggestedPrompts(channelId, threadTs, prompts, title) {
|
|
1695
|
+
await this.client.assistant.threads.setSuggestedPrompts(
|
|
1696
|
+
this.withToken({
|
|
1697
|
+
channel_id: channelId,
|
|
1698
|
+
thread_ts: threadTs,
|
|
1699
|
+
prompts,
|
|
1700
|
+
title
|
|
1701
|
+
})
|
|
1702
|
+
);
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Set status/thinking indicator for an assistant thread.
|
|
1706
|
+
* Slack Assistants API: assistant.threads.setStatus
|
|
1707
|
+
*/
|
|
1708
|
+
async setAssistantStatus(channelId, threadTs, status, loadingMessages) {
|
|
1709
|
+
await this.client.assistant.threads.setStatus(
|
|
1710
|
+
this.withToken({
|
|
1711
|
+
channel_id: channelId,
|
|
1712
|
+
thread_ts: threadTs,
|
|
1713
|
+
status,
|
|
1714
|
+
...loadingMessages && { loading_messages: loadingMessages }
|
|
1715
|
+
})
|
|
1716
|
+
);
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* Set title for an assistant thread (shown in History tab).
|
|
1720
|
+
* Slack Assistants API: assistant.threads.setTitle
|
|
1721
|
+
*/
|
|
1722
|
+
async setAssistantTitle(channelId, threadTs, title) {
|
|
1723
|
+
await this.client.assistant.threads.setTitle(
|
|
1724
|
+
this.withToken({
|
|
1725
|
+
channel_id: channelId,
|
|
1726
|
+
thread_ts: threadTs,
|
|
1727
|
+
title
|
|
1728
|
+
})
|
|
1729
|
+
);
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Resolve inline user mentions in Slack mrkdwn text.
|
|
1733
|
+
* Converts <@U123> to <@U123|displayName> so that toAst/extractPlainText
|
|
1734
|
+
* renders them as @displayName instead of @U123.
|
|
1735
|
+
*
|
|
1736
|
+
* @param skipSelfMention - When true, skips the bot's own user ID so that
|
|
1737
|
+
* mention detection (which looks for @botUserId in the text) continues to
|
|
1738
|
+
* work. Set to false when parsing historical/channel messages where mention
|
|
1739
|
+
* detection doesn't apply.
|
|
1740
|
+
*/
|
|
1741
|
+
async resolveInlineMentions(text, skipSelfMention) {
|
|
1742
|
+
const userIds = /* @__PURE__ */ new Set();
|
|
1743
|
+
const channelIds = /* @__PURE__ */ new Set();
|
|
1744
|
+
for (const segment of text.split("<")) {
|
|
1745
|
+
const end = segment.indexOf(">");
|
|
1746
|
+
if (end === -1) {
|
|
1747
|
+
continue;
|
|
1748
|
+
}
|
|
1749
|
+
const inner = segment.slice(0, end);
|
|
1750
|
+
if (inner.startsWith("@")) {
|
|
1751
|
+
const rest = inner.slice(1);
|
|
1752
|
+
const pipeIdx = rest.indexOf("|");
|
|
1753
|
+
const uid = pipeIdx >= 0 ? rest.slice(0, pipeIdx) : rest;
|
|
1754
|
+
if (SLACK_USER_ID_PATTERN.test(uid)) {
|
|
1755
|
+
userIds.add(uid);
|
|
1756
|
+
}
|
|
1757
|
+
} else if (inner.startsWith("#")) {
|
|
1758
|
+
const rest = inner.slice(1);
|
|
1759
|
+
const pipeIdx = rest.indexOf("|");
|
|
1760
|
+
if (pipeIdx === -1 && SLACK_USER_ID_PATTERN.test(rest)) {
|
|
1761
|
+
channelIds.add(rest);
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
if (userIds.size === 0 && channelIds.size === 0) {
|
|
1766
|
+
return text;
|
|
1767
|
+
}
|
|
1768
|
+
if (skipSelfMention && this._botUserId) {
|
|
1769
|
+
userIds.delete(this._botUserId);
|
|
1770
|
+
}
|
|
1771
|
+
if (userIds.size === 0 && channelIds.size === 0) {
|
|
1772
|
+
return text;
|
|
1773
|
+
}
|
|
1774
|
+
const [userLookups, channelLookups] = await Promise.all([
|
|
1775
|
+
Promise.all(
|
|
1776
|
+
[...userIds].map(async (uid) => {
|
|
1777
|
+
const info = await this.lookupUser(uid);
|
|
1778
|
+
return [uid, info.displayName];
|
|
1779
|
+
})
|
|
1780
|
+
),
|
|
1781
|
+
Promise.all(
|
|
1782
|
+
[...channelIds].map(async (cid) => {
|
|
1783
|
+
const name = await this.lookupChannel(cid);
|
|
1784
|
+
return [cid, name];
|
|
1785
|
+
})
|
|
1786
|
+
)
|
|
1787
|
+
]);
|
|
1788
|
+
const userNameMap = new Map(userLookups);
|
|
1789
|
+
const channelNameMap = new Map(channelLookups);
|
|
1790
|
+
let result = "";
|
|
1791
|
+
let remaining = text;
|
|
1792
|
+
let startIdx = findNextMention(remaining);
|
|
1793
|
+
while (startIdx !== -1) {
|
|
1794
|
+
result += remaining.slice(0, startIdx);
|
|
1795
|
+
remaining = remaining.slice(startIdx);
|
|
1796
|
+
const endIdx = remaining.indexOf(">");
|
|
1797
|
+
if (endIdx === -1) {
|
|
1798
|
+
break;
|
|
1799
|
+
}
|
|
1800
|
+
const prefix = remaining[1];
|
|
1801
|
+
const inner = remaining.slice(2, endIdx);
|
|
1802
|
+
const pipeIdx = inner.indexOf("|");
|
|
1803
|
+
const id = pipeIdx >= 0 ? inner.slice(0, pipeIdx) : inner;
|
|
1804
|
+
if (prefix === "@" && SLACK_USER_ID_PATTERN.test(id)) {
|
|
1805
|
+
const name = userNameMap.get(id);
|
|
1806
|
+
result += name ? `<@${id}|${name}>` : `<@${id}>`;
|
|
1807
|
+
} else if (prefix === "#" && pipeIdx === -1 && channelNameMap.has(id)) {
|
|
1808
|
+
const name = channelNameMap.get(id);
|
|
1809
|
+
result += `<#${id}|${name}>`;
|
|
1810
|
+
} else {
|
|
1811
|
+
result += remaining.slice(0, endIdx + 1);
|
|
1812
|
+
}
|
|
1813
|
+
remaining = remaining.slice(endIdx + 1);
|
|
1814
|
+
startIdx = findNextMention(remaining);
|
|
1815
|
+
}
|
|
1816
|
+
return result + remaining;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Extract link URLs from a Slack event.
|
|
1820
|
+
* Uses the `blocks` field (rich_text blocks with link elements) when available,
|
|
1821
|
+
* falling back to parsing `<url>` patterns from the text field.
|
|
1822
|
+
*/
|
|
1823
|
+
extractLinks(event) {
|
|
1824
|
+
const urls = /* @__PURE__ */ new Set();
|
|
1825
|
+
if (event.blocks) {
|
|
1826
|
+
for (const block of event.blocks) {
|
|
1827
|
+
if (block.type === "rich_text" && block.elements) {
|
|
1828
|
+
for (const section of block.elements) {
|
|
1829
|
+
if (section.elements) {
|
|
1830
|
+
for (const element of section.elements) {
|
|
1831
|
+
if (element.type === "link" && element.url) {
|
|
1832
|
+
urls.add(element.url);
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
if (urls.size === 0 && event.text) {
|
|
1841
|
+
const urlPattern = /<(https?:\/\/[^>]+)>/g;
|
|
1842
|
+
for (const match of event.text.matchAll(urlPattern)) {
|
|
1843
|
+
const raw = match[1];
|
|
1844
|
+
const pipeIdx = raw.indexOf("|");
|
|
1845
|
+
urls.add(pipeIdx >= 0 ? raw.slice(0, pipeIdx) : raw);
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
return [...urls].map((url) => this.createLinkPreview(url));
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1851
|
+
* Create a LinkPreview for a URL. If the URL points to a Slack message,
|
|
1852
|
+
* includes a `fetchMessage` callback that fetches and parses the linked message.
|
|
1853
|
+
*/
|
|
1854
|
+
createLinkPreview(url) {
|
|
1855
|
+
const match = SLACK_MESSAGE_URL_PATTERN.exec(url);
|
|
1856
|
+
if (!match) {
|
|
1857
|
+
return { url };
|
|
1858
|
+
}
|
|
1859
|
+
const channel = match[1];
|
|
1860
|
+
const rawTs = match[2];
|
|
1861
|
+
const ts = `${rawTs.slice(0, rawTs.length - 6)}.${rawTs.slice(rawTs.length - 6)}`;
|
|
1862
|
+
const threadId = this.encodeThreadId({ channel, threadTs: ts });
|
|
1863
|
+
return {
|
|
1864
|
+
url,
|
|
1865
|
+
fetchMessage: async () => {
|
|
1866
|
+
const result = await this.client.conversations.history(
|
|
1867
|
+
this.withToken({
|
|
1868
|
+
channel,
|
|
1869
|
+
latest: ts,
|
|
1870
|
+
inclusive: true,
|
|
1871
|
+
limit: 1
|
|
1872
|
+
})
|
|
1873
|
+
);
|
|
1874
|
+
const messages = result.messages || [];
|
|
1875
|
+
const target = messages.find((msg) => msg.ts === ts);
|
|
1876
|
+
if (!target) {
|
|
1877
|
+
throw new Error(`Message not found: ${url}`);
|
|
1878
|
+
}
|
|
1879
|
+
return this.parseSlackMessage(target, threadId);
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
}
|
|
1883
|
+
async parseSlackMessage(event, threadId, options) {
|
|
1884
|
+
const isMe = this.isMessageFromSelf(event);
|
|
1885
|
+
const skipSelfMention = options?.skipSelfMention ?? true;
|
|
1886
|
+
const rawText = event.text || "";
|
|
1887
|
+
let userName = event.username || "unknown";
|
|
1888
|
+
let fullName = event.username || "unknown";
|
|
1889
|
+
if (event.user && !event.username) {
|
|
1890
|
+
const userInfo = await this.lookupUser(event.user);
|
|
1891
|
+
userName = userInfo.displayName;
|
|
1892
|
+
fullName = userInfo.realName;
|
|
1893
|
+
}
|
|
1894
|
+
if (event.user && this.chat) {
|
|
1895
|
+
try {
|
|
1896
|
+
const participantKey = `slack:thread-participants:${threadId}`;
|
|
1897
|
+
const participants = await this.chat.getState().getList(participantKey);
|
|
1898
|
+
if (!participants.includes(event.user)) {
|
|
1899
|
+
await this.chat.getState().appendToList(participantKey, event.user, {
|
|
1900
|
+
maxLength: 100,
|
|
1901
|
+
ttlMs: _SlackAdapter.REVERSE_INDEX_TTL_MS
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
} catch (error) {
|
|
1905
|
+
this.logger.warn("Failed to track thread participant", {
|
|
1906
|
+
threadId,
|
|
1907
|
+
userId: event.user,
|
|
1908
|
+
error
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
const text = await this.resolveInlineMentions(rawText, skipSelfMention);
|
|
1913
|
+
return new Message({
|
|
1914
|
+
id: event.ts || "",
|
|
1915
|
+
threadId,
|
|
1916
|
+
text: this.formatConverter.extractPlainText(text),
|
|
1917
|
+
formatted: this.formatConverter.toAst(text),
|
|
1918
|
+
raw: event,
|
|
1919
|
+
author: {
|
|
1920
|
+
userId: event.user || event.bot_id || "unknown",
|
|
1921
|
+
userName,
|
|
1922
|
+
fullName,
|
|
1923
|
+
isBot: !!event.bot_id,
|
|
1924
|
+
isMe
|
|
1925
|
+
},
|
|
1926
|
+
metadata: {
|
|
1927
|
+
dateSent: new Date(Number.parseFloat(event.ts || "0") * 1e3),
|
|
1928
|
+
edited: !!event.edited,
|
|
1929
|
+
editedAt: event.edited ? new Date(Number.parseFloat(event.edited.ts) * 1e3) : void 0
|
|
1930
|
+
},
|
|
1931
|
+
attachments: (event.files || []).map(
|
|
1932
|
+
(file) => this.createAttachment(file)
|
|
1933
|
+
),
|
|
1934
|
+
links: this.extractLinks(event)
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
/**
|
|
1938
|
+
* Create an Attachment object from a Slack file.
|
|
1939
|
+
* Includes a fetchData method that uses the bot token for auth.
|
|
1940
|
+
*/
|
|
1941
|
+
createAttachment(file) {
|
|
1942
|
+
const url = file.url_private;
|
|
1943
|
+
const botToken = this.getToken();
|
|
1944
|
+
let type = "file";
|
|
1945
|
+
if (file.mimetype?.startsWith("image/")) {
|
|
1946
|
+
type = "image";
|
|
1947
|
+
} else if (file.mimetype?.startsWith("video/")) {
|
|
1948
|
+
type = "video";
|
|
1949
|
+
} else if (file.mimetype?.startsWith("audio/")) {
|
|
1950
|
+
type = "audio";
|
|
1951
|
+
}
|
|
1952
|
+
return {
|
|
1953
|
+
type,
|
|
1954
|
+
url,
|
|
1955
|
+
name: file.name,
|
|
1956
|
+
mimeType: file.mimetype,
|
|
1957
|
+
size: file.size,
|
|
1958
|
+
width: file.original_w,
|
|
1959
|
+
height: file.original_h,
|
|
1960
|
+
fetchData: url ? async () => {
|
|
1961
|
+
const response = await fetch(url, {
|
|
1962
|
+
headers: {
|
|
1963
|
+
Authorization: `Bearer ${botToken}`
|
|
1964
|
+
}
|
|
1965
|
+
});
|
|
1966
|
+
if (!response.ok) {
|
|
1967
|
+
throw new NetworkError(
|
|
1968
|
+
"slack",
|
|
1969
|
+
`Failed to fetch file: ${response.status} ${response.statusText}`
|
|
1970
|
+
);
|
|
1971
|
+
}
|
|
1972
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
1973
|
+
if (contentType.includes("text/html")) {
|
|
1974
|
+
throw new NetworkError(
|
|
1975
|
+
"slack",
|
|
1976
|
+
`Failed to download file from Slack: received HTML login page instead of file data. Ensure your Slack app has the "files:read" OAuth scope. URL: ${url}`
|
|
1977
|
+
);
|
|
1978
|
+
}
|
|
1979
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
1980
|
+
return Buffer.from(arrayBuffer);
|
|
1981
|
+
} : void 0
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Resolve @name mentions in text to Slack <@USER_ID> format using the
|
|
1986
|
+
* reverse user cache. When multiple users share a display name, prefers
|
|
1987
|
+
* the one who is a participant in the given thread.
|
|
1988
|
+
*/
|
|
1989
|
+
async resolveOutgoingMentions(text, threadId) {
|
|
1990
|
+
if (!this.chat) {
|
|
1991
|
+
return text;
|
|
1992
|
+
}
|
|
1993
|
+
const state = this.chat.getState();
|
|
1994
|
+
const mentionPattern = /@(\w+)/g;
|
|
1995
|
+
const mentions = /* @__PURE__ */ new Map();
|
|
1996
|
+
for (const match of text.matchAll(mentionPattern)) {
|
|
1997
|
+
const name = match[1];
|
|
1998
|
+
if (SLACK_USER_ID_EXACT_PATTERN.test(name)) {
|
|
1999
|
+
continue;
|
|
2000
|
+
}
|
|
2001
|
+
const idx = match.index;
|
|
2002
|
+
if (idx > 0 && text[idx - 1] === "<") {
|
|
2003
|
+
continue;
|
|
2004
|
+
}
|
|
2005
|
+
if (!mentions.has(name.toLowerCase())) {
|
|
2006
|
+
mentions.set(name.toLowerCase(), []);
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
if (mentions.size === 0) {
|
|
2010
|
+
return text;
|
|
2011
|
+
}
|
|
2012
|
+
for (const name of mentions.keys()) {
|
|
2013
|
+
const userIds = await state.getList(`slack:user-by-name:${name}`);
|
|
2014
|
+
const unique = [...new Set(userIds)];
|
|
2015
|
+
mentions.set(name, unique);
|
|
2016
|
+
}
|
|
2017
|
+
let participants = null;
|
|
2018
|
+
const needsParticipants = [...mentions.values()].some(
|
|
2019
|
+
(ids) => ids.length > 1
|
|
2020
|
+
);
|
|
2021
|
+
if (needsParticipants) {
|
|
2022
|
+
const participantList = await state.getList(
|
|
2023
|
+
`slack:thread-participants:${threadId}`
|
|
2024
|
+
);
|
|
2025
|
+
participants = new Set(participantList);
|
|
2026
|
+
}
|
|
2027
|
+
return text.replace(
|
|
2028
|
+
mentionPattern,
|
|
2029
|
+
(match, name, offset) => {
|
|
2030
|
+
if (offset > 0 && text[offset - 1] === "<") {
|
|
2031
|
+
return match;
|
|
2032
|
+
}
|
|
2033
|
+
if (SLACK_USER_ID_EXACT_PATTERN.test(name)) {
|
|
2034
|
+
return match;
|
|
2035
|
+
}
|
|
2036
|
+
const userIds = mentions.get(name.toLowerCase());
|
|
2037
|
+
if (!userIds || userIds.length === 0) {
|
|
2038
|
+
return match;
|
|
2039
|
+
}
|
|
2040
|
+
if (userIds.length === 1) {
|
|
2041
|
+
return `<@${userIds[0]}>`;
|
|
2042
|
+
}
|
|
2043
|
+
if (participants) {
|
|
2044
|
+
const inThread = userIds.filter((id) => participants.has(id));
|
|
2045
|
+
if (inThread.length === 1) {
|
|
2046
|
+
return `<@${inThread[0]}>`;
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
return match;
|
|
2050
|
+
}
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Pre-process an outgoing message to resolve @name mentions before rendering.
|
|
2055
|
+
*/
|
|
2056
|
+
async resolveMessageMentions(message, threadId) {
|
|
2057
|
+
if (!this.chat) {
|
|
2058
|
+
return message;
|
|
2059
|
+
}
|
|
2060
|
+
if (typeof message === "string") {
|
|
2061
|
+
return this.resolveOutgoingMentions(message, threadId);
|
|
2062
|
+
}
|
|
2063
|
+
if (typeof message === "object" && message !== null) {
|
|
2064
|
+
if ("raw" in message && typeof message.raw === "string") {
|
|
2065
|
+
return {
|
|
2066
|
+
...message,
|
|
2067
|
+
raw: await this.resolveOutgoingMentions(
|
|
2068
|
+
message.raw,
|
|
2069
|
+
threadId
|
|
2070
|
+
)
|
|
2071
|
+
};
|
|
2072
|
+
}
|
|
2073
|
+
if ("markdown" in message && typeof message.markdown === "string") {
|
|
2074
|
+
return {
|
|
2075
|
+
...message,
|
|
2076
|
+
markdown: await this.resolveOutgoingMentions(
|
|
2077
|
+
message.markdown,
|
|
2078
|
+
threadId
|
|
2079
|
+
)
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
return message;
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Try to render a message using native Slack table blocks.
|
|
2087
|
+
* Returns blocks + fallback text if the message contains tables, null otherwise.
|
|
2088
|
+
*/
|
|
2089
|
+
renderWithTableBlocks(message) {
|
|
2090
|
+
let ast = null;
|
|
2091
|
+
if (typeof message === "object" && message !== null) {
|
|
2092
|
+
if ("ast" in message) {
|
|
2093
|
+
ast = message.ast;
|
|
2094
|
+
} else if ("markdown" in message) {
|
|
2095
|
+
ast = parseMarkdown2(message.markdown);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
if (!ast) {
|
|
2099
|
+
return null;
|
|
2100
|
+
}
|
|
2101
|
+
const blocks = this.formatConverter.toBlocksWithTable(ast);
|
|
2102
|
+
if (!blocks) {
|
|
2103
|
+
return null;
|
|
2104
|
+
}
|
|
2105
|
+
const fallbackText = convertEmojiPlaceholders(
|
|
2106
|
+
this.formatConverter.renderPostable(message),
|
|
2107
|
+
"slack"
|
|
2108
|
+
);
|
|
2109
|
+
return { text: fallbackText, blocks };
|
|
2110
|
+
}
|
|
2111
|
+
async postMessage(threadId, _message) {
|
|
2112
|
+
const message = await this.resolveMessageMentions(_message, threadId);
|
|
2113
|
+
const { channel, threadTs } = this.decodeThreadId(threadId);
|
|
2114
|
+
try {
|
|
2115
|
+
const files = extractFiles(message);
|
|
2116
|
+
if (files.length > 0) {
|
|
2117
|
+
await this.uploadFiles(files, channel, threadTs || void 0);
|
|
2118
|
+
const hasText = typeof message === "string" || typeof message === "object" && message !== null && ("raw" in message && message.raw || "markdown" in message && message.markdown || "ast" in message && message.ast);
|
|
2119
|
+
const card2 = extractCard(message);
|
|
2120
|
+
if (!(hasText || card2)) {
|
|
2121
|
+
return {
|
|
2122
|
+
id: `file-${Date.now()}`,
|
|
2123
|
+
threadId,
|
|
2124
|
+
raw: { files }
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
const card = extractCard(message);
|
|
2129
|
+
if (card) {
|
|
2130
|
+
const blocks = cardToBlockKit(card);
|
|
2131
|
+
const fallbackText = cardToFallbackText(card);
|
|
2132
|
+
this.logger.debug("Slack API: chat.postMessage (blocks)", {
|
|
2133
|
+
channel,
|
|
2134
|
+
threadTs,
|
|
2135
|
+
blockCount: blocks.length
|
|
2136
|
+
});
|
|
2137
|
+
const result2 = await this.client.chat.postMessage(
|
|
2138
|
+
this.withToken({
|
|
2139
|
+
channel,
|
|
2140
|
+
thread_ts: threadTs,
|
|
2141
|
+
text: fallbackText,
|
|
2142
|
+
// Fallback for notifications
|
|
2143
|
+
blocks,
|
|
2144
|
+
unfurl_links: false,
|
|
2145
|
+
unfurl_media: false
|
|
2146
|
+
})
|
|
2147
|
+
);
|
|
2148
|
+
this.logger.debug("Slack API: chat.postMessage response", {
|
|
2149
|
+
messageId: result2.ts,
|
|
2150
|
+
ok: result2.ok
|
|
2151
|
+
});
|
|
2152
|
+
return {
|
|
2153
|
+
id: result2.ts,
|
|
2154
|
+
threadId,
|
|
2155
|
+
raw: result2
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
const tableResult = this.renderWithTableBlocks(message);
|
|
2159
|
+
if (tableResult) {
|
|
2160
|
+
this.logger.debug("Slack API: chat.postMessage (table blocks)", {
|
|
2161
|
+
channel,
|
|
2162
|
+
threadTs,
|
|
2163
|
+
blockCount: tableResult.blocks.length
|
|
2164
|
+
});
|
|
2165
|
+
const result2 = await this.client.chat.postMessage(
|
|
2166
|
+
this.withToken({
|
|
2167
|
+
channel,
|
|
2168
|
+
thread_ts: threadTs,
|
|
2169
|
+
text: tableResult.text,
|
|
2170
|
+
blocks: tableResult.blocks,
|
|
2171
|
+
unfurl_links: false,
|
|
2172
|
+
unfurl_media: false
|
|
2173
|
+
})
|
|
2174
|
+
);
|
|
2175
|
+
this.logger.debug("Slack API: chat.postMessage response", {
|
|
2176
|
+
messageId: result2.ts,
|
|
2177
|
+
ok: result2.ok
|
|
2178
|
+
});
|
|
2179
|
+
return {
|
|
2180
|
+
id: result2.ts,
|
|
2181
|
+
threadId,
|
|
2182
|
+
raw: result2
|
|
2183
|
+
};
|
|
2184
|
+
}
|
|
2185
|
+
const text = convertEmojiPlaceholders(
|
|
2186
|
+
this.formatConverter.renderPostable(message),
|
|
2187
|
+
"slack"
|
|
2188
|
+
);
|
|
2189
|
+
this.logger.debug("Slack API: chat.postMessage", {
|
|
2190
|
+
channel,
|
|
2191
|
+
threadTs,
|
|
2192
|
+
textLength: text.length
|
|
2193
|
+
});
|
|
2194
|
+
const result = await this.client.chat.postMessage(
|
|
2195
|
+
this.withToken({
|
|
2196
|
+
channel,
|
|
2197
|
+
thread_ts: threadTs,
|
|
2198
|
+
text,
|
|
2199
|
+
unfurl_links: false,
|
|
2200
|
+
unfurl_media: false
|
|
2201
|
+
})
|
|
2202
|
+
);
|
|
2203
|
+
this.logger.debug("Slack API: chat.postMessage response", {
|
|
2204
|
+
messageId: result.ts,
|
|
2205
|
+
ok: result.ok
|
|
2206
|
+
});
|
|
2207
|
+
return {
|
|
2208
|
+
id: result.ts,
|
|
2209
|
+
threadId,
|
|
2210
|
+
raw: result
|
|
2211
|
+
};
|
|
2212
|
+
} catch (error) {
|
|
2213
|
+
this.handleSlackError(error);
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
async postEphemeral(threadId, userId, _message) {
|
|
2217
|
+
const message = await this.resolveMessageMentions(_message, threadId);
|
|
2218
|
+
const { channel, threadTs } = this.decodeThreadId(threadId);
|
|
2219
|
+
try {
|
|
2220
|
+
const card = extractCard(message);
|
|
2221
|
+
if (card) {
|
|
2222
|
+
const blocks = cardToBlockKit(card);
|
|
2223
|
+
const fallbackText = cardToFallbackText(card);
|
|
2224
|
+
this.logger.debug("Slack API: chat.postEphemeral (blocks)", {
|
|
2225
|
+
channel,
|
|
2226
|
+
threadTs,
|
|
2227
|
+
userId,
|
|
2228
|
+
blockCount: blocks.length
|
|
2229
|
+
});
|
|
2230
|
+
const result2 = await this.client.chat.postEphemeral(
|
|
2231
|
+
this.withToken({
|
|
2232
|
+
channel,
|
|
2233
|
+
thread_ts: threadTs || void 0,
|
|
2234
|
+
user: userId,
|
|
2235
|
+
text: fallbackText,
|
|
2236
|
+
blocks
|
|
2237
|
+
})
|
|
2238
|
+
);
|
|
2239
|
+
this.logger.debug("Slack API: chat.postEphemeral response", {
|
|
2240
|
+
messageTs: result2.message_ts,
|
|
2241
|
+
ok: result2.ok
|
|
2242
|
+
});
|
|
2243
|
+
return {
|
|
2244
|
+
id: result2.message_ts || "",
|
|
2245
|
+
threadId,
|
|
2246
|
+
usedFallback: false,
|
|
2247
|
+
raw: result2
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
const tableResult = this.renderWithTableBlocks(message);
|
|
2251
|
+
if (tableResult) {
|
|
2252
|
+
this.logger.debug("Slack API: chat.postEphemeral (table blocks)", {
|
|
2253
|
+
channel,
|
|
2254
|
+
threadTs,
|
|
2255
|
+
userId,
|
|
2256
|
+
blockCount: tableResult.blocks.length
|
|
2257
|
+
});
|
|
2258
|
+
const result2 = await this.client.chat.postEphemeral(
|
|
2259
|
+
this.withToken({
|
|
2260
|
+
channel,
|
|
2261
|
+
thread_ts: threadTs || void 0,
|
|
2262
|
+
user: userId,
|
|
2263
|
+
text: tableResult.text,
|
|
2264
|
+
blocks: tableResult.blocks
|
|
2265
|
+
})
|
|
2266
|
+
);
|
|
2267
|
+
this.logger.debug("Slack API: chat.postEphemeral response", {
|
|
2268
|
+
messageTs: result2.message_ts,
|
|
2269
|
+
ok: result2.ok
|
|
2270
|
+
});
|
|
2271
|
+
return {
|
|
2272
|
+
id: result2.message_ts || "",
|
|
2273
|
+
threadId,
|
|
2274
|
+
usedFallback: false,
|
|
2275
|
+
raw: result2
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
const text = convertEmojiPlaceholders(
|
|
2279
|
+
this.formatConverter.renderPostable(message),
|
|
2280
|
+
"slack"
|
|
2281
|
+
);
|
|
2282
|
+
this.logger.debug("Slack API: chat.postEphemeral", {
|
|
2283
|
+
channel,
|
|
2284
|
+
threadTs,
|
|
2285
|
+
userId,
|
|
2286
|
+
textLength: text.length
|
|
2287
|
+
});
|
|
2288
|
+
const result = await this.client.chat.postEphemeral(
|
|
2289
|
+
this.withToken({
|
|
2290
|
+
channel,
|
|
2291
|
+
thread_ts: threadTs || void 0,
|
|
2292
|
+
user: userId,
|
|
2293
|
+
text
|
|
2294
|
+
})
|
|
2295
|
+
);
|
|
2296
|
+
this.logger.debug("Slack API: chat.postEphemeral response", {
|
|
2297
|
+
messageTs: result.message_ts,
|
|
2298
|
+
ok: result.ok
|
|
2299
|
+
});
|
|
2300
|
+
return {
|
|
2301
|
+
id: result.message_ts || "",
|
|
2302
|
+
threadId,
|
|
2303
|
+
usedFallback: false,
|
|
2304
|
+
raw: result
|
|
2305
|
+
};
|
|
2306
|
+
} catch (error) {
|
|
2307
|
+
this.handleSlackError(error);
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
async scheduleMessage(threadId, _message, options) {
|
|
2311
|
+
const message = await this.resolveMessageMentions(_message, threadId);
|
|
2312
|
+
const { channel, threadTs } = this.decodeThreadId(threadId);
|
|
2313
|
+
const postAtUnix = Math.floor(options.postAt.getTime() / 1e3);
|
|
2314
|
+
if (postAtUnix <= Math.floor(Date.now() / 1e3)) {
|
|
2315
|
+
throw new ValidationError("slack", "postAt must be in the future");
|
|
2316
|
+
}
|
|
2317
|
+
const files = extractFiles(message);
|
|
2318
|
+
if (files.length > 0) {
|
|
2319
|
+
throw new ValidationError(
|
|
2320
|
+
"slack",
|
|
2321
|
+
"File uploads are not supported in scheduled messages"
|
|
2322
|
+
);
|
|
2323
|
+
}
|
|
2324
|
+
const token = this.getToken();
|
|
2325
|
+
try {
|
|
2326
|
+
const card = extractCard(message);
|
|
2327
|
+
if (card) {
|
|
2328
|
+
const blocks = cardToBlockKit(card);
|
|
2329
|
+
const fallbackText = cardToFallbackText(card);
|
|
2330
|
+
this.logger.debug("Slack API: chat.scheduleMessage (blocks)", {
|
|
2331
|
+
channel,
|
|
2332
|
+
threadTs,
|
|
2333
|
+
postAt: postAtUnix,
|
|
2334
|
+
blockCount: blocks.length
|
|
2335
|
+
});
|
|
2336
|
+
const result2 = await this.client.chat.scheduleMessage({
|
|
2337
|
+
token,
|
|
2338
|
+
channel,
|
|
2339
|
+
thread_ts: threadTs || void 0,
|
|
2340
|
+
post_at: postAtUnix,
|
|
2341
|
+
text: fallbackText,
|
|
2342
|
+
blocks,
|
|
2343
|
+
unfurl_links: false,
|
|
2344
|
+
unfurl_media: false
|
|
2345
|
+
});
|
|
2346
|
+
const scheduledMessageId2 = result2.scheduled_message_id;
|
|
2347
|
+
const adapter2 = this;
|
|
2348
|
+
return {
|
|
2349
|
+
scheduledMessageId: scheduledMessageId2,
|
|
2350
|
+
channelId: channel,
|
|
2351
|
+
postAt: options.postAt,
|
|
2352
|
+
raw: result2,
|
|
2353
|
+
async cancel() {
|
|
2354
|
+
await adapter2.client.chat.deleteScheduledMessage({
|
|
2355
|
+
token,
|
|
2356
|
+
channel,
|
|
2357
|
+
scheduled_message_id: scheduledMessageId2
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2362
|
+
const text = convertEmojiPlaceholders(
|
|
2363
|
+
this.formatConverter.renderPostable(message),
|
|
2364
|
+
"slack"
|
|
2365
|
+
);
|
|
2366
|
+
this.logger.debug("Slack API: chat.scheduleMessage", {
|
|
2367
|
+
channel,
|
|
2368
|
+
threadTs,
|
|
2369
|
+
postAt: postAtUnix,
|
|
2370
|
+
textLength: text.length
|
|
2371
|
+
});
|
|
2372
|
+
const result = await this.client.chat.scheduleMessage({
|
|
2373
|
+
token,
|
|
2374
|
+
channel,
|
|
2375
|
+
thread_ts: threadTs || void 0,
|
|
2376
|
+
post_at: postAtUnix,
|
|
2377
|
+
text,
|
|
2378
|
+
unfurl_links: false,
|
|
2379
|
+
unfurl_media: false
|
|
2380
|
+
});
|
|
2381
|
+
const scheduledMessageId = result.scheduled_message_id;
|
|
2382
|
+
const adapter = this;
|
|
2383
|
+
return {
|
|
2384
|
+
scheduledMessageId,
|
|
2385
|
+
channelId: channel,
|
|
2386
|
+
postAt: options.postAt,
|
|
2387
|
+
raw: result,
|
|
2388
|
+
async cancel() {
|
|
2389
|
+
await adapter.client.chat.deleteScheduledMessage({
|
|
2390
|
+
token,
|
|
2391
|
+
channel,
|
|
2392
|
+
scheduled_message_id: scheduledMessageId
|
|
2393
|
+
});
|
|
2394
|
+
}
|
|
2395
|
+
};
|
|
2396
|
+
} catch (error) {
|
|
2397
|
+
this.handleSlackError(error);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
async openModal(triggerId, modal, contextId) {
|
|
2401
|
+
const metadata = encodeModalMetadata({
|
|
2402
|
+
contextId,
|
|
2403
|
+
privateMetadata: modal.privateMetadata
|
|
2404
|
+
});
|
|
2405
|
+
const view = modalToSlackView(modal, metadata);
|
|
2406
|
+
this.logger.debug("Slack API: views.open", {
|
|
2407
|
+
triggerId,
|
|
2408
|
+
callbackId: modal.callbackId
|
|
2409
|
+
});
|
|
2410
|
+
try {
|
|
2411
|
+
const result = await this.client.views.open(
|
|
2412
|
+
this.withToken({
|
|
2413
|
+
trigger_id: triggerId,
|
|
2414
|
+
view
|
|
2415
|
+
})
|
|
2416
|
+
);
|
|
2417
|
+
this.logger.debug("Slack API: views.open response", {
|
|
2418
|
+
viewId: result.view?.id,
|
|
2419
|
+
ok: result.ok
|
|
2420
|
+
});
|
|
2421
|
+
return { viewId: result.view?.id };
|
|
2422
|
+
} catch (error) {
|
|
2423
|
+
this.handleSlackError(error);
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
async updateModal(viewId, modal) {
|
|
2427
|
+
const view = modalToSlackView(modal);
|
|
2428
|
+
this.logger.debug("Slack API: views.update", {
|
|
2429
|
+
viewId,
|
|
2430
|
+
callbackId: modal.callbackId
|
|
2431
|
+
});
|
|
2432
|
+
try {
|
|
2433
|
+
const result = await this.client.views.update(
|
|
2434
|
+
this.withToken({
|
|
2435
|
+
view_id: viewId,
|
|
2436
|
+
view
|
|
2437
|
+
})
|
|
2438
|
+
);
|
|
2439
|
+
this.logger.debug("Slack API: views.update response", {
|
|
2440
|
+
viewId: result.view?.id,
|
|
2441
|
+
ok: result.ok
|
|
2442
|
+
});
|
|
2443
|
+
return { viewId: result.view?.id };
|
|
2444
|
+
} catch (error) {
|
|
2445
|
+
this.handleSlackError(error);
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
/**
|
|
2449
|
+
* Upload files to Slack and share them to a channel.
|
|
2450
|
+
* Returns the file IDs of uploaded files.
|
|
2451
|
+
*/
|
|
2452
|
+
async uploadFiles(files, channel, threadTs) {
|
|
2453
|
+
const bufferResults = await Promise.all(
|
|
2454
|
+
files.map(async (file) => {
|
|
2455
|
+
try {
|
|
2456
|
+
const fileBuffer = await toBuffer(file.data, { platform: "slack" });
|
|
2457
|
+
if (!fileBuffer) {
|
|
2458
|
+
return null;
|
|
2459
|
+
}
|
|
2460
|
+
return { file: fileBuffer, filename: file.filename };
|
|
2461
|
+
} catch (error) {
|
|
2462
|
+
this.logger.error("Failed to convert file to buffer", {
|
|
2463
|
+
filename: file.filename,
|
|
2464
|
+
error
|
|
2465
|
+
});
|
|
2466
|
+
return null;
|
|
2467
|
+
}
|
|
2468
|
+
})
|
|
2469
|
+
);
|
|
2470
|
+
const fileUploads = bufferResults.filter(
|
|
2471
|
+
(result2) => result2 !== null
|
|
2472
|
+
);
|
|
2473
|
+
if (fileUploads.length === 0) {
|
|
2474
|
+
return [];
|
|
2475
|
+
}
|
|
2476
|
+
this.logger.debug("Slack API: files.uploadV2 (batch)", {
|
|
2477
|
+
fileCount: fileUploads.length,
|
|
2478
|
+
filenames: fileUploads.map((f) => f.filename)
|
|
2479
|
+
});
|
|
2480
|
+
const uploadArgs = { channel_id: channel, file_uploads: fileUploads };
|
|
2481
|
+
if (threadTs) {
|
|
2482
|
+
uploadArgs.thread_ts = threadTs;
|
|
2483
|
+
}
|
|
2484
|
+
uploadArgs.token = this.getToken();
|
|
2485
|
+
const result = await this.client.files.uploadV2(uploadArgs);
|
|
2486
|
+
this.logger.debug("Slack API: files.uploadV2 response", { ok: result.ok });
|
|
2487
|
+
const fileIds = [];
|
|
2488
|
+
if (result.files?.[0]?.files) {
|
|
2489
|
+
for (const uploadedFile of result.files[0].files) {
|
|
2490
|
+
if (uploadedFile.id) {
|
|
2491
|
+
fileIds.push(uploadedFile.id);
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
return fileIds;
|
|
2496
|
+
}
|
|
2497
|
+
async editMessage(threadId, messageId, _message) {
|
|
2498
|
+
const message = await this.resolveMessageMentions(_message, threadId);
|
|
2499
|
+
const ephemeral = this.decodeEphemeralMessageId(messageId);
|
|
2500
|
+
if (ephemeral) {
|
|
2501
|
+
const { threadTs } = this.decodeThreadId(threadId);
|
|
2502
|
+
const result = await this.sendToResponseUrl(
|
|
2503
|
+
ephemeral.responseUrl,
|
|
2504
|
+
"replace",
|
|
2505
|
+
{
|
|
2506
|
+
message,
|
|
2507
|
+
threadTs
|
|
2508
|
+
}
|
|
2509
|
+
);
|
|
2510
|
+
return {
|
|
2511
|
+
id: ephemeral.messageTs,
|
|
2512
|
+
threadId,
|
|
2513
|
+
raw: { ephemeral: true, ...result }
|
|
2514
|
+
};
|
|
2515
|
+
}
|
|
2516
|
+
const { channel } = this.decodeThreadId(threadId);
|
|
2517
|
+
try {
|
|
2518
|
+
const card = extractCard(message);
|
|
2519
|
+
if (card) {
|
|
2520
|
+
const blocks = cardToBlockKit(card);
|
|
2521
|
+
const fallbackText = cardToFallbackText(card);
|
|
2522
|
+
this.logger.debug("Slack API: chat.update (blocks)", {
|
|
2523
|
+
channel,
|
|
2524
|
+
messageId,
|
|
2525
|
+
blockCount: blocks.length
|
|
2526
|
+
});
|
|
2527
|
+
const result2 = await this.client.chat.update(
|
|
2528
|
+
this.withToken({
|
|
2529
|
+
channel,
|
|
2530
|
+
ts: messageId,
|
|
2531
|
+
text: fallbackText,
|
|
2532
|
+
blocks
|
|
2533
|
+
})
|
|
2534
|
+
);
|
|
2535
|
+
this.logger.debug("Slack API: chat.update response", {
|
|
2536
|
+
messageId: result2.ts,
|
|
2537
|
+
ok: result2.ok
|
|
2538
|
+
});
|
|
2539
|
+
return {
|
|
2540
|
+
id: result2.ts,
|
|
2541
|
+
threadId,
|
|
2542
|
+
raw: result2
|
|
2543
|
+
};
|
|
2544
|
+
}
|
|
2545
|
+
const tableResult = this.renderWithTableBlocks(message);
|
|
2546
|
+
if (tableResult) {
|
|
2547
|
+
this.logger.debug("Slack API: chat.update (table blocks)", {
|
|
2548
|
+
channel,
|
|
2549
|
+
messageId,
|
|
2550
|
+
blockCount: tableResult.blocks.length
|
|
2551
|
+
});
|
|
2552
|
+
const result2 = await this.client.chat.update(
|
|
2553
|
+
this.withToken({
|
|
2554
|
+
channel,
|
|
2555
|
+
ts: messageId,
|
|
2556
|
+
text: tableResult.text,
|
|
2557
|
+
blocks: tableResult.blocks
|
|
2558
|
+
})
|
|
2559
|
+
);
|
|
2560
|
+
this.logger.debug("Slack API: chat.update response", {
|
|
2561
|
+
messageId: result2.ts,
|
|
2562
|
+
ok: result2.ok
|
|
2563
|
+
});
|
|
2564
|
+
return {
|
|
2565
|
+
id: result2.ts,
|
|
2566
|
+
threadId,
|
|
2567
|
+
raw: result2
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2570
|
+
const text = convertEmojiPlaceholders(
|
|
2571
|
+
this.formatConverter.renderPostable(message),
|
|
2572
|
+
"slack"
|
|
2573
|
+
);
|
|
2574
|
+
this.logger.debug("Slack API: chat.update", {
|
|
2575
|
+
channel,
|
|
2576
|
+
messageId,
|
|
2577
|
+
textLength: text.length
|
|
2578
|
+
});
|
|
2579
|
+
const result = await this.client.chat.update(
|
|
2580
|
+
this.withToken({
|
|
2581
|
+
channel,
|
|
2582
|
+
ts: messageId,
|
|
2583
|
+
text
|
|
2584
|
+
})
|
|
2585
|
+
);
|
|
2586
|
+
this.logger.debug("Slack API: chat.update response", {
|
|
2587
|
+
messageId: result.ts,
|
|
2588
|
+
ok: result.ok
|
|
2589
|
+
});
|
|
2590
|
+
return {
|
|
2591
|
+
id: result.ts,
|
|
2592
|
+
threadId,
|
|
2593
|
+
raw: result
|
|
2594
|
+
};
|
|
2595
|
+
} catch (error) {
|
|
2596
|
+
this.handleSlackError(error);
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
async deleteMessage(threadId, messageId) {
|
|
2600
|
+
const ephemeral = this.decodeEphemeralMessageId(messageId);
|
|
2601
|
+
if (ephemeral) {
|
|
2602
|
+
await this.sendToResponseUrl(ephemeral.responseUrl, "delete");
|
|
2603
|
+
return;
|
|
2604
|
+
}
|
|
2605
|
+
const { channel } = this.decodeThreadId(threadId);
|
|
2606
|
+
try {
|
|
2607
|
+
this.logger.debug("Slack API: chat.delete", { channel, messageId });
|
|
2608
|
+
await this.client.chat.delete(
|
|
2609
|
+
this.withToken({
|
|
2610
|
+
channel,
|
|
2611
|
+
ts: messageId
|
|
2612
|
+
})
|
|
2613
|
+
);
|
|
2614
|
+
this.logger.debug("Slack API: chat.delete response", { ok: true });
|
|
2615
|
+
} catch (error) {
|
|
2616
|
+
this.handleSlackError(error);
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
async addReaction(threadId, messageId, emoji) {
|
|
2620
|
+
const { channel } = this.decodeThreadId(threadId);
|
|
2621
|
+
const slackEmoji = defaultEmojiResolver.toSlack(emoji);
|
|
2622
|
+
const name = slackEmoji.replace(/:/g, "");
|
|
2623
|
+
try {
|
|
2624
|
+
this.logger.debug("Slack API: reactions.add", {
|
|
2625
|
+
channel,
|
|
2626
|
+
messageId,
|
|
2627
|
+
emoji: name
|
|
2628
|
+
});
|
|
2629
|
+
await this.client.reactions.add(
|
|
2630
|
+
this.withToken({
|
|
2631
|
+
channel,
|
|
2632
|
+
timestamp: messageId,
|
|
2633
|
+
name
|
|
2634
|
+
})
|
|
2635
|
+
);
|
|
2636
|
+
this.logger.debug("Slack API: reactions.add response", { ok: true });
|
|
2637
|
+
} catch (error) {
|
|
2638
|
+
this.handleSlackError(error);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
async removeReaction(threadId, messageId, emoji) {
|
|
2642
|
+
const { channel } = this.decodeThreadId(threadId);
|
|
2643
|
+
const slackEmoji = defaultEmojiResolver.toSlack(emoji);
|
|
2644
|
+
const name = slackEmoji.replace(/:/g, "");
|
|
2645
|
+
try {
|
|
2646
|
+
this.logger.debug("Slack API: reactions.remove", {
|
|
2647
|
+
channel,
|
|
2648
|
+
messageId,
|
|
2649
|
+
emoji: name
|
|
2650
|
+
});
|
|
2651
|
+
await this.client.reactions.remove(
|
|
2652
|
+
this.withToken({
|
|
2653
|
+
channel,
|
|
2654
|
+
timestamp: messageId,
|
|
2655
|
+
name
|
|
2656
|
+
})
|
|
2657
|
+
);
|
|
2658
|
+
this.logger.debug("Slack API: reactions.remove response", { ok: true });
|
|
2659
|
+
} catch (error) {
|
|
2660
|
+
this.handleSlackError(error);
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
/**
|
|
2664
|
+
* Show typing indicator with optional custom status.
|
|
2665
|
+
*
|
|
2666
|
+
* When status is provided, uses Slack's assistant.threads.setStatus API
|
|
2667
|
+
* to show custom loading text (requires Agents & AI Apps feature and assistant:write scope).
|
|
2668
|
+
* The status auto-clears when a message is posted to the thread.
|
|
2669
|
+
*
|
|
2670
|
+
* When status is not provided, defaults to "Typing..." with default loading messages.
|
|
2671
|
+
*
|
|
2672
|
+
* @param threadId - The thread to show the indicator in
|
|
2673
|
+
* @param status - Optional custom status message (e.g., "Searching documents...")
|
|
2674
|
+
*/
|
|
2675
|
+
async startTyping(threadId, status) {
|
|
2676
|
+
const { channel, threadTs } = this.decodeThreadId(threadId);
|
|
2677
|
+
if (!threadTs) {
|
|
2678
|
+
this.logger.debug("Slack: startTyping skipped - no thread context");
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
this.logger.debug("Slack API: assistant.threads.setStatus", {
|
|
2682
|
+
channel,
|
|
2683
|
+
threadTs,
|
|
2684
|
+
status
|
|
2685
|
+
});
|
|
2686
|
+
try {
|
|
2687
|
+
await this.client.assistant.threads.setStatus(
|
|
2688
|
+
this.withToken({
|
|
2689
|
+
channel_id: channel,
|
|
2690
|
+
thread_ts: threadTs,
|
|
2691
|
+
status: status ?? "Typing...",
|
|
2692
|
+
loading_messages: [status ?? "Typing..."]
|
|
2693
|
+
})
|
|
2694
|
+
);
|
|
2695
|
+
} catch (error) {
|
|
2696
|
+
this.logger.warn("Slack API: assistant.threads.setStatus failed", {
|
|
2697
|
+
channel,
|
|
2698
|
+
threadTs,
|
|
2699
|
+
error
|
|
2700
|
+
});
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
/**
|
|
2704
|
+
* Stream a message using Slack's native streaming API.
|
|
2705
|
+
*
|
|
2706
|
+
* Consumes an async iterable of text chunks and/or structured StreamChunk
|
|
2707
|
+
* objects (task_update, plan_update, markdown_text) and streams them to Slack.
|
|
2708
|
+
*
|
|
2709
|
+
* Plain strings are rendered through StreamingMarkdownRenderer for safe
|
|
2710
|
+
* incremental markdown. StreamChunk objects are passed directly to Slack's
|
|
2711
|
+
* streaming API as chunk payloads, enabling native task progress cards
|
|
2712
|
+
* and plan displays in the Slack AI Assistant UI.
|
|
2713
|
+
*
|
|
2714
|
+
* Requires `recipientUserId` and `recipientTeamId` in options.
|
|
2715
|
+
*/
|
|
2716
|
+
async stream(threadId, textStream, options) {
|
|
2717
|
+
if (!(options?.recipientUserId && options?.recipientTeamId)) {
|
|
2718
|
+
throw new ValidationError(
|
|
2719
|
+
"slack",
|
|
2720
|
+
"Slack streaming requires recipientUserId and recipientTeamId in options"
|
|
2721
|
+
);
|
|
2722
|
+
}
|
|
2723
|
+
const { channel, threadTs } = this.decodeThreadId(threadId);
|
|
2724
|
+
this.logger.debug("Slack: starting stream", { channel, threadTs });
|
|
2725
|
+
const token = this.getToken();
|
|
2726
|
+
const streamer = this.client.chatStream({
|
|
2727
|
+
channel,
|
|
2728
|
+
thread_ts: threadTs,
|
|
2729
|
+
recipient_user_id: options.recipientUserId,
|
|
2730
|
+
recipient_team_id: options.recipientTeamId,
|
|
2731
|
+
...options.taskDisplayMode && {
|
|
2732
|
+
task_display_mode: options.taskDisplayMode
|
|
2733
|
+
}
|
|
2734
|
+
});
|
|
2735
|
+
let first = true;
|
|
2736
|
+
let lastAppended = "";
|
|
2737
|
+
const renderer = new StreamingMarkdownRenderer();
|
|
2738
|
+
const flushMarkdownDelta = async (delta) => {
|
|
2739
|
+
if (delta.length === 0) {
|
|
2740
|
+
return;
|
|
2741
|
+
}
|
|
2742
|
+
if (first) {
|
|
2743
|
+
await streamer.append({ markdown_text: delta, token });
|
|
2744
|
+
first = false;
|
|
2745
|
+
} else {
|
|
2746
|
+
await streamer.append({ markdown_text: delta });
|
|
2747
|
+
}
|
|
2748
|
+
};
|
|
2749
|
+
let structuredChunksSupported = true;
|
|
2750
|
+
const sendStructuredChunk = async (chunk) => {
|
|
2751
|
+
if (!structuredChunksSupported) {
|
|
2752
|
+
return;
|
|
2753
|
+
}
|
|
2754
|
+
const committable = renderer.getCommittableText();
|
|
2755
|
+
const delta = committable.slice(lastAppended.length);
|
|
2756
|
+
await flushMarkdownDelta(delta);
|
|
2757
|
+
lastAppended = committable;
|
|
2758
|
+
try {
|
|
2759
|
+
if (first) {
|
|
2760
|
+
await streamer.append({ chunks: [chunk], token });
|
|
2761
|
+
first = false;
|
|
2762
|
+
} else {
|
|
2763
|
+
await streamer.append({ chunks: [chunk] });
|
|
2764
|
+
}
|
|
2765
|
+
} catch (error) {
|
|
2766
|
+
structuredChunksSupported = false;
|
|
2767
|
+
this.logger.warn(
|
|
2768
|
+
"Structured streaming chunk failed, falling back to text-only streaming. Ensure your Slack app manifest includes assistant_view, assistant:write scope, and @slack/web-api >= 7.14.0",
|
|
2769
|
+
{ chunkType: chunk.type, error }
|
|
2770
|
+
);
|
|
2771
|
+
}
|
|
2772
|
+
};
|
|
2773
|
+
const pushTextAndFlush = async (text) => {
|
|
2774
|
+
renderer.push(text);
|
|
2775
|
+
const committable = renderer.getCommittableText();
|
|
2776
|
+
const delta = committable.slice(lastAppended.length);
|
|
2777
|
+
await flushMarkdownDelta(delta);
|
|
2778
|
+
lastAppended = committable;
|
|
2779
|
+
};
|
|
2780
|
+
for await (const chunk of textStream) {
|
|
2781
|
+
if (typeof chunk === "string") {
|
|
2782
|
+
await pushTextAndFlush(chunk);
|
|
2783
|
+
} else if (chunk.type === "markdown_text") {
|
|
2784
|
+
await pushTextAndFlush(chunk.text);
|
|
2785
|
+
} else {
|
|
2786
|
+
await sendStructuredChunk(chunk);
|
|
2787
|
+
}
|
|
2788
|
+
}
|
|
2789
|
+
renderer.finish();
|
|
2790
|
+
const finalCommittable = renderer.getCommittableText();
|
|
2791
|
+
const finalDelta = finalCommittable.slice(lastAppended.length);
|
|
2792
|
+
await flushMarkdownDelta(finalDelta);
|
|
2793
|
+
const result = await streamer.stop(
|
|
2794
|
+
// biome-ignore lint/suspicious/noExplicitAny: stopBlocks are platform-specific Block Kit elements
|
|
2795
|
+
options?.stopBlocks ? { blocks: options.stopBlocks } : void 0
|
|
2796
|
+
);
|
|
2797
|
+
const messageTs = result.message?.ts ?? result.ts;
|
|
2798
|
+
this.logger.debug("Slack: stream complete", { messageId: messageTs });
|
|
2799
|
+
return {
|
|
2800
|
+
id: messageTs,
|
|
2801
|
+
threadId,
|
|
2802
|
+
raw: result
|
|
2803
|
+
};
|
|
2804
|
+
}
|
|
2805
|
+
/**
|
|
2806
|
+
* Open a direct message conversation with a user.
|
|
2807
|
+
* Returns a thread ID that can be used to post messages.
|
|
2808
|
+
*/
|
|
2809
|
+
async openDM(userId) {
|
|
2810
|
+
try {
|
|
2811
|
+
this.logger.debug("Slack API: conversations.open", { userId });
|
|
2812
|
+
const result = await this.client.conversations.open(
|
|
2813
|
+
this.withToken({ users: userId })
|
|
2814
|
+
);
|
|
2815
|
+
if (!result.channel?.id) {
|
|
2816
|
+
throw new NetworkError(
|
|
2817
|
+
"slack",
|
|
2818
|
+
"Failed to open DM - no channel returned"
|
|
2819
|
+
);
|
|
2820
|
+
}
|
|
2821
|
+
const channelId = result.channel.id;
|
|
2822
|
+
this.logger.debug("Slack API: conversations.open response", {
|
|
2823
|
+
channelId,
|
|
2824
|
+
ok: result.ok
|
|
2825
|
+
});
|
|
2826
|
+
return this.encodeThreadId({
|
|
2827
|
+
channel: channelId,
|
|
2828
|
+
threadTs: ""
|
|
2829
|
+
// Empty threadTs indicates top-level channel messages
|
|
2830
|
+
});
|
|
2831
|
+
} catch (error) {
|
|
2832
|
+
this.handleSlackError(error);
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
async fetchMessages(threadId, options = {}) {
|
|
2836
|
+
const { channel, threadTs } = this.decodeThreadId(threadId);
|
|
2837
|
+
const direction = options.direction ?? "backward";
|
|
2838
|
+
const limit = options.limit || 100;
|
|
2839
|
+
try {
|
|
2840
|
+
if (direction === "forward") {
|
|
2841
|
+
return await this.fetchMessagesForward(
|
|
2842
|
+
channel,
|
|
2843
|
+
threadTs,
|
|
2844
|
+
threadId,
|
|
2845
|
+
limit,
|
|
2846
|
+
options.cursor
|
|
2847
|
+
);
|
|
2848
|
+
}
|
|
2849
|
+
return await this.fetchMessagesBackward(
|
|
2850
|
+
channel,
|
|
2851
|
+
threadTs,
|
|
2852
|
+
threadId,
|
|
2853
|
+
limit,
|
|
2854
|
+
options.cursor
|
|
2855
|
+
);
|
|
2856
|
+
} catch (error) {
|
|
2857
|
+
this.handleSlackError(error);
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
/**
|
|
2861
|
+
* Fetch messages in forward direction (oldest first, efficient).
|
|
2862
|
+
* Uses native Slack cursor pagination.
|
|
2863
|
+
*/
|
|
2864
|
+
async fetchMessagesForward(channel, threadTs, threadId, limit, cursor) {
|
|
2865
|
+
this.logger.debug("Slack API: conversations.replies (forward)", {
|
|
2866
|
+
channel,
|
|
2867
|
+
threadTs,
|
|
2868
|
+
limit,
|
|
2869
|
+
cursor
|
|
2870
|
+
});
|
|
2871
|
+
const result = await this.client.conversations.replies(
|
|
2872
|
+
this.withToken({
|
|
2873
|
+
channel,
|
|
2874
|
+
ts: threadTs,
|
|
2875
|
+
limit,
|
|
2876
|
+
cursor
|
|
2877
|
+
})
|
|
2878
|
+
);
|
|
2879
|
+
const slackMessages = result.messages || [];
|
|
2880
|
+
const nextCursor = result.response_metadata?.next_cursor;
|
|
2881
|
+
this.logger.debug("Slack API: conversations.replies response", {
|
|
2882
|
+
messageCount: slackMessages.length,
|
|
2883
|
+
ok: result.ok,
|
|
2884
|
+
hasNextCursor: !!nextCursor
|
|
2885
|
+
});
|
|
2886
|
+
const messages = await Promise.all(
|
|
2887
|
+
slackMessages.map((msg) => this.parseSlackMessage(msg, threadId))
|
|
2888
|
+
);
|
|
2889
|
+
return {
|
|
2890
|
+
messages,
|
|
2891
|
+
nextCursor: nextCursor || void 0
|
|
2892
|
+
};
|
|
2893
|
+
}
|
|
2894
|
+
/**
|
|
2895
|
+
* Fetch messages in backward direction (most recent first).
|
|
2896
|
+
*
|
|
2897
|
+
* Slack's API returns oldest-first, so for backward direction we:
|
|
2898
|
+
* 1. Use `latest` parameter to fetch messages before a timestamp (cursor)
|
|
2899
|
+
* 2. Fetch up to 1000 messages (API limit) and take the last N
|
|
2900
|
+
* 3. Return messages in chronological order (oldest first within the page)
|
|
2901
|
+
*
|
|
2902
|
+
* Note: For very large threads (>1000 messages), the first backward call
|
|
2903
|
+
* may not return the absolute most recent messages. This is a Slack API limitation.
|
|
2904
|
+
*/
|
|
2905
|
+
async fetchMessagesBackward(channel, threadTs, threadId, limit, cursor) {
|
|
2906
|
+
const latest = cursor || void 0;
|
|
2907
|
+
this.logger.debug("Slack API: conversations.replies (backward)", {
|
|
2908
|
+
channel,
|
|
2909
|
+
threadTs,
|
|
2910
|
+
limit,
|
|
2911
|
+
latest
|
|
2912
|
+
});
|
|
2913
|
+
const fetchLimit = Math.min(1e3, Math.max(limit * 2, 200));
|
|
2914
|
+
const result = await this.client.conversations.replies(
|
|
2915
|
+
this.withToken({
|
|
2916
|
+
channel,
|
|
2917
|
+
ts: threadTs,
|
|
2918
|
+
limit: fetchLimit,
|
|
2919
|
+
latest,
|
|
2920
|
+
inclusive: false
|
|
2921
|
+
// Don't include the cursor message itself
|
|
2922
|
+
})
|
|
2923
|
+
);
|
|
2924
|
+
const slackMessages = result.messages || [];
|
|
2925
|
+
this.logger.debug("Slack API: conversations.replies response (backward)", {
|
|
2926
|
+
messageCount: slackMessages.length,
|
|
2927
|
+
ok: result.ok,
|
|
2928
|
+
hasMore: result.has_more
|
|
2929
|
+
});
|
|
2930
|
+
const startIndex = Math.max(0, slackMessages.length - limit);
|
|
2931
|
+
const selectedMessages = slackMessages.slice(startIndex);
|
|
2932
|
+
const messages = await Promise.all(
|
|
2933
|
+
selectedMessages.map((msg) => this.parseSlackMessage(msg, threadId))
|
|
2934
|
+
);
|
|
2935
|
+
let nextCursor;
|
|
2936
|
+
if (startIndex > 0 || result.has_more) {
|
|
2937
|
+
const oldestSelected = selectedMessages[0];
|
|
2938
|
+
if (oldestSelected?.ts) {
|
|
2939
|
+
nextCursor = oldestSelected.ts;
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
return {
|
|
2943
|
+
messages,
|
|
2944
|
+
nextCursor
|
|
2945
|
+
};
|
|
2946
|
+
}
|
|
2947
|
+
async fetchThread(threadId) {
|
|
2948
|
+
const { channel, threadTs } = this.decodeThreadId(threadId);
|
|
2949
|
+
try {
|
|
2950
|
+
this.logger.debug("Slack API: conversations.info", { channel });
|
|
2951
|
+
const result = await this.client.conversations.info(
|
|
2952
|
+
this.withToken({ channel })
|
|
2953
|
+
);
|
|
2954
|
+
const channelInfo = result.channel;
|
|
2955
|
+
this.logger.debug("Slack API: conversations.info response", {
|
|
2956
|
+
channelName: channelInfo?.name,
|
|
2957
|
+
ok: result.ok
|
|
2958
|
+
});
|
|
2959
|
+
return {
|
|
2960
|
+
id: threadId,
|
|
2961
|
+
channelId: channel,
|
|
2962
|
+
channelName: channelInfo?.name,
|
|
2963
|
+
metadata: {
|
|
2964
|
+
threadTs,
|
|
2965
|
+
channel: result.channel
|
|
2966
|
+
}
|
|
2967
|
+
};
|
|
2968
|
+
} catch (error) {
|
|
2969
|
+
this.handleSlackError(error);
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
/**
|
|
2973
|
+
* Fetch a single message by ID (timestamp).
|
|
2974
|
+
*/
|
|
2975
|
+
async fetchMessage(threadId, messageId) {
|
|
2976
|
+
const { channel, threadTs } = this.decodeThreadId(threadId);
|
|
2977
|
+
try {
|
|
2978
|
+
const result = await this.client.conversations.replies(
|
|
2979
|
+
this.withToken({
|
|
2980
|
+
channel,
|
|
2981
|
+
ts: threadTs,
|
|
2982
|
+
oldest: messageId,
|
|
2983
|
+
inclusive: true,
|
|
2984
|
+
limit: 1
|
|
2985
|
+
})
|
|
2986
|
+
);
|
|
2987
|
+
const messages = result.messages || [];
|
|
2988
|
+
const target = messages.find((msg) => msg.ts === messageId);
|
|
2989
|
+
if (!target) {
|
|
2990
|
+
return null;
|
|
2991
|
+
}
|
|
2992
|
+
return this.parseSlackMessage(target, threadId);
|
|
2993
|
+
} catch (error) {
|
|
2994
|
+
this.handleSlackError(error);
|
|
2995
|
+
}
|
|
2996
|
+
}
|
|
2997
|
+
encodeThreadId(platformData) {
|
|
2998
|
+
return `slack:${platformData.channel}:${platformData.threadTs}`;
|
|
2999
|
+
}
|
|
3000
|
+
/**
|
|
3001
|
+
* Check if a thread is a direct message conversation.
|
|
3002
|
+
* Slack DM channel IDs start with 'D'.
|
|
3003
|
+
*/
|
|
3004
|
+
isDM(threadId) {
|
|
3005
|
+
const { channel } = this.decodeThreadId(threadId);
|
|
3006
|
+
return channel.startsWith("D");
|
|
3007
|
+
}
|
|
3008
|
+
decodeThreadId(threadId) {
|
|
3009
|
+
const parts = threadId.split(":");
|
|
3010
|
+
if (parts.length < 2 || parts.length > 3 || parts[0] !== "slack") {
|
|
3011
|
+
throw new ValidationError(
|
|
3012
|
+
"slack",
|
|
3013
|
+
`Invalid Slack thread ID: ${threadId}`
|
|
3014
|
+
);
|
|
3015
|
+
}
|
|
3016
|
+
return {
|
|
3017
|
+
channel: parts[1],
|
|
3018
|
+
threadTs: parts.length === 3 ? parts[2] : ""
|
|
3019
|
+
};
|
|
3020
|
+
}
|
|
3021
|
+
parseMessage(raw) {
|
|
3022
|
+
const event = raw;
|
|
3023
|
+
const threadTs = event.thread_ts || event.ts || "";
|
|
3024
|
+
const threadId = this.encodeThreadId({
|
|
3025
|
+
channel: event.channel || "",
|
|
3026
|
+
threadTs
|
|
3027
|
+
});
|
|
3028
|
+
return this.parseSlackMessageSync(event, threadId);
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* Synchronous message parsing without user lookup.
|
|
3032
|
+
* Used for parseMessage interface - falls back to user ID for username.
|
|
3033
|
+
*/
|
|
3034
|
+
parseSlackMessageSync(event, threadId) {
|
|
3035
|
+
const isMe = this.isMessageFromSelf(event);
|
|
3036
|
+
const text = event.text || "";
|
|
3037
|
+
const userName = event.username || event.user || "unknown";
|
|
3038
|
+
const fullName = event.username || event.user || "unknown";
|
|
3039
|
+
return new Message({
|
|
3040
|
+
id: event.ts || "",
|
|
3041
|
+
threadId,
|
|
3042
|
+
text: this.formatConverter.extractPlainText(text),
|
|
3043
|
+
formatted: this.formatConverter.toAst(text),
|
|
3044
|
+
raw: event,
|
|
3045
|
+
author: {
|
|
3046
|
+
userId: event.user || event.bot_id || "unknown",
|
|
3047
|
+
userName,
|
|
3048
|
+
fullName,
|
|
3049
|
+
isBot: !!event.bot_id,
|
|
3050
|
+
isMe
|
|
3051
|
+
},
|
|
3052
|
+
metadata: {
|
|
3053
|
+
dateSent: new Date(Number.parseFloat(event.ts || "0") * 1e3),
|
|
3054
|
+
edited: !!event.edited,
|
|
3055
|
+
editedAt: event.edited ? new Date(Number.parseFloat(event.edited.ts) * 1e3) : void 0
|
|
3056
|
+
},
|
|
3057
|
+
attachments: (event.files || []).map(
|
|
3058
|
+
(file) => this.createAttachment(file)
|
|
3059
|
+
),
|
|
3060
|
+
links: this.extractLinks(event)
|
|
3061
|
+
});
|
|
3062
|
+
}
|
|
3063
|
+
// =========================================================================
|
|
3064
|
+
// Channel-level methods
|
|
3065
|
+
// =========================================================================
|
|
3066
|
+
/**
|
|
3067
|
+
* Derive channel ID from a Slack thread ID.
|
|
3068
|
+
* Slack thread IDs are "slack:CHANNEL:THREAD_TS", channel ID is "slack:CHANNEL".
|
|
3069
|
+
*/
|
|
3070
|
+
channelIdFromThreadId(threadId) {
|
|
3071
|
+
const { channel } = this.decodeThreadId(threadId);
|
|
3072
|
+
return `slack:${channel}`;
|
|
3073
|
+
}
|
|
3074
|
+
/**
|
|
3075
|
+
* Fetch channel-level messages (conversations.history, not thread replies).
|
|
3076
|
+
*/
|
|
3077
|
+
async fetchChannelMessages(channelId, options = {}) {
|
|
3078
|
+
const channel = channelId.split(":")[1];
|
|
3079
|
+
if (!channel) {
|
|
3080
|
+
throw new ValidationError(
|
|
3081
|
+
"slack",
|
|
3082
|
+
`Invalid Slack channel ID: ${channelId}`
|
|
3083
|
+
);
|
|
3084
|
+
}
|
|
3085
|
+
const direction = options.direction ?? "backward";
|
|
3086
|
+
const limit = options.limit || 100;
|
|
3087
|
+
try {
|
|
3088
|
+
if (direction === "forward") {
|
|
3089
|
+
return await this.fetchChannelMessagesForward(
|
|
3090
|
+
channel,
|
|
3091
|
+
limit,
|
|
3092
|
+
options.cursor
|
|
3093
|
+
);
|
|
3094
|
+
}
|
|
3095
|
+
return await this.fetchChannelMessagesBackward(
|
|
3096
|
+
channel,
|
|
3097
|
+
limit,
|
|
3098
|
+
options.cursor
|
|
3099
|
+
);
|
|
3100
|
+
} catch (error) {
|
|
3101
|
+
this.handleSlackError(error);
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
async fetchChannelMessagesForward(channel, limit, cursor) {
|
|
3105
|
+
this.logger.debug("Slack API: conversations.history (forward)", {
|
|
3106
|
+
channel,
|
|
3107
|
+
limit,
|
|
3108
|
+
cursor
|
|
3109
|
+
});
|
|
3110
|
+
const result = await this.client.conversations.history(
|
|
3111
|
+
this.withToken({
|
|
3112
|
+
channel,
|
|
3113
|
+
limit,
|
|
3114
|
+
oldest: cursor,
|
|
3115
|
+
inclusive: cursor ? false : void 0
|
|
3116
|
+
})
|
|
3117
|
+
);
|
|
3118
|
+
const slackMessages = (result.messages || []).reverse();
|
|
3119
|
+
const messages = await Promise.all(
|
|
3120
|
+
slackMessages.map((msg) => {
|
|
3121
|
+
const threadTs = msg.thread_ts || msg.ts || "";
|
|
3122
|
+
const threadId = `slack:${channel}:${threadTs}`;
|
|
3123
|
+
return this.parseSlackMessage(msg, threadId, {
|
|
3124
|
+
skipSelfMention: false
|
|
3125
|
+
});
|
|
3126
|
+
})
|
|
3127
|
+
);
|
|
3128
|
+
let nextCursor;
|
|
3129
|
+
if (result.has_more && slackMessages.length > 0) {
|
|
3130
|
+
const newest = slackMessages.at(-1);
|
|
3131
|
+
if (newest?.ts) {
|
|
3132
|
+
nextCursor = newest.ts;
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
return {
|
|
3136
|
+
messages,
|
|
3137
|
+
nextCursor
|
|
3138
|
+
};
|
|
3139
|
+
}
|
|
3140
|
+
async fetchChannelMessagesBackward(channel, limit, cursor) {
|
|
3141
|
+
this.logger.debug("Slack API: conversations.history (backward)", {
|
|
3142
|
+
channel,
|
|
3143
|
+
limit,
|
|
3144
|
+
cursor
|
|
3145
|
+
});
|
|
3146
|
+
const result = await this.client.conversations.history(
|
|
3147
|
+
this.withToken({
|
|
3148
|
+
channel,
|
|
3149
|
+
limit,
|
|
3150
|
+
latest: cursor,
|
|
3151
|
+
inclusive: cursor ? false : void 0
|
|
3152
|
+
})
|
|
3153
|
+
);
|
|
3154
|
+
const slackMessages = result.messages || [];
|
|
3155
|
+
const chronological = [...slackMessages].reverse();
|
|
3156
|
+
const messages = await Promise.all(
|
|
3157
|
+
chronological.map((msg) => {
|
|
3158
|
+
const threadTs = msg.thread_ts || msg.ts || "";
|
|
3159
|
+
const threadId = `slack:${channel}:${threadTs}`;
|
|
3160
|
+
return this.parseSlackMessage(msg, threadId, {
|
|
3161
|
+
skipSelfMention: false
|
|
3162
|
+
});
|
|
3163
|
+
})
|
|
3164
|
+
);
|
|
3165
|
+
let nextCursor;
|
|
3166
|
+
if (result.has_more && chronological.length > 0) {
|
|
3167
|
+
const oldest = chronological[0];
|
|
3168
|
+
if (oldest?.ts) {
|
|
3169
|
+
nextCursor = oldest.ts;
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
return {
|
|
3173
|
+
messages,
|
|
3174
|
+
nextCursor
|
|
3175
|
+
};
|
|
3176
|
+
}
|
|
3177
|
+
/**
|
|
3178
|
+
* List threads in a Slack channel.
|
|
3179
|
+
* Fetches channel history and filters for messages with replies.
|
|
3180
|
+
*/
|
|
3181
|
+
async listThreads(channelId, options = {}) {
|
|
3182
|
+
const channel = channelId.split(":")[1];
|
|
3183
|
+
if (!channel) {
|
|
3184
|
+
throw new ValidationError(
|
|
3185
|
+
"slack",
|
|
3186
|
+
`Invalid Slack channel ID: ${channelId}`
|
|
3187
|
+
);
|
|
3188
|
+
}
|
|
3189
|
+
const limit = options.limit || 50;
|
|
3190
|
+
try {
|
|
3191
|
+
this.logger.debug("Slack API: conversations.history (listThreads)", {
|
|
3192
|
+
channel,
|
|
3193
|
+
limit,
|
|
3194
|
+
cursor: options.cursor
|
|
3195
|
+
});
|
|
3196
|
+
const result = await this.client.conversations.history(
|
|
3197
|
+
this.withToken({
|
|
3198
|
+
channel,
|
|
3199
|
+
limit: Math.min(limit * 3, 200),
|
|
3200
|
+
// Fetch extra since not all have threads
|
|
3201
|
+
cursor: options.cursor
|
|
3202
|
+
})
|
|
3203
|
+
);
|
|
3204
|
+
const slackMessages = result.messages || [];
|
|
3205
|
+
const threadMessages = slackMessages.filter(
|
|
3206
|
+
(msg) => (msg.reply_count ?? 0) > 0
|
|
3207
|
+
);
|
|
3208
|
+
const selected = threadMessages.slice(0, limit);
|
|
3209
|
+
const threads = await Promise.all(
|
|
3210
|
+
selected.map(async (msg) => {
|
|
3211
|
+
const threadTs = msg.ts || "";
|
|
3212
|
+
const threadId = `slack:${channel}:${threadTs}`;
|
|
3213
|
+
const rootMessage = await this.parseSlackMessage(msg, threadId, {
|
|
3214
|
+
skipSelfMention: false
|
|
3215
|
+
});
|
|
3216
|
+
return {
|
|
3217
|
+
id: threadId,
|
|
3218
|
+
rootMessage,
|
|
3219
|
+
replyCount: msg.reply_count,
|
|
3220
|
+
lastReplyAt: msg.latest_reply ? new Date(Number.parseFloat(msg.latest_reply) * 1e3) : void 0
|
|
3221
|
+
};
|
|
3222
|
+
})
|
|
3223
|
+
);
|
|
3224
|
+
const nextCursor = result.response_metadata?.next_cursor;
|
|
3225
|
+
return {
|
|
3226
|
+
threads,
|
|
3227
|
+
nextCursor: nextCursor || void 0
|
|
3228
|
+
};
|
|
3229
|
+
} catch (error) {
|
|
3230
|
+
this.handleSlackError(error);
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
/**
|
|
3234
|
+
* Fetch Slack channel info/metadata.
|
|
3235
|
+
*/
|
|
3236
|
+
async fetchChannelInfo(channelId) {
|
|
3237
|
+
const channel = channelId.split(":")[1];
|
|
3238
|
+
if (!channel) {
|
|
3239
|
+
throw new ValidationError(
|
|
3240
|
+
"slack",
|
|
3241
|
+
`Invalid Slack channel ID: ${channelId}`
|
|
3242
|
+
);
|
|
3243
|
+
}
|
|
3244
|
+
try {
|
|
3245
|
+
this.logger.debug("Slack API: conversations.info (channel)", { channel });
|
|
3246
|
+
const result = await this.client.conversations.info(
|
|
3247
|
+
this.withToken({ channel })
|
|
3248
|
+
);
|
|
3249
|
+
const info = result.channel;
|
|
3250
|
+
return {
|
|
3251
|
+
id: channelId,
|
|
3252
|
+
name: info?.name ? `#${info.name}` : void 0,
|
|
3253
|
+
isDM: Boolean(info?.is_im || info?.is_mpim),
|
|
3254
|
+
memberCount: info?.num_members,
|
|
3255
|
+
metadata: {
|
|
3256
|
+
purpose: info?.purpose?.value,
|
|
3257
|
+
topic: info?.topic?.value
|
|
3258
|
+
}
|
|
3259
|
+
};
|
|
3260
|
+
} catch (error) {
|
|
3261
|
+
this.handleSlackError(error);
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
/**
|
|
3265
|
+
* Post a top-level message to a channel (not in a thread).
|
|
3266
|
+
*/
|
|
3267
|
+
async postChannelMessage(channelId, message) {
|
|
3268
|
+
const channel = channelId.split(":")[1];
|
|
3269
|
+
if (!channel) {
|
|
3270
|
+
throw new ValidationError(
|
|
3271
|
+
"slack",
|
|
3272
|
+
`Invalid Slack channel ID: ${channelId}`
|
|
3273
|
+
);
|
|
3274
|
+
}
|
|
3275
|
+
const syntheticThreadId = `slack:${channel}:`;
|
|
3276
|
+
return await this.postMessage(syntheticThreadId, message);
|
|
3277
|
+
}
|
|
3278
|
+
renderFormatted(content) {
|
|
3279
|
+
return this.formatConverter.fromAst(content);
|
|
3280
|
+
}
|
|
3281
|
+
/**
|
|
3282
|
+
* Check if a Slack event is from this bot.
|
|
3283
|
+
*
|
|
3284
|
+
* Slack messages can come from:
|
|
3285
|
+
* - User messages: have `user` field (U_xxx format)
|
|
3286
|
+
* - Bot messages: have `bot_id` field (B_xxx format)
|
|
3287
|
+
*
|
|
3288
|
+
* We check both because:
|
|
3289
|
+
* - _botUserId is the user ID (U_xxx) - matches event.user
|
|
3290
|
+
* - _botId is the bot ID (B_xxx) - matches event.bot_id
|
|
3291
|
+
*/
|
|
3292
|
+
isMessageFromSelf(event) {
|
|
3293
|
+
const ctx = this.requestContext.getStore();
|
|
3294
|
+
if (ctx?.botUserId && event.user === ctx.botUserId) {
|
|
3295
|
+
return true;
|
|
3296
|
+
}
|
|
3297
|
+
if (this._botUserId && event.user === this._botUserId) {
|
|
3298
|
+
return true;
|
|
3299
|
+
}
|
|
3300
|
+
if (this._botId && event.bot_id === this._botId) {
|
|
3301
|
+
return true;
|
|
3302
|
+
}
|
|
3303
|
+
return false;
|
|
3304
|
+
}
|
|
3305
|
+
handleSlackError(error) {
|
|
3306
|
+
const slackError = error;
|
|
3307
|
+
if (slackError.code === "slack_webapi_platform_error" && slackError.data?.error === "ratelimited") {
|
|
3308
|
+
throw new AdapterRateLimitError("slack");
|
|
3309
|
+
}
|
|
3310
|
+
throw error;
|
|
3311
|
+
}
|
|
3312
|
+
/**
|
|
3313
|
+
* Encode response_url and userId into messageId for ephemeral messages.
|
|
3314
|
+
* This allows edit/delete operations to work via response_url.
|
|
3315
|
+
*/
|
|
3316
|
+
encodeEphemeralMessageId(messageTs, responseUrl, userId) {
|
|
3317
|
+
const data = JSON.stringify({ responseUrl, userId });
|
|
3318
|
+
return `ephemeral:${messageTs}:${btoa(data)}`;
|
|
3319
|
+
}
|
|
3320
|
+
/**
|
|
3321
|
+
* Decode ephemeral messageId to extract messageTs, responseUrl, and userId.
|
|
3322
|
+
* Returns null if the messageId is not an ephemeral encoding.
|
|
3323
|
+
*/
|
|
3324
|
+
decodeEphemeralMessageId(messageId) {
|
|
3325
|
+
if (!messageId.startsWith("ephemeral:")) {
|
|
3326
|
+
return null;
|
|
3327
|
+
}
|
|
3328
|
+
const parts = messageId.split(":");
|
|
3329
|
+
if (parts.length < 3) {
|
|
3330
|
+
return null;
|
|
3331
|
+
}
|
|
3332
|
+
const messageTs = parts[1];
|
|
3333
|
+
const encodedData = parts.slice(2).join(":");
|
|
3334
|
+
try {
|
|
3335
|
+
const decoded = atob(encodedData);
|
|
3336
|
+
try {
|
|
3337
|
+
const data = JSON.parse(decoded);
|
|
3338
|
+
if (data.responseUrl && data.userId) {
|
|
3339
|
+
return {
|
|
3340
|
+
messageTs,
|
|
3341
|
+
responseUrl: data.responseUrl,
|
|
3342
|
+
userId: data.userId
|
|
3343
|
+
};
|
|
3344
|
+
}
|
|
3345
|
+
} catch {
|
|
3346
|
+
return { messageTs, responseUrl: decoded, userId: "" };
|
|
3347
|
+
}
|
|
3348
|
+
return null;
|
|
3349
|
+
} catch {
|
|
3350
|
+
this.logger.warn("Failed to decode ephemeral messageId", { messageId });
|
|
3351
|
+
return null;
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
/**
|
|
3355
|
+
* Send a request to Slack's response_url to modify an ephemeral message.
|
|
3356
|
+
*/
|
|
3357
|
+
async sendToResponseUrl(responseUrl, action, options) {
|
|
3358
|
+
let payload;
|
|
3359
|
+
if (action === "delete") {
|
|
3360
|
+
payload = { delete_original: true };
|
|
3361
|
+
} else {
|
|
3362
|
+
const message = options?.message;
|
|
3363
|
+
if (!message) {
|
|
3364
|
+
throw new ValidationError(
|
|
3365
|
+
"slack",
|
|
3366
|
+
"Message required for replace action"
|
|
3367
|
+
);
|
|
3368
|
+
}
|
|
3369
|
+
const card = extractCard(message);
|
|
3370
|
+
if (card) {
|
|
3371
|
+
payload = {
|
|
3372
|
+
replace_original: true,
|
|
3373
|
+
text: cardToFallbackText(card),
|
|
3374
|
+
blocks: cardToBlockKit(card)
|
|
3375
|
+
};
|
|
3376
|
+
} else {
|
|
3377
|
+
const tableResult = this.renderWithTableBlocks(message);
|
|
3378
|
+
if (tableResult) {
|
|
3379
|
+
payload = {
|
|
3380
|
+
replace_original: true,
|
|
3381
|
+
text: tableResult.text,
|
|
3382
|
+
blocks: tableResult.blocks
|
|
3383
|
+
};
|
|
3384
|
+
} else {
|
|
3385
|
+
payload = {
|
|
3386
|
+
replace_original: true,
|
|
3387
|
+
text: convertEmojiPlaceholders(
|
|
3388
|
+
this.formatConverter.renderPostable(message),
|
|
3389
|
+
"slack"
|
|
3390
|
+
)
|
|
3391
|
+
};
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
if (options?.threadTs) {
|
|
3395
|
+
payload.thread_ts = options.threadTs;
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
this.logger.debug("Slack response_url request", {
|
|
3399
|
+
action,
|
|
3400
|
+
threadTs: options?.threadTs
|
|
3401
|
+
});
|
|
3402
|
+
const response = await fetch(responseUrl, {
|
|
3403
|
+
method: "POST",
|
|
3404
|
+
headers: { "Content-Type": "application/json" },
|
|
3405
|
+
body: JSON.stringify(payload)
|
|
3406
|
+
});
|
|
3407
|
+
if (!response.ok) {
|
|
3408
|
+
const errorText = await response.text();
|
|
3409
|
+
this.logger.error("Slack response_url failed", {
|
|
3410
|
+
action,
|
|
3411
|
+
status: response.status,
|
|
3412
|
+
body: errorText
|
|
3413
|
+
});
|
|
3414
|
+
throw new NetworkError(
|
|
3415
|
+
"slack",
|
|
3416
|
+
`Failed to ${action} via response_url: ${errorText}`
|
|
3417
|
+
);
|
|
3418
|
+
}
|
|
3419
|
+
const responseText = await response.text();
|
|
3420
|
+
if (responseText) {
|
|
3421
|
+
try {
|
|
3422
|
+
return JSON.parse(responseText);
|
|
3423
|
+
} catch {
|
|
3424
|
+
return { raw: responseText };
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
return {};
|
|
3428
|
+
}
|
|
3429
|
+
};
|
|
3430
|
+
function createSlackAdapter(config) {
|
|
3431
|
+
return new SlackAdapter(config ?? {});
|
|
3432
|
+
}
|
|
3433
|
+
export {
|
|
3434
|
+
SlackAdapter,
|
|
3435
|
+
SlackFormatConverter,
|
|
3436
|
+
SlackFormatConverter as SlackMarkdownConverter,
|
|
3437
|
+
cardToBlockKit,
|
|
3438
|
+
cardToFallbackText,
|
|
3439
|
+
createSlackAdapter,
|
|
3440
|
+
decodeKey
|
|
3441
|
+
};
|
|
3442
|
+
//# sourceMappingURL=index.js.map
|