@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,3466 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Actions,
|
|
3
|
+
BaseFormatConverter,
|
|
4
|
+
Button,
|
|
5
|
+
Card,
|
|
6
|
+
CardLink,
|
|
7
|
+
CardText,
|
|
8
|
+
Divider,
|
|
9
|
+
Field,
|
|
10
|
+
Fields,
|
|
11
|
+
Image,
|
|
12
|
+
LinkButton,
|
|
13
|
+
Modal,
|
|
14
|
+
RadioSelect,
|
|
15
|
+
Section,
|
|
16
|
+
Select,
|
|
17
|
+
SelectOption,
|
|
18
|
+
Table,
|
|
19
|
+
TextInput,
|
|
20
|
+
blockquote,
|
|
21
|
+
cardChildToFallbackText,
|
|
22
|
+
cardToFallbackText,
|
|
23
|
+
codeBlock,
|
|
24
|
+
emphasis,
|
|
25
|
+
fromReactElement,
|
|
26
|
+
fromReactModalElement,
|
|
27
|
+
getNodeChildren,
|
|
28
|
+
getNodeValue,
|
|
29
|
+
inlineCode,
|
|
30
|
+
isBlockquoteNode,
|
|
31
|
+
isCardElement,
|
|
32
|
+
isCodeNode,
|
|
33
|
+
isDeleteNode,
|
|
34
|
+
isEmphasisNode,
|
|
35
|
+
isInlineCodeNode,
|
|
36
|
+
isJSX,
|
|
37
|
+
isLinkNode,
|
|
38
|
+
isListItemNode,
|
|
39
|
+
isListNode,
|
|
40
|
+
isModalElement,
|
|
41
|
+
isParagraphNode,
|
|
42
|
+
isStrongNode,
|
|
43
|
+
isTableCellNode,
|
|
44
|
+
isTableNode,
|
|
45
|
+
isTableRowNode,
|
|
46
|
+
isTextNode,
|
|
47
|
+
link,
|
|
48
|
+
markdownToPlainText,
|
|
49
|
+
paragraph,
|
|
50
|
+
parseMarkdown,
|
|
51
|
+
root,
|
|
52
|
+
strikethrough,
|
|
53
|
+
stringifyMarkdown,
|
|
54
|
+
strong,
|
|
55
|
+
tableElementToAscii,
|
|
56
|
+
tableToAscii,
|
|
57
|
+
text,
|
|
58
|
+
toCardElement,
|
|
59
|
+
toModalElement,
|
|
60
|
+
toPlainText,
|
|
61
|
+
walkAst
|
|
62
|
+
} from "./chunk-JW7GYSMH.js";
|
|
63
|
+
|
|
64
|
+
// src/ai.ts
|
|
65
|
+
var TEXT_MIME_PREFIXES = [
|
|
66
|
+
"text/",
|
|
67
|
+
"application/json",
|
|
68
|
+
"application/xml",
|
|
69
|
+
"application/javascript",
|
|
70
|
+
"application/typescript",
|
|
71
|
+
"application/yaml",
|
|
72
|
+
"application/x-yaml",
|
|
73
|
+
"application/toml"
|
|
74
|
+
];
|
|
75
|
+
function isTextMimeType(mimeType) {
|
|
76
|
+
return TEXT_MIME_PREFIXES.some(
|
|
77
|
+
(prefix) => mimeType === prefix || mimeType.startsWith(prefix)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
async function attachmentToPart(att) {
|
|
81
|
+
if (att.type === "image") {
|
|
82
|
+
if (att.fetchData) {
|
|
83
|
+
try {
|
|
84
|
+
const buffer = await att.fetchData();
|
|
85
|
+
const mimeType = att.mimeType ?? "image/png";
|
|
86
|
+
return {
|
|
87
|
+
type: "file",
|
|
88
|
+
data: `data:${mimeType};base64,${buffer.toString("base64")}`,
|
|
89
|
+
mediaType: mimeType,
|
|
90
|
+
filename: att.name
|
|
91
|
+
};
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error("toAiMessages: failed to fetch image data", error);
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
if (att.type === "file" && att.mimeType && isTextMimeType(att.mimeType)) {
|
|
100
|
+
if (att.fetchData) {
|
|
101
|
+
try {
|
|
102
|
+
const buffer = await att.fetchData();
|
|
103
|
+
return {
|
|
104
|
+
type: "file",
|
|
105
|
+
data: `data:${att.mimeType};base64,${buffer.toString("base64")}`,
|
|
106
|
+
filename: att.name,
|
|
107
|
+
mediaType: att.mimeType
|
|
108
|
+
};
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error("toAiMessages: failed to fetch file data", error);
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
async function toAiMessages(messages, options) {
|
|
119
|
+
const includeNames = options?.includeNames ?? false;
|
|
120
|
+
const transformMessage = options?.transformMessage;
|
|
121
|
+
const onUnsupported = options?.onUnsupportedAttachment ?? ((att) => {
|
|
122
|
+
console.warn(
|
|
123
|
+
`toAiMessages: unsupported attachment type "${att.type}"${att.name ? ` (${att.name})` : ""} \u2014 skipped`
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
const sorted = [...messages].sort(
|
|
127
|
+
(a, b) => (a.metadata.dateSent?.getTime() ?? 0) - (b.metadata.dateSent?.getTime() ?? 0)
|
|
128
|
+
);
|
|
129
|
+
const filtered = sorted.filter((msg) => msg.text.trim());
|
|
130
|
+
const results = await Promise.all(
|
|
131
|
+
filtered.map(async (msg) => {
|
|
132
|
+
const role = msg.author.isMe ? "assistant" : "user";
|
|
133
|
+
let textContent = includeNames && role === "user" ? `[${msg.author.userName}]: ${msg.text}` : msg.text;
|
|
134
|
+
if (msg.links.length > 0) {
|
|
135
|
+
const linkParts = msg.links.map((link2) => {
|
|
136
|
+
const parts = link2.fetchMessage ? [`[Embedded message: ${link2.url}]`] : [link2.url];
|
|
137
|
+
if (link2.title) {
|
|
138
|
+
parts.push(`Title: ${link2.title}`);
|
|
139
|
+
}
|
|
140
|
+
if (link2.description) {
|
|
141
|
+
parts.push(`Description: ${link2.description}`);
|
|
142
|
+
}
|
|
143
|
+
if (link2.siteName) {
|
|
144
|
+
parts.push(`Site: ${link2.siteName}`);
|
|
145
|
+
}
|
|
146
|
+
return parts.join("\n");
|
|
147
|
+
}).join("\n\n");
|
|
148
|
+
textContent += `
|
|
149
|
+
|
|
150
|
+
Links:
|
|
151
|
+
${linkParts}`;
|
|
152
|
+
}
|
|
153
|
+
let aiMessage;
|
|
154
|
+
if (role === "user") {
|
|
155
|
+
const attachmentParts = [];
|
|
156
|
+
for (const att of msg.attachments) {
|
|
157
|
+
const part = await attachmentToPart(att);
|
|
158
|
+
if (part) {
|
|
159
|
+
attachmentParts.push(part);
|
|
160
|
+
} else if (att.type === "video" || att.type === "audio") {
|
|
161
|
+
onUnsupported(att, msg);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (attachmentParts.length > 0) {
|
|
165
|
+
aiMessage = {
|
|
166
|
+
role,
|
|
167
|
+
content: [
|
|
168
|
+
{ type: "text", text: textContent },
|
|
169
|
+
...attachmentParts
|
|
170
|
+
]
|
|
171
|
+
};
|
|
172
|
+
} else {
|
|
173
|
+
aiMessage = { role, content: textContent };
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
aiMessage = { role, content: textContent };
|
|
177
|
+
}
|
|
178
|
+
if (transformMessage) {
|
|
179
|
+
return { result: await transformMessage(aiMessage, msg), source: msg };
|
|
180
|
+
}
|
|
181
|
+
return { result: aiMessage, source: msg };
|
|
182
|
+
})
|
|
183
|
+
);
|
|
184
|
+
return results.filter(
|
|
185
|
+
(r) => r.result != null
|
|
186
|
+
).map((r) => r.result);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// src/channel.ts
|
|
190
|
+
import { WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE2, WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE2 } from "@workflow/serde";
|
|
191
|
+
|
|
192
|
+
// src/chat-singleton.ts
|
|
193
|
+
var _singleton = null;
|
|
194
|
+
function setChatSingleton(chat) {
|
|
195
|
+
_singleton = chat;
|
|
196
|
+
}
|
|
197
|
+
function getChatSingleton() {
|
|
198
|
+
if (!_singleton) {
|
|
199
|
+
throw new Error(
|
|
200
|
+
"No Chat singleton registered. Call chat.registerSingleton() first."
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
return _singleton;
|
|
204
|
+
}
|
|
205
|
+
function hasChatSingleton() {
|
|
206
|
+
return _singleton !== null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// src/from-full-stream.ts
|
|
210
|
+
var STREAM_CHUNK_TYPES = /* @__PURE__ */ new Set([
|
|
211
|
+
"markdown_text",
|
|
212
|
+
"task_update",
|
|
213
|
+
"plan_update"
|
|
214
|
+
]);
|
|
215
|
+
async function* fromFullStream(stream) {
|
|
216
|
+
let needsSeparator = false;
|
|
217
|
+
let hasEmittedText = false;
|
|
218
|
+
for await (const event of stream) {
|
|
219
|
+
if (typeof event === "string") {
|
|
220
|
+
yield event;
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (event === null || typeof event !== "object" || !("type" in event)) {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
const typed = event;
|
|
227
|
+
if (STREAM_CHUNK_TYPES.has(typed.type)) {
|
|
228
|
+
yield event;
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
const textContent = typed.text ?? typed.delta ?? typed.textDelta;
|
|
232
|
+
if (typed.type === "text-delta" && typeof textContent === "string") {
|
|
233
|
+
if (needsSeparator && hasEmittedText) {
|
|
234
|
+
yield "\n\n";
|
|
235
|
+
}
|
|
236
|
+
needsSeparator = false;
|
|
237
|
+
hasEmittedText = true;
|
|
238
|
+
yield textContent;
|
|
239
|
+
} else if (typed.type === "step-finish") {
|
|
240
|
+
needsSeparator = true;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// src/message.ts
|
|
246
|
+
import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE } from "@workflow/serde";
|
|
247
|
+
var Message = class _Message {
|
|
248
|
+
/** Unique message ID */
|
|
249
|
+
id;
|
|
250
|
+
/** Thread this message belongs to */
|
|
251
|
+
threadId;
|
|
252
|
+
/** Plain text content (all formatting stripped) */
|
|
253
|
+
text;
|
|
254
|
+
/**
|
|
255
|
+
* Structured formatting as an AST (mdast Root).
|
|
256
|
+
* This is the canonical representation - use this for processing.
|
|
257
|
+
* Use `stringifyMarkdown(message.formatted)` to get markdown string.
|
|
258
|
+
*/
|
|
259
|
+
formatted;
|
|
260
|
+
/** Platform-specific raw payload (escape hatch) */
|
|
261
|
+
raw;
|
|
262
|
+
/** Message author */
|
|
263
|
+
author;
|
|
264
|
+
/** Message metadata */
|
|
265
|
+
metadata;
|
|
266
|
+
/** Attachments */
|
|
267
|
+
attachments;
|
|
268
|
+
/**
|
|
269
|
+
* Whether the bot is @-mentioned in this message.
|
|
270
|
+
*
|
|
271
|
+
* This is set by the Chat SDK before passing the message to handlers.
|
|
272
|
+
* It checks for `@username` in the message text using the adapter's
|
|
273
|
+
* configured `userName` and optional `botUserId`.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* chat.onSubscribedMessage(async (thread, message) => {
|
|
278
|
+
* if (message.isMention) {
|
|
279
|
+
* await thread.post("You mentioned me!");
|
|
280
|
+
* }
|
|
281
|
+
* });
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
isMention;
|
|
285
|
+
/** Links found in the message */
|
|
286
|
+
links;
|
|
287
|
+
constructor(data) {
|
|
288
|
+
this.id = data.id;
|
|
289
|
+
this.threadId = data.threadId;
|
|
290
|
+
this.text = data.text;
|
|
291
|
+
this.formatted = data.formatted;
|
|
292
|
+
this.raw = data.raw;
|
|
293
|
+
this.author = data.author;
|
|
294
|
+
this.metadata = data.metadata;
|
|
295
|
+
this.attachments = data.attachments;
|
|
296
|
+
this.isMention = data.isMention;
|
|
297
|
+
this.links = data.links ?? [];
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Serialize the message to a plain JSON object.
|
|
301
|
+
* Use this to pass message data to external systems like workflow engines.
|
|
302
|
+
*
|
|
303
|
+
* Note: Attachment `data` (Buffer) and `fetchData` (function) are omitted
|
|
304
|
+
* as they're not serializable.
|
|
305
|
+
*/
|
|
306
|
+
toJSON() {
|
|
307
|
+
return {
|
|
308
|
+
_type: "chat:Message",
|
|
309
|
+
id: this.id,
|
|
310
|
+
threadId: this.threadId,
|
|
311
|
+
text: this.text,
|
|
312
|
+
formatted: this.formatted,
|
|
313
|
+
raw: this.raw,
|
|
314
|
+
author: {
|
|
315
|
+
userId: this.author.userId,
|
|
316
|
+
userName: this.author.userName,
|
|
317
|
+
fullName: this.author.fullName,
|
|
318
|
+
isBot: this.author.isBot,
|
|
319
|
+
isMe: this.author.isMe
|
|
320
|
+
},
|
|
321
|
+
metadata: {
|
|
322
|
+
dateSent: this.metadata.dateSent.toISOString(),
|
|
323
|
+
edited: this.metadata.edited,
|
|
324
|
+
editedAt: this.metadata.editedAt?.toISOString()
|
|
325
|
+
},
|
|
326
|
+
attachments: this.attachments.map((att) => ({
|
|
327
|
+
type: att.type,
|
|
328
|
+
url: att.url,
|
|
329
|
+
name: att.name,
|
|
330
|
+
mimeType: att.mimeType,
|
|
331
|
+
size: att.size,
|
|
332
|
+
width: att.width,
|
|
333
|
+
height: att.height
|
|
334
|
+
})),
|
|
335
|
+
isMention: this.isMention,
|
|
336
|
+
links: this.links.length > 0 ? this.links.map((link2) => ({
|
|
337
|
+
url: link2.url,
|
|
338
|
+
title: link2.title,
|
|
339
|
+
description: link2.description,
|
|
340
|
+
imageUrl: link2.imageUrl,
|
|
341
|
+
siteName: link2.siteName
|
|
342
|
+
})) : void 0
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Reconstruct a Message from serialized JSON data.
|
|
347
|
+
* Converts ISO date strings back to Date objects.
|
|
348
|
+
*/
|
|
349
|
+
static fromJSON(json) {
|
|
350
|
+
return new _Message({
|
|
351
|
+
id: json.id,
|
|
352
|
+
threadId: json.threadId,
|
|
353
|
+
text: json.text,
|
|
354
|
+
formatted: json.formatted,
|
|
355
|
+
raw: json.raw,
|
|
356
|
+
author: json.author,
|
|
357
|
+
metadata: {
|
|
358
|
+
dateSent: new Date(json.metadata.dateSent),
|
|
359
|
+
edited: json.metadata.edited,
|
|
360
|
+
editedAt: json.metadata.editedAt ? new Date(json.metadata.editedAt) : void 0
|
|
361
|
+
},
|
|
362
|
+
attachments: json.attachments,
|
|
363
|
+
isMention: json.isMention,
|
|
364
|
+
links: json.links
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Serialize a Message instance for @workflow/serde.
|
|
369
|
+
* This static method is automatically called by workflow serialization.
|
|
370
|
+
*/
|
|
371
|
+
static [WORKFLOW_SERIALIZE](instance) {
|
|
372
|
+
return instance.toJSON();
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Deserialize a Message from @workflow/serde.
|
|
376
|
+
* This static method is automatically called by workflow deserialization.
|
|
377
|
+
*/
|
|
378
|
+
static [WORKFLOW_DESERIALIZE](data) {
|
|
379
|
+
return _Message.fromJSON(data);
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// src/errors.ts
|
|
384
|
+
var ChatError = class extends Error {
|
|
385
|
+
code;
|
|
386
|
+
cause;
|
|
387
|
+
constructor(message, code, cause) {
|
|
388
|
+
super(message);
|
|
389
|
+
this.name = "ChatError";
|
|
390
|
+
this.code = code;
|
|
391
|
+
this.cause = cause;
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
var RateLimitError = class extends ChatError {
|
|
395
|
+
retryAfterMs;
|
|
396
|
+
constructor(message, retryAfterMs, cause) {
|
|
397
|
+
super(message, "RATE_LIMITED", cause);
|
|
398
|
+
this.name = "RateLimitError";
|
|
399
|
+
this.retryAfterMs = retryAfterMs;
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
var LockError = class extends ChatError {
|
|
403
|
+
constructor(message, cause) {
|
|
404
|
+
super(message, "LOCK_FAILED", cause);
|
|
405
|
+
this.name = "LockError";
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
var NotImplementedError = class extends ChatError {
|
|
409
|
+
feature;
|
|
410
|
+
constructor(message, feature, cause) {
|
|
411
|
+
super(message, "NOT_IMPLEMENTED", cause);
|
|
412
|
+
this.name = "NotImplementedError";
|
|
413
|
+
this.feature = feature;
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// src/logger.ts
|
|
418
|
+
var ConsoleLogger = class _ConsoleLogger {
|
|
419
|
+
prefix;
|
|
420
|
+
level;
|
|
421
|
+
constructor(level = "info", prefix = "chat-sdk") {
|
|
422
|
+
this.level = level;
|
|
423
|
+
this.prefix = prefix;
|
|
424
|
+
}
|
|
425
|
+
shouldLog(level) {
|
|
426
|
+
const levels = ["debug", "info", "warn", "error", "silent"];
|
|
427
|
+
return levels.indexOf(level) >= levels.indexOf(this.level);
|
|
428
|
+
}
|
|
429
|
+
child(prefix) {
|
|
430
|
+
return new _ConsoleLogger(this.level, `${this.prefix}:${prefix}`);
|
|
431
|
+
}
|
|
432
|
+
// eslint-disable-next-line no-console
|
|
433
|
+
debug(message, ...args) {
|
|
434
|
+
if (this.shouldLog("debug")) {
|
|
435
|
+
console.debug(`[${this.prefix}] ${message}`, ...args);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
// eslint-disable-next-line no-console
|
|
439
|
+
info(message, ...args) {
|
|
440
|
+
if (this.shouldLog("info")) {
|
|
441
|
+
console.info(`[${this.prefix}] ${message}`, ...args);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
// eslint-disable-next-line no-console
|
|
445
|
+
warn(message, ...args) {
|
|
446
|
+
if (this.shouldLog("warn")) {
|
|
447
|
+
console.warn(`[${this.prefix}] ${message}`, ...args);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
// eslint-disable-next-line no-console
|
|
451
|
+
error(message, ...args) {
|
|
452
|
+
if (this.shouldLog("error")) {
|
|
453
|
+
console.error(`[${this.prefix}] ${message}`, ...args);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
// src/types.ts
|
|
459
|
+
var THREAD_STATE_TTL_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
460
|
+
|
|
461
|
+
// src/channel.ts
|
|
462
|
+
var CHANNEL_STATE_KEY_PREFIX = "channel-state:";
|
|
463
|
+
function isLazyConfig(config) {
|
|
464
|
+
return "adapterName" in config && !("adapter" in config);
|
|
465
|
+
}
|
|
466
|
+
function isAsyncIterable(value) {
|
|
467
|
+
return value !== null && typeof value === "object" && Symbol.asyncIterator in value;
|
|
468
|
+
}
|
|
469
|
+
var ChannelImpl = class _ChannelImpl {
|
|
470
|
+
id;
|
|
471
|
+
isDM;
|
|
472
|
+
_adapter;
|
|
473
|
+
_adapterName;
|
|
474
|
+
_stateAdapterInstance;
|
|
475
|
+
_name = null;
|
|
476
|
+
_messageHistory;
|
|
477
|
+
constructor(config) {
|
|
478
|
+
this.id = config.id;
|
|
479
|
+
this.isDM = config.isDM ?? false;
|
|
480
|
+
if (isLazyConfig(config)) {
|
|
481
|
+
this._adapterName = config.adapterName;
|
|
482
|
+
} else {
|
|
483
|
+
this._adapter = config.adapter;
|
|
484
|
+
this._stateAdapterInstance = config.stateAdapter;
|
|
485
|
+
this._messageHistory = config.messageHistory;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
get adapter() {
|
|
489
|
+
if (this._adapter) {
|
|
490
|
+
return this._adapter;
|
|
491
|
+
}
|
|
492
|
+
if (!this._adapterName) {
|
|
493
|
+
throw new Error("Channel has no adapter configured");
|
|
494
|
+
}
|
|
495
|
+
const chat = getChatSingleton();
|
|
496
|
+
const adapter = chat.getAdapter(this._adapterName);
|
|
497
|
+
if (!adapter) {
|
|
498
|
+
throw new Error(
|
|
499
|
+
`Adapter "${this._adapterName}" not found in Chat singleton`
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
this._adapter = adapter;
|
|
503
|
+
return adapter;
|
|
504
|
+
}
|
|
505
|
+
get _stateAdapter() {
|
|
506
|
+
if (this._stateAdapterInstance) {
|
|
507
|
+
return this._stateAdapterInstance;
|
|
508
|
+
}
|
|
509
|
+
const chat = getChatSingleton();
|
|
510
|
+
this._stateAdapterInstance = chat.getState();
|
|
511
|
+
return this._stateAdapterInstance;
|
|
512
|
+
}
|
|
513
|
+
get name() {
|
|
514
|
+
return this._name;
|
|
515
|
+
}
|
|
516
|
+
get state() {
|
|
517
|
+
return this._stateAdapter.get(
|
|
518
|
+
`${CHANNEL_STATE_KEY_PREFIX}${this.id}`
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
async setState(newState, options) {
|
|
522
|
+
const key = `${CHANNEL_STATE_KEY_PREFIX}${this.id}`;
|
|
523
|
+
if (options?.replace) {
|
|
524
|
+
await this._stateAdapter.set(key, newState, THREAD_STATE_TTL_MS);
|
|
525
|
+
} else {
|
|
526
|
+
const existing = await this._stateAdapter.get(key);
|
|
527
|
+
const merged = { ...existing, ...newState };
|
|
528
|
+
await this._stateAdapter.set(key, merged, THREAD_STATE_TTL_MS);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Iterate messages newest first (backward from most recent).
|
|
533
|
+
* Uses adapter.fetchChannelMessages if available, otherwise falls back
|
|
534
|
+
* to adapter.fetchMessages with the channel ID.
|
|
535
|
+
*/
|
|
536
|
+
get messages() {
|
|
537
|
+
const adapter = this.adapter;
|
|
538
|
+
const channelId = this.id;
|
|
539
|
+
const messageHistory = this._messageHistory;
|
|
540
|
+
return {
|
|
541
|
+
async *[Symbol.asyncIterator]() {
|
|
542
|
+
let cursor;
|
|
543
|
+
let yieldedAny = false;
|
|
544
|
+
while (true) {
|
|
545
|
+
const fetchOptions = { cursor, direction: "backward" };
|
|
546
|
+
const result = adapter.fetchChannelMessages ? await adapter.fetchChannelMessages(channelId, fetchOptions) : await adapter.fetchMessages(channelId, fetchOptions);
|
|
547
|
+
const reversed = [...result.messages].reverse();
|
|
548
|
+
for (const message of reversed) {
|
|
549
|
+
yieldedAny = true;
|
|
550
|
+
yield message;
|
|
551
|
+
}
|
|
552
|
+
if (!result.nextCursor || result.messages.length === 0) {
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
cursor = result.nextCursor;
|
|
556
|
+
}
|
|
557
|
+
if (!yieldedAny && messageHistory) {
|
|
558
|
+
const cached = await messageHistory.getMessages(channelId);
|
|
559
|
+
for (let i = cached.length - 1; i >= 0; i--) {
|
|
560
|
+
yield cached[i];
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Iterate threads in this channel, most recently active first.
|
|
568
|
+
*/
|
|
569
|
+
threads() {
|
|
570
|
+
const adapter = this.adapter;
|
|
571
|
+
const channelId = this.id;
|
|
572
|
+
return {
|
|
573
|
+
async *[Symbol.asyncIterator]() {
|
|
574
|
+
if (!adapter.listThreads) {
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
let cursor;
|
|
578
|
+
while (true) {
|
|
579
|
+
const result = await adapter.listThreads(channelId, {
|
|
580
|
+
cursor
|
|
581
|
+
});
|
|
582
|
+
for (const thread of result.threads) {
|
|
583
|
+
yield thread;
|
|
584
|
+
}
|
|
585
|
+
if (!result.nextCursor || result.threads.length === 0) {
|
|
586
|
+
break;
|
|
587
|
+
}
|
|
588
|
+
cursor = result.nextCursor;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
async fetchMetadata() {
|
|
594
|
+
if (this.adapter.fetchChannelInfo) {
|
|
595
|
+
const info = await this.adapter.fetchChannelInfo(this.id);
|
|
596
|
+
this._name = info.name ?? null;
|
|
597
|
+
return info;
|
|
598
|
+
}
|
|
599
|
+
return {
|
|
600
|
+
id: this.id,
|
|
601
|
+
isDM: this.isDM,
|
|
602
|
+
metadata: {}
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
async post(message) {
|
|
606
|
+
if (isAsyncIterable(message)) {
|
|
607
|
+
let accumulated = "";
|
|
608
|
+
for await (const chunk of fromFullStream(message)) {
|
|
609
|
+
if (typeof chunk === "string") {
|
|
610
|
+
accumulated += chunk;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
return this.postSingleMessage({ markdown: accumulated });
|
|
614
|
+
}
|
|
615
|
+
let postable = message;
|
|
616
|
+
if (isJSX(message)) {
|
|
617
|
+
const card = toCardElement(message);
|
|
618
|
+
if (!card) {
|
|
619
|
+
throw new Error("Invalid JSX element: must be a Card element");
|
|
620
|
+
}
|
|
621
|
+
postable = card;
|
|
622
|
+
}
|
|
623
|
+
return this.postSingleMessage(postable);
|
|
624
|
+
}
|
|
625
|
+
async postSingleMessage(postable) {
|
|
626
|
+
const rawMessage = this.adapter.postChannelMessage ? await this.adapter.postChannelMessage(this.id, postable) : await this.adapter.postMessage(this.id, postable);
|
|
627
|
+
const sent = this.createSentMessage(
|
|
628
|
+
rawMessage.id,
|
|
629
|
+
postable,
|
|
630
|
+
rawMessage.threadId
|
|
631
|
+
);
|
|
632
|
+
if (this._messageHistory) {
|
|
633
|
+
await this._messageHistory.append(this.id, new Message(sent));
|
|
634
|
+
}
|
|
635
|
+
return sent;
|
|
636
|
+
}
|
|
637
|
+
async postEphemeral(user, message, options) {
|
|
638
|
+
const { fallbackToDM } = options;
|
|
639
|
+
const userId = typeof user === "string" ? user : user.userId;
|
|
640
|
+
let postable;
|
|
641
|
+
if (isJSX(message)) {
|
|
642
|
+
const card = toCardElement(message);
|
|
643
|
+
if (!card) {
|
|
644
|
+
throw new Error("Invalid JSX element: must be a Card element");
|
|
645
|
+
}
|
|
646
|
+
postable = card;
|
|
647
|
+
} else {
|
|
648
|
+
postable = message;
|
|
649
|
+
}
|
|
650
|
+
if (this.adapter.postEphemeral) {
|
|
651
|
+
return this.adapter.postEphemeral(this.id, userId, postable);
|
|
652
|
+
}
|
|
653
|
+
if (!fallbackToDM) {
|
|
654
|
+
return null;
|
|
655
|
+
}
|
|
656
|
+
if (this.adapter.openDM) {
|
|
657
|
+
const dmThreadId = await this.adapter.openDM(userId);
|
|
658
|
+
const result = await this.adapter.postMessage(dmThreadId, postable);
|
|
659
|
+
return {
|
|
660
|
+
id: result.id,
|
|
661
|
+
threadId: dmThreadId,
|
|
662
|
+
usedFallback: true,
|
|
663
|
+
raw: result.raw
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
668
|
+
async schedule(message, options) {
|
|
669
|
+
let postable;
|
|
670
|
+
if (isJSX(message)) {
|
|
671
|
+
const card = toCardElement(message);
|
|
672
|
+
if (!card) {
|
|
673
|
+
throw new Error("Invalid JSX element: must be a Card element");
|
|
674
|
+
}
|
|
675
|
+
postable = card;
|
|
676
|
+
} else {
|
|
677
|
+
postable = message;
|
|
678
|
+
}
|
|
679
|
+
if (!this.adapter.scheduleMessage) {
|
|
680
|
+
throw new NotImplementedError(
|
|
681
|
+
"Scheduled messages are not supported by this adapter",
|
|
682
|
+
"scheduling"
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
return this.adapter.scheduleMessage(this.id, postable, options);
|
|
686
|
+
}
|
|
687
|
+
async startTyping(status) {
|
|
688
|
+
await this.adapter.startTyping(this.id, status);
|
|
689
|
+
}
|
|
690
|
+
mentionUser(userId) {
|
|
691
|
+
return `<@${userId}>`;
|
|
692
|
+
}
|
|
693
|
+
toJSON() {
|
|
694
|
+
return {
|
|
695
|
+
_type: "chat:Channel",
|
|
696
|
+
id: this.id,
|
|
697
|
+
adapterName: this.adapter.name,
|
|
698
|
+
isDM: this.isDM
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
static fromJSON(json, adapter) {
|
|
702
|
+
const channel = new _ChannelImpl({
|
|
703
|
+
id: json.id,
|
|
704
|
+
adapterName: json.adapterName,
|
|
705
|
+
isDM: json.isDM
|
|
706
|
+
});
|
|
707
|
+
if (adapter) {
|
|
708
|
+
channel._adapter = adapter;
|
|
709
|
+
}
|
|
710
|
+
return channel;
|
|
711
|
+
}
|
|
712
|
+
static [WORKFLOW_SERIALIZE2](instance) {
|
|
713
|
+
return instance.toJSON();
|
|
714
|
+
}
|
|
715
|
+
static [WORKFLOW_DESERIALIZE2](data) {
|
|
716
|
+
return _ChannelImpl.fromJSON(data);
|
|
717
|
+
}
|
|
718
|
+
createSentMessage(messageId, postable, threadIdOverride) {
|
|
719
|
+
const adapter = this.adapter;
|
|
720
|
+
const threadId = threadIdOverride || this.id;
|
|
721
|
+
const self = this;
|
|
722
|
+
const { plainText, formatted, attachments } = extractMessageContent(postable);
|
|
723
|
+
const sentMessage = {
|
|
724
|
+
id: messageId,
|
|
725
|
+
threadId,
|
|
726
|
+
text: plainText,
|
|
727
|
+
formatted,
|
|
728
|
+
raw: null,
|
|
729
|
+
author: {
|
|
730
|
+
userId: "self",
|
|
731
|
+
userName: adapter.userName,
|
|
732
|
+
fullName: adapter.userName,
|
|
733
|
+
isBot: true,
|
|
734
|
+
isMe: true
|
|
735
|
+
},
|
|
736
|
+
metadata: {
|
|
737
|
+
dateSent: /* @__PURE__ */ new Date(),
|
|
738
|
+
edited: false
|
|
739
|
+
},
|
|
740
|
+
attachments,
|
|
741
|
+
links: [],
|
|
742
|
+
toJSON() {
|
|
743
|
+
return new Message(this).toJSON();
|
|
744
|
+
},
|
|
745
|
+
async edit(newContent) {
|
|
746
|
+
let editPostable = newContent;
|
|
747
|
+
if (isJSX(newContent)) {
|
|
748
|
+
const card = toCardElement(newContent);
|
|
749
|
+
if (!card) {
|
|
750
|
+
throw new Error("Invalid JSX element: must be a Card element");
|
|
751
|
+
}
|
|
752
|
+
editPostable = card;
|
|
753
|
+
}
|
|
754
|
+
await adapter.editMessage(threadId, messageId, editPostable);
|
|
755
|
+
return self.createSentMessage(messageId, editPostable);
|
|
756
|
+
},
|
|
757
|
+
async delete() {
|
|
758
|
+
await adapter.deleteMessage(threadId, messageId);
|
|
759
|
+
},
|
|
760
|
+
async addReaction(emoji2) {
|
|
761
|
+
await adapter.addReaction(threadId, messageId, emoji2);
|
|
762
|
+
},
|
|
763
|
+
async removeReaction(emoji2) {
|
|
764
|
+
await adapter.removeReaction(threadId, messageId, emoji2);
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
return sentMessage;
|
|
768
|
+
}
|
|
769
|
+
};
|
|
770
|
+
function deriveChannelId(adapter, threadId) {
|
|
771
|
+
return adapter.channelIdFromThreadId(threadId);
|
|
772
|
+
}
|
|
773
|
+
function extractMessageContent(message) {
|
|
774
|
+
if (typeof message === "string") {
|
|
775
|
+
return {
|
|
776
|
+
plainText: message,
|
|
777
|
+
formatted: root([paragraph([text(message)])]),
|
|
778
|
+
attachments: []
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
if ("raw" in message) {
|
|
782
|
+
return {
|
|
783
|
+
plainText: message.raw,
|
|
784
|
+
formatted: root([paragraph([text(message.raw)])]),
|
|
785
|
+
attachments: message.attachments || []
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
if ("markdown" in message) {
|
|
789
|
+
const ast = parseMarkdown(message.markdown);
|
|
790
|
+
return {
|
|
791
|
+
plainText: toPlainText(ast),
|
|
792
|
+
formatted: ast,
|
|
793
|
+
attachments: message.attachments || []
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
if ("ast" in message) {
|
|
797
|
+
return {
|
|
798
|
+
plainText: toPlainText(message.ast),
|
|
799
|
+
formatted: message.ast,
|
|
800
|
+
attachments: message.attachments || []
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
if ("card" in message) {
|
|
804
|
+
const fallbackText = message.fallbackText || cardToFallbackText(message.card);
|
|
805
|
+
return {
|
|
806
|
+
plainText: fallbackText,
|
|
807
|
+
formatted: root([paragraph([text(fallbackText)])]),
|
|
808
|
+
attachments: []
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
if ("type" in message && message.type === "card") {
|
|
812
|
+
const fallbackText = cardToFallbackText(message);
|
|
813
|
+
return {
|
|
814
|
+
plainText: fallbackText,
|
|
815
|
+
formatted: root([paragraph([text(fallbackText)])]),
|
|
816
|
+
attachments: []
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
throw new Error("Invalid PostableMessage format");
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
// src/message-history.ts
|
|
823
|
+
var DEFAULT_MAX_MESSAGES = 100;
|
|
824
|
+
var DEFAULT_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
825
|
+
var KEY_PREFIX = "msg-history:";
|
|
826
|
+
var MessageHistoryCache = class {
|
|
827
|
+
state;
|
|
828
|
+
maxMessages;
|
|
829
|
+
ttlMs;
|
|
830
|
+
constructor(state, config) {
|
|
831
|
+
this.state = state;
|
|
832
|
+
this.maxMessages = config?.maxMessages ?? DEFAULT_MAX_MESSAGES;
|
|
833
|
+
this.ttlMs = config?.ttlMs ?? DEFAULT_TTL_MS;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* Atomically append a message to the history for a thread.
|
|
837
|
+
* Trims to maxMessages (keeps newest) and refreshes TTL.
|
|
838
|
+
*/
|
|
839
|
+
async append(threadId, message) {
|
|
840
|
+
const key = `${KEY_PREFIX}${threadId}`;
|
|
841
|
+
const serialized = message.toJSON();
|
|
842
|
+
serialized.raw = null;
|
|
843
|
+
await this.state.appendToList(key, serialized, {
|
|
844
|
+
maxLength: this.maxMessages,
|
|
845
|
+
ttlMs: this.ttlMs
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Get messages for a thread in chronological order (oldest first).
|
|
850
|
+
*
|
|
851
|
+
* @param threadId - The thread ID
|
|
852
|
+
* @param limit - Optional limit on number of messages to return (returns newest N)
|
|
853
|
+
*/
|
|
854
|
+
async getMessages(threadId, limit) {
|
|
855
|
+
const key = `${KEY_PREFIX}${threadId}`;
|
|
856
|
+
const stored = await this.state.getList(key);
|
|
857
|
+
const sliced = limit && stored.length > limit ? stored.slice(stored.length - limit) : stored;
|
|
858
|
+
return sliced.map((s) => Message.fromJSON(s));
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
// src/thread.ts
|
|
863
|
+
import { WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3, WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3 } from "@workflow/serde";
|
|
864
|
+
|
|
865
|
+
// src/streaming-markdown.ts
|
|
866
|
+
import remend from "remend";
|
|
867
|
+
var StreamingMarkdownRenderer = class {
|
|
868
|
+
accumulated = "";
|
|
869
|
+
dirty = true;
|
|
870
|
+
cachedRender = "";
|
|
871
|
+
finished = false;
|
|
872
|
+
/** Number of code fence toggles from completed lines (odd = inside). */
|
|
873
|
+
fenceToggles = 0;
|
|
874
|
+
/** Incomplete trailing line buffer for incremental fence tracking. */
|
|
875
|
+
incompleteLine = "";
|
|
876
|
+
/** Append a chunk from the LLM stream. */
|
|
877
|
+
push(chunk) {
|
|
878
|
+
this.accumulated += chunk;
|
|
879
|
+
this.dirty = true;
|
|
880
|
+
this.incompleteLine += chunk;
|
|
881
|
+
const parts = this.incompleteLine.split("\n");
|
|
882
|
+
this.incompleteLine = parts.pop() ?? "";
|
|
883
|
+
for (const line of parts) {
|
|
884
|
+
const trimmed = line.trimStart();
|
|
885
|
+
if (trimmed.startsWith("```") || trimmed.startsWith("~~~")) {
|
|
886
|
+
this.fenceToggles++;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
/** O(1) check if accumulated text is inside an unclosed code fence. */
|
|
891
|
+
isAccumulatedInsideFence() {
|
|
892
|
+
let inside = this.fenceToggles % 2 === 1;
|
|
893
|
+
const trimmed = this.incompleteLine.trimStart();
|
|
894
|
+
if (trimmed.startsWith("```") || trimmed.startsWith("~~~")) {
|
|
895
|
+
inside = !inside;
|
|
896
|
+
}
|
|
897
|
+
return inside;
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Get renderable markdown for an intermediate edit.
|
|
901
|
+
* - Holds back trailing lines that look like a table header (|...|)
|
|
902
|
+
* until a separator line (|---|---|) confirms or the next line denies.
|
|
903
|
+
* - Applies remend() to close incomplete inline markers.
|
|
904
|
+
* - Idempotent: returns cached result if no push() since last call.
|
|
905
|
+
*/
|
|
906
|
+
render() {
|
|
907
|
+
if (!this.dirty) {
|
|
908
|
+
return this.cachedRender;
|
|
909
|
+
}
|
|
910
|
+
this.dirty = false;
|
|
911
|
+
if (this.finished) {
|
|
912
|
+
this.cachedRender = remend(this.accumulated);
|
|
913
|
+
return this.cachedRender;
|
|
914
|
+
}
|
|
915
|
+
if (this.isAccumulatedInsideFence()) {
|
|
916
|
+
this.cachedRender = remend(this.accumulated);
|
|
917
|
+
return this.cachedRender;
|
|
918
|
+
}
|
|
919
|
+
const committable = getCommittablePrefix(this.accumulated);
|
|
920
|
+
this.cachedRender = remend(committable);
|
|
921
|
+
return this.cachedRender;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Get text safe for append-only streaming (e.g. Slack native streaming).
|
|
925
|
+
*
|
|
926
|
+
* - Holds back unconfirmed table headers until separator arrives.
|
|
927
|
+
* - Wraps confirmed tables in code fences so pipes render as literal
|
|
928
|
+
* text (not broken mrkdwn). The code fence is left OPEN while
|
|
929
|
+
* the table is still streaming, keeping output monotonic for deltas.
|
|
930
|
+
* - Holds back unclosed inline markers (**, *, ~~, `, [).
|
|
931
|
+
* - The final editMessage replaces everything with properly formatted text.
|
|
932
|
+
*/
|
|
933
|
+
getCommittableText() {
|
|
934
|
+
if (this.finished) {
|
|
935
|
+
return wrapTablesForAppend(this.accumulated, true);
|
|
936
|
+
}
|
|
937
|
+
let text2 = this.accumulated;
|
|
938
|
+
if (text2.length > 0 && !text2.endsWith("\n")) {
|
|
939
|
+
const lastNewline = text2.lastIndexOf("\n");
|
|
940
|
+
const withoutIncompleteLine = lastNewline >= 0 ? text2.slice(0, lastNewline + 1) : "";
|
|
941
|
+
if (isInsideCodeFence(withoutIncompleteLine)) {
|
|
942
|
+
return wrapTablesForAppend(text2);
|
|
943
|
+
}
|
|
944
|
+
text2 = withoutIncompleteLine;
|
|
945
|
+
}
|
|
946
|
+
if (isInsideCodeFence(text2)) {
|
|
947
|
+
return wrapTablesForAppend(text2);
|
|
948
|
+
}
|
|
949
|
+
const committed = getCommittablePrefix(text2);
|
|
950
|
+
const wrapped = wrapTablesForAppend(committed);
|
|
951
|
+
if (isInsideCodeFence(wrapped)) {
|
|
952
|
+
return wrapped;
|
|
953
|
+
}
|
|
954
|
+
return findCleanPrefix(wrapped);
|
|
955
|
+
}
|
|
956
|
+
/** Raw accumulated text (no remend, no buffering). For the final edit. */
|
|
957
|
+
getText() {
|
|
958
|
+
return this.accumulated;
|
|
959
|
+
}
|
|
960
|
+
/** Signal stream end. Flushes held-back lines. Returns final render. */
|
|
961
|
+
finish() {
|
|
962
|
+
this.finished = true;
|
|
963
|
+
this.dirty = true;
|
|
964
|
+
return this.render();
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
var INLINE_MARKER_CHARS = /* @__PURE__ */ new Set(["*", "~", "`", "["]);
|
|
968
|
+
function isClean(text2) {
|
|
969
|
+
return remend(text2).length <= text2.length;
|
|
970
|
+
}
|
|
971
|
+
function findCleanPrefix(text2) {
|
|
972
|
+
if (text2.length === 0 || isClean(text2)) {
|
|
973
|
+
return text2;
|
|
974
|
+
}
|
|
975
|
+
for (let i = text2.length - 1; i >= 0; i--) {
|
|
976
|
+
if (INLINE_MARKER_CHARS.has(text2[i])) {
|
|
977
|
+
while (i > 0 && text2[i - 1] === text2[i]) {
|
|
978
|
+
i--;
|
|
979
|
+
}
|
|
980
|
+
const candidate = text2.slice(0, i);
|
|
981
|
+
if (isClean(candidate)) {
|
|
982
|
+
return candidate;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
return "";
|
|
987
|
+
}
|
|
988
|
+
var TABLE_ROW_RE = /^\|.*\|$/;
|
|
989
|
+
var TABLE_SEPARATOR_RE = /^\|[\s:]*-{1,}[\s:]*(\|[\s:]*-{1,}[\s:]*)*\|$/;
|
|
990
|
+
function isInsideCodeFence(text2) {
|
|
991
|
+
let inside = false;
|
|
992
|
+
for (const line of text2.split("\n")) {
|
|
993
|
+
const trimmed = line.trimStart();
|
|
994
|
+
if (trimmed.startsWith("```") || trimmed.startsWith("~~~")) {
|
|
995
|
+
inside = !inside;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return inside;
|
|
999
|
+
}
|
|
1000
|
+
function getCommittablePrefix(text2) {
|
|
1001
|
+
const endsWithNewline = text2.endsWith("\n");
|
|
1002
|
+
const lines = text2.split("\n");
|
|
1003
|
+
if (!endsWithNewline && lines.length > 0) {
|
|
1004
|
+
lines.pop();
|
|
1005
|
+
}
|
|
1006
|
+
if (endsWithNewline && lines.length > 0 && lines.at(-1) === "") {
|
|
1007
|
+
lines.pop();
|
|
1008
|
+
}
|
|
1009
|
+
let heldCount = 0;
|
|
1010
|
+
let separatorFound = false;
|
|
1011
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
1012
|
+
const trimmed = lines[i].trim();
|
|
1013
|
+
if (trimmed === "") {
|
|
1014
|
+
break;
|
|
1015
|
+
}
|
|
1016
|
+
if (TABLE_SEPARATOR_RE.test(trimmed)) {
|
|
1017
|
+
separatorFound = true;
|
|
1018
|
+
break;
|
|
1019
|
+
}
|
|
1020
|
+
if (TABLE_ROW_RE.test(trimmed)) {
|
|
1021
|
+
heldCount++;
|
|
1022
|
+
} else {
|
|
1023
|
+
break;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
if (separatorFound || heldCount === 0) {
|
|
1027
|
+
return text2;
|
|
1028
|
+
}
|
|
1029
|
+
const commitLineCount = lines.length - heldCount;
|
|
1030
|
+
const committedLines = lines.slice(0, commitLineCount);
|
|
1031
|
+
let result = committedLines.join("\n");
|
|
1032
|
+
if (committedLines.length > 0) {
|
|
1033
|
+
result += "\n";
|
|
1034
|
+
}
|
|
1035
|
+
return result;
|
|
1036
|
+
}
|
|
1037
|
+
function wrapTablesForAppend(text2, closeFences = false) {
|
|
1038
|
+
const hadTrailingNewline = text2.endsWith("\n");
|
|
1039
|
+
const lines = text2.split("\n");
|
|
1040
|
+
if (hadTrailingNewline && lines.length > 0 && lines.at(-1) === "") {
|
|
1041
|
+
lines.pop();
|
|
1042
|
+
}
|
|
1043
|
+
const result = [];
|
|
1044
|
+
let inTable = false;
|
|
1045
|
+
let inUserCodeFence = false;
|
|
1046
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1047
|
+
const trimmed = lines[i].trim();
|
|
1048
|
+
if (!inTable && (trimmed.startsWith("```") || trimmed.startsWith("~~~"))) {
|
|
1049
|
+
inUserCodeFence = !inUserCodeFence;
|
|
1050
|
+
result.push(lines[i]);
|
|
1051
|
+
continue;
|
|
1052
|
+
}
|
|
1053
|
+
if (inUserCodeFence) {
|
|
1054
|
+
result.push(lines[i]);
|
|
1055
|
+
continue;
|
|
1056
|
+
}
|
|
1057
|
+
const isTableLine = trimmed !== "" && (TABLE_ROW_RE.test(trimmed) || TABLE_SEPARATOR_RE.test(trimmed));
|
|
1058
|
+
if (isTableLine && !inTable) {
|
|
1059
|
+
let hasSeparator = false;
|
|
1060
|
+
for (let j = i; j < lines.length; j++) {
|
|
1061
|
+
const t = lines[j].trim();
|
|
1062
|
+
if (TABLE_SEPARATOR_RE.test(t)) {
|
|
1063
|
+
hasSeparator = true;
|
|
1064
|
+
break;
|
|
1065
|
+
}
|
|
1066
|
+
if (t === "" || !TABLE_ROW_RE.test(t)) {
|
|
1067
|
+
break;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
if (hasSeparator) {
|
|
1071
|
+
result.push("```");
|
|
1072
|
+
inTable = true;
|
|
1073
|
+
}
|
|
1074
|
+
} else if (!isTableLine && inTable) {
|
|
1075
|
+
result.push("```");
|
|
1076
|
+
inTable = false;
|
|
1077
|
+
}
|
|
1078
|
+
result.push(lines[i]);
|
|
1079
|
+
}
|
|
1080
|
+
if (inTable && closeFences) {
|
|
1081
|
+
result.push("```");
|
|
1082
|
+
}
|
|
1083
|
+
let output = result.join("\n");
|
|
1084
|
+
if (hadTrailingNewline) {
|
|
1085
|
+
output += "\n";
|
|
1086
|
+
}
|
|
1087
|
+
return output;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
// src/thread.ts
|
|
1091
|
+
function isLazyConfig2(config) {
|
|
1092
|
+
return "adapterName" in config && !("adapter" in config);
|
|
1093
|
+
}
|
|
1094
|
+
var THREAD_STATE_KEY_PREFIX = "thread-state:";
|
|
1095
|
+
function isAsyncIterable2(value) {
|
|
1096
|
+
return value !== null && typeof value === "object" && Symbol.asyncIterator in value;
|
|
1097
|
+
}
|
|
1098
|
+
var ThreadImpl = class _ThreadImpl {
|
|
1099
|
+
id;
|
|
1100
|
+
channelId;
|
|
1101
|
+
isDM;
|
|
1102
|
+
/** Direct adapter instance (if provided) */
|
|
1103
|
+
_adapter;
|
|
1104
|
+
/** Adapter name for lazy resolution */
|
|
1105
|
+
_adapterName;
|
|
1106
|
+
/** Direct state adapter instance (if provided) */
|
|
1107
|
+
_stateAdapterInstance;
|
|
1108
|
+
_recentMessages = [];
|
|
1109
|
+
_isSubscribedContext;
|
|
1110
|
+
/** Current message context for streaming - provides userId/teamId */
|
|
1111
|
+
_currentMessage;
|
|
1112
|
+
/** Update interval for fallback streaming */
|
|
1113
|
+
_streamingUpdateIntervalMs;
|
|
1114
|
+
/** Placeholder text for fallback streaming (post + edit) */
|
|
1115
|
+
_fallbackStreamingPlaceholderText;
|
|
1116
|
+
/** Cached channel instance */
|
|
1117
|
+
_channel;
|
|
1118
|
+
/** Message history cache (set only for adapters with persistMessageHistory) */
|
|
1119
|
+
_messageHistory;
|
|
1120
|
+
_logger;
|
|
1121
|
+
constructor(config) {
|
|
1122
|
+
this.id = config.id;
|
|
1123
|
+
this.channelId = config.channelId;
|
|
1124
|
+
this.isDM = config.isDM ?? false;
|
|
1125
|
+
this._isSubscribedContext = config.isSubscribedContext ?? false;
|
|
1126
|
+
this._currentMessage = config.currentMessage;
|
|
1127
|
+
this._logger = config.logger;
|
|
1128
|
+
this._streamingUpdateIntervalMs = config.streamingUpdateIntervalMs ?? 500;
|
|
1129
|
+
this._fallbackStreamingPlaceholderText = config.fallbackStreamingPlaceholderText !== void 0 ? config.fallbackStreamingPlaceholderText : "...";
|
|
1130
|
+
if (isLazyConfig2(config)) {
|
|
1131
|
+
this._adapterName = config.adapterName;
|
|
1132
|
+
} else {
|
|
1133
|
+
this._adapter = config.adapter;
|
|
1134
|
+
this._stateAdapterInstance = config.stateAdapter;
|
|
1135
|
+
this._messageHistory = config.messageHistory;
|
|
1136
|
+
}
|
|
1137
|
+
if (config.initialMessage) {
|
|
1138
|
+
this._recentMessages = [config.initialMessage];
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Get the adapter for this thread.
|
|
1143
|
+
* If created with lazy config, resolves from Chat singleton on first access.
|
|
1144
|
+
*/
|
|
1145
|
+
get adapter() {
|
|
1146
|
+
if (this._adapter) {
|
|
1147
|
+
return this._adapter;
|
|
1148
|
+
}
|
|
1149
|
+
if (!this._adapterName) {
|
|
1150
|
+
throw new Error("Thread has no adapter configured");
|
|
1151
|
+
}
|
|
1152
|
+
const chat = getChatSingleton();
|
|
1153
|
+
const adapter = chat.getAdapter(this._adapterName);
|
|
1154
|
+
if (!adapter) {
|
|
1155
|
+
throw new Error(
|
|
1156
|
+
`Adapter "${this._adapterName}" not found in Chat singleton`
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
|
+
this._adapter = adapter;
|
|
1160
|
+
return adapter;
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Get the state adapter for this thread.
|
|
1164
|
+
* If created with lazy config, resolves from Chat singleton on first access.
|
|
1165
|
+
*/
|
|
1166
|
+
get _stateAdapter() {
|
|
1167
|
+
if (this._stateAdapterInstance) {
|
|
1168
|
+
return this._stateAdapterInstance;
|
|
1169
|
+
}
|
|
1170
|
+
const chat = getChatSingleton();
|
|
1171
|
+
this._stateAdapterInstance = chat.getState();
|
|
1172
|
+
return this._stateAdapterInstance;
|
|
1173
|
+
}
|
|
1174
|
+
get recentMessages() {
|
|
1175
|
+
return this._recentMessages;
|
|
1176
|
+
}
|
|
1177
|
+
set recentMessages(messages) {
|
|
1178
|
+
this._recentMessages = messages;
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Get the current thread state.
|
|
1182
|
+
* Returns null if no state has been set.
|
|
1183
|
+
*/
|
|
1184
|
+
get state() {
|
|
1185
|
+
return this._stateAdapter.get(
|
|
1186
|
+
`${THREAD_STATE_KEY_PREFIX}${this.id}`
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Set the thread state. Merges with existing state by default.
|
|
1191
|
+
* State is persisted for 30 days.
|
|
1192
|
+
*/
|
|
1193
|
+
async setState(newState, options) {
|
|
1194
|
+
const key = `${THREAD_STATE_KEY_PREFIX}${this.id}`;
|
|
1195
|
+
if (options?.replace) {
|
|
1196
|
+
await this._stateAdapter.set(key, newState, THREAD_STATE_TTL_MS);
|
|
1197
|
+
} else {
|
|
1198
|
+
const existing = await this._stateAdapter.get(key);
|
|
1199
|
+
const merged = { ...existing, ...newState };
|
|
1200
|
+
await this._stateAdapter.set(key, merged, THREAD_STATE_TTL_MS);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Get the Channel containing this thread.
|
|
1205
|
+
* Lazy-created and cached.
|
|
1206
|
+
*/
|
|
1207
|
+
get channel() {
|
|
1208
|
+
if (!this._channel) {
|
|
1209
|
+
const channelId = deriveChannelId(this.adapter, this.id);
|
|
1210
|
+
this._channel = new ChannelImpl({
|
|
1211
|
+
id: channelId,
|
|
1212
|
+
adapter: this.adapter,
|
|
1213
|
+
stateAdapter: this._stateAdapter,
|
|
1214
|
+
isDM: this.isDM,
|
|
1215
|
+
messageHistory: this._messageHistory
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
return this._channel;
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Iterate messages newest first (backward from most recent).
|
|
1222
|
+
* Auto-paginates lazily.
|
|
1223
|
+
*/
|
|
1224
|
+
get messages() {
|
|
1225
|
+
const adapter = this.adapter;
|
|
1226
|
+
const threadId = this.id;
|
|
1227
|
+
const messageHistory = this._messageHistory;
|
|
1228
|
+
return {
|
|
1229
|
+
async *[Symbol.asyncIterator]() {
|
|
1230
|
+
let cursor;
|
|
1231
|
+
let yieldedAny = false;
|
|
1232
|
+
while (true) {
|
|
1233
|
+
const result = await adapter.fetchMessages(threadId, {
|
|
1234
|
+
cursor,
|
|
1235
|
+
direction: "backward"
|
|
1236
|
+
});
|
|
1237
|
+
const reversed = [...result.messages].reverse();
|
|
1238
|
+
for (const message of reversed) {
|
|
1239
|
+
yieldedAny = true;
|
|
1240
|
+
yield message;
|
|
1241
|
+
}
|
|
1242
|
+
if (!result.nextCursor || result.messages.length === 0) {
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
cursor = result.nextCursor;
|
|
1246
|
+
}
|
|
1247
|
+
if (!yieldedAny && messageHistory) {
|
|
1248
|
+
const cached = await messageHistory.getMessages(threadId);
|
|
1249
|
+
for (let i = cached.length - 1; i >= 0; i--) {
|
|
1250
|
+
yield cached[i];
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
get allMessages() {
|
|
1257
|
+
const adapter = this.adapter;
|
|
1258
|
+
const threadId = this.id;
|
|
1259
|
+
const messageHistory = this._messageHistory;
|
|
1260
|
+
return {
|
|
1261
|
+
async *[Symbol.asyncIterator]() {
|
|
1262
|
+
let cursor;
|
|
1263
|
+
let yieldedAny = false;
|
|
1264
|
+
while (true) {
|
|
1265
|
+
const result = await adapter.fetchMessages(threadId, {
|
|
1266
|
+
limit: 100,
|
|
1267
|
+
cursor,
|
|
1268
|
+
direction: "forward"
|
|
1269
|
+
});
|
|
1270
|
+
for (const message of result.messages) {
|
|
1271
|
+
yieldedAny = true;
|
|
1272
|
+
yield message;
|
|
1273
|
+
}
|
|
1274
|
+
if (!result.nextCursor || result.messages.length === 0) {
|
|
1275
|
+
break;
|
|
1276
|
+
}
|
|
1277
|
+
cursor = result.nextCursor;
|
|
1278
|
+
}
|
|
1279
|
+
if (!yieldedAny && messageHistory) {
|
|
1280
|
+
const cached = await messageHistory.getMessages(threadId);
|
|
1281
|
+
for (const message of cached) {
|
|
1282
|
+
yield message;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
async isSubscribed() {
|
|
1289
|
+
if (this._isSubscribedContext) {
|
|
1290
|
+
return true;
|
|
1291
|
+
}
|
|
1292
|
+
return this._stateAdapter.isSubscribed(this.id);
|
|
1293
|
+
}
|
|
1294
|
+
async subscribe() {
|
|
1295
|
+
await this._stateAdapter.subscribe(this.id);
|
|
1296
|
+
if (this.adapter.onThreadSubscribe) {
|
|
1297
|
+
await this.adapter.onThreadSubscribe(this.id);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
async unsubscribe() {
|
|
1301
|
+
await this._stateAdapter.unsubscribe(this.id);
|
|
1302
|
+
}
|
|
1303
|
+
async post(message) {
|
|
1304
|
+
if (isAsyncIterable2(message)) {
|
|
1305
|
+
return this.handleStream(message);
|
|
1306
|
+
}
|
|
1307
|
+
let postable = message;
|
|
1308
|
+
if (isJSX(message)) {
|
|
1309
|
+
const card = toCardElement(message);
|
|
1310
|
+
if (!card) {
|
|
1311
|
+
throw new Error("Invalid JSX element: must be a Card element");
|
|
1312
|
+
}
|
|
1313
|
+
postable = card;
|
|
1314
|
+
}
|
|
1315
|
+
const rawMessage = await this.adapter.postMessage(this.id, postable);
|
|
1316
|
+
const result = this.createSentMessage(
|
|
1317
|
+
rawMessage.id,
|
|
1318
|
+
postable,
|
|
1319
|
+
rawMessage.threadId
|
|
1320
|
+
);
|
|
1321
|
+
if (this._messageHistory) {
|
|
1322
|
+
await this._messageHistory.append(this.id, new Message(result));
|
|
1323
|
+
}
|
|
1324
|
+
return result;
|
|
1325
|
+
}
|
|
1326
|
+
async postEphemeral(user, message, options) {
|
|
1327
|
+
const { fallbackToDM } = options;
|
|
1328
|
+
const userId = typeof user === "string" ? user : user.userId;
|
|
1329
|
+
let postable;
|
|
1330
|
+
if (isJSX(message)) {
|
|
1331
|
+
const card = toCardElement(message);
|
|
1332
|
+
if (!card) {
|
|
1333
|
+
throw new Error("Invalid JSX element: must be a Card element");
|
|
1334
|
+
}
|
|
1335
|
+
postable = card;
|
|
1336
|
+
} else {
|
|
1337
|
+
postable = message;
|
|
1338
|
+
}
|
|
1339
|
+
if (this.adapter.postEphemeral) {
|
|
1340
|
+
return this.adapter.postEphemeral(this.id, userId, postable);
|
|
1341
|
+
}
|
|
1342
|
+
if (!fallbackToDM) {
|
|
1343
|
+
return null;
|
|
1344
|
+
}
|
|
1345
|
+
if (this.adapter.openDM) {
|
|
1346
|
+
const dmThreadId = await this.adapter.openDM(userId);
|
|
1347
|
+
const result = await this.adapter.postMessage(dmThreadId, postable);
|
|
1348
|
+
return {
|
|
1349
|
+
id: result.id,
|
|
1350
|
+
threadId: dmThreadId,
|
|
1351
|
+
usedFallback: true,
|
|
1352
|
+
raw: result.raw
|
|
1353
|
+
};
|
|
1354
|
+
}
|
|
1355
|
+
return null;
|
|
1356
|
+
}
|
|
1357
|
+
async schedule(message, options) {
|
|
1358
|
+
let postable;
|
|
1359
|
+
if (isJSX(message)) {
|
|
1360
|
+
const card = toCardElement(message);
|
|
1361
|
+
if (!card) {
|
|
1362
|
+
throw new Error("Invalid JSX element: must be a Card element");
|
|
1363
|
+
}
|
|
1364
|
+
postable = card;
|
|
1365
|
+
} else {
|
|
1366
|
+
postable = message;
|
|
1367
|
+
}
|
|
1368
|
+
if (!this.adapter.scheduleMessage) {
|
|
1369
|
+
throw new NotImplementedError(
|
|
1370
|
+
"Scheduled messages are not supported by this adapter",
|
|
1371
|
+
"scheduling"
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
return this.adapter.scheduleMessage(this.id, postable, options);
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Handle streaming from an AsyncIterable.
|
|
1378
|
+
* Normalizes the stream (supports both textStream and fullStream from AI SDK),
|
|
1379
|
+
* then uses adapter's native streaming if available, otherwise falls back to post+edit.
|
|
1380
|
+
*/
|
|
1381
|
+
async handleStream(rawStream) {
|
|
1382
|
+
const textStream = fromFullStream(rawStream);
|
|
1383
|
+
const options = {};
|
|
1384
|
+
if (this._currentMessage) {
|
|
1385
|
+
options.recipientUserId = this._currentMessage.author.userId;
|
|
1386
|
+
const raw = this._currentMessage.raw;
|
|
1387
|
+
options.recipientTeamId = raw?.team_id ?? raw?.team;
|
|
1388
|
+
}
|
|
1389
|
+
if (this.adapter.stream) {
|
|
1390
|
+
let accumulated = "";
|
|
1391
|
+
const wrappedStream = {
|
|
1392
|
+
[Symbol.asyncIterator]: () => {
|
|
1393
|
+
const iterator = textStream[Symbol.asyncIterator]();
|
|
1394
|
+
return {
|
|
1395
|
+
async next() {
|
|
1396
|
+
const result = await iterator.next();
|
|
1397
|
+
if (!result.done) {
|
|
1398
|
+
const value = result.value;
|
|
1399
|
+
if (typeof value === "string") {
|
|
1400
|
+
accumulated += value;
|
|
1401
|
+
} else if (value.type === "markdown_text") {
|
|
1402
|
+
accumulated += value.text;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
return result;
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
};
|
|
1410
|
+
const raw = await this.adapter.stream(this.id, wrappedStream, options);
|
|
1411
|
+
const sent = this.createSentMessage(
|
|
1412
|
+
raw.id,
|
|
1413
|
+
{ markdown: accumulated },
|
|
1414
|
+
raw.threadId
|
|
1415
|
+
);
|
|
1416
|
+
if (this._messageHistory) {
|
|
1417
|
+
await this._messageHistory.append(this.id, new Message(sent));
|
|
1418
|
+
}
|
|
1419
|
+
return sent;
|
|
1420
|
+
}
|
|
1421
|
+
const textOnlyStream = {
|
|
1422
|
+
[Symbol.asyncIterator]: () => {
|
|
1423
|
+
const iterator = textStream[Symbol.asyncIterator]();
|
|
1424
|
+
return {
|
|
1425
|
+
async next() {
|
|
1426
|
+
while (true) {
|
|
1427
|
+
const result = await iterator.next();
|
|
1428
|
+
if (result.done) {
|
|
1429
|
+
return { value: void 0, done: true };
|
|
1430
|
+
}
|
|
1431
|
+
const value = result.value;
|
|
1432
|
+
if (typeof value === "string") {
|
|
1433
|
+
return { value, done: false };
|
|
1434
|
+
}
|
|
1435
|
+
if (value.type === "markdown_text") {
|
|
1436
|
+
return { value: value.text, done: false };
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
return this.fallbackStream(textOnlyStream, options);
|
|
1444
|
+
}
|
|
1445
|
+
async startTyping(status) {
|
|
1446
|
+
await this.adapter.startTyping(this.id, status);
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Fallback streaming implementation using post + edit.
|
|
1450
|
+
* Used when adapter doesn't support native streaming.
|
|
1451
|
+
* Uses recursive setTimeout to send updates every intervalMs (default 500ms).
|
|
1452
|
+
* Schedules next update only after current edit completes to avoid overwhelming slow services.
|
|
1453
|
+
*/
|
|
1454
|
+
async fallbackStream(textStream, options) {
|
|
1455
|
+
const intervalMs = options?.updateIntervalMs ?? this._streamingUpdateIntervalMs;
|
|
1456
|
+
const placeholderText = this._fallbackStreamingPlaceholderText;
|
|
1457
|
+
let msg = placeholderText === null ? null : await this.adapter.postMessage(this.id, placeholderText);
|
|
1458
|
+
let threadIdForEdits = this.id;
|
|
1459
|
+
const renderer = new StreamingMarkdownRenderer();
|
|
1460
|
+
let lastEditContent = "";
|
|
1461
|
+
let stopped = false;
|
|
1462
|
+
let pendingEdit = null;
|
|
1463
|
+
let timerId = null;
|
|
1464
|
+
if (msg) {
|
|
1465
|
+
threadIdForEdits = msg.threadId || this.id;
|
|
1466
|
+
lastEditContent = placeholderText ?? "";
|
|
1467
|
+
}
|
|
1468
|
+
const scheduleNextEdit = () => {
|
|
1469
|
+
timerId = setTimeout(() => {
|
|
1470
|
+
pendingEdit = doEditAndReschedule();
|
|
1471
|
+
}, intervalMs);
|
|
1472
|
+
};
|
|
1473
|
+
const doEditAndReschedule = async () => {
|
|
1474
|
+
if (stopped || !msg) {
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
const content = renderer.render();
|
|
1478
|
+
if (content !== lastEditContent) {
|
|
1479
|
+
try {
|
|
1480
|
+
await this.adapter.editMessage(threadIdForEdits, msg.id, {
|
|
1481
|
+
markdown: content
|
|
1482
|
+
});
|
|
1483
|
+
lastEditContent = content;
|
|
1484
|
+
} catch (error) {
|
|
1485
|
+
this._logger?.warn("fallbackStream edit failed", error);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
if (!stopped) {
|
|
1489
|
+
scheduleNextEdit();
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
if (msg) {
|
|
1493
|
+
scheduleNextEdit();
|
|
1494
|
+
}
|
|
1495
|
+
try {
|
|
1496
|
+
for await (const chunk of textStream) {
|
|
1497
|
+
renderer.push(chunk);
|
|
1498
|
+
if (!msg) {
|
|
1499
|
+
const content = renderer.render();
|
|
1500
|
+
msg = await this.adapter.postMessage(this.id, {
|
|
1501
|
+
markdown: content
|
|
1502
|
+
});
|
|
1503
|
+
threadIdForEdits = msg.threadId || this.id;
|
|
1504
|
+
lastEditContent = content;
|
|
1505
|
+
scheduleNextEdit();
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
} finally {
|
|
1509
|
+
stopped = true;
|
|
1510
|
+
if (timerId) {
|
|
1511
|
+
clearTimeout(timerId);
|
|
1512
|
+
timerId = null;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
if (pendingEdit) {
|
|
1516
|
+
await pendingEdit;
|
|
1517
|
+
}
|
|
1518
|
+
const accumulated = renderer.getText();
|
|
1519
|
+
const finalContent = renderer.finish();
|
|
1520
|
+
if (!msg) {
|
|
1521
|
+
msg = await this.adapter.postMessage(this.id, {
|
|
1522
|
+
markdown: accumulated
|
|
1523
|
+
});
|
|
1524
|
+
threadIdForEdits = msg.threadId || this.id;
|
|
1525
|
+
lastEditContent = accumulated;
|
|
1526
|
+
}
|
|
1527
|
+
if (finalContent !== lastEditContent) {
|
|
1528
|
+
await this.adapter.editMessage(threadIdForEdits, msg.id, {
|
|
1529
|
+
markdown: accumulated
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
const sent = this.createSentMessage(
|
|
1533
|
+
msg.id,
|
|
1534
|
+
{ markdown: accumulated },
|
|
1535
|
+
threadIdForEdits
|
|
1536
|
+
);
|
|
1537
|
+
if (this._messageHistory) {
|
|
1538
|
+
await this._messageHistory.append(this.id, new Message(sent));
|
|
1539
|
+
}
|
|
1540
|
+
return sent;
|
|
1541
|
+
}
|
|
1542
|
+
async refresh() {
|
|
1543
|
+
const result = await this.adapter.fetchMessages(this.id, { limit: 50 });
|
|
1544
|
+
if (result.messages.length > 0) {
|
|
1545
|
+
this._recentMessages = result.messages;
|
|
1546
|
+
} else if (this._messageHistory) {
|
|
1547
|
+
this._recentMessages = await this._messageHistory.getMessages(
|
|
1548
|
+
this.id,
|
|
1549
|
+
50
|
|
1550
|
+
);
|
|
1551
|
+
} else {
|
|
1552
|
+
this._recentMessages = [];
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
mentionUser(userId) {
|
|
1556
|
+
return `<@${userId}>`;
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Serialize the thread to a plain JSON object.
|
|
1560
|
+
* Use this to pass thread data to external systems like workflow engines.
|
|
1561
|
+
*
|
|
1562
|
+
* @example
|
|
1563
|
+
* ```typescript
|
|
1564
|
+
* // Pass to a workflow
|
|
1565
|
+
* await workflow.start("my-workflow", {
|
|
1566
|
+
* thread: thread.toJSON(),
|
|
1567
|
+
* message: serializeMessage(message),
|
|
1568
|
+
* });
|
|
1569
|
+
* ```
|
|
1570
|
+
*/
|
|
1571
|
+
toJSON() {
|
|
1572
|
+
return {
|
|
1573
|
+
_type: "chat:Thread",
|
|
1574
|
+
id: this.id,
|
|
1575
|
+
channelId: this.channelId,
|
|
1576
|
+
currentMessage: this._currentMessage?.toJSON(),
|
|
1577
|
+
isDM: this.isDM,
|
|
1578
|
+
adapterName: this.adapter.name
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Reconstruct a Thread from serialized JSON data.
|
|
1583
|
+
*
|
|
1584
|
+
* Reconstructs a ThreadImpl from serialized data.
|
|
1585
|
+
* Uses lazy resolution from Chat.getSingleton() for adapter and state.
|
|
1586
|
+
*
|
|
1587
|
+
* @param json - Serialized thread data
|
|
1588
|
+
* @requires Call `chat.registerSingleton()` before deserializing threads
|
|
1589
|
+
*
|
|
1590
|
+
* @example
|
|
1591
|
+
* ```typescript
|
|
1592
|
+
* const thread = ThreadImpl.fromJSON(serializedThread);
|
|
1593
|
+
* ```
|
|
1594
|
+
*/
|
|
1595
|
+
static fromJSON(json, adapter) {
|
|
1596
|
+
const thread = new _ThreadImpl({
|
|
1597
|
+
id: json.id,
|
|
1598
|
+
adapterName: json.adapterName,
|
|
1599
|
+
channelId: json.channelId,
|
|
1600
|
+
currentMessage: json.currentMessage ? Message.fromJSON(json.currentMessage) : void 0,
|
|
1601
|
+
isDM: json.isDM
|
|
1602
|
+
});
|
|
1603
|
+
if (adapter) {
|
|
1604
|
+
thread._adapter = adapter;
|
|
1605
|
+
}
|
|
1606
|
+
return thread;
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* Serialize a ThreadImpl instance for @workflow/serde.
|
|
1610
|
+
* This static method is automatically called by workflow serialization.
|
|
1611
|
+
*/
|
|
1612
|
+
static [WORKFLOW_SERIALIZE3](instance) {
|
|
1613
|
+
return instance.toJSON();
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Deserialize a ThreadImpl from @workflow/serde.
|
|
1617
|
+
* Uses lazy adapter resolution from Chat.getSingleton().
|
|
1618
|
+
* Requires chat.registerSingleton() to have been called.
|
|
1619
|
+
*/
|
|
1620
|
+
static [WORKFLOW_DESERIALIZE3](data) {
|
|
1621
|
+
return _ThreadImpl.fromJSON(data);
|
|
1622
|
+
}
|
|
1623
|
+
createSentMessage(messageId, postable, threadIdOverride) {
|
|
1624
|
+
const adapter = this.adapter;
|
|
1625
|
+
const threadId = threadIdOverride || this.id;
|
|
1626
|
+
const self = this;
|
|
1627
|
+
const { plainText, formatted, attachments } = extractMessageContent2(postable);
|
|
1628
|
+
const sentMessage = {
|
|
1629
|
+
id: messageId,
|
|
1630
|
+
threadId,
|
|
1631
|
+
text: plainText,
|
|
1632
|
+
formatted,
|
|
1633
|
+
raw: null,
|
|
1634
|
+
// Will be populated if needed
|
|
1635
|
+
links: [],
|
|
1636
|
+
author: {
|
|
1637
|
+
userId: "self",
|
|
1638
|
+
userName: adapter.userName,
|
|
1639
|
+
fullName: adapter.userName,
|
|
1640
|
+
isBot: true,
|
|
1641
|
+
isMe: true
|
|
1642
|
+
},
|
|
1643
|
+
metadata: {
|
|
1644
|
+
dateSent: /* @__PURE__ */ new Date(),
|
|
1645
|
+
edited: false
|
|
1646
|
+
},
|
|
1647
|
+
attachments,
|
|
1648
|
+
toJSON() {
|
|
1649
|
+
return new Message(this).toJSON();
|
|
1650
|
+
},
|
|
1651
|
+
async edit(newContent) {
|
|
1652
|
+
let postable2 = newContent;
|
|
1653
|
+
if (isJSX(newContent)) {
|
|
1654
|
+
const card = toCardElement(newContent);
|
|
1655
|
+
if (!card) {
|
|
1656
|
+
throw new Error("Invalid JSX element: must be a Card element");
|
|
1657
|
+
}
|
|
1658
|
+
postable2 = card;
|
|
1659
|
+
}
|
|
1660
|
+
await adapter.editMessage(threadId, messageId, postable2);
|
|
1661
|
+
return self.createSentMessage(messageId, postable2);
|
|
1662
|
+
},
|
|
1663
|
+
async delete() {
|
|
1664
|
+
await adapter.deleteMessage(threadId, messageId);
|
|
1665
|
+
},
|
|
1666
|
+
async addReaction(emoji2) {
|
|
1667
|
+
await adapter.addReaction(threadId, messageId, emoji2);
|
|
1668
|
+
},
|
|
1669
|
+
async removeReaction(emoji2) {
|
|
1670
|
+
await adapter.removeReaction(threadId, messageId, emoji2);
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
return sentMessage;
|
|
1674
|
+
}
|
|
1675
|
+
createSentMessageFromMessage(message) {
|
|
1676
|
+
const adapter = this.adapter;
|
|
1677
|
+
const threadId = this.id;
|
|
1678
|
+
const messageId = message.id;
|
|
1679
|
+
const self = this;
|
|
1680
|
+
return {
|
|
1681
|
+
id: message.id,
|
|
1682
|
+
threadId: message.threadId,
|
|
1683
|
+
text: message.text,
|
|
1684
|
+
formatted: message.formatted,
|
|
1685
|
+
raw: message.raw,
|
|
1686
|
+
author: message.author,
|
|
1687
|
+
metadata: message.metadata,
|
|
1688
|
+
attachments: message.attachments,
|
|
1689
|
+
links: message.links,
|
|
1690
|
+
isMention: message.isMention,
|
|
1691
|
+
toJSON() {
|
|
1692
|
+
return message.toJSON();
|
|
1693
|
+
},
|
|
1694
|
+
async edit(newContent) {
|
|
1695
|
+
let postable = newContent;
|
|
1696
|
+
if (isJSX(newContent)) {
|
|
1697
|
+
const card = toCardElement(newContent);
|
|
1698
|
+
if (!card) {
|
|
1699
|
+
throw new Error("Invalid JSX element: must be a Card element");
|
|
1700
|
+
}
|
|
1701
|
+
postable = card;
|
|
1702
|
+
}
|
|
1703
|
+
await adapter.editMessage(threadId, messageId, postable);
|
|
1704
|
+
return self.createSentMessage(messageId, postable, threadId);
|
|
1705
|
+
},
|
|
1706
|
+
async delete() {
|
|
1707
|
+
await adapter.deleteMessage(threadId, messageId);
|
|
1708
|
+
},
|
|
1709
|
+
async addReaction(emoji2) {
|
|
1710
|
+
await adapter.addReaction(threadId, messageId, emoji2);
|
|
1711
|
+
},
|
|
1712
|
+
async removeReaction(emoji2) {
|
|
1713
|
+
await adapter.removeReaction(threadId, messageId, emoji2);
|
|
1714
|
+
}
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1717
|
+
};
|
|
1718
|
+
function extractMessageContent2(message) {
|
|
1719
|
+
if (typeof message === "string") {
|
|
1720
|
+
return {
|
|
1721
|
+
plainText: message,
|
|
1722
|
+
formatted: root([paragraph([text(message)])]),
|
|
1723
|
+
attachments: []
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
if ("raw" in message) {
|
|
1727
|
+
return {
|
|
1728
|
+
plainText: message.raw,
|
|
1729
|
+
formatted: root([paragraph([text(message.raw)])]),
|
|
1730
|
+
attachments: message.attachments || []
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
if ("markdown" in message) {
|
|
1734
|
+
const ast = parseMarkdown(message.markdown);
|
|
1735
|
+
return {
|
|
1736
|
+
plainText: toPlainText(ast),
|
|
1737
|
+
formatted: ast,
|
|
1738
|
+
attachments: message.attachments || []
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
if ("ast" in message) {
|
|
1742
|
+
return {
|
|
1743
|
+
plainText: toPlainText(message.ast),
|
|
1744
|
+
formatted: message.ast,
|
|
1745
|
+
attachments: message.attachments || []
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
if ("card" in message) {
|
|
1749
|
+
const fallbackText = message.fallbackText || cardToFallbackText(message.card);
|
|
1750
|
+
return {
|
|
1751
|
+
plainText: fallbackText,
|
|
1752
|
+
formatted: root([paragraph([text(fallbackText)])]),
|
|
1753
|
+
attachments: []
|
|
1754
|
+
};
|
|
1755
|
+
}
|
|
1756
|
+
if ("type" in message && message.type === "card") {
|
|
1757
|
+
const fallbackText = cardToFallbackText(message);
|
|
1758
|
+
return {
|
|
1759
|
+
plainText: fallbackText,
|
|
1760
|
+
formatted: root([paragraph([text(fallbackText)])]),
|
|
1761
|
+
attachments: []
|
|
1762
|
+
};
|
|
1763
|
+
}
|
|
1764
|
+
throw new Error("Invalid PostableMessage format");
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
// src/chat.ts
|
|
1768
|
+
var DEFAULT_LOCK_TTL_MS = 3e4;
|
|
1769
|
+
var SLACK_USER_ID_REGEX = /^U[A-Z0-9]+$/i;
|
|
1770
|
+
var DISCORD_SNOWFLAKE_REGEX = /^\d{17,19}$/;
|
|
1771
|
+
var DEDUPE_TTL_MS = 5 * 60 * 1e3;
|
|
1772
|
+
var MODAL_CONTEXT_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
1773
|
+
var Chat = class {
|
|
1774
|
+
/**
|
|
1775
|
+
* Register this Chat instance as the global singleton.
|
|
1776
|
+
* Required for Thread deserialization via @workflow/serde.
|
|
1777
|
+
*
|
|
1778
|
+
* @example
|
|
1779
|
+
* ```typescript
|
|
1780
|
+
* const chat = new Chat({ ... });
|
|
1781
|
+
* chat.registerSingleton();
|
|
1782
|
+
*
|
|
1783
|
+
* // Now threads can be deserialized without passing chat explicitly
|
|
1784
|
+
* const thread = ThreadImpl.fromJSON(serializedThread);
|
|
1785
|
+
* ```
|
|
1786
|
+
*/
|
|
1787
|
+
registerSingleton() {
|
|
1788
|
+
setChatSingleton(this);
|
|
1789
|
+
return this;
|
|
1790
|
+
}
|
|
1791
|
+
/**
|
|
1792
|
+
* Get the registered singleton Chat instance.
|
|
1793
|
+
* Throws if no singleton has been registered.
|
|
1794
|
+
*/
|
|
1795
|
+
static getSingleton() {
|
|
1796
|
+
return getChatSingleton();
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Check if a singleton has been registered.
|
|
1800
|
+
*/
|
|
1801
|
+
static hasSingleton() {
|
|
1802
|
+
return hasChatSingleton();
|
|
1803
|
+
}
|
|
1804
|
+
adapters;
|
|
1805
|
+
_stateAdapter;
|
|
1806
|
+
userName;
|
|
1807
|
+
logger;
|
|
1808
|
+
_streamingUpdateIntervalMs;
|
|
1809
|
+
_fallbackStreamingPlaceholderText;
|
|
1810
|
+
_dedupeTtlMs;
|
|
1811
|
+
_onLockConflict;
|
|
1812
|
+
_messageHistory;
|
|
1813
|
+
mentionHandlers = [];
|
|
1814
|
+
directMessageHandlers = [];
|
|
1815
|
+
messagePatterns = [];
|
|
1816
|
+
subscribedMessageHandlers = [];
|
|
1817
|
+
reactionHandlers = [];
|
|
1818
|
+
actionHandlers = [];
|
|
1819
|
+
modalSubmitHandlers = [];
|
|
1820
|
+
modalCloseHandlers = [];
|
|
1821
|
+
slashCommandHandlers = [];
|
|
1822
|
+
assistantThreadStartedHandlers = [];
|
|
1823
|
+
assistantContextChangedHandlers = [];
|
|
1824
|
+
appHomeOpenedHandlers = [];
|
|
1825
|
+
memberJoinedChannelHandlers = [];
|
|
1826
|
+
/** Initialization state */
|
|
1827
|
+
initPromise = null;
|
|
1828
|
+
initialized = false;
|
|
1829
|
+
/**
|
|
1830
|
+
* Type-safe webhook handlers keyed by adapter name.
|
|
1831
|
+
* @example
|
|
1832
|
+
* chat.webhooks.slack(request, { backgroundTask: waitUntil });
|
|
1833
|
+
*/
|
|
1834
|
+
webhooks;
|
|
1835
|
+
constructor(config) {
|
|
1836
|
+
this.userName = config.userName;
|
|
1837
|
+
this._stateAdapter = config.state;
|
|
1838
|
+
this.adapters = /* @__PURE__ */ new Map();
|
|
1839
|
+
this._streamingUpdateIntervalMs = config.streamingUpdateIntervalMs ?? 500;
|
|
1840
|
+
this._fallbackStreamingPlaceholderText = config.fallbackStreamingPlaceholderText !== void 0 ? config.fallbackStreamingPlaceholderText : "...";
|
|
1841
|
+
this._dedupeTtlMs = config.dedupeTtlMs ?? DEDUPE_TTL_MS;
|
|
1842
|
+
this._onLockConflict = config.onLockConflict;
|
|
1843
|
+
this._messageHistory = new MessageHistoryCache(
|
|
1844
|
+
this._stateAdapter,
|
|
1845
|
+
config.messageHistory
|
|
1846
|
+
);
|
|
1847
|
+
if (typeof config.logger === "string") {
|
|
1848
|
+
this.logger = new ConsoleLogger(config.logger);
|
|
1849
|
+
} else {
|
|
1850
|
+
this.logger = config.logger || new ConsoleLogger("info");
|
|
1851
|
+
}
|
|
1852
|
+
const webhooks = {};
|
|
1853
|
+
for (const [name, adapter] of Object.entries(config.adapters)) {
|
|
1854
|
+
this.adapters.set(name, adapter);
|
|
1855
|
+
webhooks[name] = (request, options) => this.handleWebhook(name, request, options);
|
|
1856
|
+
}
|
|
1857
|
+
this.webhooks = webhooks;
|
|
1858
|
+
this.logger.debug("Chat instance created", {
|
|
1859
|
+
adapters: Object.keys(config.adapters)
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Handle a webhook request for a specific adapter.
|
|
1864
|
+
* Automatically initializes adapters on first call.
|
|
1865
|
+
*/
|
|
1866
|
+
async handleWebhook(adapterName, request, options) {
|
|
1867
|
+
await this.ensureInitialized();
|
|
1868
|
+
const adapter = this.adapters.get(adapterName);
|
|
1869
|
+
if (!adapter) {
|
|
1870
|
+
return new Response(`Unknown adapter: ${adapterName}`, { status: 404 });
|
|
1871
|
+
}
|
|
1872
|
+
return adapter.handleWebhook(request, options);
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Ensure the chat instance is initialized.
|
|
1876
|
+
* This is called automatically before handling webhooks.
|
|
1877
|
+
*/
|
|
1878
|
+
async ensureInitialized() {
|
|
1879
|
+
if (this.initialized) {
|
|
1880
|
+
return;
|
|
1881
|
+
}
|
|
1882
|
+
if (!this.initPromise) {
|
|
1883
|
+
this.initPromise = this.doInitialize();
|
|
1884
|
+
}
|
|
1885
|
+
await this.initPromise;
|
|
1886
|
+
}
|
|
1887
|
+
async doInitialize() {
|
|
1888
|
+
this.logger.info("Initializing chat instance...");
|
|
1889
|
+
await this._stateAdapter.connect();
|
|
1890
|
+
this.logger.debug("State connected");
|
|
1891
|
+
const initPromises = Array.from(this.adapters.values()).map(
|
|
1892
|
+
async (adapter) => {
|
|
1893
|
+
this.logger.debug("Initializing adapter", adapter.name);
|
|
1894
|
+
const result = await adapter.initialize(this);
|
|
1895
|
+
this.logger.debug("Adapter initialized", adapter.name);
|
|
1896
|
+
return result;
|
|
1897
|
+
}
|
|
1898
|
+
);
|
|
1899
|
+
await Promise.all(initPromises);
|
|
1900
|
+
this.initialized = true;
|
|
1901
|
+
this.logger.info("Chat instance initialized", {
|
|
1902
|
+
adapters: Array.from(this.adapters.keys())
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* Gracefully shut down the chat instance.
|
|
1907
|
+
*/
|
|
1908
|
+
async shutdown() {
|
|
1909
|
+
this.logger.info("Shutting down chat instance...");
|
|
1910
|
+
await this._stateAdapter.disconnect();
|
|
1911
|
+
this.initialized = false;
|
|
1912
|
+
this.initPromise = null;
|
|
1913
|
+
this.logger.info("Chat instance shut down");
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* Initialize the chat instance and all adapters.
|
|
1917
|
+
* This is called automatically when handling webhooks, but can be called
|
|
1918
|
+
* manually for non-webhook use cases (e.g., Gateway listeners).
|
|
1919
|
+
*/
|
|
1920
|
+
async initialize() {
|
|
1921
|
+
await this.ensureInitialized();
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Register a handler for new @-mentions of the bot.
|
|
1925
|
+
*
|
|
1926
|
+
* **Important**: This handler is ONLY called for mentions in **unsubscribed** threads.
|
|
1927
|
+
* Once a thread is subscribed (via `thread.subscribe()`), subsequent messages
|
|
1928
|
+
* including @-mentions go to `onSubscribedMessage` handlers instead.
|
|
1929
|
+
*
|
|
1930
|
+
* To detect mentions in subscribed threads, check `message.isMention`:
|
|
1931
|
+
*
|
|
1932
|
+
* @example
|
|
1933
|
+
* ```typescript
|
|
1934
|
+
* // Handle new mentions (unsubscribed threads only)
|
|
1935
|
+
* chat.onNewMention(async (thread, message) => {
|
|
1936
|
+
* await thread.subscribe(); // Subscribe to follow-up messages
|
|
1937
|
+
* await thread.post("Hello! I'll be watching this thread.");
|
|
1938
|
+
* });
|
|
1939
|
+
*
|
|
1940
|
+
* // Handle all messages in subscribed threads
|
|
1941
|
+
* chat.onSubscribedMessage(async (thread, message) => {
|
|
1942
|
+
* if (message.isMention) {
|
|
1943
|
+
* // User @-mentioned us in a thread we're already watching
|
|
1944
|
+
* await thread.post("You mentioned me again!");
|
|
1945
|
+
* }
|
|
1946
|
+
* });
|
|
1947
|
+
* ```
|
|
1948
|
+
*/
|
|
1949
|
+
onNewMention(handler) {
|
|
1950
|
+
this.mentionHandlers.push(handler);
|
|
1951
|
+
this.logger.debug("Registered mention handler");
|
|
1952
|
+
}
|
|
1953
|
+
/**
|
|
1954
|
+
* Register a handler for direct messages.
|
|
1955
|
+
*
|
|
1956
|
+
* Called when a message is received in a DM thread that is not subscribed.
|
|
1957
|
+
* If no `onDirectMessage` handlers are registered, DMs fall through to
|
|
1958
|
+
* `onNewMention` for backward compatibility.
|
|
1959
|
+
*
|
|
1960
|
+
* @param handler - Handler called for DM messages
|
|
1961
|
+
*
|
|
1962
|
+
* @example
|
|
1963
|
+
* ```typescript
|
|
1964
|
+
* chat.onDirectMessage(async (thread, message) => {
|
|
1965
|
+
* await thread.subscribe();
|
|
1966
|
+
* await thread.post("Thanks for the DM!");
|
|
1967
|
+
* });
|
|
1968
|
+
* ```
|
|
1969
|
+
*/
|
|
1970
|
+
onDirectMessage(handler) {
|
|
1971
|
+
this.directMessageHandlers.push(handler);
|
|
1972
|
+
this.logger.debug("Registered direct message handler");
|
|
1973
|
+
}
|
|
1974
|
+
/**
|
|
1975
|
+
* Register a handler for messages matching a regex pattern.
|
|
1976
|
+
*
|
|
1977
|
+
* @param pattern - Regular expression to match against message text
|
|
1978
|
+
* @param handler - Handler called when pattern matches
|
|
1979
|
+
*
|
|
1980
|
+
* @example
|
|
1981
|
+
* ```typescript
|
|
1982
|
+
* // Match messages starting with "!help"
|
|
1983
|
+
* chat.onNewMessage(/^!help/, async (thread, message) => {
|
|
1984
|
+
* await thread.post("Available commands: !help, !status, !ping");
|
|
1985
|
+
* });
|
|
1986
|
+
* ```
|
|
1987
|
+
*/
|
|
1988
|
+
onNewMessage(pattern, handler) {
|
|
1989
|
+
this.messagePatterns.push({ pattern, handler });
|
|
1990
|
+
this.logger.debug("Registered message pattern handler", {
|
|
1991
|
+
pattern: pattern.toString()
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Register a handler for messages in subscribed threads.
|
|
1996
|
+
*
|
|
1997
|
+
* Called for all messages in threads that have been subscribed via `thread.subscribe()`.
|
|
1998
|
+
* This includes:
|
|
1999
|
+
* - Follow-up messages from users
|
|
2000
|
+
* - Messages that @-mention the bot (check `message.isMention`)
|
|
2001
|
+
*
|
|
2002
|
+
* Does NOT fire for:
|
|
2003
|
+
* - The message that triggered the subscription (e.g., the initial @mention)
|
|
2004
|
+
* - Messages sent by the bot itself
|
|
2005
|
+
*
|
|
2006
|
+
* @example
|
|
2007
|
+
* ```typescript
|
|
2008
|
+
* chat.onSubscribedMessage(async (thread, message) => {
|
|
2009
|
+
* // Handle all follow-up messages
|
|
2010
|
+
* if (message.isMention) {
|
|
2011
|
+
* // User @-mentioned us in a subscribed thread
|
|
2012
|
+
* }
|
|
2013
|
+
* await thread.post(`Got your message: ${message.text}`);
|
|
2014
|
+
* });
|
|
2015
|
+
* ```
|
|
2016
|
+
*/
|
|
2017
|
+
onSubscribedMessage(handler) {
|
|
2018
|
+
this.subscribedMessageHandlers.push(handler);
|
|
2019
|
+
this.logger.debug("Registered subscribed message handler");
|
|
2020
|
+
}
|
|
2021
|
+
onReaction(emojiOrHandler, handler) {
|
|
2022
|
+
if (typeof emojiOrHandler === "function") {
|
|
2023
|
+
this.reactionHandlers.push({ emoji: [], handler: emojiOrHandler });
|
|
2024
|
+
this.logger.debug("Registered reaction handler for all emoji");
|
|
2025
|
+
} else if (handler) {
|
|
2026
|
+
this.reactionHandlers.push({ emoji: emojiOrHandler, handler });
|
|
2027
|
+
this.logger.debug("Registered reaction handler", {
|
|
2028
|
+
emoji: emojiOrHandler.map((e) => typeof e === "string" ? e : e.name)
|
|
2029
|
+
});
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
onAction(actionIdOrHandler, handler) {
|
|
2033
|
+
if (typeof actionIdOrHandler === "function") {
|
|
2034
|
+
this.actionHandlers.push({ actionIds: [], handler: actionIdOrHandler });
|
|
2035
|
+
this.logger.debug("Registered action handler for all actions");
|
|
2036
|
+
} else if (handler) {
|
|
2037
|
+
const actionIds = Array.isArray(actionIdOrHandler) ? actionIdOrHandler : [actionIdOrHandler];
|
|
2038
|
+
this.actionHandlers.push({ actionIds, handler });
|
|
2039
|
+
this.logger.debug("Registered action handler", { actionIds });
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
onModalSubmit(callbackIdOrHandler, handler) {
|
|
2043
|
+
if (typeof callbackIdOrHandler === "function") {
|
|
2044
|
+
this.modalSubmitHandlers.push({
|
|
2045
|
+
callbackIds: [],
|
|
2046
|
+
handler: callbackIdOrHandler
|
|
2047
|
+
});
|
|
2048
|
+
this.logger.debug("Registered modal submit handler for all modals");
|
|
2049
|
+
} else if (handler) {
|
|
2050
|
+
const callbackIds = Array.isArray(callbackIdOrHandler) ? callbackIdOrHandler : [callbackIdOrHandler];
|
|
2051
|
+
this.modalSubmitHandlers.push({ callbackIds, handler });
|
|
2052
|
+
this.logger.debug("Registered modal submit handler", { callbackIds });
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
onModalClose(callbackIdOrHandler, handler) {
|
|
2056
|
+
if (typeof callbackIdOrHandler === "function") {
|
|
2057
|
+
this.modalCloseHandlers.push({
|
|
2058
|
+
callbackIds: [],
|
|
2059
|
+
handler: callbackIdOrHandler
|
|
2060
|
+
});
|
|
2061
|
+
this.logger.debug("Registered modal close handler for all modals");
|
|
2062
|
+
} else if (handler) {
|
|
2063
|
+
const callbackIds = Array.isArray(callbackIdOrHandler) ? callbackIdOrHandler : [callbackIdOrHandler];
|
|
2064
|
+
this.modalCloseHandlers.push({ callbackIds, handler });
|
|
2065
|
+
this.logger.debug("Registered modal close handler", { callbackIds });
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
onSlashCommand(commandOrHandler, handler) {
|
|
2069
|
+
if (typeof commandOrHandler === "function") {
|
|
2070
|
+
this.slashCommandHandlers.push({
|
|
2071
|
+
commands: [],
|
|
2072
|
+
handler: commandOrHandler
|
|
2073
|
+
});
|
|
2074
|
+
this.logger.debug("Registered slash command handler for all commands");
|
|
2075
|
+
} else if (handler) {
|
|
2076
|
+
const commands = Array.isArray(commandOrHandler) ? commandOrHandler : [commandOrHandler];
|
|
2077
|
+
const normalizedCommands = commands.map(
|
|
2078
|
+
(cmd) => cmd.startsWith("/") ? cmd : `/${cmd}`
|
|
2079
|
+
);
|
|
2080
|
+
this.slashCommandHandlers.push({ commands: normalizedCommands, handler });
|
|
2081
|
+
this.logger.debug("Registered slash command handler", {
|
|
2082
|
+
commands: normalizedCommands
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
onAssistantThreadStarted(handler) {
|
|
2087
|
+
this.assistantThreadStartedHandlers.push(handler);
|
|
2088
|
+
this.logger.debug("Registered assistant thread started handler");
|
|
2089
|
+
}
|
|
2090
|
+
onAssistantContextChanged(handler) {
|
|
2091
|
+
this.assistantContextChangedHandlers.push(handler);
|
|
2092
|
+
this.logger.debug("Registered assistant context changed handler");
|
|
2093
|
+
}
|
|
2094
|
+
onAppHomeOpened(handler) {
|
|
2095
|
+
this.appHomeOpenedHandlers.push(handler);
|
|
2096
|
+
this.logger.debug("Registered app home opened handler");
|
|
2097
|
+
}
|
|
2098
|
+
onMemberJoinedChannel(handler) {
|
|
2099
|
+
this.memberJoinedChannelHandlers.push(handler);
|
|
2100
|
+
this.logger.debug("Registered member joined channel handler");
|
|
2101
|
+
}
|
|
2102
|
+
/**
|
|
2103
|
+
* Get an adapter by name with type safety.
|
|
2104
|
+
*/
|
|
2105
|
+
getAdapter(name) {
|
|
2106
|
+
return this.adapters.get(name);
|
|
2107
|
+
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Get a JSON.parse reviver function that automatically deserializes
|
|
2110
|
+
* chat:Thread and chat:Message objects.
|
|
2111
|
+
*
|
|
2112
|
+
* Use this when parsing JSON that contains serialized Thread or Message objects
|
|
2113
|
+
* (e.g., from workflow engine payloads).
|
|
2114
|
+
*
|
|
2115
|
+
* @returns A reviver function for JSON.parse
|
|
2116
|
+
*
|
|
2117
|
+
* @example
|
|
2118
|
+
* ```typescript
|
|
2119
|
+
* // Parse workflow payload with automatic deserialization
|
|
2120
|
+
* const data = JSON.parse(payload, chat.reviver());
|
|
2121
|
+
*
|
|
2122
|
+
* // data.thread is now a ThreadImpl instance
|
|
2123
|
+
* // data.message is now a Message object with Date fields restored
|
|
2124
|
+
* await data.thread.post("Hello from workflow!");
|
|
2125
|
+
* ```
|
|
2126
|
+
*/
|
|
2127
|
+
reviver() {
|
|
2128
|
+
this.registerSingleton();
|
|
2129
|
+
return function reviver(_key, value) {
|
|
2130
|
+
if (value && typeof value === "object" && "_type" in value) {
|
|
2131
|
+
const typed = value;
|
|
2132
|
+
if (typed._type === "chat:Thread") {
|
|
2133
|
+
return ThreadImpl.fromJSON(value);
|
|
2134
|
+
}
|
|
2135
|
+
if (typed._type === "chat:Channel") {
|
|
2136
|
+
return ChannelImpl.fromJSON(value);
|
|
2137
|
+
}
|
|
2138
|
+
if (typed._type === "chat:Message") {
|
|
2139
|
+
return Message.fromJSON(value);
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
return value;
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
// ChatInstance interface implementations
|
|
2146
|
+
/**
|
|
2147
|
+
* Process an incoming message from an adapter.
|
|
2148
|
+
* Handles waitUntil registration and error catching internally.
|
|
2149
|
+
* Adapters should call this instead of handleIncomingMessage directly.
|
|
2150
|
+
*/
|
|
2151
|
+
processMessage(adapter, threadId, messageOrFactory, options) {
|
|
2152
|
+
const task = (async () => {
|
|
2153
|
+
const message = typeof messageOrFactory === "function" ? await messageOrFactory() : messageOrFactory;
|
|
2154
|
+
await this.handleIncomingMessage(adapter, threadId, message);
|
|
2155
|
+
})().catch((err) => {
|
|
2156
|
+
this.logger.error("Message processing error", { error: err, threadId });
|
|
2157
|
+
});
|
|
2158
|
+
if (options?.waitUntil) {
|
|
2159
|
+
options.waitUntil(task);
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
/**
|
|
2163
|
+
* Process an incoming reaction event from an adapter.
|
|
2164
|
+
* Handles waitUntil registration and error catching internally.
|
|
2165
|
+
*/
|
|
2166
|
+
processReaction(event, options) {
|
|
2167
|
+
const task = this.handleReactionEvent(event).catch((err) => {
|
|
2168
|
+
this.logger.error("Reaction processing error", {
|
|
2169
|
+
error: err,
|
|
2170
|
+
emoji: event.emoji,
|
|
2171
|
+
messageId: event.messageId
|
|
2172
|
+
});
|
|
2173
|
+
});
|
|
2174
|
+
if (options?.waitUntil) {
|
|
2175
|
+
options.waitUntil(task);
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
/**
|
|
2179
|
+
* Process an incoming action event (button click) from an adapter.
|
|
2180
|
+
* Handles waitUntil registration and error catching internally.
|
|
2181
|
+
*/
|
|
2182
|
+
processAction(event, options) {
|
|
2183
|
+
const task = this.handleActionEvent(event).catch((err) => {
|
|
2184
|
+
this.logger.error("Action processing error", {
|
|
2185
|
+
error: err,
|
|
2186
|
+
actionId: event.actionId,
|
|
2187
|
+
messageId: event.messageId
|
|
2188
|
+
});
|
|
2189
|
+
});
|
|
2190
|
+
if (options?.waitUntil) {
|
|
2191
|
+
options.waitUntil(task);
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
async processModalSubmit(event, contextId, _options) {
|
|
2195
|
+
const { relatedThread, relatedMessage, relatedChannel } = await this.retrieveModalContext(event.adapter.name, contextId);
|
|
2196
|
+
const fullEvent = {
|
|
2197
|
+
...event,
|
|
2198
|
+
relatedThread,
|
|
2199
|
+
relatedMessage,
|
|
2200
|
+
relatedChannel
|
|
2201
|
+
};
|
|
2202
|
+
for (const { callbackIds, handler } of this.modalSubmitHandlers) {
|
|
2203
|
+
if (callbackIds.length === 0 || callbackIds.includes(event.callbackId)) {
|
|
2204
|
+
try {
|
|
2205
|
+
const response = await handler(fullEvent);
|
|
2206
|
+
if (response) {
|
|
2207
|
+
return response;
|
|
2208
|
+
}
|
|
2209
|
+
} catch (err) {
|
|
2210
|
+
this.logger.error("Modal submit handler error", {
|
|
2211
|
+
error: err,
|
|
2212
|
+
callbackId: event.callbackId
|
|
2213
|
+
});
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
processModalClose(event, contextId, options) {
|
|
2219
|
+
const task = (async () => {
|
|
2220
|
+
const { relatedThread, relatedMessage, relatedChannel } = await this.retrieveModalContext(event.adapter.name, contextId);
|
|
2221
|
+
const fullEvent = {
|
|
2222
|
+
...event,
|
|
2223
|
+
relatedThread,
|
|
2224
|
+
relatedMessage,
|
|
2225
|
+
relatedChannel
|
|
2226
|
+
};
|
|
2227
|
+
for (const { callbackIds, handler } of this.modalCloseHandlers) {
|
|
2228
|
+
if (callbackIds.length === 0 || callbackIds.includes(event.callbackId)) {
|
|
2229
|
+
await handler(fullEvent);
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
})().catch((err) => {
|
|
2233
|
+
this.logger.error("Modal close handler error", {
|
|
2234
|
+
error: err,
|
|
2235
|
+
callbackId: event.callbackId
|
|
2236
|
+
});
|
|
2237
|
+
});
|
|
2238
|
+
if (options?.waitUntil) {
|
|
2239
|
+
options.waitUntil(task);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
/**
|
|
2243
|
+
* Process an incoming slash command from an adapter.
|
|
2244
|
+
* Handles waitUntil registration and error catching internally.
|
|
2245
|
+
*/
|
|
2246
|
+
processSlashCommand(event, options) {
|
|
2247
|
+
const task = this.handleSlashCommandEvent(event).catch((err) => {
|
|
2248
|
+
this.logger.error("Slash command processing error", {
|
|
2249
|
+
error: err,
|
|
2250
|
+
command: event.command,
|
|
2251
|
+
text: event.text
|
|
2252
|
+
});
|
|
2253
|
+
});
|
|
2254
|
+
if (options?.waitUntil) {
|
|
2255
|
+
options.waitUntil(task);
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
processAssistantThreadStarted(event, options) {
|
|
2259
|
+
const task = (async () => {
|
|
2260
|
+
for (const handler of this.assistantThreadStartedHandlers) {
|
|
2261
|
+
await handler(event);
|
|
2262
|
+
}
|
|
2263
|
+
})().catch((err) => {
|
|
2264
|
+
this.logger.error("Assistant thread started handler error", {
|
|
2265
|
+
error: err,
|
|
2266
|
+
threadId: event.threadId
|
|
2267
|
+
});
|
|
2268
|
+
});
|
|
2269
|
+
if (options?.waitUntil) {
|
|
2270
|
+
options.waitUntil(task);
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
processAssistantContextChanged(event, options) {
|
|
2274
|
+
const task = (async () => {
|
|
2275
|
+
for (const handler of this.assistantContextChangedHandlers) {
|
|
2276
|
+
await handler(event);
|
|
2277
|
+
}
|
|
2278
|
+
})().catch((err) => {
|
|
2279
|
+
this.logger.error("Assistant context changed handler error", {
|
|
2280
|
+
error: err,
|
|
2281
|
+
threadId: event.threadId
|
|
2282
|
+
});
|
|
2283
|
+
});
|
|
2284
|
+
if (options?.waitUntil) {
|
|
2285
|
+
options.waitUntil(task);
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
processAppHomeOpened(event, options) {
|
|
2289
|
+
const task = (async () => {
|
|
2290
|
+
for (const handler of this.appHomeOpenedHandlers) {
|
|
2291
|
+
await handler(event);
|
|
2292
|
+
}
|
|
2293
|
+
})().catch((err) => {
|
|
2294
|
+
this.logger.error("App home opened handler error", {
|
|
2295
|
+
error: err,
|
|
2296
|
+
userId: event.userId
|
|
2297
|
+
});
|
|
2298
|
+
});
|
|
2299
|
+
if (options?.waitUntil) {
|
|
2300
|
+
options.waitUntil(task);
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
processMemberJoinedChannel(event, options) {
|
|
2304
|
+
const task = (async () => {
|
|
2305
|
+
for (const handler of this.memberJoinedChannelHandlers) {
|
|
2306
|
+
await handler(event);
|
|
2307
|
+
}
|
|
2308
|
+
})().catch((err) => {
|
|
2309
|
+
this.logger.error("Member joined channel handler error", {
|
|
2310
|
+
error: err,
|
|
2311
|
+
channelId: event.channelId,
|
|
2312
|
+
userId: event.userId
|
|
2313
|
+
});
|
|
2314
|
+
});
|
|
2315
|
+
if (options?.waitUntil) {
|
|
2316
|
+
options.waitUntil(task);
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Handle a slash command event internally.
|
|
2321
|
+
*/
|
|
2322
|
+
async handleSlashCommandEvent(event) {
|
|
2323
|
+
this.logger.debug("Incoming slash command", {
|
|
2324
|
+
adapter: event.adapter.name,
|
|
2325
|
+
command: event.command,
|
|
2326
|
+
text: event.text,
|
|
2327
|
+
user: event.user.userName
|
|
2328
|
+
});
|
|
2329
|
+
if (event.user.isMe) {
|
|
2330
|
+
this.logger.debug("Skipping slash command from self", {
|
|
2331
|
+
command: event.command
|
|
2332
|
+
});
|
|
2333
|
+
return;
|
|
2334
|
+
}
|
|
2335
|
+
const channel = new ChannelImpl({
|
|
2336
|
+
id: event.channelId,
|
|
2337
|
+
adapter: event.adapter,
|
|
2338
|
+
stateAdapter: this._stateAdapter
|
|
2339
|
+
});
|
|
2340
|
+
const fullEvent = {
|
|
2341
|
+
...event,
|
|
2342
|
+
channel,
|
|
2343
|
+
openModal: async (modal) => {
|
|
2344
|
+
if (!event.triggerId) {
|
|
2345
|
+
this.logger.warn("Cannot open modal: no triggerId available");
|
|
2346
|
+
return void 0;
|
|
2347
|
+
}
|
|
2348
|
+
if (!event.adapter.openModal) {
|
|
2349
|
+
this.logger.warn(
|
|
2350
|
+
`Cannot open modal: ${event.adapter.name} does not support modals`
|
|
2351
|
+
);
|
|
2352
|
+
return void 0;
|
|
2353
|
+
}
|
|
2354
|
+
let modalElement = modal;
|
|
2355
|
+
if (isJSX(modal)) {
|
|
2356
|
+
const converted = toModalElement(modal);
|
|
2357
|
+
if (!converted) {
|
|
2358
|
+
throw new Error("Invalid JSX element: must be a Modal element");
|
|
2359
|
+
}
|
|
2360
|
+
modalElement = converted;
|
|
2361
|
+
}
|
|
2362
|
+
const contextId = crypto.randomUUID();
|
|
2363
|
+
this.storeModalContext(
|
|
2364
|
+
event.adapter.name,
|
|
2365
|
+
contextId,
|
|
2366
|
+
void 0,
|
|
2367
|
+
void 0,
|
|
2368
|
+
channel
|
|
2369
|
+
);
|
|
2370
|
+
return event.adapter.openModal(
|
|
2371
|
+
event.triggerId,
|
|
2372
|
+
modalElement,
|
|
2373
|
+
contextId
|
|
2374
|
+
);
|
|
2375
|
+
}
|
|
2376
|
+
};
|
|
2377
|
+
this.logger.debug("Checking slash command handlers", {
|
|
2378
|
+
handlerCount: this.slashCommandHandlers.length,
|
|
2379
|
+
command: event.command
|
|
2380
|
+
});
|
|
2381
|
+
for (const { commands, handler } of this.slashCommandHandlers) {
|
|
2382
|
+
if (commands.length === 0) {
|
|
2383
|
+
this.logger.debug("Running catch-all slash command handler");
|
|
2384
|
+
await handler(fullEvent);
|
|
2385
|
+
continue;
|
|
2386
|
+
}
|
|
2387
|
+
if (commands.includes(event.command)) {
|
|
2388
|
+
this.logger.debug("Running matched slash command handler", {
|
|
2389
|
+
command: event.command
|
|
2390
|
+
});
|
|
2391
|
+
await handler(fullEvent);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
/**
|
|
2396
|
+
* Store modal context server-side with a context ID.
|
|
2397
|
+
* Called when opening a modal to preserve thread/message/channel for the submit handler.
|
|
2398
|
+
*/
|
|
2399
|
+
storeModalContext(adapterName, contextId, thread, message, channel) {
|
|
2400
|
+
const key = `modal-context:${adapterName}:${contextId}`;
|
|
2401
|
+
const context = {
|
|
2402
|
+
thread: thread?.toJSON(),
|
|
2403
|
+
message: message?.toJSON(),
|
|
2404
|
+
channel: channel?.toJSON()
|
|
2405
|
+
};
|
|
2406
|
+
this._stateAdapter.set(key, context, MODAL_CONTEXT_TTL_MS).catch((err) => {
|
|
2407
|
+
this.logger.error("Failed to store modal context", {
|
|
2408
|
+
contextId,
|
|
2409
|
+
error: err
|
|
2410
|
+
});
|
|
2411
|
+
});
|
|
2412
|
+
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Retrieve and delete modal context from server-side storage.
|
|
2415
|
+
* Called when processing modal submit/close to reconstruct thread/message/channel.
|
|
2416
|
+
*/
|
|
2417
|
+
async retrieveModalContext(adapterName, contextId) {
|
|
2418
|
+
if (!contextId) {
|
|
2419
|
+
return {
|
|
2420
|
+
relatedThread: void 0,
|
|
2421
|
+
relatedMessage: void 0,
|
|
2422
|
+
relatedChannel: void 0
|
|
2423
|
+
};
|
|
2424
|
+
}
|
|
2425
|
+
const key = `modal-context:${adapterName}:${contextId}`;
|
|
2426
|
+
const stored = await this._stateAdapter.get(key);
|
|
2427
|
+
if (!stored) {
|
|
2428
|
+
return {
|
|
2429
|
+
relatedThread: void 0,
|
|
2430
|
+
relatedMessage: void 0,
|
|
2431
|
+
relatedChannel: void 0
|
|
2432
|
+
};
|
|
2433
|
+
}
|
|
2434
|
+
const adapter = this.adapters.get(adapterName);
|
|
2435
|
+
let relatedThread;
|
|
2436
|
+
if (stored.thread) {
|
|
2437
|
+
relatedThread = ThreadImpl.fromJSON(stored.thread, adapter);
|
|
2438
|
+
}
|
|
2439
|
+
let relatedMessage;
|
|
2440
|
+
if (stored.message && relatedThread) {
|
|
2441
|
+
const message = Message.fromJSON(stored.message);
|
|
2442
|
+
relatedMessage = relatedThread.createSentMessageFromMessage(message);
|
|
2443
|
+
}
|
|
2444
|
+
let relatedChannel;
|
|
2445
|
+
if (stored.channel) {
|
|
2446
|
+
relatedChannel = ChannelImpl.fromJSON(stored.channel, adapter);
|
|
2447
|
+
}
|
|
2448
|
+
return { relatedThread, relatedMessage, relatedChannel };
|
|
2449
|
+
}
|
|
2450
|
+
/**
|
|
2451
|
+
* Handle an action event internally.
|
|
2452
|
+
*/
|
|
2453
|
+
async handleActionEvent(event) {
|
|
2454
|
+
this.logger.debug("Incoming action", {
|
|
2455
|
+
adapter: event.adapter.name,
|
|
2456
|
+
actionId: event.actionId,
|
|
2457
|
+
value: event.value,
|
|
2458
|
+
user: event.user.userName,
|
|
2459
|
+
messageId: event.messageId,
|
|
2460
|
+
threadId: event.threadId
|
|
2461
|
+
});
|
|
2462
|
+
if (event.user.isMe) {
|
|
2463
|
+
this.logger.debug("Skipping action from self", {
|
|
2464
|
+
actionId: event.actionId
|
|
2465
|
+
});
|
|
2466
|
+
return;
|
|
2467
|
+
}
|
|
2468
|
+
const isSubscribed = false;
|
|
2469
|
+
const messageForThread = event.messageId ? new Message({
|
|
2470
|
+
id: event.messageId,
|
|
2471
|
+
threadId: event.threadId,
|
|
2472
|
+
text: "",
|
|
2473
|
+
formatted: { type: "root", children: [] },
|
|
2474
|
+
raw: event.raw,
|
|
2475
|
+
author: event.user,
|
|
2476
|
+
metadata: { dateSent: /* @__PURE__ */ new Date(), edited: false },
|
|
2477
|
+
attachments: []
|
|
2478
|
+
}) : {};
|
|
2479
|
+
const thread = event.threadId ? await this.createThread(
|
|
2480
|
+
event.adapter,
|
|
2481
|
+
event.threadId,
|
|
2482
|
+
messageForThread,
|
|
2483
|
+
isSubscribed
|
|
2484
|
+
) : null;
|
|
2485
|
+
const fullEvent = {
|
|
2486
|
+
...event,
|
|
2487
|
+
thread,
|
|
2488
|
+
openModal: async (modal) => {
|
|
2489
|
+
if (!event.triggerId) {
|
|
2490
|
+
this.logger.warn("Cannot open modal: no triggerId available");
|
|
2491
|
+
return void 0;
|
|
2492
|
+
}
|
|
2493
|
+
if (!event.adapter.openModal) {
|
|
2494
|
+
this.logger.warn(
|
|
2495
|
+
`Cannot open modal: ${event.adapter.name} does not support modals`
|
|
2496
|
+
);
|
|
2497
|
+
return void 0;
|
|
2498
|
+
}
|
|
2499
|
+
let modalElement = modal;
|
|
2500
|
+
if (isJSX(modal)) {
|
|
2501
|
+
const converted = toModalElement(modal);
|
|
2502
|
+
if (!converted) {
|
|
2503
|
+
throw new Error("Invalid JSX element: must be a Modal element");
|
|
2504
|
+
}
|
|
2505
|
+
modalElement = converted;
|
|
2506
|
+
}
|
|
2507
|
+
let message;
|
|
2508
|
+
if (thread) {
|
|
2509
|
+
const isEphemeralMessage = event.messageId?.startsWith("ephemeral:");
|
|
2510
|
+
if (isEphemeralMessage) {
|
|
2511
|
+
const recentMessage = thread.recentMessages[0];
|
|
2512
|
+
if (recentMessage && typeof recentMessage.toJSON === "function") {
|
|
2513
|
+
message = recentMessage;
|
|
2514
|
+
}
|
|
2515
|
+
} else if (event.messageId && event.adapter.fetchMessage) {
|
|
2516
|
+
const fetched = await event.adapter.fetchMessage(event.threadId, event.messageId).catch(() => null);
|
|
2517
|
+
if (fetched) {
|
|
2518
|
+
message = new Message(fetched);
|
|
2519
|
+
} else {
|
|
2520
|
+
const recentMessage = thread.recentMessages[0];
|
|
2521
|
+
if (recentMessage && typeof recentMessage.toJSON === "function") {
|
|
2522
|
+
message = recentMessage;
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
const contextId = crypto.randomUUID();
|
|
2528
|
+
const channel = thread ? thread.channel : void 0;
|
|
2529
|
+
this.storeModalContext(
|
|
2530
|
+
event.adapter.name,
|
|
2531
|
+
contextId,
|
|
2532
|
+
thread ? thread : void 0,
|
|
2533
|
+
message,
|
|
2534
|
+
channel
|
|
2535
|
+
);
|
|
2536
|
+
return event.adapter.openModal(
|
|
2537
|
+
event.triggerId,
|
|
2538
|
+
modalElement,
|
|
2539
|
+
contextId
|
|
2540
|
+
);
|
|
2541
|
+
}
|
|
2542
|
+
};
|
|
2543
|
+
this.logger.debug("Checking action handlers", {
|
|
2544
|
+
handlerCount: this.actionHandlers.length,
|
|
2545
|
+
actionId: event.actionId
|
|
2546
|
+
});
|
|
2547
|
+
for (const { actionIds, handler } of this.actionHandlers) {
|
|
2548
|
+
if (actionIds.length === 0) {
|
|
2549
|
+
this.logger.debug("Running catch-all action handler");
|
|
2550
|
+
await handler(fullEvent);
|
|
2551
|
+
continue;
|
|
2552
|
+
}
|
|
2553
|
+
if (actionIds.includes(event.actionId)) {
|
|
2554
|
+
this.logger.debug("Running matched action handler", {
|
|
2555
|
+
actionId: event.actionId
|
|
2556
|
+
});
|
|
2557
|
+
await handler(fullEvent);
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
/**
|
|
2562
|
+
* Handle a reaction event internally.
|
|
2563
|
+
*/
|
|
2564
|
+
async handleReactionEvent(event) {
|
|
2565
|
+
this.logger.debug("Incoming reaction", {
|
|
2566
|
+
adapter: event.adapter?.name,
|
|
2567
|
+
emoji: event.emoji,
|
|
2568
|
+
rawEmoji: event.rawEmoji,
|
|
2569
|
+
added: event.added,
|
|
2570
|
+
user: event.user.userName,
|
|
2571
|
+
messageId: event.messageId,
|
|
2572
|
+
threadId: event.threadId
|
|
2573
|
+
});
|
|
2574
|
+
if (event.user.isMe) {
|
|
2575
|
+
this.logger.debug("Skipping reaction from self", {
|
|
2576
|
+
emoji: event.emoji
|
|
2577
|
+
});
|
|
2578
|
+
return;
|
|
2579
|
+
}
|
|
2580
|
+
if (!event.adapter) {
|
|
2581
|
+
this.logger.error("Reaction event missing adapter");
|
|
2582
|
+
return;
|
|
2583
|
+
}
|
|
2584
|
+
const isSubscribed = await this._stateAdapter.isSubscribed(event.threadId);
|
|
2585
|
+
const thread = await this.createThread(
|
|
2586
|
+
event.adapter,
|
|
2587
|
+
event.threadId,
|
|
2588
|
+
event.message ?? {},
|
|
2589
|
+
isSubscribed
|
|
2590
|
+
);
|
|
2591
|
+
const fullEvent = {
|
|
2592
|
+
...event,
|
|
2593
|
+
adapter: event.adapter,
|
|
2594
|
+
thread
|
|
2595
|
+
};
|
|
2596
|
+
this.logger.debug("Checking reaction handlers", {
|
|
2597
|
+
handlerCount: this.reactionHandlers.length,
|
|
2598
|
+
emoji: event.emoji.name,
|
|
2599
|
+
rawEmoji: event.rawEmoji
|
|
2600
|
+
});
|
|
2601
|
+
for (const { emoji: emojiFilter, handler } of this.reactionHandlers) {
|
|
2602
|
+
if (emojiFilter.length === 0) {
|
|
2603
|
+
this.logger.debug("Running catch-all reaction handler");
|
|
2604
|
+
await handler(fullEvent);
|
|
2605
|
+
continue;
|
|
2606
|
+
}
|
|
2607
|
+
const matches = emojiFilter.some((filter) => {
|
|
2608
|
+
if (filter === fullEvent.emoji) {
|
|
2609
|
+
return true;
|
|
2610
|
+
}
|
|
2611
|
+
const filterName = typeof filter === "string" ? filter : filter.name;
|
|
2612
|
+
return filterName === fullEvent.emoji.name || filterName === fullEvent.rawEmoji;
|
|
2613
|
+
});
|
|
2614
|
+
this.logger.debug("Reaction filter check", {
|
|
2615
|
+
filterEmoji: emojiFilter.map(
|
|
2616
|
+
(e) => typeof e === "string" ? e : e.name
|
|
2617
|
+
),
|
|
2618
|
+
eventEmoji: fullEvent.emoji.name,
|
|
2619
|
+
matches
|
|
2620
|
+
});
|
|
2621
|
+
if (matches) {
|
|
2622
|
+
this.logger.debug("Running matched reaction handler");
|
|
2623
|
+
await handler(fullEvent);
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
getState() {
|
|
2628
|
+
return this._stateAdapter;
|
|
2629
|
+
}
|
|
2630
|
+
getUserName() {
|
|
2631
|
+
return this.userName;
|
|
2632
|
+
}
|
|
2633
|
+
getLogger(prefix) {
|
|
2634
|
+
if (prefix) {
|
|
2635
|
+
return this.logger.child(prefix);
|
|
2636
|
+
}
|
|
2637
|
+
return this.logger;
|
|
2638
|
+
}
|
|
2639
|
+
/**
|
|
2640
|
+
* Open a direct message conversation with a user.
|
|
2641
|
+
*
|
|
2642
|
+
* Accepts either a user ID string or an Author object (from message.author or event.user).
|
|
2643
|
+
*
|
|
2644
|
+
* The adapter is automatically inferred from the userId format:
|
|
2645
|
+
* - Slack: `U...` (e.g., "U00FAKEUSER1")
|
|
2646
|
+
* - Teams: `29:...` (e.g., "29:198PbJuw...")
|
|
2647
|
+
* - Google Chat: `users/...` (e.g., "users/100000000000000000001")
|
|
2648
|
+
* - Discord: numeric snowflake (e.g., "1033044521375764530")
|
|
2649
|
+
*
|
|
2650
|
+
* @param user - Platform-specific user ID string, or an Author object
|
|
2651
|
+
* @returns A Thread that can be used to post messages
|
|
2652
|
+
*
|
|
2653
|
+
* @example
|
|
2654
|
+
* ```ts
|
|
2655
|
+
* // Using user ID directly
|
|
2656
|
+
* const dmThread = await chat.openDM("U123456");
|
|
2657
|
+
* await dmThread.post("Hello via DM!");
|
|
2658
|
+
*
|
|
2659
|
+
* // Using Author object from a message
|
|
2660
|
+
* chat.onSubscribedMessage(async (thread, message) => {
|
|
2661
|
+
* const dmThread = await chat.openDM(message.author);
|
|
2662
|
+
* await dmThread.post("Hello via DM!");
|
|
2663
|
+
* });
|
|
2664
|
+
* ```
|
|
2665
|
+
*/
|
|
2666
|
+
async openDM(user) {
|
|
2667
|
+
const userId = typeof user === "string" ? user : user.userId;
|
|
2668
|
+
const adapter = this.inferAdapterFromUserId(userId);
|
|
2669
|
+
if (!adapter.openDM) {
|
|
2670
|
+
throw new ChatError(
|
|
2671
|
+
`Adapter "${adapter.name}" does not support openDM`,
|
|
2672
|
+
"NOT_SUPPORTED"
|
|
2673
|
+
);
|
|
2674
|
+
}
|
|
2675
|
+
const threadId = await adapter.openDM(userId);
|
|
2676
|
+
return this.createThread(adapter, threadId, {}, false);
|
|
2677
|
+
}
|
|
2678
|
+
/**
|
|
2679
|
+
* Get a Channel by its channel ID.
|
|
2680
|
+
*
|
|
2681
|
+
* The adapter is automatically inferred from the channel ID prefix.
|
|
2682
|
+
*
|
|
2683
|
+
* @param channelId - Channel ID (e.g., "slack:C123ABC", "gchat:spaces/ABC123")
|
|
2684
|
+
* @returns A Channel that can be used to list threads, post messages, iterate messages, etc.
|
|
2685
|
+
*
|
|
2686
|
+
* @example
|
|
2687
|
+
* ```typescript
|
|
2688
|
+
* const channel = chat.channel("slack:C123ABC");
|
|
2689
|
+
*
|
|
2690
|
+
* // Iterate messages newest first
|
|
2691
|
+
* for await (const msg of channel.messages) {
|
|
2692
|
+
* console.log(msg.text);
|
|
2693
|
+
* }
|
|
2694
|
+
*
|
|
2695
|
+
* // List threads
|
|
2696
|
+
* for await (const t of channel.threads()) {
|
|
2697
|
+
* console.log(t.rootMessage.text, t.replyCount);
|
|
2698
|
+
* }
|
|
2699
|
+
*
|
|
2700
|
+
* // Post to channel
|
|
2701
|
+
* await channel.post("Hello channel!");
|
|
2702
|
+
* ```
|
|
2703
|
+
*/
|
|
2704
|
+
channel(channelId) {
|
|
2705
|
+
const adapterName = channelId.split(":")[0];
|
|
2706
|
+
if (!adapterName) {
|
|
2707
|
+
throw new ChatError(
|
|
2708
|
+
`Invalid channel ID: ${channelId}`,
|
|
2709
|
+
"INVALID_CHANNEL_ID"
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
const adapter = this.adapters.get(adapterName);
|
|
2713
|
+
if (!adapter) {
|
|
2714
|
+
throw new ChatError(
|
|
2715
|
+
`Adapter "${adapterName}" not found for channel ID "${channelId}"`,
|
|
2716
|
+
"ADAPTER_NOT_FOUND"
|
|
2717
|
+
);
|
|
2718
|
+
}
|
|
2719
|
+
return new ChannelImpl({
|
|
2720
|
+
id: channelId,
|
|
2721
|
+
adapter,
|
|
2722
|
+
stateAdapter: this._stateAdapter
|
|
2723
|
+
});
|
|
2724
|
+
}
|
|
2725
|
+
/**
|
|
2726
|
+
* Infer which adapter to use based on the userId format.
|
|
2727
|
+
*/
|
|
2728
|
+
inferAdapterFromUserId(userId) {
|
|
2729
|
+
if (userId.startsWith("users/")) {
|
|
2730
|
+
const adapter = this.adapters.get("gchat");
|
|
2731
|
+
if (adapter) {
|
|
2732
|
+
return adapter;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
if (userId.startsWith("29:")) {
|
|
2736
|
+
const adapter = this.adapters.get("teams");
|
|
2737
|
+
if (adapter) {
|
|
2738
|
+
return adapter;
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
if (SLACK_USER_ID_REGEX.test(userId)) {
|
|
2742
|
+
const adapter = this.adapters.get("slack");
|
|
2743
|
+
if (adapter) {
|
|
2744
|
+
return adapter;
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
if (DISCORD_SNOWFLAKE_REGEX.test(userId)) {
|
|
2748
|
+
const adapter = this.adapters.get("discord");
|
|
2749
|
+
if (adapter) {
|
|
2750
|
+
return adapter;
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2753
|
+
throw new ChatError(
|
|
2754
|
+
`Cannot infer adapter from userId "${userId}". Expected format: Slack (U...), Teams (29:...), Google Chat (users/...), or Discord (numeric snowflake).`,
|
|
2755
|
+
"UNKNOWN_USER_ID_FORMAT"
|
|
2756
|
+
);
|
|
2757
|
+
}
|
|
2758
|
+
/**
|
|
2759
|
+
* Handle an incoming message from an adapter.
|
|
2760
|
+
* This is called by adapters when they receive a webhook.
|
|
2761
|
+
*
|
|
2762
|
+
* The Chat class handles common concerns centrally:
|
|
2763
|
+
* - Deduplication: Same message may arrive multiple times (e.g., Slack sends
|
|
2764
|
+
* both `message` and `app_mention` events, GChat sends direct webhook + Pub/Sub)
|
|
2765
|
+
* - Bot filtering: Messages from the bot itself are skipped
|
|
2766
|
+
* - Locking: Only one instance processes a thread at a time
|
|
2767
|
+
*/
|
|
2768
|
+
async handleIncomingMessage(adapter, threadId, message) {
|
|
2769
|
+
this.logger.debug("Incoming message", {
|
|
2770
|
+
adapter: adapter.name,
|
|
2771
|
+
threadId,
|
|
2772
|
+
messageId: message.id,
|
|
2773
|
+
text: message.text,
|
|
2774
|
+
author: message.author.userName,
|
|
2775
|
+
authorUserId: message.author.userId,
|
|
2776
|
+
isBot: message.author.isBot,
|
|
2777
|
+
isMe: message.author.isMe
|
|
2778
|
+
});
|
|
2779
|
+
if (message.author.isMe) {
|
|
2780
|
+
this.logger.debug("Skipping message from self (isMe=true)", {
|
|
2781
|
+
adapter: adapter.name,
|
|
2782
|
+
threadId,
|
|
2783
|
+
author: message.author.userName
|
|
2784
|
+
});
|
|
2785
|
+
return;
|
|
2786
|
+
}
|
|
2787
|
+
const dedupeKey = `dedupe:${adapter.name}:${message.id}`;
|
|
2788
|
+
const isFirstProcess = await this._stateAdapter.setIfNotExists(
|
|
2789
|
+
dedupeKey,
|
|
2790
|
+
true,
|
|
2791
|
+
this._dedupeTtlMs
|
|
2792
|
+
);
|
|
2793
|
+
if (!isFirstProcess) {
|
|
2794
|
+
this.logger.debug("Skipping duplicate message", {
|
|
2795
|
+
adapter: adapter.name,
|
|
2796
|
+
messageId: message.id
|
|
2797
|
+
});
|
|
2798
|
+
return;
|
|
2799
|
+
}
|
|
2800
|
+
if (adapter.persistMessageHistory) {
|
|
2801
|
+
const channelId = adapter.channelIdFromThreadId(threadId);
|
|
2802
|
+
const appends = [this._messageHistory.append(threadId, message)];
|
|
2803
|
+
if (channelId !== threadId) {
|
|
2804
|
+
appends.push(this._messageHistory.append(channelId, message));
|
|
2805
|
+
}
|
|
2806
|
+
await Promise.all(appends);
|
|
2807
|
+
}
|
|
2808
|
+
let lock = await this._stateAdapter.acquireLock(
|
|
2809
|
+
threadId,
|
|
2810
|
+
DEFAULT_LOCK_TTL_MS
|
|
2811
|
+
);
|
|
2812
|
+
if (!lock) {
|
|
2813
|
+
const resolution = typeof this._onLockConflict === "function" ? await this._onLockConflict(threadId, message) : this._onLockConflict ?? "drop";
|
|
2814
|
+
if (resolution === "force") {
|
|
2815
|
+
this.logger.info("Force-releasing lock on thread", { threadId });
|
|
2816
|
+
await this._stateAdapter.forceReleaseLock(threadId);
|
|
2817
|
+
lock = await this._stateAdapter.acquireLock(
|
|
2818
|
+
threadId,
|
|
2819
|
+
DEFAULT_LOCK_TTL_MS
|
|
2820
|
+
);
|
|
2821
|
+
}
|
|
2822
|
+
if (!lock) {
|
|
2823
|
+
this.logger.warn("Could not acquire lock on thread", { threadId });
|
|
2824
|
+
throw new LockError(
|
|
2825
|
+
`Could not acquire lock on thread ${threadId}. Another instance may be processing.`
|
|
2826
|
+
);
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
this.logger.debug("Lock acquired", { threadId, token: lock.token });
|
|
2830
|
+
try {
|
|
2831
|
+
message.isMention = message.isMention || this.detectMention(adapter, message);
|
|
2832
|
+
const isSubscribed = await this._stateAdapter.isSubscribed(threadId);
|
|
2833
|
+
this.logger.debug("Subscription check", {
|
|
2834
|
+
threadId,
|
|
2835
|
+
isSubscribed,
|
|
2836
|
+
subscribedHandlerCount: this.subscribedMessageHandlers.length
|
|
2837
|
+
});
|
|
2838
|
+
const thread = await this.createThread(
|
|
2839
|
+
adapter,
|
|
2840
|
+
threadId,
|
|
2841
|
+
message,
|
|
2842
|
+
isSubscribed
|
|
2843
|
+
);
|
|
2844
|
+
const isDM = adapter.isDM?.(threadId) ?? false;
|
|
2845
|
+
if (isDM && this.directMessageHandlers.length > 0) {
|
|
2846
|
+
this.logger.debug("Direct message received - calling handlers", {
|
|
2847
|
+
threadId,
|
|
2848
|
+
handlerCount: this.directMessageHandlers.length
|
|
2849
|
+
});
|
|
2850
|
+
const channel = thread.channel;
|
|
2851
|
+
for (const handler of this.directMessageHandlers) {
|
|
2852
|
+
await handler(thread, message, channel);
|
|
2853
|
+
}
|
|
2854
|
+
return;
|
|
2855
|
+
}
|
|
2856
|
+
if (isDM) {
|
|
2857
|
+
message.isMention = true;
|
|
2858
|
+
}
|
|
2859
|
+
if (isSubscribed) {
|
|
2860
|
+
this.logger.debug("Message in subscribed thread - calling handlers", {
|
|
2861
|
+
threadId,
|
|
2862
|
+
handlerCount: this.subscribedMessageHandlers.length
|
|
2863
|
+
});
|
|
2864
|
+
await this.runHandlers(this.subscribedMessageHandlers, thread, message);
|
|
2865
|
+
return;
|
|
2866
|
+
}
|
|
2867
|
+
if (message.isMention) {
|
|
2868
|
+
this.logger.debug("Bot mentioned", {
|
|
2869
|
+
threadId,
|
|
2870
|
+
text: message.text.slice(0, 100)
|
|
2871
|
+
});
|
|
2872
|
+
await this.runHandlers(this.mentionHandlers, thread, message);
|
|
2873
|
+
return;
|
|
2874
|
+
}
|
|
2875
|
+
this.logger.debug("Checking message patterns", {
|
|
2876
|
+
patternCount: this.messagePatterns.length,
|
|
2877
|
+
patterns: this.messagePatterns.map((p) => p.pattern.toString()),
|
|
2878
|
+
messageText: message.text
|
|
2879
|
+
});
|
|
2880
|
+
let matchedPattern = false;
|
|
2881
|
+
for (const { pattern, handler } of this.messagePatterns) {
|
|
2882
|
+
const matches = pattern.test(message.text);
|
|
2883
|
+
this.logger.debug("Pattern test", {
|
|
2884
|
+
pattern: pattern.toString(),
|
|
2885
|
+
text: message.text,
|
|
2886
|
+
matches
|
|
2887
|
+
});
|
|
2888
|
+
if (matches) {
|
|
2889
|
+
this.logger.debug("Message matched pattern - calling handler", {
|
|
2890
|
+
pattern: pattern.toString()
|
|
2891
|
+
});
|
|
2892
|
+
matchedPattern = true;
|
|
2893
|
+
await handler(thread, message);
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
if (!matchedPattern) {
|
|
2897
|
+
this.logger.debug("No handlers matched message", {
|
|
2898
|
+
threadId,
|
|
2899
|
+
text: message.text.slice(0, 100)
|
|
2900
|
+
});
|
|
2901
|
+
}
|
|
2902
|
+
} finally {
|
|
2903
|
+
await this._stateAdapter.releaseLock(lock);
|
|
2904
|
+
this.logger.debug("Lock released", { threadId });
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
createThread(adapter, threadId, initialMessage, isSubscribedContext = false) {
|
|
2908
|
+
const parts = threadId.split(":");
|
|
2909
|
+
const channelId = parts[1] || "";
|
|
2910
|
+
const isDM = adapter.isDM?.(threadId) ?? false;
|
|
2911
|
+
return new ThreadImpl({
|
|
2912
|
+
id: threadId,
|
|
2913
|
+
adapter,
|
|
2914
|
+
channelId,
|
|
2915
|
+
stateAdapter: this._stateAdapter,
|
|
2916
|
+
initialMessage,
|
|
2917
|
+
isSubscribedContext,
|
|
2918
|
+
isDM,
|
|
2919
|
+
currentMessage: initialMessage,
|
|
2920
|
+
logger: this.logger,
|
|
2921
|
+
streamingUpdateIntervalMs: this._streamingUpdateIntervalMs,
|
|
2922
|
+
fallbackStreamingPlaceholderText: this._fallbackStreamingPlaceholderText,
|
|
2923
|
+
messageHistory: adapter.persistMessageHistory ? this._messageHistory : void 0
|
|
2924
|
+
});
|
|
2925
|
+
}
|
|
2926
|
+
/**
|
|
2927
|
+
* Detect if the bot was mentioned in the message.
|
|
2928
|
+
* All adapters normalize mentions to @name format, so we just check for @username.
|
|
2929
|
+
*/
|
|
2930
|
+
detectMention(adapter, message) {
|
|
2931
|
+
const botUserName = adapter.userName || this.userName;
|
|
2932
|
+
const botUserId = adapter.botUserId;
|
|
2933
|
+
const usernamePattern = new RegExp(
|
|
2934
|
+
`@${this.escapeRegex(botUserName)}\\b`,
|
|
2935
|
+
"i"
|
|
2936
|
+
);
|
|
2937
|
+
if (usernamePattern.test(message.text)) {
|
|
2938
|
+
return true;
|
|
2939
|
+
}
|
|
2940
|
+
if (botUserId) {
|
|
2941
|
+
const userIdPattern = new RegExp(
|
|
2942
|
+
`@${this.escapeRegex(botUserId)}\\b`,
|
|
2943
|
+
"i"
|
|
2944
|
+
);
|
|
2945
|
+
if (userIdPattern.test(message.text)) {
|
|
2946
|
+
return true;
|
|
2947
|
+
}
|
|
2948
|
+
const discordPattern = new RegExp(
|
|
2949
|
+
`<@!?${this.escapeRegex(botUserId)}>`,
|
|
2950
|
+
"i"
|
|
2951
|
+
);
|
|
2952
|
+
if (discordPattern.test(message.text)) {
|
|
2953
|
+
return true;
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2956
|
+
return false;
|
|
2957
|
+
}
|
|
2958
|
+
escapeRegex(str) {
|
|
2959
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2960
|
+
}
|
|
2961
|
+
async runHandlers(handlers, thread, message) {
|
|
2962
|
+
for (const handler of handlers) {
|
|
2963
|
+
await handler(thread, message);
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
};
|
|
2967
|
+
|
|
2968
|
+
// src/emoji.ts
|
|
2969
|
+
var emojiRegistry = /* @__PURE__ */ new Map();
|
|
2970
|
+
function getEmoji(name) {
|
|
2971
|
+
let emojiValue = emojiRegistry.get(name);
|
|
2972
|
+
if (!emojiValue) {
|
|
2973
|
+
emojiValue = Object.freeze({
|
|
2974
|
+
name,
|
|
2975
|
+
toString: () => `{{emoji:${name}}}`,
|
|
2976
|
+
toJSON: () => `{{emoji:${name}}}`
|
|
2977
|
+
});
|
|
2978
|
+
emojiRegistry.set(name, emojiValue);
|
|
2979
|
+
}
|
|
2980
|
+
return emojiValue;
|
|
2981
|
+
}
|
|
2982
|
+
var DEFAULT_EMOJI_MAP = {
|
|
2983
|
+
// Reactions & Gestures
|
|
2984
|
+
thumbs_up: { slack: ["+1", "thumbsup"], gchat: "\u{1F44D}" },
|
|
2985
|
+
thumbs_down: { slack: ["-1", "thumbsdown"], gchat: "\u{1F44E}" },
|
|
2986
|
+
clap: { slack: "clap", gchat: "\u{1F44F}" },
|
|
2987
|
+
wave: { slack: "wave", gchat: "\u{1F44B}" },
|
|
2988
|
+
pray: { slack: "pray", gchat: "\u{1F64F}" },
|
|
2989
|
+
muscle: { slack: "muscle", gchat: "\u{1F4AA}" },
|
|
2990
|
+
ok_hand: { slack: "ok_hand", gchat: "\u{1F44C}" },
|
|
2991
|
+
point_up: { slack: "point_up", gchat: "\u{1F446}" },
|
|
2992
|
+
point_down: { slack: "point_down", gchat: "\u{1F447}" },
|
|
2993
|
+
point_left: { slack: "point_left", gchat: "\u{1F448}" },
|
|
2994
|
+
point_right: { slack: "point_right", gchat: "\u{1F449}" },
|
|
2995
|
+
raised_hands: { slack: "raised_hands", gchat: "\u{1F64C}" },
|
|
2996
|
+
shrug: { slack: "shrug", gchat: "\u{1F937}" },
|
|
2997
|
+
facepalm: { slack: "facepalm", gchat: "\u{1F926}" },
|
|
2998
|
+
// Emotions & Faces
|
|
2999
|
+
heart: { slack: "heart", gchat: ["\u2764\uFE0F", "\u2764"] },
|
|
3000
|
+
smile: { slack: ["smile", "slightly_smiling_face"], gchat: "\u{1F60A}" },
|
|
3001
|
+
laugh: { slack: ["laughing", "satisfied", "joy"], gchat: ["\u{1F602}", "\u{1F606}"] },
|
|
3002
|
+
thinking: { slack: "thinking_face", gchat: "\u{1F914}" },
|
|
3003
|
+
sad: { slack: ["cry", "sad", "white_frowning_face"], gchat: "\u{1F622}" },
|
|
3004
|
+
cry: { slack: "sob", gchat: "\u{1F62D}" },
|
|
3005
|
+
angry: { slack: "angry", gchat: "\u{1F620}" },
|
|
3006
|
+
love_eyes: { slack: "heart_eyes", gchat: "\u{1F60D}" },
|
|
3007
|
+
cool: { slack: "sunglasses", gchat: "\u{1F60E}" },
|
|
3008
|
+
wink: { slack: "wink", gchat: "\u{1F609}" },
|
|
3009
|
+
surprised: { slack: "open_mouth", gchat: "\u{1F62E}" },
|
|
3010
|
+
worried: { slack: "worried", gchat: "\u{1F61F}" },
|
|
3011
|
+
confused: { slack: "confused", gchat: "\u{1F615}" },
|
|
3012
|
+
neutral: { slack: "neutral_face", gchat: "\u{1F610}" },
|
|
3013
|
+
sleeping: { slack: "sleeping", gchat: "\u{1F634}" },
|
|
3014
|
+
sick: { slack: "nauseated_face", gchat: "\u{1F922}" },
|
|
3015
|
+
mind_blown: { slack: "exploding_head", gchat: "\u{1F92F}" },
|
|
3016
|
+
relieved: { slack: "relieved", gchat: "\u{1F60C}" },
|
|
3017
|
+
grimace: { slack: "grimacing", gchat: "\u{1F62C}" },
|
|
3018
|
+
rolling_eyes: { slack: "rolling_eyes", gchat: "\u{1F644}" },
|
|
3019
|
+
hug: { slack: "hugging_face", gchat: "\u{1F917}" },
|
|
3020
|
+
zany: { slack: "zany_face", gchat: "\u{1F92A}" },
|
|
3021
|
+
// Status & Symbols
|
|
3022
|
+
check: {
|
|
3023
|
+
slack: ["white_check_mark", "heavy_check_mark"],
|
|
3024
|
+
gchat: ["\u2705", "\u2714\uFE0F"]
|
|
3025
|
+
},
|
|
3026
|
+
x: { slack: ["x", "heavy_multiplication_x"], gchat: ["\u274C", "\u2716\uFE0F"] },
|
|
3027
|
+
question: { slack: "question", gchat: ["\u2753", "?"] },
|
|
3028
|
+
exclamation: { slack: "exclamation", gchat: "\u2757" },
|
|
3029
|
+
warning: { slack: "warning", gchat: "\u26A0\uFE0F" },
|
|
3030
|
+
stop: { slack: "octagonal_sign", gchat: "\u{1F6D1}" },
|
|
3031
|
+
info: { slack: "information_source", gchat: "\u2139\uFE0F" },
|
|
3032
|
+
"100": { slack: "100", gchat: "\u{1F4AF}" },
|
|
3033
|
+
fire: { slack: "fire", gchat: "\u{1F525}" },
|
|
3034
|
+
star: { slack: "star", gchat: "\u2B50" },
|
|
3035
|
+
sparkles: { slack: "sparkles", gchat: "\u2728" },
|
|
3036
|
+
lightning: { slack: "zap", gchat: "\u26A1" },
|
|
3037
|
+
boom: { slack: "boom", gchat: "\u{1F4A5}" },
|
|
3038
|
+
eyes: { slack: "eyes", gchat: "\u{1F440}" },
|
|
3039
|
+
// Status Indicators (colored circles)
|
|
3040
|
+
green_circle: { slack: "large_green_circle", gchat: "\u{1F7E2}" },
|
|
3041
|
+
yellow_circle: { slack: "large_yellow_circle", gchat: "\u{1F7E1}" },
|
|
3042
|
+
red_circle: { slack: "red_circle", gchat: "\u{1F534}" },
|
|
3043
|
+
blue_circle: { slack: "large_blue_circle", gchat: "\u{1F535}" },
|
|
3044
|
+
white_circle: { slack: "white_circle", gchat: "\u26AA" },
|
|
3045
|
+
black_circle: { slack: "black_circle", gchat: "\u26AB" },
|
|
3046
|
+
// Objects & Tools
|
|
3047
|
+
rocket: { slack: "rocket", gchat: "\u{1F680}" },
|
|
3048
|
+
party: { slack: ["tada", "partying_face"], gchat: ["\u{1F389}", "\u{1F973}"] },
|
|
3049
|
+
confetti: { slack: "confetti_ball", gchat: "\u{1F38A}" },
|
|
3050
|
+
balloon: { slack: "balloon", gchat: "\u{1F388}" },
|
|
3051
|
+
gift: { slack: "gift", gchat: "\u{1F381}" },
|
|
3052
|
+
trophy: { slack: "trophy", gchat: "\u{1F3C6}" },
|
|
3053
|
+
medal: { slack: "first_place_medal", gchat: "\u{1F947}" },
|
|
3054
|
+
lightbulb: { slack: "bulb", gchat: "\u{1F4A1}" },
|
|
3055
|
+
gear: { slack: "gear", gchat: "\u2699\uFE0F" },
|
|
3056
|
+
wrench: { slack: "wrench", gchat: "\u{1F527}" },
|
|
3057
|
+
hammer: { slack: "hammer", gchat: "\u{1F528}" },
|
|
3058
|
+
bug: { slack: "bug", gchat: "\u{1F41B}" },
|
|
3059
|
+
link: { slack: "link", gchat: "\u{1F517}" },
|
|
3060
|
+
lock: { slack: "lock", gchat: "\u{1F512}" },
|
|
3061
|
+
unlock: { slack: "unlock", gchat: "\u{1F513}" },
|
|
3062
|
+
key: { slack: "key", gchat: "\u{1F511}" },
|
|
3063
|
+
pin: { slack: "pushpin", gchat: "\u{1F4CC}" },
|
|
3064
|
+
memo: { slack: "memo", gchat: "\u{1F4DD}" },
|
|
3065
|
+
clipboard: { slack: "clipboard", gchat: "\u{1F4CB}" },
|
|
3066
|
+
calendar: { slack: "calendar", gchat: "\u{1F4C5}" },
|
|
3067
|
+
clock: { slack: "clock1", gchat: "\u{1F550}" },
|
|
3068
|
+
hourglass: { slack: "hourglass", gchat: "\u23F3" },
|
|
3069
|
+
bell: { slack: "bell", gchat: "\u{1F514}" },
|
|
3070
|
+
megaphone: { slack: "mega", gchat: "\u{1F4E2}" },
|
|
3071
|
+
speech_bubble: { slack: "speech_balloon", gchat: "\u{1F4AC}" },
|
|
3072
|
+
email: { slack: "email", gchat: "\u{1F4E7}" },
|
|
3073
|
+
inbox: { slack: "inbox_tray", gchat: "\u{1F4E5}" },
|
|
3074
|
+
outbox: { slack: "outbox_tray", gchat: "\u{1F4E4}" },
|
|
3075
|
+
package: { slack: "package", gchat: "\u{1F4E6}" },
|
|
3076
|
+
folder: { slack: "file_folder", gchat: "\u{1F4C1}" },
|
|
3077
|
+
file: { slack: "page_facing_up", gchat: "\u{1F4C4}" },
|
|
3078
|
+
chart_up: { slack: "chart_with_upwards_trend", gchat: "\u{1F4C8}" },
|
|
3079
|
+
chart_down: { slack: "chart_with_downwards_trend", gchat: "\u{1F4C9}" },
|
|
3080
|
+
coffee: { slack: "coffee", gchat: "\u2615" },
|
|
3081
|
+
pizza: { slack: "pizza", gchat: "\u{1F355}" },
|
|
3082
|
+
beer: { slack: "beer", gchat: "\u{1F37A}" },
|
|
3083
|
+
// Arrows & Directions
|
|
3084
|
+
arrow_up: { slack: "arrow_up", gchat: "\u2B06\uFE0F" },
|
|
3085
|
+
arrow_down: { slack: "arrow_down", gchat: "\u2B07\uFE0F" },
|
|
3086
|
+
arrow_left: { slack: "arrow_left", gchat: "\u2B05\uFE0F" },
|
|
3087
|
+
arrow_right: { slack: "arrow_right", gchat: "\u27A1\uFE0F" },
|
|
3088
|
+
refresh: { slack: "arrows_counterclockwise", gchat: "\u{1F504}" },
|
|
3089
|
+
// Nature & Weather
|
|
3090
|
+
sun: { slack: "sunny", gchat: "\u2600\uFE0F" },
|
|
3091
|
+
cloud: { slack: "cloud", gchat: "\u2601\uFE0F" },
|
|
3092
|
+
rain: { slack: "rain_cloud", gchat: "\u{1F327}\uFE0F" },
|
|
3093
|
+
snow: { slack: "snowflake", gchat: "\u2744\uFE0F" },
|
|
3094
|
+
rainbow: { slack: "rainbow", gchat: "\u{1F308}" }
|
|
3095
|
+
};
|
|
3096
|
+
var EmojiResolver = class {
|
|
3097
|
+
emojiMap;
|
|
3098
|
+
slackToNormalized;
|
|
3099
|
+
gchatToNormalized;
|
|
3100
|
+
constructor(customMap) {
|
|
3101
|
+
this.emojiMap = { ...DEFAULT_EMOJI_MAP, ...customMap };
|
|
3102
|
+
this.slackToNormalized = /* @__PURE__ */ new Map();
|
|
3103
|
+
this.gchatToNormalized = /* @__PURE__ */ new Map();
|
|
3104
|
+
this.buildReverseMaps();
|
|
3105
|
+
}
|
|
3106
|
+
buildReverseMaps() {
|
|
3107
|
+
for (const [normalized, formats] of Object.entries(this.emojiMap)) {
|
|
3108
|
+
const slackFormats = Array.isArray(formats.slack) ? formats.slack : [formats.slack];
|
|
3109
|
+
for (const slack of slackFormats) {
|
|
3110
|
+
this.slackToNormalized.set(slack.toLowerCase(), normalized);
|
|
3111
|
+
}
|
|
3112
|
+
const gchatFormats = Array.isArray(formats.gchat) ? formats.gchat : [formats.gchat];
|
|
3113
|
+
for (const gchat of gchatFormats) {
|
|
3114
|
+
this.gchatToNormalized.set(gchat, normalized);
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
/**
|
|
3119
|
+
* Convert a Slack emoji name to normalized EmojiValue.
|
|
3120
|
+
* Returns an EmojiValue for the raw emoji if no mapping exists.
|
|
3121
|
+
*/
|
|
3122
|
+
fromSlack(slackEmoji) {
|
|
3123
|
+
const cleaned = slackEmoji.replace(/^:|:$/g, "").toLowerCase();
|
|
3124
|
+
const normalized = this.slackToNormalized.get(cleaned) ?? slackEmoji;
|
|
3125
|
+
return getEmoji(normalized);
|
|
3126
|
+
}
|
|
3127
|
+
/**
|
|
3128
|
+
* Convert a Google Chat unicode emoji to normalized EmojiValue.
|
|
3129
|
+
* Returns an EmojiValue for the raw emoji if no mapping exists.
|
|
3130
|
+
*/
|
|
3131
|
+
fromGChat(gchatEmoji) {
|
|
3132
|
+
const normalized = this.gchatToNormalized.get(gchatEmoji) ?? gchatEmoji;
|
|
3133
|
+
return getEmoji(normalized);
|
|
3134
|
+
}
|
|
3135
|
+
/**
|
|
3136
|
+
* Convert a Teams reaction type to normalized EmojiValue.
|
|
3137
|
+
* Teams uses specific names: like, heart, laugh, surprised, sad, angry
|
|
3138
|
+
* Returns an EmojiValue for the raw reaction if no mapping exists.
|
|
3139
|
+
*/
|
|
3140
|
+
fromTeams(teamsReaction) {
|
|
3141
|
+
const teamsMap = {
|
|
3142
|
+
like: "thumbs_up",
|
|
3143
|
+
heart: "heart",
|
|
3144
|
+
laugh: "laugh",
|
|
3145
|
+
surprised: "surprised",
|
|
3146
|
+
sad: "sad",
|
|
3147
|
+
angry: "angry"
|
|
3148
|
+
};
|
|
3149
|
+
const normalized = teamsMap[teamsReaction] ?? teamsReaction;
|
|
3150
|
+
return getEmoji(normalized);
|
|
3151
|
+
}
|
|
3152
|
+
/**
|
|
3153
|
+
* Convert a normalized emoji (or EmojiValue) to Slack format.
|
|
3154
|
+
* Returns the first Slack format if multiple exist.
|
|
3155
|
+
*/
|
|
3156
|
+
toSlack(emoji2) {
|
|
3157
|
+
const name = typeof emoji2 === "string" ? emoji2 : emoji2.name;
|
|
3158
|
+
const formats = this.emojiMap[name];
|
|
3159
|
+
if (!formats) {
|
|
3160
|
+
return name;
|
|
3161
|
+
}
|
|
3162
|
+
return Array.isArray(formats.slack) ? formats.slack[0] : formats.slack;
|
|
3163
|
+
}
|
|
3164
|
+
/**
|
|
3165
|
+
* Convert a normalized emoji (or EmojiValue) to Google Chat format.
|
|
3166
|
+
* Returns the first GChat format if multiple exist.
|
|
3167
|
+
*/
|
|
3168
|
+
toGChat(emoji2) {
|
|
3169
|
+
const name = typeof emoji2 === "string" ? emoji2 : emoji2.name;
|
|
3170
|
+
const formats = this.emojiMap[name];
|
|
3171
|
+
if (!formats) {
|
|
3172
|
+
return name;
|
|
3173
|
+
}
|
|
3174
|
+
return Array.isArray(formats.gchat) ? formats.gchat[0] : formats.gchat;
|
|
3175
|
+
}
|
|
3176
|
+
/**
|
|
3177
|
+
* Convert a normalized emoji (or EmojiValue) to Discord format (unicode).
|
|
3178
|
+
* Discord uses unicode emoji, same as Google Chat.
|
|
3179
|
+
*/
|
|
3180
|
+
toDiscord(emoji2) {
|
|
3181
|
+
return this.toGChat(emoji2);
|
|
3182
|
+
}
|
|
3183
|
+
/**
|
|
3184
|
+
* Check if an emoji (in any format) matches a normalized emoji name or EmojiValue.
|
|
3185
|
+
*/
|
|
3186
|
+
matches(rawEmoji, normalized) {
|
|
3187
|
+
const name = typeof normalized === "string" ? normalized : normalized.name;
|
|
3188
|
+
const formats = this.emojiMap[name];
|
|
3189
|
+
if (!formats) {
|
|
3190
|
+
return rawEmoji === name;
|
|
3191
|
+
}
|
|
3192
|
+
const slackFormats = Array.isArray(formats.slack) ? formats.slack : [formats.slack];
|
|
3193
|
+
const gchatFormats = Array.isArray(formats.gchat) ? formats.gchat : [formats.gchat];
|
|
3194
|
+
const cleanedRaw = rawEmoji.replace(/^:|:$/g, "").toLowerCase();
|
|
3195
|
+
return slackFormats.some((s) => s.toLowerCase() === cleanedRaw) || gchatFormats.includes(rawEmoji);
|
|
3196
|
+
}
|
|
3197
|
+
/**
|
|
3198
|
+
* Add or override emoji mappings.
|
|
3199
|
+
*/
|
|
3200
|
+
extend(customMap) {
|
|
3201
|
+
Object.assign(this.emojiMap, customMap);
|
|
3202
|
+
this.buildReverseMaps();
|
|
3203
|
+
}
|
|
3204
|
+
};
|
|
3205
|
+
var defaultEmojiResolver = new EmojiResolver();
|
|
3206
|
+
var EMOJI_PLACEHOLDER_REGEX = /\{\{emoji:([a-z0-9_]+)\}\}/gi;
|
|
3207
|
+
function convertEmojiPlaceholders(text2, platform, resolver = defaultEmojiResolver) {
|
|
3208
|
+
return text2.replace(EMOJI_PLACEHOLDER_REGEX, (_, emojiName) => {
|
|
3209
|
+
switch (platform) {
|
|
3210
|
+
case "slack":
|
|
3211
|
+
return `:${resolver.toSlack(emojiName)}:`;
|
|
3212
|
+
case "gchat":
|
|
3213
|
+
return resolver.toGChat(emojiName);
|
|
3214
|
+
case "teams":
|
|
3215
|
+
return resolver.toGChat(emojiName);
|
|
3216
|
+
case "discord":
|
|
3217
|
+
return resolver.toDiscord(emojiName);
|
|
3218
|
+
case "github":
|
|
3219
|
+
return resolver.toGChat(emojiName);
|
|
3220
|
+
case "linear":
|
|
3221
|
+
return resolver.toGChat(emojiName);
|
|
3222
|
+
case "whatsapp":
|
|
3223
|
+
return resolver.toGChat(emojiName);
|
|
3224
|
+
default:
|
|
3225
|
+
return resolver.toGChat(emojiName);
|
|
3226
|
+
}
|
|
3227
|
+
});
|
|
3228
|
+
}
|
|
3229
|
+
function createEmoji(customEmoji) {
|
|
3230
|
+
const wellKnownEmoji = [
|
|
3231
|
+
// Reactions & Gestures
|
|
3232
|
+
"thumbs_up",
|
|
3233
|
+
"thumbs_down",
|
|
3234
|
+
"clap",
|
|
3235
|
+
"wave",
|
|
3236
|
+
"pray",
|
|
3237
|
+
"muscle",
|
|
3238
|
+
"ok_hand",
|
|
3239
|
+
"point_up",
|
|
3240
|
+
"point_down",
|
|
3241
|
+
"point_left",
|
|
3242
|
+
"point_right",
|
|
3243
|
+
"raised_hands",
|
|
3244
|
+
"shrug",
|
|
3245
|
+
"facepalm",
|
|
3246
|
+
// Emotions & Faces
|
|
3247
|
+
"heart",
|
|
3248
|
+
"smile",
|
|
3249
|
+
"laugh",
|
|
3250
|
+
"thinking",
|
|
3251
|
+
"sad",
|
|
3252
|
+
"cry",
|
|
3253
|
+
"angry",
|
|
3254
|
+
"love_eyes",
|
|
3255
|
+
"cool",
|
|
3256
|
+
"wink",
|
|
3257
|
+
"surprised",
|
|
3258
|
+
"worried",
|
|
3259
|
+
"confused",
|
|
3260
|
+
"neutral",
|
|
3261
|
+
"sleeping",
|
|
3262
|
+
"sick",
|
|
3263
|
+
"mind_blown",
|
|
3264
|
+
"relieved",
|
|
3265
|
+
"grimace",
|
|
3266
|
+
"rolling_eyes",
|
|
3267
|
+
"hug",
|
|
3268
|
+
"zany",
|
|
3269
|
+
// Status & Symbols
|
|
3270
|
+
"check",
|
|
3271
|
+
"x",
|
|
3272
|
+
"question",
|
|
3273
|
+
"exclamation",
|
|
3274
|
+
"warning",
|
|
3275
|
+
"stop",
|
|
3276
|
+
"info",
|
|
3277
|
+
"100",
|
|
3278
|
+
"fire",
|
|
3279
|
+
"star",
|
|
3280
|
+
"sparkles",
|
|
3281
|
+
"lightning",
|
|
3282
|
+
"boom",
|
|
3283
|
+
"eyes",
|
|
3284
|
+
// Status Indicators
|
|
3285
|
+
"green_circle",
|
|
3286
|
+
"yellow_circle",
|
|
3287
|
+
"red_circle",
|
|
3288
|
+
"blue_circle",
|
|
3289
|
+
"white_circle",
|
|
3290
|
+
"black_circle",
|
|
3291
|
+
// Objects & Tools
|
|
3292
|
+
"rocket",
|
|
3293
|
+
"party",
|
|
3294
|
+
"confetti",
|
|
3295
|
+
"balloon",
|
|
3296
|
+
"gift",
|
|
3297
|
+
"trophy",
|
|
3298
|
+
"medal",
|
|
3299
|
+
"lightbulb",
|
|
3300
|
+
"gear",
|
|
3301
|
+
"wrench",
|
|
3302
|
+
"hammer",
|
|
3303
|
+
"bug",
|
|
3304
|
+
"link",
|
|
3305
|
+
"lock",
|
|
3306
|
+
"unlock",
|
|
3307
|
+
"key",
|
|
3308
|
+
"pin",
|
|
3309
|
+
"memo",
|
|
3310
|
+
"clipboard",
|
|
3311
|
+
"calendar",
|
|
3312
|
+
"clock",
|
|
3313
|
+
"hourglass",
|
|
3314
|
+
"bell",
|
|
3315
|
+
"megaphone",
|
|
3316
|
+
"speech_bubble",
|
|
3317
|
+
"email",
|
|
3318
|
+
"inbox",
|
|
3319
|
+
"outbox",
|
|
3320
|
+
"package",
|
|
3321
|
+
"folder",
|
|
3322
|
+
"file",
|
|
3323
|
+
"chart_up",
|
|
3324
|
+
"chart_down",
|
|
3325
|
+
"coffee",
|
|
3326
|
+
"pizza",
|
|
3327
|
+
"beer",
|
|
3328
|
+
// Arrows & Directions
|
|
3329
|
+
"arrow_up",
|
|
3330
|
+
"arrow_down",
|
|
3331
|
+
"arrow_left",
|
|
3332
|
+
"arrow_right",
|
|
3333
|
+
"refresh",
|
|
3334
|
+
// Nature & Weather
|
|
3335
|
+
"sun",
|
|
3336
|
+
"cloud",
|
|
3337
|
+
"rain",
|
|
3338
|
+
"snow",
|
|
3339
|
+
"rainbow"
|
|
3340
|
+
];
|
|
3341
|
+
const helper = {
|
|
3342
|
+
custom: (name) => getEmoji(name)
|
|
3343
|
+
};
|
|
3344
|
+
for (const name of wellKnownEmoji) {
|
|
3345
|
+
helper[name] = getEmoji(name);
|
|
3346
|
+
}
|
|
3347
|
+
if (customEmoji) {
|
|
3348
|
+
for (const key of Object.keys(customEmoji)) {
|
|
3349
|
+
helper[key] = getEmoji(key);
|
|
3350
|
+
}
|
|
3351
|
+
defaultEmojiResolver.extend(customEmoji);
|
|
3352
|
+
}
|
|
3353
|
+
return helper;
|
|
3354
|
+
}
|
|
3355
|
+
var emoji = createEmoji();
|
|
3356
|
+
|
|
3357
|
+
// src/index.ts
|
|
3358
|
+
var Actions2 = Actions;
|
|
3359
|
+
var Button2 = Button;
|
|
3360
|
+
var Card2 = Card;
|
|
3361
|
+
var cardChildToFallbackText2 = cardChildToFallbackText;
|
|
3362
|
+
var CardLink2 = CardLink;
|
|
3363
|
+
var CardText2 = CardText;
|
|
3364
|
+
var Divider2 = Divider;
|
|
3365
|
+
var Field2 = Field;
|
|
3366
|
+
var Fields2 = Fields;
|
|
3367
|
+
var fromReactElement2 = fromReactElement;
|
|
3368
|
+
var Image2 = Image;
|
|
3369
|
+
var isCardElement2 = isCardElement;
|
|
3370
|
+
var isJSX2 = isJSX;
|
|
3371
|
+
var LinkButton2 = LinkButton;
|
|
3372
|
+
var Section2 = Section;
|
|
3373
|
+
var Table2 = Table;
|
|
3374
|
+
var toCardElement2 = toCardElement;
|
|
3375
|
+
var toModalElement2 = toModalElement;
|
|
3376
|
+
var fromReactModalElement2 = fromReactModalElement;
|
|
3377
|
+
var isModalElement2 = isModalElement;
|
|
3378
|
+
var Modal2 = Modal;
|
|
3379
|
+
var RadioSelect2 = RadioSelect;
|
|
3380
|
+
var Select2 = Select;
|
|
3381
|
+
var SelectOption2 = SelectOption;
|
|
3382
|
+
var TextInput2 = TextInput;
|
|
3383
|
+
export {
|
|
3384
|
+
Actions2 as Actions,
|
|
3385
|
+
BaseFormatConverter,
|
|
3386
|
+
Button2 as Button,
|
|
3387
|
+
Card2 as Card,
|
|
3388
|
+
CardLink2 as CardLink,
|
|
3389
|
+
CardText2 as CardText,
|
|
3390
|
+
ChannelImpl,
|
|
3391
|
+
Chat,
|
|
3392
|
+
ChatError,
|
|
3393
|
+
ConsoleLogger,
|
|
3394
|
+
DEFAULT_EMOJI_MAP,
|
|
3395
|
+
Divider2 as Divider,
|
|
3396
|
+
EmojiResolver,
|
|
3397
|
+
Field2 as Field,
|
|
3398
|
+
Fields2 as Fields,
|
|
3399
|
+
Image2 as Image,
|
|
3400
|
+
LinkButton2 as LinkButton,
|
|
3401
|
+
LockError,
|
|
3402
|
+
Message,
|
|
3403
|
+
MessageHistoryCache,
|
|
3404
|
+
Modal2 as Modal,
|
|
3405
|
+
NotImplementedError,
|
|
3406
|
+
RadioSelect2 as RadioSelect,
|
|
3407
|
+
RateLimitError,
|
|
3408
|
+
Section2 as Section,
|
|
3409
|
+
Select2 as Select,
|
|
3410
|
+
SelectOption2 as SelectOption,
|
|
3411
|
+
StreamingMarkdownRenderer,
|
|
3412
|
+
THREAD_STATE_TTL_MS,
|
|
3413
|
+
Table2 as Table,
|
|
3414
|
+
TextInput2 as TextInput,
|
|
3415
|
+
ThreadImpl,
|
|
3416
|
+
blockquote,
|
|
3417
|
+
cardChildToFallbackText2 as cardChildToFallbackText,
|
|
3418
|
+
codeBlock,
|
|
3419
|
+
convertEmojiPlaceholders,
|
|
3420
|
+
createEmoji,
|
|
3421
|
+
defaultEmojiResolver,
|
|
3422
|
+
deriveChannelId,
|
|
3423
|
+
emoji,
|
|
3424
|
+
emphasis,
|
|
3425
|
+
fromFullStream,
|
|
3426
|
+
fromReactElement2 as fromReactElement,
|
|
3427
|
+
fromReactModalElement2 as fromReactModalElement,
|
|
3428
|
+
getEmoji,
|
|
3429
|
+
getNodeChildren,
|
|
3430
|
+
getNodeValue,
|
|
3431
|
+
inlineCode,
|
|
3432
|
+
isBlockquoteNode,
|
|
3433
|
+
isCardElement2 as isCardElement,
|
|
3434
|
+
isCodeNode,
|
|
3435
|
+
isDeleteNode,
|
|
3436
|
+
isEmphasisNode,
|
|
3437
|
+
isInlineCodeNode,
|
|
3438
|
+
isJSX2 as isJSX,
|
|
3439
|
+
isLinkNode,
|
|
3440
|
+
isListItemNode,
|
|
3441
|
+
isListNode,
|
|
3442
|
+
isModalElement2 as isModalElement,
|
|
3443
|
+
isParagraphNode,
|
|
3444
|
+
isStrongNode,
|
|
3445
|
+
isTableCellNode,
|
|
3446
|
+
isTableNode,
|
|
3447
|
+
isTableRowNode,
|
|
3448
|
+
isTextNode,
|
|
3449
|
+
link,
|
|
3450
|
+
markdownToPlainText,
|
|
3451
|
+
paragraph,
|
|
3452
|
+
parseMarkdown,
|
|
3453
|
+
root,
|
|
3454
|
+
strikethrough,
|
|
3455
|
+
stringifyMarkdown,
|
|
3456
|
+
strong,
|
|
3457
|
+
tableElementToAscii,
|
|
3458
|
+
tableToAscii,
|
|
3459
|
+
text,
|
|
3460
|
+
toAiMessages,
|
|
3461
|
+
toCardElement2 as toCardElement,
|
|
3462
|
+
toModalElement2 as toModalElement,
|
|
3463
|
+
toPlainText,
|
|
3464
|
+
walkAst
|
|
3465
|
+
};
|
|
3466
|
+
//# sourceMappingURL=index.js.map
|