@hasna/connectors 1.3.30 → 1.3.32

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.
Files changed (693) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -0
  3. package/bin/index.js +461 -1702
  4. package/bin/mcp.js +583 -1768
  5. package/bin/serve.js +647 -1875
  6. package/connectors/{imessage → connect-github}/bin/index.js +892 -390
  7. package/connectors/connect-github/dist/index.js +520 -0
  8. package/connectors/{cloudflare → connect-yousign}/bun.lock +3 -3
  9. package/connectors/connect-yousign/node_modules/@types/bun/LICENSE +21 -0
  10. package/connectors/connect-yousign/node_modules/@types/bun/README.md +20 -0
  11. package/connectors/connect-yousign/node_modules/@types/bun/index.d.ts +1 -0
  12. package/connectors/connect-yousign/node_modules/@types/bun/package.json +53 -0
  13. package/connectors/connect-yousign/node_modules/@types/node/LICENSE +21 -0
  14. package/connectors/connect-yousign/node_modules/@types/node/README.md +15 -0
  15. package/connectors/connect-yousign/node_modules/@types/node/assert/strict.d.ts +105 -0
  16. package/connectors/connect-yousign/node_modules/@types/node/assert.d.ts +955 -0
  17. package/connectors/connect-yousign/node_modules/@types/node/async_hooks.d.ts +623 -0
  18. package/connectors/connect-yousign/node_modules/@types/node/buffer.buffer.d.ts +466 -0
  19. package/connectors/connect-yousign/node_modules/@types/node/buffer.d.ts +1810 -0
  20. package/connectors/connect-yousign/node_modules/@types/node/child_process.d.ts +1433 -0
  21. package/connectors/connect-yousign/node_modules/@types/node/cluster.d.ts +486 -0
  22. package/connectors/connect-yousign/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  23. package/connectors/connect-yousign/node_modules/@types/node/console.d.ts +151 -0
  24. package/connectors/connect-yousign/node_modules/@types/node/constants.d.ts +20 -0
  25. package/connectors/connect-yousign/node_modules/@types/node/crypto.d.ts +4065 -0
  26. package/connectors/connect-yousign/node_modules/@types/node/dgram.d.ts +564 -0
  27. package/connectors/connect-yousign/node_modules/@types/node/diagnostics_channel.d.ts +576 -0
  28. package/connectors/connect-yousign/node_modules/@types/node/dns/promises.d.ts +503 -0
  29. package/connectors/connect-yousign/node_modules/@types/node/dns.d.ts +922 -0
  30. package/connectors/connect-yousign/node_modules/@types/node/domain.d.ts +166 -0
  31. package/connectors/connect-yousign/node_modules/@types/node/events.d.ts +1047 -0
  32. package/connectors/connect-yousign/node_modules/@types/node/fs/promises.d.ts +1329 -0
  33. package/connectors/connect-yousign/node_modules/@types/node/fs.d.ts +4678 -0
  34. package/connectors/connect-yousign/node_modules/@types/node/globals.d.ts +150 -0
  35. package/connectors/connect-yousign/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  36. package/connectors/connect-yousign/node_modules/@types/node/http.d.ts +2188 -0
  37. package/connectors/connect-yousign/node_modules/@types/node/http2.d.ts +2480 -0
  38. package/connectors/connect-yousign/node_modules/@types/node/https.d.ts +405 -0
  39. package/connectors/connect-yousign/node_modules/@types/node/index.d.ts +115 -0
  40. package/connectors/connect-yousign/node_modules/@types/node/inspector/promises.d.ts +41 -0
  41. package/connectors/connect-yousign/node_modules/@types/node/inspector.d.ts +269 -0
  42. package/connectors/connect-yousign/node_modules/@types/node/inspector.generated.d.ts +4401 -0
  43. package/connectors/connect-yousign/node_modules/@types/node/module.d.ts +757 -0
  44. package/connectors/connect-yousign/node_modules/@types/node/net.d.ts +933 -0
  45. package/connectors/connect-yousign/node_modules/@types/node/os.d.ts +507 -0
  46. package/connectors/connect-yousign/node_modules/@types/node/package.json +155 -0
  47. package/connectors/connect-yousign/node_modules/@types/node/path/posix.d.ts +8 -0
  48. package/connectors/connect-yousign/node_modules/@types/node/path/win32.d.ts +8 -0
  49. package/connectors/connect-yousign/node_modules/@types/node/path.d.ts +187 -0
  50. package/connectors/connect-yousign/node_modules/@types/node/perf_hooks.d.ts +643 -0
  51. package/connectors/connect-yousign/node_modules/@types/node/process.d.ts +2175 -0
  52. package/connectors/connect-yousign/node_modules/@types/node/punycode.d.ts +117 -0
  53. package/connectors/connect-yousign/node_modules/@types/node/querystring.d.ts +152 -0
  54. package/connectors/connect-yousign/node_modules/@types/node/quic.d.ts +910 -0
  55. package/connectors/connect-yousign/node_modules/@types/node/readline/promises.d.ts +161 -0
  56. package/connectors/connect-yousign/node_modules/@types/node/readline.d.ts +542 -0
  57. package/connectors/connect-yousign/node_modules/@types/node/repl.d.ts +415 -0
  58. package/connectors/connect-yousign/node_modules/@types/node/sea.d.ts +162 -0
  59. package/connectors/connect-yousign/node_modules/@types/node/sqlite.d.ts +1065 -0
  60. package/connectors/connect-yousign/node_modules/@types/node/stream/consumers.d.ts +38 -0
  61. package/connectors/connect-yousign/node_modules/@types/node/stream/promises.d.ts +211 -0
  62. package/connectors/connect-yousign/node_modules/@types/node/stream/web.d.ts +296 -0
  63. package/connectors/connect-yousign/node_modules/@types/node/stream.d.ts +1770 -0
  64. package/connectors/connect-yousign/node_modules/@types/node/string_decoder.d.ts +67 -0
  65. package/connectors/connect-yousign/node_modules/@types/node/test/reporters.d.ts +96 -0
  66. package/connectors/connect-yousign/node_modules/@types/node/test.d.ts +2275 -0
  67. package/connectors/connect-yousign/node_modules/@types/node/timers/promises.d.ts +108 -0
  68. package/connectors/connect-yousign/node_modules/@types/node/timers.d.ts +159 -0
  69. package/connectors/connect-yousign/node_modules/@types/node/tls.d.ts +1203 -0
  70. package/connectors/connect-yousign/node_modules/@types/node/trace_events.d.ts +197 -0
  71. package/connectors/connect-yousign/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
  72. package/connectors/connect-yousign/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  73. package/connectors/connect-yousign/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  74. package/connectors/connect-yousign/node_modules/@types/node/ts5.6/index.d.ts +117 -0
  75. package/connectors/connect-yousign/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  76. package/connectors/connect-yousign/node_modules/@types/node/ts5.7/index.d.ts +117 -0
  77. package/connectors/connect-yousign/node_modules/@types/node/tty.d.ts +250 -0
  78. package/connectors/connect-yousign/node_modules/@types/node/url.d.ts +541 -0
  79. package/connectors/connect-yousign/node_modules/@types/node/util/types.d.ts +558 -0
  80. package/connectors/connect-yousign/node_modules/@types/node/util.d.ts +1687 -0
  81. package/connectors/connect-yousign/node_modules/@types/node/v8.d.ts +988 -0
  82. package/connectors/connect-yousign/node_modules/@types/node/vm.d.ts +1208 -0
  83. package/connectors/connect-yousign/node_modules/@types/node/wasi.d.ts +202 -0
  84. package/connectors/connect-yousign/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  85. package/connectors/connect-yousign/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  86. package/connectors/connect-yousign/node_modules/@types/node/web-globals/console.d.ts +9 -0
  87. package/connectors/connect-yousign/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  88. package/connectors/connect-yousign/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  89. package/connectors/connect-yousign/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  90. package/connectors/connect-yousign/node_modules/@types/node/web-globals/events.d.ts +106 -0
  91. package/connectors/connect-yousign/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  92. package/connectors/connect-yousign/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  93. package/connectors/connect-yousign/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  94. package/connectors/connect-yousign/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  95. package/connectors/connect-yousign/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  96. package/connectors/connect-yousign/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  97. package/connectors/connect-yousign/node_modules/@types/node/web-globals/streams.d.ts +115 -0
  98. package/connectors/connect-yousign/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  99. package/connectors/connect-yousign/node_modules/@types/node/web-globals/url.d.ts +24 -0
  100. package/connectors/connect-yousign/node_modules/@types/node/worker_threads.d.ts +717 -0
  101. package/connectors/connect-yousign/node_modules/@types/node/zlib.d.ts +682 -0
  102. package/connectors/connect-yousign/node_modules/bun-types/CLAUDE.md +105 -0
  103. package/connectors/connect-yousign/node_modules/bun-types/README.md +33 -0
  104. package/connectors/connect-yousign/node_modules/bun-types/bun.d.ts +8481 -0
  105. package/connectors/connect-yousign/node_modules/bun-types/bun.ns.d.ts +5 -0
  106. package/connectors/connect-yousign/node_modules/bun-types/bundle.d.ts +74 -0
  107. package/connectors/connect-yousign/node_modules/bun-types/deprecated.d.ts +184 -0
  108. package/connectors/connect-yousign/node_modules/bun-types/devserver.d.ts +187 -0
  109. package/connectors/connect-yousign/node_modules/bun-types/docs/README.md +28 -0
  110. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/bytecode.mdx +447 -0
  111. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/css.mdx +1024 -0
  112. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/esbuild.mdx +304 -0
  113. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/executables.mdx +1318 -0
  114. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/fullstack.mdx +1086 -0
  115. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/hot-reloading.mdx +229 -0
  116. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/html-static.mdx +498 -0
  117. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/index.mdx +1840 -0
  118. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/loaders.mdx +451 -0
  119. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/macros.mdx +328 -0
  120. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/minifier.mdx +1286 -0
  121. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/plugins.mdx +477 -0
  122. package/connectors/connect-yousign/node_modules/bun-types/docs/bundler/standalone-html.mdx +314 -0
  123. package/connectors/connect-yousign/node_modules/bun-types/docs/feedback.mdx +75 -0
  124. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-array.mdx +29 -0
  125. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-blob.mdx +26 -0
  126. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-buffer.mdx +27 -0
  127. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-string.mdx +17 -0
  128. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/arraybuffer-to-typedarray.mdx +41 -0
  129. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-arraybuffer.mdx +16 -0
  130. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-dataview.mdx +16 -0
  131. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-stream.mdx +16 -0
  132. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-string.mdx +17 -0
  133. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/blob-to-typedarray.mdx +16 -0
  134. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-arraybuffer.mdx +16 -0
  135. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-blob.mdx +16 -0
  136. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-readablestream.mdx +43 -0
  137. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-string.mdx +27 -0
  138. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/buffer-to-typedarray.mdx +16 -0
  139. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/dataview-to-string.mdx +17 -0
  140. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-arraybuffer.mdx +27 -0
  141. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-blob.mdx +18 -0
  142. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-buffer.mdx +16 -0
  143. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-dataview.mdx +16 -0
  144. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-readablestream.mdx +43 -0
  145. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/binary/typedarray-to-string.mdx +18 -0
  146. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/aws-lambda.mdx +204 -0
  147. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/digital-ocean.mdx +161 -0
  148. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/google-cloud-run.mdx +194 -0
  149. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/railway.mdx +145 -0
  150. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/render.mdx +82 -0
  151. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/deployment/vercel.mdx +97 -0
  152. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/astro.mdx +82 -0
  153. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/discordjs.mdx +80 -0
  154. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/docker.mdx +151 -0
  155. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/drizzle.mdx +195 -0
  156. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/elysia.mdx +31 -0
  157. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/express.mdx +43 -0
  158. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/gel.mdx +261 -0
  159. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/hono.mdx +47 -0
  160. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/mongoose.mdx +92 -0
  161. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/neon-drizzle.mdx +234 -0
  162. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/neon-serverless-postgres.mdx +60 -0
  163. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/nextjs.mdx +103 -0
  164. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/nuxt.mdx +96 -0
  165. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/pm2.mdx +55 -0
  166. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/prisma-postgres.mdx +169 -0
  167. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/prisma.mdx +164 -0
  168. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/qwik.mdx +114 -0
  169. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/react.mdx +52 -0
  170. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/remix.mdx +97 -0
  171. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/sentry.mdx +54 -0
  172. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/solidstart.mdx +62 -0
  173. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/ssr-react.mdx +49 -0
  174. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/stric.mdx +54 -0
  175. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/sveltekit.mdx +138 -0
  176. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/systemd.mdx +114 -0
  177. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/tanstack-start.mdx +791 -0
  178. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/upstash.mdx +87 -0
  179. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/ecosystem/vite.mdx +77 -0
  180. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/html-rewriter/extract-links.mdx +71 -0
  181. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/html-rewriter/extract-social-meta.mdx +97 -0
  182. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/cluster.mdx +69 -0
  183. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/fetch-unix.mdx +35 -0
  184. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/fetch.mdx +26 -0
  185. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/file-uploads.mdx +97 -0
  186. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/hot.mdx +28 -0
  187. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/proxy.mdx +50 -0
  188. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/server.mdx +48 -0
  189. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/simple.mdx +20 -0
  190. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/stream-file.mdx +50 -0
  191. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/stream-iterator.mdx +49 -0
  192. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/stream-node-streams-in-bun.mdx +22 -0
  193. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/http/tls.mdx +32 -0
  194. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/index.mdx +10 -0
  195. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-dev.mdx +28 -0
  196. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-git.mdx +40 -0
  197. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-optional.mdx +27 -0
  198. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-peer.mdx +45 -0
  199. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add-tarball.mdx +35 -0
  200. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/add.mdx +44 -0
  201. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/azure-artifacts.mdx +76 -0
  202. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/cicd.mdx +43 -0
  203. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/custom-registry.mdx +32 -0
  204. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/from-npm-install-to-bun-install.mdx +230 -0
  205. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/git-diff-bun-lockfile.mdx +48 -0
  206. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/jfrog-artifactory.mdx +28 -0
  207. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/npm-alias.mdx +25 -0
  208. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/registry-scope.mdx +40 -0
  209. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/trusted.mdx +52 -0
  210. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/workspaces.mdx +70 -0
  211. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/install/yarnlock.mdx +51 -0
  212. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/argv.mdx +66 -0
  213. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/ctrl-c.mdx +18 -0
  214. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/ipc.mdx +69 -0
  215. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/nanoseconds.mdx +15 -0
  216. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/os-signals.mdx +31 -0
  217. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/spawn-stderr.mdx +34 -0
  218. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/spawn-stdout.mdx +28 -0
  219. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/spawn.mdx +43 -0
  220. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/process/stdin.mdx +62 -0
  221. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/arraybuffer.mdx +30 -0
  222. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/buffer.mdx +21 -0
  223. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/exists.mdx +18 -0
  224. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/json.mdx +19 -0
  225. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/mime.mdx +22 -0
  226. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/stream.mdx +28 -0
  227. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/string.mdx +24 -0
  228. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/uint8array.mdx +23 -0
  229. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/read-file/watch.mdx +66 -0
  230. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/build-time-constants.mdx +295 -0
  231. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/cicd.mdx +45 -0
  232. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/codesign-macos-executable.mdx +61 -0
  233. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/define-constant.mdx +149 -0
  234. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/delete-directory.mdx +39 -0
  235. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/delete-file.mdx +21 -0
  236. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/heap-snapshot.mdx +28 -0
  237. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-html.mdx +15 -0
  238. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-json.mdx +46 -0
  239. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-json5.mdx +74 -0
  240. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-toml.mdx +32 -0
  241. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/import-yaml.mdx +104 -0
  242. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/read-env.mdx +37 -0
  243. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/set-env.mdx +51 -0
  244. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/shell.mdx +42 -0
  245. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/timezone.mdx +38 -0
  246. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/tsconfig-paths.mdx +31 -0
  247. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/typescript.mdx +51 -0
  248. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/vscode-debugger.mdx +47 -0
  249. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/runtime/web-debugger.mdx +103 -0
  250. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-arraybuffer.mdx +13 -0
  251. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-blob.mdx +13 -0
  252. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-json.mdx +14 -0
  253. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-string.mdx +14 -0
  254. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/node-readable-to-uint8array.mdx +13 -0
  255. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-array.mdx +16 -0
  256. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-arraybuffer.mdx +16 -0
  257. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-blob.mdx +16 -0
  258. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-buffer.mdx +17 -0
  259. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-json.mdx +16 -0
  260. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-string.mdx +16 -0
  261. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/streams/to-typedarray.mdx +24 -0
  262. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/bail.mdx +24 -0
  263. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/concurrent-test-glob.mdx +146 -0
  264. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/coverage-threshold.mdx +67 -0
  265. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/coverage.mdx +49 -0
  266. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/happy-dom.mdx +73 -0
  267. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/migrate-from-jest.mdx +125 -0
  268. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/mock-clock.mdx +50 -0
  269. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/mock-functions.mdx +70 -0
  270. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/rerun-each.mdx +16 -0
  271. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/run-tests.mdx +116 -0
  272. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/skip-tests.mdx +43 -0
  273. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/snapshot.mdx +102 -0
  274. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/spy-on.mdx +49 -0
  275. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/svelte-test.mdx +113 -0
  276. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/testing-library.mdx +93 -0
  277. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/timeout.mdx +17 -0
  278. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/todo-tests.mdx +74 -0
  279. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/update-snapshots.mdx +49 -0
  280. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/test/watch-mode.mdx +24 -0
  281. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/base64.mdx +17 -0
  282. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/deep-equals.mdx +41 -0
  283. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/deflate.mdx +20 -0
  284. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/detect-bun.mdx +28 -0
  285. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/entrypoint.mdx +19 -0
  286. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/escape-html.mdx +24 -0
  287. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/file-url-to-path.mdx +16 -0
  288. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/gzip.mdx +20 -0
  289. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/hash-a-password.mdx +56 -0
  290. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/import-meta-dir.mdx +15 -0
  291. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/import-meta-file.mdx +15 -0
  292. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/import-meta-path.mdx +15 -0
  293. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/javascript-uuid.mdx +25 -0
  294. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/main.mdx +43 -0
  295. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/path-to-file-url.mdx +16 -0
  296. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/sleep.mdx +24 -0
  297. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/upgrade.mdx +93 -0
  298. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/version.mdx +23 -0
  299. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/util/which-path-to-executable-bin.mdx +17 -0
  300. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/websocket/compression.mdx +33 -0
  301. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/websocket/context.mdx +79 -0
  302. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/websocket/pubsub.mdx +43 -0
  303. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/websocket/simple.mdx +38 -0
  304. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/append.mdx +54 -0
  305. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/basic.mdx +46 -0
  306. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/blob.mdx +30 -0
  307. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/cat.mdx +19 -0
  308. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/file-cp.mdx +18 -0
  309. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/filesink.mdx +54 -0
  310. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/response.mdx +19 -0
  311. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/stdout.mdx +23 -0
  312. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/stream.mdx +19 -0
  313. package/connectors/connect-yousign/node_modules/bun-types/docs/guides/write-file/unlink.mdx +18 -0
  314. package/connectors/connect-yousign/node_modules/bun-types/docs/index.mdx +133 -0
  315. package/connectors/connect-yousign/node_modules/bun-types/docs/installation.mdx +372 -0
  316. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/bunx.mdx +91 -0
  317. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/catalogs.mdx +292 -0
  318. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/add.mdx +179 -0
  319. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/audit.mdx +60 -0
  320. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/info.mdx +70 -0
  321. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/install.mdx +591 -0
  322. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/link.mdx +61 -0
  323. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/outdated.mdx +197 -0
  324. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/patch.mdx +69 -0
  325. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/pm.mdx +323 -0
  326. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/publish.mdx +131 -0
  327. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/remove.mdx +16 -0
  328. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/update.mdx +140 -0
  329. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/cli/why.mdx +84 -0
  330. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/filter.mdx +127 -0
  331. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/global-cache.mdx +72 -0
  332. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/isolated-installs.mdx +220 -0
  333. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/lifecycle.mdx +64 -0
  334. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/lockfile.mdx +64 -0
  335. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/npmrc.mdx +245 -0
  336. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/overrides.mdx +83 -0
  337. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/scopes-registries.mdx +35 -0
  338. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/security-scanner-api.mdx +95 -0
  339. package/connectors/connect-yousign/node_modules/bun-types/docs/pm/workspaces.mdx +115 -0
  340. package/connectors/connect-yousign/node_modules/bun-types/docs/project/benchmarking.mdx +296 -0
  341. package/connectors/connect-yousign/node_modules/bun-types/docs/project/bindgen.mdx +223 -0
  342. package/connectors/connect-yousign/node_modules/bun-types/docs/project/building-windows.mdx +143 -0
  343. package/connectors/connect-yousign/node_modules/bun-types/docs/project/contributing.mdx +366 -0
  344. package/connectors/connect-yousign/node_modules/bun-types/docs/project/feedback.mdx +20 -0
  345. package/connectors/connect-yousign/node_modules/bun-types/docs/project/license.mdx +78 -0
  346. package/connectors/connect-yousign/node_modules/bun-types/docs/project/roadmap.mdx +8 -0
  347. package/connectors/connect-yousign/node_modules/bun-types/docs/quickstart.mdx +251 -0
  348. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/archive.mdx +452 -0
  349. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/auto-install.mdx +97 -0
  350. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/binary-data.mdx +846 -0
  351. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/bun-apis.mdx +59 -0
  352. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/bunfig.mdx +754 -0
  353. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/c-compiler.mdx +204 -0
  354. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/child-process.mdx +659 -0
  355. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/color.mdx +267 -0
  356. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/console.mdx +67 -0
  357. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/cookies.mdx +454 -0
  358. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/debugger.mdx +335 -0
  359. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/environment-variables.mdx +231 -0
  360. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/ffi.mdx +567 -0
  361. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/file-io.mdx +306 -0
  362. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/file-system-router.mdx +118 -0
  363. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/file-types.mdx +482 -0
  364. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/glob.mdx +181 -0
  365. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/globals.mdx +72 -0
  366. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/hashing.mdx +315 -0
  367. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/html-rewriter.mdx +333 -0
  368. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/cookies.mdx +79 -0
  369. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/error-handling.mdx +40 -0
  370. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/metrics.mdx +36 -0
  371. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/routing.mdx +289 -0
  372. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/server.mdx +645 -0
  373. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/tls.mdx +101 -0
  374. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/http/websockets.mdx +414 -0
  375. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/index.mdx +223 -0
  376. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/json5.mdx +271 -0
  377. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/jsonl.mdx +188 -0
  378. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/jsx.mdx +115 -0
  379. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/markdown.mdx +344 -0
  380. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/module-resolution.mdx +374 -0
  381. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/networking/dns.mdx +111 -0
  382. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/networking/fetch.mdx +484 -0
  383. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/networking/tcp.mdx +239 -0
  384. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/networking/udp.mdx +180 -0
  385. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/node-api.mdx +19 -0
  386. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/nodejs-compat.mdx +468 -0
  387. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/plugins.mdx +419 -0
  388. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/redis.mdx +583 -0
  389. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/repl.mdx +176 -0
  390. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/s3.mdx +881 -0
  391. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/secrets.mdx +340 -0
  392. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/semver.mdx +57 -0
  393. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/shell.mdx +637 -0
  394. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/sql.mdx +1404 -0
  395. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/sqlite.mdx +721 -0
  396. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/streams.mdx +232 -0
  397. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/templating/create.mdx +269 -0
  398. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/templating/init.mdx +58 -0
  399. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/transpiler.mdx +288 -0
  400. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/typescript.mdx +58 -0
  401. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/utils.mdx +1010 -0
  402. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/watch-mode.mdx +161 -0
  403. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/web-apis.mdx +29 -0
  404. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/workers.mdx +314 -0
  405. package/connectors/connect-yousign/node_modules/bun-types/docs/runtime/yaml.mdx +469 -0
  406. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/add.mdx +166 -0
  407. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/build.mdx +197 -0
  408. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/bunx.mdx +49 -0
  409. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/feedback.mdx +17 -0
  410. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/init.mdx +84 -0
  411. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/install.mdx +173 -0
  412. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/link.mdx +163 -0
  413. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/outdated.mdx +140 -0
  414. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/patch.mdx +171 -0
  415. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/publish.mdx +198 -0
  416. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/remove.mdx +146 -0
  417. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/run.mdx +305 -0
  418. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/test.mdx +105 -0
  419. package/connectors/connect-yousign/node_modules/bun-types/docs/snippets/cli/update.mdx +144 -0
  420. package/connectors/connect-yousign/node_modules/bun-types/docs/test/code-coverage.mdx +409 -0
  421. package/connectors/connect-yousign/node_modules/bun-types/docs/test/configuration.mdx +520 -0
  422. package/connectors/connect-yousign/node_modules/bun-types/docs/test/dates-times.mdx +129 -0
  423. package/connectors/connect-yousign/node_modules/bun-types/docs/test/discovery.mdx +90 -0
  424. package/connectors/connect-yousign/node_modules/bun-types/docs/test/dom.mdx +226 -0
  425. package/connectors/connect-yousign/node_modules/bun-types/docs/test/index.mdx +409 -0
  426. package/connectors/connect-yousign/node_modules/bun-types/docs/test/lifecycle.mdx +366 -0
  427. package/connectors/connect-yousign/node_modules/bun-types/docs/test/mocks.mdx +637 -0
  428. package/connectors/connect-yousign/node_modules/bun-types/docs/test/reporters.mdx +126 -0
  429. package/connectors/connect-yousign/node_modules/bun-types/docs/test/runtime-behavior.mdx +342 -0
  430. package/connectors/connect-yousign/node_modules/bun-types/docs/test/snapshots.mdx +434 -0
  431. package/connectors/connect-yousign/node_modules/bun-types/docs/test/writing-tests.mdx +672 -0
  432. package/connectors/connect-yousign/node_modules/bun-types/docs/typescript.mdx +54 -0
  433. package/connectors/connect-yousign/node_modules/bun-types/extensions.d.ts +40 -0
  434. package/connectors/connect-yousign/node_modules/bun-types/fetch.d.ts +79 -0
  435. package/connectors/connect-yousign/node_modules/bun-types/ffi.d.ts +1154 -0
  436. package/connectors/connect-yousign/node_modules/bun-types/globals.d.ts +2067 -0
  437. package/connectors/connect-yousign/node_modules/bun-types/html-rewriter.d.ts +186 -0
  438. package/connectors/connect-yousign/node_modules/bun-types/index.d.ts +32 -0
  439. package/connectors/connect-yousign/node_modules/bun-types/jsc.d.ts +233 -0
  440. package/connectors/connect-yousign/node_modules/bun-types/jsx.d.ts +11 -0
  441. package/connectors/connect-yousign/node_modules/bun-types/overrides.d.ts +376 -0
  442. package/connectors/connect-yousign/node_modules/bun-types/package.json +37 -0
  443. package/connectors/connect-yousign/node_modules/bun-types/redis.d.ts +3352 -0
  444. package/connectors/connect-yousign/node_modules/bun-types/s3.d.ts +1335 -0
  445. package/connectors/connect-yousign/node_modules/bun-types/security.d.ts +101 -0
  446. package/connectors/connect-yousign/node_modules/bun-types/serve.d.ts +1296 -0
  447. package/connectors/connect-yousign/node_modules/bun-types/shell.d.ts +380 -0
  448. package/connectors/connect-yousign/node_modules/bun-types/sql.d.ts +887 -0
  449. package/connectors/connect-yousign/node_modules/bun-types/sqlite.d.ts +1322 -0
  450. package/connectors/connect-yousign/node_modules/bun-types/test-globals.d.ts +22 -0
  451. package/connectors/connect-yousign/node_modules/bun-types/test.d.ts +2392 -0
  452. package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/branding.d.ts +283 -0
  453. package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/index.d.ts +1207 -0
  454. package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/messages.d.ts +395 -0
  455. package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/overloads.d.ts +669 -0
  456. package/connectors/connect-yousign/node_modules/bun-types/vendor/expect-type/utils.d.ts +431 -0
  457. package/connectors/connect-yousign/node_modules/bun-types/wasm.d.ts +193 -0
  458. package/connectors/connect-yousign/node_modules/chalk/license +9 -0
  459. package/connectors/connect-yousign/node_modules/chalk/package.json +83 -0
  460. package/connectors/connect-yousign/node_modules/chalk/readme.md +297 -0
  461. package/connectors/connect-yousign/node_modules/chalk/source/index.d.ts +325 -0
  462. package/connectors/connect-yousign/node_modules/chalk/source/index.js +225 -0
  463. package/connectors/connect-yousign/node_modules/chalk/source/utilities.js +33 -0
  464. package/connectors/connect-yousign/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
  465. package/connectors/connect-yousign/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
  466. package/connectors/connect-yousign/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
  467. package/connectors/connect-yousign/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
  468. package/connectors/connect-yousign/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
  469. package/connectors/connect-yousign/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
  470. package/connectors/connect-yousign/node_modules/commander/LICENSE +22 -0
  471. package/connectors/connect-yousign/node_modules/commander/Readme.md +1157 -0
  472. package/connectors/connect-yousign/node_modules/commander/esm.mjs +16 -0
  473. package/connectors/connect-yousign/node_modules/commander/index.js +24 -0
  474. package/connectors/connect-yousign/node_modules/commander/lib/argument.js +149 -0
  475. package/connectors/connect-yousign/node_modules/commander/lib/command.js +2509 -0
  476. package/connectors/connect-yousign/node_modules/commander/lib/error.js +39 -0
  477. package/connectors/connect-yousign/node_modules/commander/lib/help.js +520 -0
  478. package/connectors/connect-yousign/node_modules/commander/lib/option.js +330 -0
  479. package/connectors/connect-yousign/node_modules/commander/lib/suggestSimilar.js +101 -0
  480. package/connectors/connect-yousign/node_modules/commander/package-support.json +16 -0
  481. package/connectors/connect-yousign/node_modules/commander/package.json +84 -0
  482. package/connectors/connect-yousign/node_modules/commander/typings/esm.d.mts +3 -0
  483. package/connectors/connect-yousign/node_modules/commander/typings/index.d.ts +969 -0
  484. package/connectors/connect-yousign/node_modules/typescript/LICENSE.txt +55 -0
  485. package/connectors/connect-yousign/node_modules/typescript/README.md +50 -0
  486. package/connectors/connect-yousign/node_modules/typescript/SECURITY.md +41 -0
  487. package/connectors/connect-yousign/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  488. package/connectors/connect-yousign/node_modules/typescript/bin/tsc +2 -0
  489. package/connectors/connect-yousign/node_modules/typescript/bin/tsserver +2 -0
  490. package/connectors/connect-yousign/node_modules/typescript/lib/_tsc.js +133818 -0
  491. package/connectors/connect-yousign/node_modules/typescript/lib/_tsserver.js +659 -0
  492. package/connectors/connect-yousign/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  493. package/connectors/connect-yousign/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  494. package/connectors/connect-yousign/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  495. package/connectors/connect-yousign/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  496. package/connectors/connect-yousign/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  497. package/connectors/connect-yousign/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  498. package/connectors/connect-yousign/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  499. package/connectors/connect-yousign/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  500. package/connectors/connect-yousign/node_modules/typescript/lib/lib.d.ts +22 -0
  501. package/connectors/connect-yousign/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  502. package/connectors/connect-yousign/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  503. package/connectors/connect-yousign/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  504. package/connectors/connect-yousign/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  505. package/connectors/connect-yousign/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  506. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  507. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  508. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  509. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  510. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  511. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  512. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  513. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  514. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  515. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  516. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  517. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  518. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  519. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  520. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  521. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  522. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  523. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  524. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  525. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  526. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  527. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  528. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  529. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  530. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  531. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  532. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  533. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  534. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  535. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  536. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  537. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  538. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  539. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  540. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  541. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  542. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  543. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  544. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  545. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  546. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  547. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  548. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  549. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  550. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  551. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  552. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  553. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  554. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  555. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  556. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  557. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  558. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  559. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  560. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  561. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  562. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  563. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  564. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  565. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  566. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  567. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  568. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  569. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  570. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  571. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  572. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  573. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  574. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  575. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  576. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  577. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  578. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  579. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  580. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  581. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  582. package/connectors/connect-yousign/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  583. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  584. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  585. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  586. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  587. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  588. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  589. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  590. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  591. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  592. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  593. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  594. package/connectors/connect-yousign/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  595. package/connectors/connect-yousign/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  596. package/connectors/connect-yousign/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  597. package/connectors/connect-yousign/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  598. package/connectors/connect-yousign/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  599. package/connectors/connect-yousign/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  600. package/connectors/connect-yousign/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  601. package/connectors/connect-yousign/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  602. package/connectors/connect-yousign/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  603. package/connectors/connect-yousign/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  604. package/connectors/connect-yousign/node_modules/typescript/lib/tsc.js +8 -0
  605. package/connectors/connect-yousign/node_modules/typescript/lib/tsserver.js +8 -0
  606. package/connectors/connect-yousign/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  607. package/connectors/connect-yousign/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  608. package/connectors/connect-yousign/node_modules/typescript/lib/typesMap.json +497 -0
  609. package/connectors/connect-yousign/node_modules/typescript/lib/typescript.d.ts +11437 -0
  610. package/connectors/connect-yousign/node_modules/typescript/lib/typescript.js +200276 -0
  611. package/connectors/connect-yousign/node_modules/typescript/lib/typingsInstaller.js +8 -0
  612. package/connectors/connect-yousign/node_modules/typescript/lib/watchGuard.js +53 -0
  613. package/connectors/connect-yousign/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
  614. package/connectors/connect-yousign/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
  615. package/connectors/connect-yousign/node_modules/typescript/package.json +120 -0
  616. package/connectors/connect-yousign/node_modules/undici-types/LICENSE +21 -0
  617. package/connectors/connect-yousign/node_modules/undici-types/README.md +6 -0
  618. package/connectors/connect-yousign/node_modules/undici-types/agent.d.ts +32 -0
  619. package/connectors/connect-yousign/node_modules/undici-types/api.d.ts +43 -0
  620. package/connectors/connect-yousign/node_modules/undici-types/balanced-pool.d.ts +30 -0
  621. package/connectors/connect-yousign/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  622. package/connectors/connect-yousign/node_modules/undici-types/cache.d.ts +36 -0
  623. package/connectors/connect-yousign/node_modules/undici-types/client-stats.d.ts +15 -0
  624. package/connectors/connect-yousign/node_modules/undici-types/client.d.ts +108 -0
  625. package/connectors/connect-yousign/node_modules/undici-types/connector.d.ts +34 -0
  626. package/connectors/connect-yousign/node_modules/undici-types/content-type.d.ts +21 -0
  627. package/connectors/connect-yousign/node_modules/undici-types/cookies.d.ts +30 -0
  628. package/connectors/connect-yousign/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  629. package/connectors/connect-yousign/node_modules/undici-types/dispatcher.d.ts +276 -0
  630. package/connectors/connect-yousign/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  631. package/connectors/connect-yousign/node_modules/undici-types/errors.d.ts +161 -0
  632. package/connectors/connect-yousign/node_modules/undici-types/eventsource.d.ts +66 -0
  633. package/connectors/connect-yousign/node_modules/undici-types/fetch.d.ts +211 -0
  634. package/connectors/connect-yousign/node_modules/undici-types/formdata.d.ts +108 -0
  635. package/connectors/connect-yousign/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  636. package/connectors/connect-yousign/node_modules/undici-types/global-origin.d.ts +7 -0
  637. package/connectors/connect-yousign/node_modules/undici-types/h2c-client.d.ts +73 -0
  638. package/connectors/connect-yousign/node_modules/undici-types/handlers.d.ts +15 -0
  639. package/connectors/connect-yousign/node_modules/undici-types/header.d.ts +160 -0
  640. package/connectors/connect-yousign/node_modules/undici-types/index.d.ts +88 -0
  641. package/connectors/connect-yousign/node_modules/undici-types/interceptors.d.ts +73 -0
  642. package/connectors/connect-yousign/node_modules/undici-types/mock-agent.d.ts +68 -0
  643. package/connectors/connect-yousign/node_modules/undici-types/mock-call-history.d.ts +111 -0
  644. package/connectors/connect-yousign/node_modules/undici-types/mock-client.d.ts +27 -0
  645. package/connectors/connect-yousign/node_modules/undici-types/mock-errors.d.ts +12 -0
  646. package/connectors/connect-yousign/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  647. package/connectors/connect-yousign/node_modules/undici-types/mock-pool.d.ts +27 -0
  648. package/connectors/connect-yousign/node_modules/undici-types/package.json +55 -0
  649. package/connectors/connect-yousign/node_modules/undici-types/patch.d.ts +29 -0
  650. package/connectors/connect-yousign/node_modules/undici-types/pool-stats.d.ts +19 -0
  651. package/connectors/connect-yousign/node_modules/undici-types/pool.d.ts +41 -0
  652. package/connectors/connect-yousign/node_modules/undici-types/proxy-agent.d.ts +29 -0
  653. package/connectors/connect-yousign/node_modules/undici-types/readable.d.ts +68 -0
  654. package/connectors/connect-yousign/node_modules/undici-types/retry-agent.d.ts +8 -0
  655. package/connectors/connect-yousign/node_modules/undici-types/retry-handler.d.ts +125 -0
  656. package/connectors/connect-yousign/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  657. package/connectors/connect-yousign/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  658. package/connectors/connect-yousign/node_modules/undici-types/util.d.ts +18 -0
  659. package/connectors/connect-yousign/node_modules/undici-types/utility.d.ts +7 -0
  660. package/connectors/connect-yousign/node_modules/undici-types/webidl.d.ts +341 -0
  661. package/connectors/connect-yousign/node_modules/undici-types/websocket.d.ts +186 -0
  662. package/dashboard/dist/assets/index-CSlS3oNV.css +1 -0
  663. package/dashboard/dist/assets/index-NCasN7x4.js +284 -0
  664. package/dashboard/dist/index.html +2 -2
  665. package/dist/cli/commands/auth.d.ts +0 -3
  666. package/dist/index.d.ts +1 -2
  667. package/dist/index.js +167 -1399
  668. package/dist/lib/lock.d.ts +1 -1
  669. package/dist/lib/runner.d.ts +0 -31
  670. package/dist/lib/workflow-runner.d.ts +0 -7
  671. package/dist/server/auth.d.ts +3 -4
  672. package/package.json +1 -1
  673. package/connectors/gmail/bin/index.js +0 -7027
  674. package/connectors/googledrive/bin/index.js +0 -5958
  675. package/connectors/imessage/bin/.gitkeep +0 -2
  676. package/connectors/imessage/bun.lock +0 -32
  677. package/dashboard/dist/assets/index-ClBXkNbL.css +0 -1
  678. package/dashboard/dist/assets/index-DvfmyAO4.js +0 -284
  679. package/dist/core/builtins.test.d.ts +0 -1
  680. package/dist/core/connectors/gmail.d.ts +0 -5
  681. package/dist/core/connectors/googledrive.d.ts +0 -6
  682. package/dist/core/connectors/internal-operations.test.d.ts +0 -1
  683. package/dist/core/connectors/internal-runtime.test.d.ts +0 -1
  684. package/dist/core/errors.test.d.ts +0 -1
  685. package/dist/lib/connector-resolver.d.ts +0 -37
  686. package/dist/lib/connector-resolver.test.d.ts +0 -1
  687. package/dist/lib/manifest.d.ts +0 -50
  688. package/dist/lib/manifest.test.d.ts +0 -1
  689. package/dist/lib/runner-auth.test.d.ts +0 -1
  690. package/dist/lib/test-endpoints.test.d.ts +0 -1
  691. package/dist/server/auth-exchange.test.d.ts +0 -1
  692. package/dist/server/auth-refresh.test.d.ts +0 -1
  693. /package/dist/{cli/auth-no-browser.test.d.ts → server/server.test.d.ts} +0 -0
package/bin/mcp.js CHANGED
@@ -8548,7 +8548,6 @@ var require_limitLength = __commonJS((exports) => {
8548
8548
  var require_pattern = __commonJS((exports) => {
8549
8549
  Object.defineProperty(exports, "__esModule", { value: true });
8550
8550
  var code_1 = require_code2();
8551
- var util_1 = require_util();
8552
8551
  var codegen_1 = require_codegen();
8553
8552
  var error2 = {
8554
8553
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
@@ -8561,18 +8560,10 @@ var require_pattern = __commonJS((exports) => {
8561
8560
  $data: true,
8562
8561
  error: error2,
8563
8562
  code(cxt) {
8564
- const { gen, data, $data, schema, schemaCode, it } = cxt;
8563
+ const { data, $data, schema, schemaCode, it } = cxt;
8565
8564
  const u = it.opts.unicodeRegExp ? "u" : "";
8566
- if ($data) {
8567
- const { regExp } = it.opts.code;
8568
- const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
8569
- const valid = gen.let("valid");
8570
- gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
8571
- cxt.fail$data((0, codegen_1._)`!${valid}`);
8572
- } else {
8573
- const regExp = (0, code_1.usePattern)(cxt, schema);
8574
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
8575
- }
8565
+ const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
8566
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
8576
8567
  }
8577
8568
  };
8578
8569
  exports.default = def;
@@ -10485,7 +10476,7 @@ var init_zod = __esm(() => {
10485
10476
  });
10486
10477
 
10487
10478
  // src/core/errors.ts
10488
- var ConnectorDefinitionError, ConnectorOperationNotFoundError;
10479
+ var ConnectorDefinitionError;
10489
10480
  var init_errors2 = __esm(() => {
10490
10481
  ConnectorDefinitionError = class ConnectorDefinitionError extends Error {
10491
10482
  code;
@@ -10495,16 +10486,6 @@ var init_errors2 = __esm(() => {
10495
10486
  this.code = code;
10496
10487
  }
10497
10488
  };
10498
- ConnectorOperationNotFoundError = class ConnectorOperationNotFoundError extends Error {
10499
- connectorName;
10500
- operationName;
10501
- constructor(connectorName, operationName) {
10502
- super(`Operation '${operationName}' not found on connector '${connectorName}'`);
10503
- this.name = "ConnectorOperationNotFoundError";
10504
- this.connectorName = connectorName;
10505
- this.operationName = operationName;
10506
- }
10507
- };
10508
10489
  });
10509
10490
 
10510
10491
  // src/core/connector.ts
@@ -10546,34 +10527,11 @@ function defineConnector(definition) {
10546
10527
  operations: normalizedOperations
10547
10528
  };
10548
10529
  }
10549
- function listConnectorOperations(connector) {
10550
- return Object.values(connector.operations).sort((a, b) => a.name.localeCompare(b.name));
10551
- }
10552
- function getConnectorOperation(connector, name) {
10553
- return listConnectorOperations(connector).find((operation) => operation.name === name);
10554
- }
10555
- async function executeConnectorOperation(connector, args) {
10556
- const operation = getConnectorOperation(connector, args.operation);
10557
- if (!operation) {
10558
- throw new ConnectorOperationNotFoundError(connector.meta.name, args.operation);
10559
- }
10560
- const context = connector.createContext ? await connector.createContext({
10561
- credentials: args.credentials,
10562
- profile: args.profile
10563
- }) : undefined;
10564
- const parsedInput = operation.inputSchema ? operation.inputSchema.parse(args.input ?? {}) : args.input ?? {};
10565
- return operation.execute({
10566
- connector,
10567
- context,
10568
- profile: args.profile,
10569
- credentials: args.credentials
10570
- }, parsedInput);
10571
- }
10572
10530
  var CONNECTOR_NAME_RE, OPERATION_NAME_RE;
10573
10531
  var init_connector = __esm(() => {
10574
10532
  init_errors2();
10575
10533
  CONNECTOR_NAME_RE = /^[a-z0-9-]+$/;
10576
- OPERATION_NAME_RE = /^[A-Za-z0-9:._-]+$/;
10534
+ OPERATION_NAME_RE = /^[a-z0-9:_-]+$/;
10577
10535
  });
10578
10536
 
10579
10537
  // src/core/registry.ts
@@ -10612,10 +10570,10 @@ import { dirname, join } from "path";
10612
10570
  import { fileURLToPath, pathToFileURL } from "url";
10613
10571
  function resolveGithubConnectorDir() {
10614
10572
  const candidates = [
10615
- join(__dirname2, "..", "..", "..", "connectors", "github"),
10616
- join(__dirname2, "..", "..", "connectors", "github"),
10617
- join(__dirname2, "..", "connectors", "github"),
10618
- join(process.cwd(), "connectors", "github")
10573
+ join(__dirname2, "..", "..", "..", "connectors", "connect-github"),
10574
+ join(__dirname2, "..", "..", "connectors", "connect-github"),
10575
+ join(__dirname2, "..", "connectors", "connect-github"),
10576
+ join(process.cwd(), "connectors", "connect-github")
10619
10577
  ];
10620
10578
  for (const candidate of candidates) {
10621
10579
  if (existsSync(candidate)) {
@@ -11471,812 +11429,12 @@ Commands:
11471
11429
  });
11472
11430
  });
11473
11431
 
11474
- // src/core/connectors/gmail.ts
11475
- import { existsSync as existsSync2, mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
11476
- import { homedir } from "os";
11477
- import { basename, join as join2 } from "path";
11478
- async function modifyMessage(profile, messageId, addLabelIds, removeLabelIds) {
11479
- return requestJson(profile, `/users/me/messages/${encodeURIComponent(messageId)}/modify`, {}, {
11480
- method: "POST",
11481
- body: {
11482
- addLabelIds: addLabelIds ?? [],
11483
- removeLabelIds: removeLabelIds ?? []
11484
- }
11485
- });
11486
- }
11487
- async function replyToMessage(profile, messageId, input) {
11488
- const original = await requestJson(profile, `/users/me/messages/${encodeURIComponent(messageId)}`, { format: "full" });
11489
- const headers = headersToObject(original.payload?.headers ?? []);
11490
- const subject = normalizeReplySubject(headers.Subject ?? headers.subject ?? "");
11491
- const to = headers.From ?? headers.from ?? "";
11492
- const messageIdHeader = headers["Message-ID"] ?? headers["Message-Id"] ?? headers["message-id"] ?? "";
11493
- const references = [headers.References ?? headers.references, messageIdHeader].filter(Boolean).join(" ");
11494
- const raw = buildRawEmail({
11495
- to,
11496
- cc: normalizeStringArray(input.cc),
11497
- bcc: normalizeStringArray(input.bcc),
11498
- subject,
11499
- body: input.body,
11500
- isHtml: Boolean(input.html ?? input.isHtml),
11501
- inReplyTo: messageIdHeader,
11502
- references
11503
- });
11504
- return requestJson(profile, "/users/me/messages/send", {}, {
11505
- method: "POST",
11506
- body: {
11507
- raw: Buffer.from(raw).toString("base64url"),
11508
- threadId: original.threadId
11509
- }
11510
- });
11511
- }
11512
- async function downloadAttachments(profile, input) {
11513
- const messageId = getMessageId(input);
11514
- const outputDir = input.dir ?? input.outputDir ?? join2(configDirs()[0], "attachments", messageId);
11515
- mkdirSync(outputDir, { recursive: true });
11516
- const attachments = input.attachmentId && input.filename ? [{
11517
- attachmentId: input.attachmentId,
11518
- filename: input.filename,
11519
- mimeType: input.mimeType ?? "application/octet-stream",
11520
- size: 0
11521
- }] : collectAttachments((await requestJson(profile, `/users/me/messages/${encodeURIComponent(messageId)}`, { format: "full" })).payload);
11522
- const downloaded = [];
11523
- for (const attachment of attachments) {
11524
- const data = await requestJson(profile, `/users/me/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachment.attachmentId)}`, {});
11525
- const filename = safeFilename(attachment.filename);
11526
- const path = join2(outputDir, filename);
11527
- const buffer = Buffer.from(data.data, "base64url");
11528
- writeFileSync(path, buffer);
11529
- downloaded.push({
11530
- filename,
11531
- path,
11532
- size: buffer.length,
11533
- mimeType: attachment.mimeType
11534
- });
11535
- }
11536
- return downloaded;
11537
- }
11538
- async function requestJson(profile, path, params, options = {}) {
11539
- const token = await getValidAccessToken(profile);
11540
- const url = new URL(`${GMAIL_API_BASE}${path}`);
11541
- for (const [key, value] of Object.entries(params)) {
11542
- if (value !== undefined && value !== null && value !== "")
11543
- url.searchParams.append(key, String(value));
11544
- }
11545
- let lastError;
11546
- for (let attempt = 0;attempt <= MAX_GMAIL_RETRIES; attempt++) {
11547
- let response;
11548
- try {
11549
- response = await fetch(url, {
11550
- method: options.method ?? "GET",
11551
- headers: {
11552
- Authorization: `Bearer ${token}`,
11553
- Accept: "application/json",
11554
- ...options.body ? { "Content-Type": "application/json" } : {}
11555
- },
11556
- body: options.body ? JSON.stringify(options.body) : undefined
11557
- });
11558
- } catch (error3) {
11559
- lastError = error3 instanceof Error ? error3.message : String(error3);
11560
- if (attempt >= MAX_GMAIL_RETRIES)
11561
- throw error3;
11562
- await sleep(gmailBackoffDelayMs(attempt));
11563
- continue;
11564
- }
11565
- const text = await response.text();
11566
- const data = text ? JSON.parse(text) : {};
11567
- if (response.ok)
11568
- return data;
11569
- const error2 = data;
11570
- lastError = error2.error?.message ?? response.statusText;
11571
- if (!isRetryableGmailResponse(response.status, error2) || attempt >= MAX_GMAIL_RETRIES) {
11572
- throw new Error(`Gmail request failed (${response.status}): ${lastError}`);
11573
- }
11574
- await sleep(gmailBackoffDelayMs(attempt, response.headers.get("retry-after")));
11575
- }
11576
- throw new Error(`Gmail request failed: ${lastError ?? "unknown error"}`);
11577
- }
11578
- function isRetryableGmailResponse(status, error2) {
11579
- if ([429, 500, 502, 503, 504].includes(status))
11580
- return true;
11581
- const reasons = error2.error?.errors?.map((entry) => entry.reason) ?? [];
11582
- return reasons.some((reason) => reason === "rateLimitExceeded" || reason === "userRateLimitExceeded");
11583
- }
11584
- function gmailBackoffDelayMs(attempt, retryAfter = null) {
11585
- if (retryAfter) {
11586
- const seconds = Number(retryAfter);
11587
- if (Number.isFinite(seconds) && seconds >= 0)
11588
- return seconds * 1000;
11589
- }
11590
- const base = Number(process.env.CONNECTORS_GMAIL_RETRY_BASE_MS ?? "1000");
11591
- const baseMs = Number.isFinite(base) && base >= 0 ? base : 1000;
11592
- const jitterMs = Math.floor(Math.random() * 1000);
11593
- return Math.min(2 ** attempt * baseMs + jitterMs, 64000);
11594
- }
11595
- function sleep(ms) {
11596
- return new Promise((resolve) => setTimeout(resolve, ms));
11597
- }
11598
- async function getValidAccessToken(profile) {
11599
- if (process.env.GMAIL_ACCESS_TOKEN)
11600
- return process.env.GMAIL_ACCESS_TOKEN;
11601
- const tokens = loadTokens(profile);
11602
- if (!tokens?.accessToken && !tokens?.refreshToken) {
11603
- throw new Error(`Gmail profile "${profile}" is not authenticated. Run: connectors auth gmail`);
11604
- }
11605
- if (tokens.accessToken && (!tokens.expiresAt || Date.now() < tokens.expiresAt - REFRESH_BUFFER_MS))
11606
- return tokens.accessToken;
11607
- if (!tokens.refreshToken)
11608
- return tokens.accessToken ?? "";
11609
- return (await refreshAccessToken(profile, tokens)).accessToken ?? "";
11610
- }
11611
- async function refreshAccessToken(profile, currentTokens) {
11612
- const credentials = loadCredentials(profile);
11613
- if (!credentials.clientId || !credentials.clientSecret)
11614
- throw new Error("Gmail OAuth credentials are not configured. Run: connectors auth gmail");
11615
- if (!currentTokens.refreshToken)
11616
- throw new Error(`Gmail profile "${profile}" has no refresh token. Run: connectors auth gmail`);
11617
- const response = await fetch(TOKEN_URL, {
11618
- method: "POST",
11619
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
11620
- body: new URLSearchParams({
11621
- client_id: credentials.clientId,
11622
- client_secret: credentials.clientSecret,
11623
- refresh_token: currentTokens.refreshToken,
11624
- grant_type: "refresh_token"
11625
- })
11626
- });
11627
- const data = await response.json().catch(() => ({}));
11628
- if (!response.ok || !data.access_token)
11629
- throw new Error(`Gmail token refresh failed: ${data.error_description || data.error || response.statusText}`);
11630
- const tokens = {
11631
- accessToken: data.access_token,
11632
- refreshToken: currentTokens.refreshToken,
11633
- expiresAt: Date.now() + (data.expires_in ?? 3600) * 1000,
11634
- tokenType: data.token_type ?? currentTokens.tokenType,
11635
- scope: data.scope ?? currentTokens.scope
11636
- };
11637
- saveTokens(profile, tokens);
11638
- return tokens;
11639
- }
11640
- function listProfiles() {
11641
- const profiles = new Set;
11642
- for (const baseDir of configDirs()) {
11643
- const profilesDir = join2(baseDir, "profiles");
11644
- if (!existsSync2(profilesDir))
11645
- continue;
11646
- for (const entry of readdirSync(profilesDir, { withFileTypes: true })) {
11647
- if (entry.isDirectory())
11648
- profiles.add(entry.name);
11649
- if (entry.isFile() && entry.name.endsWith(".json"))
11650
- profiles.add(basename(entry.name, ".json"));
11651
- }
11652
- }
11653
- return Array.from(profiles).sort((a, b) => a.localeCompare(b));
11654
- }
11655
- function loadCredentials(profile) {
11656
- const envClientId = process.env.GMAIL_CLIENT_ID ?? process.env.GOOGLE_CLIENT_ID;
11657
- const envClientSecret = process.env.GMAIL_CLIENT_SECRET ?? process.env.GOOGLE_CLIENT_SECRET;
11658
- if (envClientId && envClientSecret)
11659
- return { clientId: envClientId, clientSecret: envClientSecret };
11660
- for (const baseDir of configDirs()) {
11661
- const credentials = {
11662
- ...readJson(join2(baseDir, "credentials.json")),
11663
- ...readJson(join2(baseDir, "profiles", profile, "config.json"))
11664
- };
11665
- if (credentials.clientId || credentials.clientSecret)
11666
- return credentials;
11667
- }
11668
- return {};
11669
- }
11670
- function loadTokens(profile) {
11671
- for (const baseDir of configDirs()) {
11672
- const fromProfile = readJson(join2(baseDir, "profiles", profile, "tokens.json"));
11673
- if (fromProfile)
11674
- return fromProfile;
11675
- const flat = readJson(join2(baseDir, "profiles", `${profile}.json`));
11676
- if (flat)
11677
- return flat.tokens ?? (flat.accessToken || flat.refreshToken ? flat : null);
11678
- }
11679
- return null;
11680
- }
11681
- function saveTokens(profile, tokens) {
11682
- const baseDir = configDirs().find((dir) => existsSync2(dir)) ?? configDirs()[0];
11683
- const profileDir = join2(baseDir, "profiles", profile);
11684
- mkdirSync(profileDir, { recursive: true });
11685
- writeFileSync(join2(profileDir, "tokens.json"), JSON.stringify(tokens, null, 2), { mode: 384 });
11686
- }
11687
- function configDirs() {
11688
- const explicit = process.env.HASNA_GMAIL_CONNECTOR_DIR ?? process.env.GMAIL_CONNECTOR_DIR;
11689
- if (explicit)
11690
- return [explicit];
11691
- const baseDir = process.env.HASNA_CONNECTORS_DIR ?? join2(homedir(), ".hasna", "connectors");
11692
- return [join2(baseDir, "gmail"), join2(baseDir, "connect-gmail")];
11693
- }
11694
- function readJson(path) {
11695
- if (!existsSync2(path))
11696
- return null;
11697
- try {
11698
- return JSON.parse(readFileSync(path, "utf8"));
11699
- } catch {
11700
- return null;
11701
- }
11702
- }
11703
- function getMessageId(input) {
11704
- const id = input.messageId ?? (input.args?.[0] != null ? String(input.args[0]) : undefined);
11705
- if (!id)
11706
- throw new Error("Gmail messageId is required");
11707
- return id;
11708
- }
11709
- function headersToObject(headers) {
11710
- const out = {};
11711
- for (const header of headers)
11712
- out[header.name] = header.value;
11713
- return out;
11714
- }
11715
- function extractBody(message, preferHtml = false) {
11716
- if (!message.payload)
11717
- return "";
11718
- const targetType = preferHtml ? "text/html" : "text/plain";
11719
- const parts = [];
11720
- collectTextParts(message.payload, parts);
11721
- return parts.find((part) => part.mimeType === targetType)?.data ?? parts.find((part) => part.mimeType.startsWith("text/"))?.data ?? "";
11722
- }
11723
- function collectTextParts(part, results) {
11724
- const mimeType = (part.mimeType ?? "").split(";")[0].trim().toLowerCase();
11725
- if (part.body?.data && mimeType.startsWith("text/")) {
11726
- results.push({ mimeType, data: Buffer.from(part.body.data, "base64url").toString("utf8") });
11727
- }
11728
- for (const child of part.parts ?? [])
11729
- collectTextParts(child, results);
11730
- }
11731
- function collectAttachments(part, attachments = []) {
11732
- if (!part)
11733
- return attachments;
11734
- if (part.body?.attachmentId && part.filename) {
11735
- attachments.push({
11736
- attachmentId: part.body.attachmentId,
11737
- filename: part.filename,
11738
- mimeType: part.mimeType ?? "application/octet-stream",
11739
- size: part.body.size ?? 0,
11740
- partId: part.partId
11741
- });
11742
- }
11743
- for (const child of part.parts ?? [])
11744
- collectAttachments(child, attachments);
11745
- return attachments;
11746
- }
11747
- function normalizeStringArray(value) {
11748
- if (!value)
11749
- return [];
11750
- return Array.isArray(value) ? value : value.split(",").map((item) => item.trim()).filter(Boolean);
11751
- }
11752
- function normalizeReplySubject(subject) {
11753
- return subject.toLowerCase().startsWith("re:") ? subject : `Re: ${subject}`;
11754
- }
11755
- function buildRawEmail(input) {
11756
- const headers = [
11757
- `To: ${input.to}`,
11758
- input.cc.length ? `Cc: ${input.cc.join(", ")}` : "",
11759
- input.bcc.length ? `Bcc: ${input.bcc.join(", ")}` : "",
11760
- `Subject: ${input.subject}`,
11761
- input.inReplyTo ? `In-Reply-To: ${input.inReplyTo}` : "",
11762
- input.references ? `References: ${input.references}` : "",
11763
- "MIME-Version: 1.0",
11764
- `Content-Type: ${input.isHtml ? "text/html" : "text/plain"}; charset=UTF-8`
11765
- ].filter(Boolean);
11766
- return `${headers.join(`\r
11767
- `)}\r
11768
- \r
11769
- ${input.body}`;
11770
- }
11771
- function safeFilename(filename) {
11772
- return basename(filename.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000]/g, " ")).replace(/[\/\\]/g, "_");
11773
- }
11774
- var GMAIL_API_BASE = "https://gmail.googleapis.com/gmail/v1", TOKEN_URL = "https://oauth2.googleapis.com/token", REFRESH_BUFFER_MS, MAX_GMAIL_RETRIES = 5, listMessagesSchema, messageIdSchema, readMessageSchema, attachmentListSchema, attachmentDownloadSchema, historyListSchema, replySchema, gmailConnector;
11775
- var init_gmail = __esm(() => {
11776
- init_zod();
11777
- init_connector();
11778
- REFRESH_BUFFER_MS = 5 * 60 * 1000;
11779
- listMessagesSchema = exports_external.object({
11780
- max: exports_external.coerce.number().int().positive().max(500).optional(),
11781
- maxResults: exports_external.coerce.number().int().positive().max(500).optional(),
11782
- pageToken: exports_external.string().optional(),
11783
- query: exports_external.string().optional(),
11784
- q: exports_external.string().optional(),
11785
- label: exports_external.string().optional(),
11786
- labelIds: exports_external.union([exports_external.string(), exports_external.array(exports_external.string())]).optional(),
11787
- includeSpamTrash: exports_external.boolean().optional()
11788
- });
11789
- messageIdSchema = exports_external.object({
11790
- args: exports_external.array(exports_external.union([exports_external.string(), exports_external.number(), exports_external.boolean()])).optional(),
11791
- messageId: exports_external.string().optional()
11792
- });
11793
- readMessageSchema = messageIdSchema.extend({
11794
- body: exports_external.boolean().optional(),
11795
- html: exports_external.boolean().optional(),
11796
- format: exports_external.enum(["full", "metadata", "minimal", "raw"]).optional()
11797
- });
11798
- attachmentListSchema = messageIdSchema;
11799
- attachmentDownloadSchema = messageIdSchema.extend({
11800
- attachmentId: exports_external.string().optional(),
11801
- filename: exports_external.string().optional(),
11802
- mimeType: exports_external.string().optional(),
11803
- dir: exports_external.string().optional(),
11804
- outputDir: exports_external.string().optional()
11805
- });
11806
- historyListSchema = exports_external.object({
11807
- startHistoryId: exports_external.string(),
11808
- historyTypes: exports_external.union([exports_external.string(), exports_external.array(exports_external.string())]).optional(),
11809
- labelId: exports_external.string().optional(),
11810
- maxResults: exports_external.coerce.number().int().positive().max(500).optional(),
11811
- pageToken: exports_external.string().optional()
11812
- });
11813
- replySchema = messageIdSchema.extend({
11814
- body: exports_external.string(),
11815
- html: exports_external.boolean().optional(),
11816
- isHtml: exports_external.boolean().optional(),
11817
- cc: exports_external.union([exports_external.string(), exports_external.array(exports_external.string())]).optional(),
11818
- bcc: exports_external.union([exports_external.string(), exports_external.array(exports_external.string())]).optional()
11819
- });
11820
- gmailConnector = defineConnector({
11821
- meta: {
11822
- name: "gmail",
11823
- displayName: "Gmail",
11824
- description: "Profile-aware Gmail mailbox operations for sync, labels, attachments, history, and replies.",
11825
- category: "communication",
11826
- tags: ["google", "gmail", "email", "mailbox"]
11827
- },
11828
- auth: {
11829
- type: "oauth2",
11830
- supportsProfiles: true,
11831
- fields: [
11832
- { key: "clientId", env: "GMAIL_CLIENT_ID", label: "OAuth client ID" },
11833
- { key: "clientSecret", env: "GMAIL_CLIENT_SECRET", label: "OAuth client secret", secret: true }
11834
- ]
11835
- },
11836
- createContext: ({ profile }) => ({ profile: profile || "default" }),
11837
- operations: {
11838
- "profiles.list": {
11839
- summary: "List configured Gmail profiles.",
11840
- execute: () => ({ profiles: listProfiles() })
11841
- },
11842
- "profile.get": {
11843
- summary: "Get the authenticated Gmail profile.",
11844
- execute: async ({ context }) => requestJson(context.profile, "/users/me/profile", {})
11845
- },
11846
- "messages.list": {
11847
- summary: "List Gmail messages.",
11848
- inputSchema: listMessagesSchema,
11849
- execute: async ({ context }, input) => {
11850
- const labelIds = normalizeStringArray(input.labelIds ?? input.label);
11851
- return requestJson(context.profile, "/users/me/messages", {
11852
- maxResults: input.maxResults ?? input.max ?? 50,
11853
- pageToken: input.pageToken,
11854
- q: input.q ?? input.query,
11855
- labelIds: labelIds.length > 0 ? labelIds.join(",") : undefined,
11856
- includeSpamTrash: input.includeSpamTrash
11857
- });
11858
- }
11859
- },
11860
- "messages.read": {
11861
- summary: "Read a Gmail message with optional extracted body.",
11862
- inputSchema: readMessageSchema,
11863
- execute: async ({ context }, input) => {
11864
- const messageId = getMessageId(input);
11865
- const message = await requestJson(context.profile, `/users/me/messages/${encodeURIComponent(messageId)}`, { format: input.format ?? "full" });
11866
- const headers = headersToObject(message.payload?.headers ?? []);
11867
- return {
11868
- ...message,
11869
- from: headers.From ?? headers.from ?? "",
11870
- to: headers.To ?? headers.to ?? "",
11871
- cc: headers.Cc ?? headers.cc ?? "",
11872
- subject: headers.Subject ?? headers.subject ?? "",
11873
- date: headers.Date ?? headers.date ?? "",
11874
- body: input.body ? extractBody(message, Boolean(input.html)) : undefined,
11875
- size: message.sizeEstimate
11876
- };
11877
- }
11878
- },
11879
- "messages.getRaw": {
11880
- summary: "Read raw base64url Gmail message content.",
11881
- inputSchema: messageIdSchema,
11882
- execute: async ({ context }, input) => {
11883
- const messageId = getMessageId(input);
11884
- return requestJson(context.profile, `/users/me/messages/${encodeURIComponent(messageId)}`, { format: "raw" });
11885
- }
11886
- },
11887
- "messages.mark-read": {
11888
- summary: "Mark a message as read.",
11889
- inputSchema: messageIdSchema,
11890
- execute: async ({ context }, input) => modifyMessage(context.profile, getMessageId(input), undefined, ["UNREAD"])
11891
- },
11892
- "messages.mark-unread": {
11893
- summary: "Mark a message as unread.",
11894
- inputSchema: messageIdSchema,
11895
- execute: async ({ context }, input) => modifyMessage(context.profile, getMessageId(input), ["UNREAD"], undefined)
11896
- },
11897
- "messages.archive": {
11898
- summary: "Archive a message by removing the INBOX label.",
11899
- inputSchema: messageIdSchema,
11900
- execute: async ({ context }, input) => modifyMessage(context.profile, getMessageId(input), undefined, ["INBOX"])
11901
- },
11902
- "messages.star": {
11903
- summary: "Star a message.",
11904
- inputSchema: messageIdSchema,
11905
- execute: async ({ context }, input) => modifyMessage(context.profile, getMessageId(input), ["STARRED"], undefined)
11906
- },
11907
- "messages.reply": {
11908
- summary: "Reply to a Gmail message in the same thread.",
11909
- inputSchema: replySchema,
11910
- execute: async ({ context }, input) => replyToMessage(context.profile, getMessageId(input), input)
11911
- },
11912
- "attachments.list": {
11913
- summary: "List Gmail message attachments.",
11914
- inputSchema: attachmentListSchema,
11915
- execute: async ({ context }, input) => {
11916
- const message = await requestJson(context.profile, `/users/me/messages/${encodeURIComponent(getMessageId(input))}`, { format: "full" });
11917
- return collectAttachments(message.payload);
11918
- }
11919
- },
11920
- "attachments.download": {
11921
- summary: "Download one or all Gmail message attachments to disk.",
11922
- inputSchema: attachmentDownloadSchema,
11923
- execute: async ({ context }, input) => downloadAttachments(context.profile, input)
11924
- },
11925
- "labels.list": {
11926
- summary: "List Gmail labels.",
11927
- execute: async ({ context }) => requestJson(context.profile, "/users/me/labels", {})
11928
- },
11929
- "history.list": {
11930
- summary: "List Gmail mailbox history from a history id.",
11931
- inputSchema: historyListSchema,
11932
- execute: async ({ context }, input) => requestJson(context.profile, "/users/me/history", {
11933
- startHistoryId: input.startHistoryId,
11934
- historyTypes: normalizeStringArray(input.historyTypes).join(",") || undefined,
11935
- labelId: input.labelId,
11936
- maxResults: input.maxResults,
11937
- pageToken: input.pageToken
11938
- })
11939
- }
11940
- }
11941
- });
11942
- });
11943
-
11944
- // src/core/connectors/googledrive.ts
11945
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync as readdirSync2, writeFileSync as writeFileSync2 } from "fs";
11946
- import { homedir as homedir2 } from "os";
11947
- import { basename as basename2, join as join3 } from "path";
11948
- async function requestJson2(profile, path, params) {
11949
- const response = await request(profile, path, params);
11950
- const text = await response.text();
11951
- return text ? JSON.parse(text) : {};
11952
- }
11953
- async function requestBinary(profile, path, params) {
11954
- return (await request(profile, path, params)).arrayBuffer();
11955
- }
11956
- async function request(profile, path, params) {
11957
- const token = await getValidAccessToken2(profile);
11958
- const url = new URL(`${DRIVE_API_BASE}${path}`);
11959
- for (const [key, value] of Object.entries(params)) {
11960
- if (value !== undefined && value !== null && value !== "")
11961
- url.searchParams.set(key, String(value));
11962
- }
11963
- const response = await fetch(url, { headers: { Authorization: `Bearer ${token}`, Accept: "application/json" } });
11964
- if (!response.ok) {
11965
- const body = await response.text().catch(() => "");
11966
- throw new Error(`Google Drive request failed (${response.status}): ${extractGoogleError(body) || response.statusText}`);
11967
- }
11968
- return response;
11969
- }
11970
- async function getValidAccessToken2(profile) {
11971
- if (process.env.GOOGLE_ACCESS_TOKEN)
11972
- return process.env.GOOGLE_ACCESS_TOKEN;
11973
- const tokens = loadTokens2(profile);
11974
- if (!tokens?.accessToken && !tokens?.refreshToken) {
11975
- throw new Error(`Google Drive profile "${profile}" is not authenticated. Run: connectors auth googledrive`);
11976
- }
11977
- if (tokens.accessToken && (!tokens.expiresAt || Date.now() < tokens.expiresAt - REFRESH_BUFFER_MS2))
11978
- return tokens.accessToken;
11979
- if (!tokens.refreshToken)
11980
- return tokens.accessToken ?? "";
11981
- return (await refreshAccessToken2(profile, tokens)).accessToken ?? "";
11982
- }
11983
- async function refreshAccessToken2(profile, currentTokens) {
11984
- const credentials = loadCredentials2(profile);
11985
- if (!credentials.clientId || !credentials.clientSecret)
11986
- throw new Error("Google Drive OAuth credentials are not configured. Run: connectors auth googledrive");
11987
- if (!currentTokens.refreshToken)
11988
- throw new Error(`Google Drive profile "${profile}" has no refresh token. Run: connectors auth googledrive`);
11989
- const response = await fetch(TOKEN_URL2, {
11990
- method: "POST",
11991
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
11992
- body: new URLSearchParams({
11993
- client_id: credentials.clientId,
11994
- client_secret: credentials.clientSecret,
11995
- refresh_token: currentTokens.refreshToken,
11996
- grant_type: "refresh_token"
11997
- })
11998
- });
11999
- const data = await response.json().catch(() => ({}));
12000
- if (!response.ok || !data.access_token)
12001
- throw new Error(`Google Drive token refresh failed: ${data.error_description || data.error || response.statusText}`);
12002
- const tokens = {
12003
- accessToken: data.access_token,
12004
- refreshToken: currentTokens.refreshToken,
12005
- expiresAt: Date.now() + (data.expires_in ?? 3600) * 1000,
12006
- tokenType: data.token_type ?? currentTokens.tokenType,
12007
- scope: data.scope ?? currentTokens.scope
12008
- };
12009
- saveTokens2(profile, tokens);
12010
- return tokens;
12011
- }
12012
- function listProfiles2() {
12013
- const profiles = new Set;
12014
- for (const baseDir of configDirs2()) {
12015
- const profilesDir = join3(baseDir, "profiles");
12016
- if (!existsSync3(profilesDir))
12017
- continue;
12018
- for (const entry of readdirSync2(profilesDir, { withFileTypes: true })) {
12019
- if (entry.isDirectory())
12020
- profiles.add(entry.name);
12021
- if (entry.isFile() && entry.name.endsWith(".json"))
12022
- profiles.add(basename2(entry.name, ".json"));
12023
- }
12024
- }
12025
- return Array.from(profiles).sort((a, b) => a.localeCompare(b));
12026
- }
12027
- function listProfileStatuses(profile) {
12028
- const profiles = profile ? [profile] : listProfiles2();
12029
- const uniqueProfiles = profiles.length ? profiles : ["default"];
12030
- const now = Date.now();
12031
- return uniqueProfiles.map((name) => {
12032
- const tokens = loadTokens2(name);
12033
- const credentials = loadCredentials2(name);
12034
- const hasAccessToken = Boolean(tokens?.accessToken || process.env.GOOGLE_ACCESS_TOKEN);
12035
- const hasRefreshToken = Boolean(tokens?.refreshToken);
12036
- const hasOAuthCredentials = Boolean(credentials.clientId && credentials.clientSecret);
12037
- const expiresAt = tokens?.expiresAt ?? null;
12038
- const expired = Boolean(expiresAt && now >= expiresAt - REFRESH_BUFFER_MS2);
12039
- const authenticated = Boolean(process.env.GOOGLE_ACCESS_TOKEN || hasRefreshToken || hasAccessToken && !expired);
12040
- const configured = authenticated || hasOAuthCredentials;
12041
- const authRequired = !authenticated || expired && !hasRefreshToken;
12042
- return {
12043
- profile: name,
12044
- configured,
12045
- authenticated,
12046
- expired,
12047
- expiresAt,
12048
- hasAccessToken,
12049
- hasRefreshToken,
12050
- hasOAuthCredentials,
12051
- authRequired,
12052
- message: authRequired ? `Google Drive profile "${name}" needs authentication. Run: connectors auth googledrive` : expired ? `Google Drive profile "${name}" access token is expired but can refresh.` : `Google Drive profile "${name}" is authenticated.`
12053
- };
12054
- });
12055
- }
12056
- function loadCredentials2(profile) {
12057
- const envClientId = process.env.GOOGLE_CLIENT_ID;
12058
- const envClientSecret = process.env.GOOGLE_CLIENT_SECRET;
12059
- if (envClientId && envClientSecret)
12060
- return { clientId: envClientId, clientSecret: envClientSecret };
12061
- for (const baseDir of configDirs2()) {
12062
- const credentials = {
12063
- ...readJson2(join3(baseDir, "credentials.json")),
12064
- ...readJson2(join3(baseDir, "profiles", profile, "config.json"))
12065
- };
12066
- if (credentials.clientId || credentials.clientSecret)
12067
- return credentials;
12068
- }
12069
- return {};
12070
- }
12071
- function loadTokens2(profile) {
12072
- for (const baseDir of configDirs2()) {
12073
- const fromProfile = readJson2(join3(baseDir, "profiles", profile, "tokens.json"));
12074
- if (fromProfile)
12075
- return fromProfile;
12076
- const flat = readJson2(join3(baseDir, "profiles", `${profile}.json`));
12077
- if (flat)
12078
- return flat.tokens ?? (flat.accessToken || flat.refreshToken ? flat : null);
12079
- }
12080
- return null;
12081
- }
12082
- function saveTokens2(profile, tokens) {
12083
- const baseDir = configDirs2().find((dir) => existsSync3(dir)) ?? configDirs2()[0];
12084
- const profileDir = join3(baseDir, "profiles", profile);
12085
- mkdirSync2(profileDir, { recursive: true });
12086
- writeFileSync2(join3(profileDir, "tokens.json"), JSON.stringify(tokens, null, 2), { mode: 384 });
12087
- }
12088
- function configDirs2() {
12089
- const explicit = process.env.HASNA_GOOGLE_DRIVE_CONNECTOR_DIR ?? process.env.GOOGLE_DRIVE_CONNECTOR_DIR;
12090
- if (explicit)
12091
- return [explicit];
12092
- const baseDir = process.env.HASNA_CONNECTORS_DIR ?? join3(homedir2(), ".hasna", "connectors");
12093
- return [join3(baseDir, "googledrive"), join3(baseDir, "connect-googledrive")];
12094
- }
12095
- function readJson2(path) {
12096
- if (!existsSync3(path))
12097
- return null;
12098
- try {
12099
- return JSON.parse(readFileSync2(path, "utf8"));
12100
- } catch {
12101
- return null;
12102
- }
12103
- }
12104
- function defaultExportMimeType(googleMimeType) {
12105
- if (googleMimeType.endsWith(".document"))
12106
- return DEFAULT_EXPORT_FORMATS.document;
12107
- if (googleMimeType.endsWith(".spreadsheet"))
12108
- return DEFAULT_EXPORT_FORMATS.spreadsheet;
12109
- if (googleMimeType.endsWith(".presentation"))
12110
- return DEFAULT_EXPORT_FORMATS.presentation;
12111
- if (googleMimeType.endsWith(".drawing"))
12112
- return DEFAULT_EXPORT_FORMATS.drawing;
12113
- throw new Error(`Cannot export Google Workspace file type: ${googleMimeType}`);
12114
- }
12115
- function extensionForMimeType(mimeType) {
12116
- return EXPORT_EXTENSIONS[mimeType] ?? "";
12117
- }
12118
- function extractGoogleError(body) {
12119
- if (!body)
12120
- return "";
12121
- try {
12122
- const parsed = JSON.parse(body);
12123
- return parsed.error?.message ?? body;
12124
- } catch {
12125
- return body;
12126
- }
12127
- }
12128
- var DRIVE_API_BASE = "https://www.googleapis.com/drive/v3", TOKEN_URL2 = "https://oauth2.googleapis.com/token", REFRESH_BUFFER_MS2, DEFAULT_FILE_FIELDS, DEFAULT_EXPORT_FORMATS, EXPORT_EXTENSIONS, listFilesSchema, listDrivesSchema, fileIdSchema, downloadSchema, profilesStatusSchema, googleDriveConnector;
12129
- var init_googledrive = __esm(() => {
12130
- init_zod();
12131
- init_connector();
12132
- REFRESH_BUFFER_MS2 = 5 * 60 * 1000;
12133
- DEFAULT_FILE_FIELDS = [
12134
- "id",
12135
- "name",
12136
- "mimeType",
12137
- "parents",
12138
- "version",
12139
- "md5Checksum",
12140
- "size",
12141
- "modifiedTime",
12142
- "createdTime",
12143
- "trashed",
12144
- "webViewLink",
12145
- "webContentLink"
12146
- ].join(",");
12147
- DEFAULT_EXPORT_FORMATS = {
12148
- document: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
12149
- spreadsheet: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
12150
- presentation: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
12151
- drawing: "image/png"
12152
- };
12153
- EXPORT_EXTENSIONS = {
12154
- "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx",
12155
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx",
12156
- "application/vnd.openxmlformats-officedocument.presentationml.presentation": ".pptx",
12157
- "application/pdf": ".pdf",
12158
- "text/plain": ".txt",
12159
- "text/csv": ".csv",
12160
- "image/png": ".png",
12161
- "image/jpeg": ".jpg",
12162
- "image/svg+xml": ".svg"
12163
- };
12164
- listFilesSchema = exports_external.object({
12165
- pageSize: exports_external.coerce.number().int().positive().max(1000).optional(),
12166
- pageToken: exports_external.string().optional(),
12167
- q: exports_external.string().optional(),
12168
- fields: exports_external.string().optional(),
12169
- orderBy: exports_external.string().optional(),
12170
- corpora: exports_external.enum(["user", "drive", "allDrives"]).optional(),
12171
- driveId: exports_external.string().optional(),
12172
- supportsAllDrives: exports_external.boolean().optional(),
12173
- includeItemsFromAllDrives: exports_external.boolean().optional()
12174
- });
12175
- listDrivesSchema = exports_external.object({
12176
- pageSize: exports_external.coerce.number().int().positive().max(100).optional(),
12177
- pageToken: exports_external.string().optional(),
12178
- q: exports_external.string().optional()
12179
- });
12180
- fileIdSchema = exports_external.object({
12181
- fileId: exports_external.string(),
12182
- fields: exports_external.string().optional()
12183
- });
12184
- downloadSchema = exports_external.object({
12185
- fileId: exports_external.string(),
12186
- file: exports_external.object({
12187
- id: exports_external.string(),
12188
- name: exports_external.string(),
12189
- mimeType: exports_external.string()
12190
- }).optional(),
12191
- exportMimeType: exports_external.string().optional()
12192
- });
12193
- profilesStatusSchema = exports_external.object({
12194
- profile: exports_external.string().optional()
12195
- });
12196
- googleDriveConnector = defineConnector({
12197
- meta: {
12198
- name: "googledrive",
12199
- displayName: "Google Drive",
12200
- description: "Profile-aware Google Drive discovery and file download operations.",
12201
- category: "storage",
12202
- tags: ["google", "drive", "files", "storage"]
12203
- },
12204
- auth: {
12205
- type: "oauth2",
12206
- supportsProfiles: true,
12207
- fields: [
12208
- { key: "clientId", env: "GOOGLE_CLIENT_ID", label: "OAuth client ID" },
12209
- { key: "clientSecret", env: "GOOGLE_CLIENT_SECRET", label: "OAuth client secret", secret: true }
12210
- ]
12211
- },
12212
- createContext: ({ profile }) => ({ profile: profile || "default" }),
12213
- operations: {
12214
- "profiles.list": {
12215
- summary: "List configured Google Drive profiles.",
12216
- execute: () => ({ profiles: listProfiles2() })
12217
- },
12218
- "profiles.status": {
12219
- summary: "List Google Drive profile authentication status.",
12220
- inputSchema: profilesStatusSchema,
12221
- execute: (_ctx, input) => ({ profiles: listProfileStatuses(input.profile) })
12222
- },
12223
- "files.list": {
12224
- summary: "List Google Drive files.",
12225
- inputSchema: listFilesSchema,
12226
- execute: async ({ context }, input) => requestJson2(context.profile, "/files", {
12227
- pageSize: input.pageSize ?? 1000,
12228
- pageToken: input.pageToken,
12229
- q: input.q,
12230
- fields: input.fields ?? `nextPageToken,files(${DEFAULT_FILE_FIELDS})`,
12231
- orderBy: input.orderBy ?? "modifiedTime desc",
12232
- corpora: input.corpora,
12233
- driveId: input.driveId,
12234
- supportsAllDrives: input.supportsAllDrives ?? true,
12235
- includeItemsFromAllDrives: input.includeItemsFromAllDrives ?? false
12236
- })
12237
- },
12238
- "files.get": {
12239
- summary: "Get Google Drive file metadata.",
12240
- inputSchema: fileIdSchema,
12241
- execute: async ({ context }, input) => requestJson2(context.profile, `/files/${encodeURIComponent(input.fileId)}`, {
12242
- fields: input.fields ?? DEFAULT_FILE_FIELDS,
12243
- supportsAllDrives: true
12244
- })
12245
- },
12246
- "files.download": {
12247
- summary: "Download or export a Google Drive file as base64 content.",
12248
- inputSchema: downloadSchema,
12249
- execute: async ({ context }, input) => {
12250
- const file = input.file ?? await requestJson2(context.profile, `/files/${encodeURIComponent(input.fileId)}`, { fields: DEFAULT_FILE_FIELDS, supportsAllDrives: true });
12251
- const exportMimeType = file.mimeType.startsWith("application/vnd.google-apps.") ? input.exportMimeType ?? defaultExportMimeType(file.mimeType) : undefined;
12252
- const data = await requestBinary(context.profile, exportMimeType ? `/files/${encodeURIComponent(file.id)}/export` : `/files/${encodeURIComponent(file.id)}`, exportMimeType ? { mimeType: exportMimeType, supportsAllDrives: true } : { alt: "media", supportsAllDrives: true });
12253
- const mimeType = exportMimeType ?? file.mimeType ?? "application/octet-stream";
12254
- return {
12255
- dataBase64: Buffer.from(data).toString("base64"),
12256
- filename: exportMimeType ? `${file.name}${extensionForMimeType(exportMimeType)}` : file.name,
12257
- mimeType
12258
- };
12259
- }
12260
- },
12261
- "drives.list": {
12262
- summary: "List Google shared drives.",
12263
- inputSchema: listDrivesSchema,
12264
- execute: async ({ context }, input) => requestJson2(context.profile, "/drives", {
12265
- pageSize: input.pageSize ?? 100,
12266
- pageToken: input.pageToken,
12267
- q: input.q
12268
- })
12269
- }
12270
- }
12271
- });
12272
- });
12273
-
12274
11432
  // package.json
12275
11433
  var package_default;
12276
11434
  var init_package = __esm(() => {
12277
11435
  package_default = {
12278
11436
  name: "@hasna/connectors",
12279
- version: "1.3.30",
11437
+ version: "1.3.24",
12280
11438
  description: "Open source connector library - Install API connectors with a single command",
12281
11439
  type: "module",
12282
11440
  bin: {
@@ -12367,22 +11525,22 @@ var init_package = __esm(() => {
12367
11525
  import { createRequire } from "module";
12368
11526
  import { Database } from "bun:sqlite";
12369
11527
  import {
12370
- existsSync as existsSync4,
12371
- mkdirSync as mkdirSync3,
12372
- readdirSync as readdirSync3,
11528
+ existsSync as existsSync2,
11529
+ mkdirSync,
11530
+ readdirSync,
12373
11531
  copyFileSync
12374
11532
  } from "fs";
12375
- import { homedir as homedir3 } from "os";
12376
- import { join as join4, relative } from "path";
12377
- import { existsSync as existsSync22, mkdirSync as mkdirSync22, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
12378
- import { homedir as homedir22 } from "os";
11533
+ import { homedir } from "os";
11534
+ import { join as join2, relative } from "path";
11535
+ import { existsSync as existsSync22, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
11536
+ import { homedir as homedir2 } from "os";
12379
11537
  import { join as join22 } from "path";
12380
- import { readdirSync as readdirSync22, existsSync as existsSync32 } from "fs";
12381
- import { join as join32 } from "path";
12382
- import { homedir as homedir32 } from "os";
11538
+ import { readdirSync as readdirSync2, existsSync as existsSync3 } from "fs";
11539
+ import { join as join3 } from "path";
11540
+ import { homedir as homedir3 } from "os";
12383
11541
  import { hostname as hostname2 } from "os";
12384
11542
  import { homedir as homedir4 } from "os";
12385
- import { join as join42 } from "path";
11543
+ import { join as join4 } from "path";
12386
11544
  import { join as join6, dirname as dirname2 } from "path";
12387
11545
  import { homedir as homedir5, platform } from "os";
12388
11546
  function __accessProp2(key) {
@@ -13255,13 +12413,13 @@ function custom3(check2, _params = {}, fatal) {
13255
12413
  return ZodAny2.create();
13256
12414
  }
13257
12415
  function getDataDir(serviceName) {
13258
- const dir = join4(HASNA_DIR, serviceName);
13259
- mkdirSync3(dir, { recursive: true });
12416
+ const dir = join2(HASNA_DIR, serviceName);
12417
+ mkdirSync(dir, { recursive: true });
13260
12418
  return dir;
13261
12419
  }
13262
12420
  function getDbPath(serviceName) {
13263
12421
  const dir = getDataDir(serviceName);
13264
- return join4(dir, `${serviceName}.db`);
12422
+ return join2(dir, `${serviceName}.db`);
13265
12423
  }
13266
12424
  function getConfigDir() {
13267
12425
  return CONFIG_DIR;
@@ -13274,15 +12432,15 @@ function getCloudConfig() {
13274
12432
  return CloudConfigSchema.parse({});
13275
12433
  }
13276
12434
  try {
13277
- const raw = readFileSync3(CONFIG_PATH, "utf-8");
12435
+ const raw = readFileSync(CONFIG_PATH, "utf-8");
13278
12436
  return CloudConfigSchema.parse(JSON.parse(raw));
13279
12437
  } catch {
13280
12438
  return CloudConfigSchema.parse({});
13281
12439
  }
13282
12440
  }
13283
12441
  function saveCloudConfig(config2) {
13284
- mkdirSync22(CONFIG_DIR, { recursive: true });
13285
- writeFileSync3(CONFIG_PATH, JSON.stringify(config2, null, 2) + `
12442
+ mkdirSync2(CONFIG_DIR, { recursive: true });
12443
+ writeFileSync(CONFIG_PATH, JSON.stringify(config2, null, 2) + `
13286
12444
  `, "utf-8");
13287
12445
  }
13288
12446
  function getConnectionString(dbName) {
@@ -13312,11 +12470,11 @@ function isSyncExcludedTable(table) {
13312
12470
  return SYNC_EXCLUDED_TABLE_PATTERNS.some((p) => p.test(table));
13313
12471
  }
13314
12472
  function discoverServices() {
13315
- const dataDir = join32(homedir32(), ".hasna");
13316
- if (!existsSync32(dataDir))
12473
+ const dataDir = join3(homedir3(), ".hasna");
12474
+ if (!existsSync3(dataDir))
13317
12475
  return [];
13318
12476
  try {
13319
- const entries = readdirSync22(dataDir, { withFileTypes: true });
12477
+ const entries = readdirSync2(dataDir, { withFileTypes: true });
13320
12478
  return entries.filter((e) => {
13321
12479
  if (!e.isDirectory())
13322
12480
  return false;
@@ -13334,24 +12492,24 @@ function discoverSyncableServices() {
13334
12492
  return local.filter((s) => pgSet.has(s));
13335
12493
  }
13336
12494
  function getServiceDbPath(service) {
13337
- const dataDir = join32(homedir32(), ".hasna", service);
13338
- if (!existsSync32(dataDir))
12495
+ const dataDir = join3(homedir3(), ".hasna", service);
12496
+ if (!existsSync3(dataDir))
13339
12497
  return null;
13340
12498
  const candidates = [
13341
- join32(dataDir, `${service}.db`),
13342
- join32(dataDir, "data.db"),
13343
- join32(dataDir, "database.db")
12499
+ join3(dataDir, `${service}.db`),
12500
+ join3(dataDir, "data.db"),
12501
+ join3(dataDir, "database.db")
13344
12502
  ];
13345
12503
  try {
13346
- const files = readdirSync22(dataDir);
12504
+ const files = readdirSync2(dataDir);
13347
12505
  for (const f of files) {
13348
12506
  if (f.endsWith(".db") && !f.endsWith("-wal") && !f.endsWith("-shm")) {
13349
- candidates.push(join32(dataDir, f));
12507
+ candidates.push(join3(dataDir, f));
13350
12508
  }
13351
12509
  }
13352
12510
  } catch {}
13353
12511
  for (const p of candidates) {
13354
- if (existsSync32(p))
12512
+ if (existsSync3(p))
13355
12513
  return p;
13356
12514
  }
13357
12515
  return null;
@@ -13658,9 +12816,9 @@ async function syncTransfer(source, target, options, _direction) {
13658
12816
  const batch = rows.slice(offset, offset + batchSize);
13659
12817
  try {
13660
12818
  if (isAsyncAdapter(target)) {
13661
- await batchUpsertPg(target, table, columns, updateCols, pkColumns, batch);
12819
+ await batchUpsertPg(target, table, columns, updateCols, pkColumns, batch, columns.includes(conflictColumn) ? conflictColumn : undefined);
13662
12820
  } else {
13663
- batchUpsertSqlite(target, table, columns, updateCols, pkColumns, batch);
12821
+ batchUpsertSqlite(target, table, columns, updateCols, pkColumns, batch, columns.includes(conflictColumn) ? conflictColumn : undefined);
13664
12822
  }
13665
12823
  result.rowsWritten += batch.length;
13666
12824
  } catch (err) {
@@ -13707,7 +12865,7 @@ async function syncTransfer(source, target, options, _direction) {
13707
12865
  }
13708
12866
  return results;
13709
12867
  }
13710
- async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, batch) {
12868
+ async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, batch, conflictColumn) {
13711
12869
  if (batch.length === 0)
13712
12870
  return;
13713
12871
  const colList = columns.map((c) => `"${c}"`).join(", ");
@@ -13717,20 +12875,22 @@ async function batchUpsertPg(target, table, columns, updateCols, primaryKeys, ba
13717
12875
  }).join(", ");
13718
12876
  const pkList = primaryKeys.map((c) => `"${c}"`).join(", ");
13719
12877
  const setClause = updateCols.length > 0 ? updateCols.map((c) => `"${c}" = EXCLUDED."${c}"`).join(", ") : `"${primaryKeys[0]}" = EXCLUDED."${primaryKeys[0]}"`;
12878
+ const whereClause = conflictColumn && updateCols.includes(conflictColumn) ? ` WHERE "${table}"."${conflictColumn}" IS NULL OR EXCLUDED."${conflictColumn}" >= "${table}"."${conflictColumn}"` : "";
13720
12879
  const sql = `INSERT INTO "${table}" (${colList}) VALUES ${valuePlaceholders}
13721
- ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}`;
12880
+ ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}${whereClause}`;
13722
12881
  const params = batch.flatMap((row) => columns.map((c) => row[c] ?? null));
13723
12882
  await target.run(sql, ...params);
13724
12883
  }
13725
- function batchUpsertSqlite(target, table, columns, updateCols, primaryKeys, batch) {
12884
+ function batchUpsertSqlite(target, table, columns, updateCols, primaryKeys, batch, conflictColumn) {
13726
12885
  if (batch.length === 0)
13727
12886
  return;
13728
12887
  const colList = columns.map((c) => `"${c}"`).join(", ");
13729
12888
  const valuePlaceholders = batch.map(() => `(${columns.map(() => "?").join(", ")})`).join(", ");
13730
12889
  const pkList = primaryKeys.map((c) => `"${c}"`).join(", ");
13731
12890
  const setClause = updateCols.length > 0 ? updateCols.map((c) => `"${c}" = EXCLUDED."${c}"`).join(", ") : `"${primaryKeys[0]}" = EXCLUDED."${primaryKeys[0]}"`;
12891
+ const whereClause = conflictColumn && updateCols.includes(conflictColumn) ? ` WHERE "${table}"."${conflictColumn}" IS NULL OR EXCLUDED."${conflictColumn}" >= "${table}"."${conflictColumn}"` : "";
13732
12892
  const sql = `INSERT INTO "${table}" (${colList}) VALUES ${valuePlaceholders}
13733
- ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}`;
12893
+ ON CONFLICT (${pkList}) DO UPDATE SET ${setClause}${whereClause}`;
13734
12894
  const params = batch.flatMap((row) => columns.map((c) => coerceForSqlite(row[c])));
13735
12895
  target.run(sql, ...params);
13736
12896
  }
@@ -13955,7 +13115,7 @@ class SyncProgressTracker {
13955
13115
  }
13956
13116
  }
13957
13117
  }
13958
- function registerCloudTools(server, serviceName) {
13118
+ function registerCloudTools(server, serviceName, opts = {}) {
13959
13119
  server.tool(`${serviceName}_cloud_status`, "Show cloud configuration and connection health", {}, async () => {
13960
13120
  const config2 = getCloudConfig();
13961
13121
  const lines = [
@@ -13988,8 +13148,13 @@ function registerCloudTools(server, serviceName) {
13988
13148
  isError: true
13989
13149
  };
13990
13150
  }
13991
- const local = new SqliteAdapter(getDbPath(serviceName));
13151
+ const local = new SqliteAdapter(opts.dbPath ?? getDbPath(serviceName));
13992
13152
  const cloud = new PgAdapterAsync(getConnectionString(serviceName));
13153
+ if (opts.migrations?.length) {
13154
+ for (const sql of opts.migrations) {
13155
+ await cloud.run(sql);
13156
+ }
13157
+ }
13993
13158
  const tableList = tablesStr ? tablesStr.split(",").map((t) => t.trim()) : listSqliteTables(local);
13994
13159
  const results = await syncPush(local, cloud, { tables: tableList });
13995
13160
  local.close();
@@ -14011,7 +13176,7 @@ function registerCloudTools(server, serviceName) {
14011
13176
  isError: true
14012
13177
  };
14013
13178
  }
14014
- const local = new SqliteAdapter(getDbPath(serviceName));
13179
+ const local = new SqliteAdapter(opts.dbPath ?? getDbPath(serviceName));
14015
13180
  const cloud = new PgAdapterAsync(getConnectionString(serviceName));
14016
13181
  let tableList;
14017
13182
  if (tablesStr) {
@@ -22278,7 +21443,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
22278
21443
  init_external2();
22279
21444
  });
22280
21445
  init_dotfile = __esm2(() => {
22281
- HASNA_DIR = join4(homedir3(), ".hasna");
21446
+ HASNA_DIR = join2(homedir(), ".hasna");
22282
21447
  });
22283
21448
  exports_config = {};
22284
21449
  __export2(exports_config, {
@@ -22309,7 +21474,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
22309
21474
  schedule_minutes: exports_external2.number().default(0)
22310
21475
  }).default({})
22311
21476
  });
22312
- CONFIG_DIR = join22(homedir22(), ".hasna", "cloud");
21477
+ CONFIG_DIR = join22(homedir2(), ".hasna", "cloud");
22313
21478
  CONFIG_PATH = join22(CONFIG_DIR, "config.json");
22314
21479
  });
22315
21480
  exports_discover = {};
@@ -22374,7 +21539,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
22374
21539
  init_adapter();
22375
21540
  init_config();
22376
21541
  init_discover();
22377
- AUTO_SYNC_CONFIG_PATH = join42(homedir4(), ".hasna", "cloud", "config.json");
21542
+ AUTO_SYNC_CONFIG_PATH = join4(homedir4(), ".hasna", "cloud", "config.json");
22378
21543
  init_config();
22379
21544
  init_adapter();
22380
21545
  init_dotfile();
@@ -22403,13 +21568,13 @@ __export(exports_database, {
22403
21568
  });
22404
21569
  import { dirname as dirname3, join as join5 } from "path";
22405
21570
  import { homedir as homedir6 } from "os";
22406
- import { mkdirSync as mkdirSync4, existsSync as existsSync5, readdirSync as readdirSync4, copyFileSync as copyFileSync2, statSync } from "fs";
21571
+ import { mkdirSync as mkdirSync3, existsSync as existsSync4, readdirSync as readdirSync3, copyFileSync as copyFileSync2, statSync } from "fs";
22407
21572
  function mergeDirectoryContents(sourceDir, targetDir) {
22408
- if (!existsSync5(sourceDir)) {
21573
+ if (!existsSync4(sourceDir)) {
22409
21574
  return;
22410
21575
  }
22411
- mkdirSync4(targetDir, { recursive: true });
22412
- for (const entry of readdirSync4(sourceDir)) {
21576
+ mkdirSync3(targetDir, { recursive: true });
21577
+ for (const entry of readdirSync3(sourceDir)) {
22413
21578
  const sourcePath = join5(sourceDir, entry);
22414
21579
  const targetPath = join5(targetDir, entry);
22415
21580
  try {
@@ -22418,7 +21583,7 @@ function mergeDirectoryContents(sourceDir, targetDir) {
22418
21583
  mergeDirectoryContents(sourcePath, targetPath);
22419
21584
  continue;
22420
21585
  }
22421
- if (!existsSync5(targetPath)) {
21586
+ if (!existsSync4(targetPath)) {
22422
21587
  copyFileSync2(sourcePath, targetPath);
22423
21588
  }
22424
21589
  } catch {}
@@ -22428,7 +21593,7 @@ function getConnectorsHome() {
22428
21593
  const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir6();
22429
21594
  const newDir = join5(home, ".hasna", "connectors");
22430
21595
  const legacyDirs = [join5(home, ".connectors"), join5(home, ".connect")];
22431
- mkdirSync4(newDir, { recursive: true });
21596
+ mkdirSync3(newDir, { recursive: true });
22432
21597
  for (const legacyDir of legacyDirs) {
22433
21598
  try {
22434
21599
  mergeDirectoryContents(legacyDir, newDir);
@@ -22446,7 +21611,7 @@ function getDatabase(path) {
22446
21611
  _dbPath = null;
22447
21612
  }
22448
21613
  if (dbPath !== ":memory:") {
22449
- mkdirSync4(dirname3(dbPath), { recursive: true });
21614
+ mkdirSync3(dirname3(dbPath), { recursive: true });
22450
21615
  }
22451
21616
  _db = new SqliteAdapter(dbPath);
22452
21617
  _dbPath = dbPath;
@@ -22578,99 +21743,17 @@ var init_database = __esm(() => {
22578
21743
  DB_PATH = join5(DB_DIR, "connectors.db");
22579
21744
  });
22580
21745
 
22581
- // src/lib/connector-resolver.ts
22582
- import { existsSync as existsSync6, readdirSync as readdirSync5, statSync as statSync2 } from "fs";
22583
- import { join as join7 } from "path";
22584
- function normalizeConnectorName(name) {
22585
- const trimmed = name.trim().toLowerCase();
22586
- return trimmed.startsWith(LEGACY_CONNECTOR_PREFIX) ? trimmed.slice(LEGACY_CONNECTOR_PREFIX.length) : trimmed;
22587
- }
22588
- function legacyConnectorName(name) {
22589
- return `${LEGACY_CONNECTOR_PREFIX}${normalizeConnectorName(name)}`;
22590
- }
22591
- function resolveConnectorName(name) {
22592
- const canonicalName = normalizeConnectorName(name);
22593
- const legacyName = legacyConnectorName(canonicalName);
22594
- return {
22595
- input: name,
22596
- canonicalName,
22597
- legacyName,
22598
- aliases: canonicalName === legacyName ? [canonicalName] : [canonicalName, legacyName],
22599
- isLegacyInput: name.trim().toLowerCase().startsWith(LEGACY_CONNECTOR_PREFIX)
22600
- };
22601
- }
22602
- function isValidConnectorName(name) {
22603
- const trimmed = name.trim();
22604
- if (trimmed !== trimmed.toLowerCase())
22605
- return false;
22606
- return CONNECTOR_NAME_RE2.test(normalizeConnectorName(trimmed));
22607
- }
22608
- function connectorPackageDirNames(name) {
22609
- const { canonicalName, legacyName } = resolveConnectorName(name);
22610
- if (!canonicalName)
22611
- return [legacyName];
22612
- return canonicalName === legacyName ? [canonicalName] : [canonicalName, legacyName];
22613
- }
22614
- function resolveConnectorPackagePath(connectorsDir, name) {
22615
- const resolution = resolveConnectorName(name);
22616
- const dirNames = connectorPackageDirNames(name);
22617
- const checkedPaths = dirNames.map((dirName) => join7(connectorsDir, dirName));
22618
- const existingPath = checkedPaths.find((path) => existsSync6(path)) ?? null;
22619
- const existingDirName = existingPath ? dirNames[checkedPaths.indexOf(existingPath)] : null;
22620
- return {
22621
- ...resolution,
22622
- connectorsDir,
22623
- preferredDirName: dirNames[0],
22624
- preferredPath: checkedPaths[0],
22625
- existingPath,
22626
- existingDirName,
22627
- checkedPaths
22628
- };
22629
- }
22630
- function getConnectorPackagePath(connectorsDir, name) {
22631
- const resolved = resolveConnectorPackagePath(connectorsDir, name);
22632
- return resolved.existingPath ?? resolved.preferredPath;
22633
- }
22634
- function resolveConnectorConfigPaths(name, connectorsHome = getConnectorsHome()) {
22635
- const resolution = resolveConnectorName(name);
22636
- const preferredDirName = resolution.canonicalName || resolution.legacyName;
22637
- const preferredPath = join7(connectorsHome, preferredDirName);
22638
- const legacyPath = join7(connectorsHome, resolution.legacyName);
22639
- const paths = preferredPath === legacyPath ? [preferredPath] : [preferredPath, legacyPath];
22640
- const existingPaths = paths.filter((path) => existsSync6(path));
22641
- return {
22642
- ...resolution,
22643
- connectorsHome,
22644
- preferredDirName,
22645
- preferredPath,
22646
- legacyPath,
22647
- existingPaths,
22648
- readPaths: paths
22649
- };
22650
- }
22651
- function getConnectorConfigDir(name, connectorsHome = getConnectorsHome()) {
22652
- return resolveConnectorConfigPaths(name, connectorsHome).preferredPath;
22653
- }
22654
- function getConnectorConfigReadDirs(name, connectorsHome = getConnectorsHome()) {
22655
- return resolveConnectorConfigPaths(name, connectorsHome).readPaths;
22656
- }
22657
- var LEGACY_CONNECTOR_PREFIX = "connect-", CONNECTOR_NAME_RE2;
22658
- var init_connector_resolver = __esm(() => {
22659
- init_database();
22660
- CONNECTOR_NAME_RE2 = /^[a-z0-9-]+$/;
22661
- });
22662
-
22663
21746
  // src/core/connectors/imessage.ts
22664
21747
  import {
22665
- existsSync as existsSync7,
21748
+ existsSync as existsSync6,
22666
21749
  mkdirSync as mkdirSync5,
22667
- readFileSync as readFileSync4,
22668
- readdirSync as readdirSync6,
21750
+ readFileSync as readFileSync2,
21751
+ readdirSync as readdirSync5,
22669
21752
  rmSync,
22670
- statSync as statSync3,
22671
- writeFileSync as writeFileSync4
21753
+ statSync as statSync2,
21754
+ writeFileSync as writeFileSync2
22672
21755
  } from "fs";
22673
- import { join as join9 } from "path";
21756
+ import { join as join7 } from "path";
22674
21757
  function buildRootHelp(specs) {
22675
21758
  const lines = [
22676
21759
  "Usage: connect-imessage [options] [command]",
@@ -22715,44 +21798,36 @@ function buildCommandHelp(spec) {
22715
21798
  `);
22716
21799
  }
22717
21800
  function getConfigDir2() {
22718
- return getConnectorConfigDir(CONNECTOR_NAME);
22719
- }
22720
- function getConfigReadDirs() {
22721
- return getConnectorConfigReadDirs(CONNECTOR_NAME);
21801
+ return join7(getConnectorsHome(), CONNECTOR_DIRNAME);
22722
21802
  }
22723
21803
  function getProfilesDir() {
22724
- return join9(getConfigDir2(), "profiles");
21804
+ return join7(getConfigDir2(), "profiles");
22725
21805
  }
22726
21806
  function getCurrentProfile() {
22727
- for (const configDir of getConfigReadDirs()) {
22728
- const currentProfileFile = join9(configDir, "current_profile");
22729
- if (!existsSync7(currentProfileFile))
22730
- continue;
22731
- try {
22732
- return readFileSync4(currentProfileFile, "utf-8").trim() || "default";
22733
- } catch {
22734
- return "default";
22735
- }
21807
+ const currentProfileFile = join7(getConfigDir2(), "current_profile");
21808
+ if (!existsSync6(currentProfileFile)) {
21809
+ return "default";
21810
+ }
21811
+ try {
21812
+ return readFileSync2(currentProfileFile, "utf-8").trim() || "default";
21813
+ } catch {
21814
+ return "default";
22736
21815
  }
22737
- return "default";
22738
21816
  }
22739
21817
  function setCurrentProfile(profile) {
22740
21818
  const configDir = getConfigDir2();
22741
21819
  mkdirSync5(configDir, { recursive: true });
22742
- writeFileSync4(join9(configDir, "current_profile"), profile);
21820
+ writeFileSync2(join7(configDir, "current_profile"), profile);
22743
21821
  }
22744
21822
  function getFlatProfilePath(profile) {
22745
- return join9(getProfilesDir(), `${profile}.json`);
21823
+ return join7(getProfilesDir(), `${profile}.json`);
22746
21824
  }
22747
- function getFlatProfileReadPaths(profile) {
22748
- return getConfigReadDirs().map((dir) => join9(dir, "profiles", `${profile}.json`));
22749
- }
22750
- function getDirectoryProfileReadPaths(profile) {
22751
- return getConfigReadDirs().map((dir) => join9(dir, "profiles", profile, "config.json"));
21825
+ function getDirectoryProfilePath(profile) {
21826
+ return join7(getProfilesDir(), profile, "config.json");
22752
21827
  }
22753
21828
  function loadJsonFile(path) {
22754
21829
  try {
22755
- return JSON.parse(readFileSync4(path, "utf-8"));
21830
+ return JSON.parse(readFileSync2(path, "utf-8"));
22756
21831
  } catch {
22757
21832
  return {};
22758
21833
  }
@@ -22768,8 +21843,8 @@ function sanitizeProfileConfig(config2) {
22768
21843
  };
22769
21844
  }
22770
21845
  function loadProfile(profile = getCurrentProfile()) {
22771
- const flatConfig = getFlatProfileReadPaths(profile).reverse().reduce((config2, path) => ({ ...config2, ...existsSync7(path) ? loadJsonFile(path) : {} }), {});
22772
- const directoryConfig = getDirectoryProfileReadPaths(profile).reverse().reduce((config2, path) => ({ ...config2, ...existsSync7(path) ? loadJsonFile(path) : {} }), {});
21846
+ const flatConfig = existsSync6(getFlatProfilePath(profile)) ? loadJsonFile(getFlatProfilePath(profile)) : {};
21847
+ const directoryConfig = existsSync6(getDirectoryProfilePath(profile)) ? loadJsonFile(getDirectoryProfilePath(profile)) : {};
22773
21848
  return sanitizeProfileConfig({
22774
21849
  ...flatConfig,
22775
21850
  ...directoryConfig
@@ -22778,33 +21853,32 @@ function loadProfile(profile = getCurrentProfile()) {
22778
21853
  function writeProfile(profile, config2) {
22779
21854
  const profilesDir = getProfilesDir();
22780
21855
  mkdirSync5(profilesDir, { recursive: true });
22781
- writeFileSync4(getFlatProfilePath(profile), JSON.stringify(config2, null, 2) + `
21856
+ writeFileSync2(getFlatProfilePath(profile), JSON.stringify(config2, null, 2) + `
22782
21857
  `);
22783
21858
  }
22784
21859
  function profileExists(profile) {
22785
21860
  if (profile === "default") {
22786
21861
  return true;
22787
21862
  }
22788
- return getFlatProfileReadPaths(profile).some((path) => existsSync7(path)) || getConfigReadDirs().some((dir) => existsSync7(join9(dir, "profiles", profile)));
21863
+ return existsSync6(getFlatProfilePath(profile)) || existsSync6(join7(getProfilesDir(), profile));
22789
21864
  }
22790
- function listProfiles3() {
21865
+ function listProfiles() {
21866
+ const profilesDir = getProfilesDir();
22791
21867
  const seen = new Set(["default"]);
22792
- for (const configDir of getConfigReadDirs()) {
22793
- const profilesDir = join9(configDir, "profiles");
22794
- if (!existsSync7(profilesDir))
22795
- continue;
22796
- try {
22797
- for (const entry of readdirSync6(profilesDir)) {
22798
- const fullPath = join9(profilesDir, entry);
22799
- const stat = statSync3(fullPath);
22800
- if (stat.isDirectory()) {
22801
- seen.add(entry);
22802
- } else if (entry.endsWith(".json")) {
22803
- seen.add(entry.replace(/\.json$/, ""));
22804
- }
22805
- }
22806
- } catch {}
21868
+ if (!existsSync6(profilesDir)) {
21869
+ return [...seen];
22807
21870
  }
21871
+ try {
21872
+ for (const entry of readdirSync5(profilesDir)) {
21873
+ const fullPath = join7(profilesDir, entry);
21874
+ const stat = statSync2(fullPath);
21875
+ if (stat.isDirectory()) {
21876
+ seen.add(entry);
21877
+ } else if (entry.endsWith(".json")) {
21878
+ seen.add(entry.replace(/\.json$/, ""));
21879
+ }
21880
+ }
21881
+ } catch {}
22808
21882
  return [...seen].sort();
22809
21883
  }
22810
21884
  function createProfile(profile, config2 = {}) {
@@ -22817,11 +21891,11 @@ function createProfile(profile, config2 = {}) {
22817
21891
  }
22818
21892
  function clearProfile(profile = getCurrentProfile()) {
22819
21893
  const flatPath = getFlatProfilePath(profile);
22820
- const directoryPath = join9(getProfilesDir(), profile);
22821
- if (existsSync7(flatPath)) {
21894
+ const directoryPath = join7(getProfilesDir(), profile);
21895
+ if (existsSync6(flatPath)) {
22822
21896
  rmSync(flatPath);
22823
21897
  }
22824
- if (existsSync7(directoryPath)) {
21898
+ if (existsSync6(directoryPath)) {
22825
21899
  rmSync(directoryPath, { recursive: true, force: true });
22826
21900
  }
22827
21901
  }
@@ -23117,7 +22191,7 @@ async function sendMessage(context, input) {
23117
22191
  direction: "outbound"
23118
22192
  });
23119
22193
  }
23120
- async function replyToMessage2(context, input) {
22194
+ async function replyToMessage(context, input) {
23121
22195
  const payload = await bridgeRequest(context, "/messages/reply", {
23122
22196
  method: "POST",
23123
22197
  body: {
@@ -23231,7 +22305,7 @@ async function runProfileCommand2(args, context) {
23231
22305
  switch (subcommand) {
23232
22306
  case "list": {
23233
22307
  const current = getCurrentProfile();
23234
- const profiles = listProfiles3();
22308
+ const profiles = listProfiles();
23235
22309
  return successOutput({ current, profiles }, context.format, () => profiles.map((profile) => `${profile}${profile === current ? " (active)" : ""}`).join(`
23236
22310
  `));
23237
22311
  }
@@ -23405,7 +22479,7 @@ async function runMessageCommand(args, context) {
23405
22479
  if (!conversationId || !text) {
23406
22480
  return failure2("Usage: connect-imessage message reply --conversation <id> --text <text>");
23407
22481
  }
23408
- return successOutput(await replyToMessage2(resolved, {
22482
+ return successOutput(await replyToMessage(resolved, {
23409
22483
  conversationId,
23410
22484
  text,
23411
22485
  replyToMessageId: asString2(options.replyTo),
@@ -23424,7 +22498,7 @@ function createOperationContext(args) {
23424
22498
  deviceId: extractCredentialString(args.credentials, "deviceId")
23425
22499
  });
23426
22500
  }
23427
- var CONNECTOR_NAME = "imessage", COMMAND_SPECS, ROOT_HELP2, COMMAND_HELP2, COMMAND_DESCRIPTORS, IMESSAGE_DOCS = `# CLAUDE.md
22501
+ var CONNECTOR_DIRNAME = "connect-imessage", COMMAND_SPECS, ROOT_HELP2, COMMAND_HELP2, COMMAND_DESCRIPTORS, IMESSAGE_DOCS = `# CLAUDE.md
23428
22502
 
23429
22503
  ## Project Overview
23430
22504
 
@@ -23454,12 +22528,12 @@ API Key authentication is optional and depends on the bridge deployment. A bridg
23454
22528
 
23455
22529
  ## Data Storage
23456
22530
 
23457
- Connector state is stored under \`~/.hasna/connectors/imessage/\`. Profiles are read from both \`profiles/<name>.json\` and \`profiles/<name>/config.json\` so the connector stays compatible with the shared dashboard auth helpers while remaining fully internal to the one-product repo.
22531
+ Connector state is stored under \`~/.hasna/connectors/connect-imessage/\`. Profiles are read from both \`profiles/<name>.json\` and \`profiles/<name>/config.json\` so the connector stays compatible with the shared dashboard auth helpers while remaining fully internal to the one-product repo.
23458
22532
  `, commandInputSchema, conversationListInputSchema, conversationGetInputSchema, messageListInputSchema, messageSendInputSchema, messageReplyInputSchema, imessageConnector;
23459
22533
  var init_imessage = __esm(() => {
23460
22534
  init_package();
23461
22535
  init_zod();
23462
- init_connector_resolver();
22536
+ init_database();
23463
22537
  init_connector();
23464
22538
  COMMAND_SPECS = [
23465
22539
  {
@@ -23683,7 +22757,7 @@ var init_imessage = __esm(() => {
23683
22757
  summary: "Reply to an existing conversation through the bridge",
23684
22758
  inputSchema: messageReplyInputSchema,
23685
22759
  async execute({ context }, input) {
23686
- return replyToMessage2(context, input);
22760
+ return replyToMessage(context, input);
23687
22761
  }
23688
22762
  }
23689
22763
  },
@@ -23747,18 +22821,18 @@ var init_imessage = __esm(() => {
23747
22821
  });
23748
22822
 
23749
22823
  // src/core/connectors/stripe.ts
23750
- import { existsSync as existsSync8 } from "fs";
23751
- import { dirname as dirname4, join as join10 } from "path";
22824
+ import { existsSync as existsSync7 } from "fs";
22825
+ import { dirname as dirname4, join as join8 } from "path";
23752
22826
  import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
23753
22827
  function resolveStripeConnectorDir() {
23754
22828
  const candidates = [
23755
- join10(__dirname3, "..", "..", "..", "connectors", "stripe"),
23756
- join10(__dirname3, "..", "..", "connectors", "stripe"),
23757
- join10(__dirname3, "..", "connectors", "stripe"),
23758
- join10(process.cwd(), "connectors", "stripe")
22829
+ join8(__dirname3, "..", "..", "..", "connectors", "connect-stripe"),
22830
+ join8(__dirname3, "..", "..", "connectors", "connect-stripe"),
22831
+ join8(__dirname3, "..", "connectors", "connect-stripe"),
22832
+ join8(process.cwd(), "connectors", "connect-stripe")
23759
22833
  ];
23760
22834
  for (const candidate of candidates) {
23761
- if (existsSync8(candidate)) {
22835
+ if (existsSync7(candidate)) {
23762
22836
  return candidate;
23763
22837
  }
23764
22838
  }
@@ -23806,10 +22880,10 @@ function buildCommandHelp2(spec) {
23806
22880
  `);
23807
22881
  }
23808
22882
  async function loadStripeApiModule() {
23809
- return await import(pathToFileURL2(join10(CONNECTOR_DIR2, "src", "api", "index.ts")).href);
22883
+ return await import(pathToFileURL2(join8(CONNECTOR_DIR2, "src", "api", "index.ts")).href);
23810
22884
  }
23811
22885
  async function loadStripeConfigModule() {
23812
- return await import(pathToFileURL2(join10(CONNECTOR_DIR2, "src", "utils", "config.ts")).href);
22886
+ return await import(pathToFileURL2(join8(CONNECTOR_DIR2, "src", "utils", "config.ts")).href);
23813
22887
  }
23814
22888
  function extractGlobalArgs3(args) {
23815
22889
  const remaining = [];
@@ -24630,14 +23704,10 @@ var INTERNAL_CONNECTOR_DEFINITIONS, INTERNAL_CONNECTOR_REGISTRY;
24630
23704
  var init_builtins = __esm(() => {
24631
23705
  init_registry();
24632
23706
  init_github();
24633
- init_gmail();
24634
- init_googledrive();
24635
23707
  init_imessage();
24636
23708
  init_stripe();
24637
23709
  INTERNAL_CONNECTOR_DEFINITIONS = [
24638
- gmailConnector,
24639
23710
  githubConnector,
24640
- googleDriveConnector,
24641
23711
  imessageConnector,
24642
23712
  stripeConnector
24643
23713
  ];
@@ -24655,17 +23725,17 @@ __export(exports_llm, {
24655
23725
  PROVIDER_DEFAULTS: () => PROVIDER_DEFAULTS,
24656
23726
  LLMClient: () => LLMClient
24657
23727
  });
24658
- import { existsSync as existsSync10, readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync6 } from "fs";
24659
- import { join as join12 } from "path";
23728
+ import { existsSync as existsSync9, readFileSync as readFileSync4, writeFileSync as writeFileSync3, mkdirSync as mkdirSync6 } from "fs";
23729
+ import { join as join10 } from "path";
24660
23730
  function getLlmConfigPath() {
24661
- return join12(getConnectorsHome(), "llm.json");
23731
+ return join10(getConnectorsHome(), "llm.json");
24662
23732
  }
24663
23733
  function getLlmConfig() {
24664
23734
  const path = getLlmConfigPath();
24665
- if (!existsSync10(path))
23735
+ if (!existsSync9(path))
24666
23736
  return null;
24667
23737
  try {
24668
- return JSON.parse(readFileSync6(path, "utf-8"));
23738
+ return JSON.parse(readFileSync4(path, "utf-8"));
24669
23739
  } catch {
24670
23740
  return null;
24671
23741
  }
@@ -24673,7 +23743,7 @@ function getLlmConfig() {
24673
23743
  function saveLlmConfig(config2) {
24674
23744
  const dir = getConnectorsHome();
24675
23745
  mkdirSync6(dir, { recursive: true });
24676
- writeFileSync5(getLlmConfigPath(), JSON.stringify(config2, null, 2));
23746
+ writeFileSync3(getLlmConfigPath(), JSON.stringify(config2, null, 2));
24677
23747
  }
24678
23748
  function setLlmStrip(enabled) {
24679
23749
  const config2 = getLlmConfig();
@@ -24792,34 +23862,37 @@ __export(exports_installer, {
24792
23862
  getConnectorDocs: () => getConnectorDocs,
24793
23863
  connectorExists: () => connectorExists
24794
23864
  });
24795
- import { existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync7, writeFileSync as writeFileSync6, readdirSync as readdirSync7, statSync as statSync4, rmSync as rmSync2 } from "fs";
24796
- import { join as join13, dirname as dirname6 } from "path";
23865
+ import { existsSync as existsSync10, mkdirSync as mkdirSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync4, readdirSync as readdirSync6, statSync as statSync3, rmSync as rmSync2 } from "fs";
23866
+ import { join as join11, dirname as dirname6 } from "path";
24797
23867
  import { fileURLToPath as fileURLToPath4 } from "url";
24798
23868
  function resolveConnectorsDir() {
24799
- const fromBin = join13(__dirname4, "..", "connectors");
24800
- if (existsSync11(fromBin))
23869
+ const fromBin = join11(__dirname4, "..", "connectors");
23870
+ if (existsSync10(fromBin))
24801
23871
  return fromBin;
24802
- const fromSrc = join13(__dirname4, "..", "..", "connectors");
24803
- if (existsSync11(fromSrc))
23872
+ const fromSrc = join11(__dirname4, "..", "..", "connectors");
23873
+ if (existsSync10(fromSrc))
24804
23874
  return fromSrc;
24805
23875
  return fromBin;
24806
23876
  }
23877
+ function normalizeConnectorName(name) {
23878
+ return name.startsWith("connect-") ? name.slice("connect-".length) : name;
23879
+ }
24807
23880
  function getProjectConnectorsDir(targetDir) {
24808
- return join13(targetDir, PROJECT_CONNECTORS_DIRNAME);
23881
+ return join11(targetDir, PROJECT_CONNECTORS_DIRNAME);
24809
23882
  }
24810
23883
  function getEnablementManifestPath(targetDir) {
24811
- return join13(getProjectConnectorsDir(targetDir), ENABLEMENT_MANIFEST_FILENAME);
23884
+ return join11(getProjectConnectorsDir(targetDir), ENABLEMENT_MANIFEST_FILENAME);
24812
23885
  }
24813
23886
  function getLegacyInstallPath(targetDir, name) {
24814
- return join13(getProjectConnectorsDir(targetDir), legacyConnectorName(name));
23887
+ return join11(getProjectConnectorsDir(targetDir), `connect-${normalizeConnectorName(name)}`);
24815
23888
  }
24816
23889
  function loadEnablementManifest(targetDir) {
24817
23890
  const manifestPath = getEnablementManifestPath(targetDir);
24818
- if (!existsSync11(manifestPath)) {
23891
+ if (!existsSync10(manifestPath)) {
24819
23892
  return null;
24820
23893
  }
24821
23894
  try {
24822
- const raw = JSON.parse(readFileSync7(manifestPath, "utf-8"));
23895
+ const raw = JSON.parse(readFileSync5(manifestPath, "utf-8"));
24823
23896
  if (!Array.isArray(raw.connectors)) {
24824
23897
  return null;
24825
23898
  }
@@ -24835,12 +23908,12 @@ function loadEnablementManifest(targetDir) {
24835
23908
  }
24836
23909
  function getLegacyInstalledConnectors(targetDir) {
24837
23910
  const connectorsDir = getProjectConnectorsDir(targetDir);
24838
- if (!existsSync11(connectorsDir)) {
23911
+ if (!existsSync10(connectorsDir)) {
24839
23912
  return [];
24840
23913
  }
24841
- return readdirSync7(connectorsDir).filter((entry) => {
24842
- const fullPath = join13(connectorsDir, entry);
24843
- return entry.startsWith("connect-") && statSync4(fullPath).isDirectory();
23914
+ return readdirSync6(connectorsDir).filter((entry) => {
23915
+ const fullPath = join11(connectorsDir, entry);
23916
+ return entry.startsWith("connect-") && statSync3(fullPath).isDirectory();
24844
23917
  }).map((entry) => entry.replace("connect-", "")).sort();
24845
23918
  }
24846
23919
  function getEnabledConnectors(targetDir) {
@@ -24848,7 +23921,7 @@ function getEnabledConnectors(targetDir) {
24848
23921
  return [...new Set([...manifestConnectors, ...getLegacyInstalledConnectors(targetDir)])].sort();
24849
23922
  }
24850
23923
  function updateConnectorsIndex(connectorsDir, connectors18) {
24851
- const indexPath = join13(connectorsDir, ENABLEMENT_INDEX_FILENAME);
23924
+ const indexPath = join11(connectorsDir, ENABLEMENT_INDEX_FILENAME);
24852
23925
  const connectorList = connectors18.map((connector) => ` "${connector}",`).join(`
24853
23926
  `);
24854
23927
  const content = `/**
@@ -24864,7 +23937,7 @@ ${connectorList}
24864
23937
 
24865
23938
  export type EnabledConnectorName = typeof enabledConnectors[number];
24866
23939
  `;
24867
- writeFileSync6(indexPath, content);
23940
+ writeFileSync4(indexPath, content);
24868
23941
  }
24869
23942
  function writeEnablementManifest(targetDir, connectors18) {
24870
23943
  const connectorsDir = getProjectConnectorsDir(targetDir);
@@ -24875,16 +23948,17 @@ function writeEnablementManifest(targetDir, connectors18) {
24875
23948
  updatedAt: new Date().toISOString(),
24876
23949
  connectors: [...new Set(connectors18.map((value) => normalizeConnectorName(value)))].sort()
24877
23950
  };
24878
- writeFileSync6(getEnablementManifestPath(targetDir), JSON.stringify(manifest, null, 2) + `
23951
+ writeFileSync4(getEnablementManifestPath(targetDir), JSON.stringify(manifest, null, 2) + `
24879
23952
  `);
24880
23953
  updateConnectorsIndex(connectorsDir, manifest.connectors);
24881
23954
  }
24882
23955
  function getConnectorPath(name) {
24883
- return getConnectorPackagePath(CONNECTORS_DIR, name);
23956
+ const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
23957
+ return join11(CONNECTORS_DIR, connectorName);
24884
23958
  }
24885
23959
  function connectorExists(name) {
24886
23960
  const normalizedName = normalizeConnectorName(name);
24887
- return hasInternalConnectorDefinition(normalizedName) || existsSync11(getConnectorPath(normalizedName));
23961
+ return hasInternalConnectorDefinition(normalizedName) || existsSync10(getConnectorPath(normalizedName));
24888
23962
  }
24889
23963
  function installConnector(name, options = {}) {
24890
23964
  const { targetDir = process.cwd(), overwrite = false } = options;
@@ -24917,7 +23991,7 @@ function installConnector(name, options = {}) {
24917
23991
  try {
24918
23992
  const nextEnabled = [...new Set([...installed, normalizedName])].sort();
24919
23993
  writeEnablementManifest(targetDir, nextEnabled);
24920
- if (overwrite && existsSync11(legacyInstallPath)) {
23994
+ if (overwrite && existsSync10(legacyInstallPath)) {
24921
23995
  rmSync2(legacyInstallPath, { recursive: true });
24922
23996
  }
24923
23997
  return {
@@ -24952,9 +24026,9 @@ function parseConnectorDocs(raw) {
24952
24026
  function getConnectorDocs(name) {
24953
24027
  const normalizedName = normalizeConnectorName(name);
24954
24028
  const connectorPath = getConnectorPath(normalizedName);
24955
- const claudeMdPath = join13(connectorPath, "CLAUDE.md");
24956
- if (existsSync11(claudeMdPath)) {
24957
- return parseConnectorDocs(readFileSync7(claudeMdPath, "utf-8"));
24029
+ const claudeMdPath = join11(connectorPath, "CLAUDE.md");
24030
+ if (existsSync10(claudeMdPath)) {
24031
+ return parseConnectorDocs(readFileSync5(claudeMdPath, "utf-8"));
24958
24032
  }
24959
24033
  const internalDocs = getInternalConnectorDefinition(normalizedName)?.docsMarkdown;
24960
24034
  if (internalDocs) {
@@ -24998,7 +24072,7 @@ function removeConnector(name, targetDir = process.cwd()) {
24998
24072
  const nextEnabled = installed.filter((connector) => connector !== normalizedName);
24999
24073
  writeEnablementManifest(targetDir, nextEnabled);
25000
24074
  const legacyInstallPath = getLegacyInstallPath(targetDir, normalizedName);
25001
- if (existsSync11(legacyInstallPath)) {
24075
+ if (existsSync10(legacyInstallPath)) {
25002
24076
  rmSync2(legacyInstallPath, { recursive: true });
25003
24077
  }
25004
24078
  return true;
@@ -25006,7 +24080,6 @@ function removeConnector(name, targetDir = process.cwd()) {
25006
24080
  var __dirname4, CONNECTORS_DIR, PROJECT_CONNECTORS_DIRNAME = ".connectors", ENABLEMENT_MANIFEST_FILENAME = "manifest.json", ENABLEMENT_INDEX_FILENAME = "index.ts";
25007
24081
  var init_installer = __esm(() => {
25008
24082
  init_builtins();
25009
- init_connector_resolver();
25010
24083
  __dirname4 = dirname6(fileURLToPath4(import.meta.url));
25011
24084
  CONNECTORS_DIR = resolveConnectorsDir();
25012
24085
  });
@@ -25080,426 +24153,30 @@ var init_usage = __esm(() => {
25080
24153
  init_database();
25081
24154
  });
25082
24155
 
25083
- // src/lib/lock.ts
25084
- import { openSync, closeSync, unlinkSync, existsSync as existsSync12, statSync as statSync5 } from "fs";
25085
- import { mkdirSync as mkdirSync8 } from "fs";
25086
- function lockPath(connector) {
25087
- const dir = getConnectorConfigDir(connector);
25088
- mkdirSync8(dir, { recursive: true });
25089
- return `${dir}/.write.lock`;
25090
- }
25091
- function isStale(path) {
25092
- try {
25093
- const stat = statSync5(path);
25094
- return Date.now() - stat.mtimeMs > STALE_LOCK_MS;
25095
- } catch {
25096
- return false;
25097
- }
25098
- }
25099
- function tryAcquire(path) {
25100
- if (existsSync12(path) && isStale(path)) {
25101
- try {
25102
- unlinkSync(path);
25103
- } catch {}
25104
- }
25105
- try {
25106
- const fd = openSync(path, "wx");
25107
- closeSync(fd);
25108
- return true;
25109
- } catch (e) {
25110
- if (e.code === "EEXIST")
25111
- return false;
25112
- throw e;
25113
- }
25114
- }
25115
- function release(path) {
25116
- try {
25117
- unlinkSync(path);
25118
- } catch {}
25119
- }
25120
- async function withWriteLock(connector, fn) {
25121
- connector = normalizeConnectorName(connector);
25122
- const path = lockPath(connector);
25123
- const deadline = Date.now() + LOCK_TIMEOUT_MS;
25124
- while (Date.now() < deadline) {
25125
- if (tryAcquire(path)) {
25126
- try {
25127
- return await fn();
25128
- } finally {
25129
- release(path);
25130
- }
25131
- }
25132
- await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_MS));
25133
- }
25134
- throw new LockTimeoutError(connector);
25135
- }
25136
- var LOCK_TIMEOUT_MS = 5000, LOCK_RETRY_MS = 100, STALE_LOCK_MS = 30000, LockTimeoutError;
25137
- var init_lock = __esm(() => {
25138
- init_connector_resolver();
25139
- LockTimeoutError = class LockTimeoutError extends Error {
25140
- connector;
25141
- constructor(connector) {
25142
- super(`Could not acquire write lock for connector "${connector}" within ${LOCK_TIMEOUT_MS}ms. Another agent may be writing. Try again shortly.`);
25143
- this.connector = connector;
25144
- this.name = "LockTimeoutError";
25145
- }
25146
- };
25147
- });
25148
-
25149
- // src/server/auth.ts
25150
- import { existsSync as existsSync13, readFileSync as readFileSync8, writeFileSync as writeFileSync7, mkdirSync as mkdirSync9, readdirSync as readdirSync8, rmSync as rmSync3, statSync as statSync6 } from "fs";
25151
- import { join as join14 } from "path";
25152
- function getAuthType(name) {
25153
- name = normalizeConnectorName(name);
25154
- const docs = getConnectorDocs(name);
25155
- if (!docs?.auth)
25156
- return "apikey";
25157
- const authLower = docs.auth.toLowerCase();
25158
- if (authLower.includes("oauth"))
25159
- return "oauth";
25160
- if (authLower.includes("bearer token"))
25161
- return "bearer";
25162
- return "apikey";
25163
- }
25164
- function getConnectorConfigDir2(name) {
25165
- name = normalizeConnectorName(name);
25166
- return getConnectorConfigDir(name);
25167
- }
25168
- function getConnectorConfigReadDirs2(name) {
25169
- name = normalizeConnectorName(name);
25170
- return getConnectorConfigReadDirs(name);
25171
- }
25172
- function getCurrentProfile2(name) {
25173
- name = normalizeConnectorName(name);
25174
- for (const configDir of getConnectorConfigReadDirs2(name)) {
25175
- const currentProfileFile = join14(configDir, "current_profile");
25176
- if (existsSync13(currentProfileFile)) {
25177
- try {
25178
- return readFileSync8(currentProfileFile, "utf-8").trim() || "default";
25179
- } catch {
25180
- return "default";
25181
- }
25182
- }
25183
- }
25184
- return "default";
25185
- }
25186
- function loadProfileConfigFromDir(configDir, profile) {
25187
- let flatConfig = {};
25188
- let dirConfig = {};
25189
- const profileFile = join14(configDir, "profiles", `${profile}.json`);
25190
- if (existsSync13(profileFile)) {
25191
- try {
25192
- flatConfig = JSON.parse(readFileSync8(profileFile, "utf-8"));
25193
- } catch {}
25194
- }
25195
- const profileDirConfig = join14(configDir, "profiles", profile, "config.json");
25196
- if (existsSync13(profileDirConfig)) {
25197
- try {
25198
- dirConfig = JSON.parse(readFileSync8(profileDirConfig, "utf-8"));
25199
- } catch {}
25200
- }
25201
- return { ...flatConfig, ...dirConfig };
25202
- }
25203
- function loadProfileConfig(name) {
25204
- name = normalizeConnectorName(name);
25205
- const profile = getCurrentProfile2(name);
25206
- const merged = {};
25207
- for (const configDir of [...getConnectorConfigReadDirs2(name)].reverse()) {
25208
- Object.assign(merged, loadProfileConfigFromDir(configDir, profile));
25209
- }
25210
- return merged;
25211
- }
25212
- function loadTokens3(name) {
25213
- name = normalizeConnectorName(name);
25214
- const profile = getCurrentProfile2(name);
25215
- for (const configDir of getConnectorConfigReadDirs2(name)) {
25216
- const tokensFile = join14(configDir, "profiles", profile, "tokens.json");
25217
- if (existsSync13(tokensFile)) {
25218
- try {
25219
- return JSON.parse(readFileSync8(tokensFile, "utf-8"));
25220
- } catch {
25221
- return null;
25222
- }
25223
- }
25224
- }
25225
- const profileConfig = loadProfileConfig(name);
25226
- if (profileConfig.refreshToken || profileConfig.accessToken) {
25227
- return {
25228
- accessToken: profileConfig.accessToken ?? "",
25229
- refreshToken: profileConfig.refreshToken,
25230
- expiresAt: profileConfig.expiresAt ?? 0,
25231
- tokenType: profileConfig.tokenType,
25232
- scope: profileConfig.scope
25233
- };
25234
- }
25235
- return null;
25236
- }
25237
- function isStoredOAuthEnvVarSet(variable, oauthConfig, tokens, profileConfig) {
25238
- if (variable.endsWith("_CLIENT_ID")) {
25239
- return Boolean(oauthConfig.clientId || profileConfig.clientId);
25240
- }
25241
- if (variable.endsWith("_CLIENT_SECRET")) {
25242
- return Boolean(oauthConfig.clientSecret || profileConfig.clientSecret);
25243
- }
25244
- if (variable.endsWith("_ACCESS_TOKEN")) {
25245
- return Boolean(tokens?.accessToken || profileConfig.accessToken);
25246
- }
25247
- if (variable.endsWith("_REFRESH_TOKEN")) {
25248
- return Boolean(tokens?.refreshToken || profileConfig.refreshToken);
25249
- }
25250
- if (variable.endsWith("_TOKEN_EXPIRES_AT")) {
25251
- return Boolean(tokens?.expiresAt || profileConfig.expiresAt);
25252
- }
25253
- return false;
25254
- }
25255
- function getAuthStatus(name) {
25256
- name = normalizeConnectorName(name);
25257
- const authType = getAuthType(name);
25258
- const docs = getConnectorDocs(name);
25259
- const oauthConfig = authType === "oauth" ? getOAuthConfig(name) : {};
25260
- const tokens = authType === "oauth" ? loadTokens3(name) : null;
25261
- const profileConfig = authType === "oauth" ? loadProfileConfig(name) : {};
25262
- const envVars = (docs?.envVars || []).map((v) => ({
25263
- variable: v.variable,
25264
- description: v.description,
25265
- set: !!process.env[v.variable] || authType === "oauth" && isStoredOAuthEnvVarSet(v.variable, oauthConfig, tokens, profileConfig)
25266
- }));
25267
- const envVarTotalCount = envVars.length;
25268
- const envVarSetCount = envVars.filter((v) => v.set).length;
25269
- if (authType === "oauth") {
25270
- const hasTokens = !!tokens?.accessToken || !!profileConfig.accessToken;
25271
- const hasRefreshToken = !!tokens?.refreshToken || !!profileConfig.refreshToken;
25272
- const tokenExpiry = tokens?.expiresAt || profileConfig.expiresAt;
25273
- const hasOAuthCredentials = Boolean(oauthConfig.clientId && oauthConfig.clientSecret);
25274
- const hasEnvVar2 = envVars.some((v) => v.set);
25275
- return {
25276
- type: "oauth",
25277
- configured: hasTokens || hasRefreshToken || hasOAuthCredentials || hasEnvVar2,
25278
- tokenExpiry,
25279
- hasRefreshToken,
25280
- hasOAuthCredentials,
25281
- envVars,
25282
- envVarSetCount,
25283
- envVarTotalCount
25284
- };
25285
- }
25286
- const config2 = loadProfileConfig(name);
25287
- const hasKey = Object.values(config2).some((v) => typeof v === "string" && v.length > 0);
25288
- const hasEnvVar = envVars.some((v) => v.set);
25289
- return {
25290
- type: authType,
25291
- configured: hasKey || hasEnvVar,
25292
- envVars,
25293
- envVarSetCount,
25294
- envVarTotalCount
25295
- };
25296
- }
25297
- function getEnvVars(name) {
25298
- name = normalizeConnectorName(name);
25299
- const docs = getConnectorDocs(name);
25300
- return docs?.envVars || [];
25301
- }
25302
- async function saveApiKey(name, key, field) {
25303
- name = normalizeConnectorName(name);
25304
- return withWriteLock(name, () => _saveApiKey(name, key, field));
25305
- }
25306
- function _saveApiKey(name, key, field) {
25307
- name = normalizeConnectorName(name);
25308
- const configDir = getConnectorConfigDir2(name);
25309
- const profile = getCurrentProfile2(name);
25310
- const keyField = field || guessKeyField(name);
25311
- if (keyField === "clientId" || keyField === "clientSecret") {
25312
- const credentialsFile = join14(configDir, "credentials.json");
25313
- mkdirSync9(configDir, { recursive: true });
25314
- let creds = {};
25315
- if (existsSync13(credentialsFile)) {
25316
- try {
25317
- creds = JSON.parse(readFileSync8(credentialsFile, "utf-8"));
25318
- } catch {}
25319
- }
25320
- creds[keyField] = key;
25321
- writeFileSync7(credentialsFile, JSON.stringify(creds, null, 2));
25322
- return;
25323
- }
25324
- const profileFile = join14(configDir, "profiles", `${profile}.json`);
25325
- const profileDir = join14(configDir, "profiles", profile);
25326
- if (existsSync13(profileFile)) {
25327
- let config2 = {};
25328
- try {
25329
- config2 = JSON.parse(readFileSync8(profileFile, "utf-8"));
25330
- } catch {}
25331
- config2[keyField] = key;
25332
- writeFileSync7(profileFile, JSON.stringify(config2, null, 2));
25333
- return;
25334
- }
25335
- if (existsSync13(profileDir)) {
25336
- const configFile = join14(profileDir, "config.json");
25337
- let config2 = {};
25338
- if (existsSync13(configFile)) {
25339
- try {
25340
- config2 = JSON.parse(readFileSync8(configFile, "utf-8"));
25341
- } catch {}
25342
- }
25343
- config2[keyField] = key;
25344
- writeFileSync7(configFile, JSON.stringify(config2, null, 2));
25345
- return;
25346
- }
25347
- mkdirSync9(profileDir, { recursive: true });
25348
- writeFileSync7(join14(profileDir, "config.json"), JSON.stringify({ [keyField]: key }, null, 2));
25349
- }
25350
- function guessKeyField(name) {
25351
- name = normalizeConnectorName(name);
25352
- const docs = getConnectorDocs(name);
25353
- if (!docs?.envVars.length)
25354
- return "apiKey";
25355
- const keyVar = docs.envVars.find((v) => v.variable.includes("API_KEY") || v.variable.includes("API_SECRET") || v.variable.includes("TOKEN") || v.variable.includes("SECRET"));
25356
- if (keyVar) {
25357
- const parts = keyVar.variable.toLowerCase().split("_");
25358
- const withoutPrefix = parts.slice(1);
25359
- if (withoutPrefix.length > 0) {
25360
- return withoutPrefix.map((p, i) => i === 0 ? p : p.charAt(0).toUpperCase() + p.slice(1)).join("");
25361
- }
25362
- }
25363
- return "apiKey";
25364
- }
25365
- function getOAuthConfig(name) {
25366
- name = normalizeConnectorName(name);
25367
- for (const configDir of getConnectorConfigReadDirs2(name)) {
25368
- const credentialsFile = join14(configDir, "credentials.json");
25369
- if (existsSync13(credentialsFile)) {
25370
- try {
25371
- const creds = JSON.parse(readFileSync8(credentialsFile, "utf-8"));
25372
- return { clientId: creds.clientId, clientSecret: creds.clientSecret };
25373
- } catch {}
25374
- }
25375
- }
25376
- const config2 = loadProfileConfig(name);
25377
- return {
25378
- clientId: config2.clientId,
25379
- clientSecret: config2.clientSecret
25380
- };
25381
- }
25382
- function saveOAuthTokens(name, tokens) {
25383
- name = normalizeConnectorName(name);
25384
- const configDir = getConnectorConfigDir2(name);
25385
- const profile = getCurrentProfile2(name);
25386
- const profileDir = join14(configDir, "profiles", profile);
25387
- mkdirSync9(profileDir, { recursive: true });
25388
- const tokensFile = join14(profileDir, "tokens.json");
25389
- writeFileSync7(tokensFile, JSON.stringify(tokens, null, 2), { mode: 384 });
25390
- }
25391
- async function refreshOAuthToken(name) {
25392
- name = normalizeConnectorName(name);
25393
- return withWriteLock(name, () => _refreshOAuthToken(name));
25394
- }
25395
- async function _refreshOAuthToken(name) {
25396
- name = normalizeConnectorName(name);
25397
- const oauthConfig = getOAuthConfig(name);
25398
- const currentTokens = loadTokens3(name);
25399
- if (!oauthConfig.clientId || !oauthConfig.clientSecret) {
25400
- throw new Error("OAuth credentials not configured for " + name);
25401
- }
25402
- if (!currentTokens?.refreshToken) {
25403
- throw new Error("No refresh token available. Please re-authenticate.");
25404
- }
25405
- const response = await fetch(GOOGLE_TOKEN_URL, {
25406
- method: "POST",
25407
- headers: { "Content-Type": "application/x-www-form-urlencoded" },
25408
- body: new URLSearchParams({
25409
- client_id: oauthConfig.clientId,
25410
- client_secret: oauthConfig.clientSecret,
25411
- refresh_token: currentTokens.refreshToken,
25412
- grant_type: "refresh_token"
25413
- }),
25414
- signal: AbortSignal.timeout(FETCH_TIMEOUT)
25415
- });
25416
- if (!response.ok) {
25417
- const error2 = await response.json().catch(() => ({ error: response.statusText }));
25418
- throw new Error(`Token refresh failed: ${error2.error_description || error2.error}`);
25419
- }
25420
- const data = await response.json();
25421
- const tokens = {
25422
- accessToken: data.access_token,
25423
- refreshToken: currentTokens.refreshToken,
25424
- expiresAt: Date.now() + data.expires_in * 1000,
25425
- tokenType: data.token_type,
25426
- scope: data.scope || currentTokens.scope
25427
- };
25428
- saveOAuthTokens(name, tokens);
25429
- return tokens;
25430
- }
25431
- var FETCH_TIMEOUT = 1e4, oauthStateStore, GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token", GOOGLE_SCOPES;
25432
- var init_auth = __esm(() => {
25433
- init_installer();
25434
- init_lock();
25435
- init_connector_resolver();
25436
- oauthStateStore = new Map;
25437
- GOOGLE_SCOPES = {
25438
- gmail: [
25439
- "https://www.googleapis.com/auth/gmail.readonly",
25440
- "https://www.googleapis.com/auth/gmail.send",
25441
- "https://www.googleapis.com/auth/gmail.compose",
25442
- "https://www.googleapis.com/auth/gmail.modify",
25443
- "https://www.googleapis.com/auth/gmail.labels",
25444
- "https://mail.google.com/"
25445
- ].join(" "),
25446
- googlecalendar: [
25447
- "https://www.googleapis.com/auth/calendar",
25448
- "https://www.googleapis.com/auth/calendar.events"
25449
- ].join(" "),
25450
- googledrive: [
25451
- "https://www.googleapis.com/auth/drive",
25452
- "https://www.googleapis.com/auth/drive.file"
25453
- ].join(" "),
25454
- googledocs: [
25455
- "https://www.googleapis.com/auth/documents",
25456
- "https://www.googleapis.com/auth/drive.file"
25457
- ].join(" "),
25458
- googlesheets: [
25459
- "https://www.googleapis.com/auth/spreadsheets",
25460
- "https://www.googleapis.com/auth/drive.file"
25461
- ].join(" "),
25462
- googletasks: [
25463
- "https://www.googleapis.com/auth/tasks"
25464
- ].join(" "),
25465
- googlecontacts: [
25466
- "https://www.googleapis.com/auth/contacts",
25467
- "https://www.googleapis.com/auth/contacts.readonly"
25468
- ].join(" "),
25469
- google: [
25470
- "openid",
25471
- "https://www.googleapis.com/auth/userinfo.email",
25472
- "https://www.googleapis.com/auth/userinfo.profile"
25473
- ].join(" ")
25474
- };
25475
- });
25476
-
25477
- // src/lib/runner.ts
25478
- var exports_runner = {};
25479
- __export(exports_runner, {
25480
- runConnectorOperation: () => runConnectorOperation,
25481
- runConnectorCommand: () => runConnectorCommand,
25482
- parseCommanderHelpOperations: () => parseCommanderHelpOperations,
25483
- hasConnectorCommandSurface: () => hasConnectorCommandSurface,
25484
- getConnectorsWithCli: () => getConnectorsWithCli,
25485
- getConnectorOperations: () => getConnectorOperations,
25486
- getConnectorCommandHelp: () => getConnectorCommandHelp,
25487
- getConnectorCliPath: () => getConnectorCliPath,
25488
- buildEnvWithCredentials: () => buildEnvWithCredentials,
25489
- buildConnectorOperationArgs: () => buildConnectorOperationArgs
25490
- });
25491
- import { existsSync as existsSync15, readdirSync as readdirSync9 } from "fs";
25492
- import { join as join16, dirname as dirname7 } from "path";
25493
- import { fileURLToPath as fileURLToPath5 } from "url";
25494
- import { spawn as spawn2 } from "child_process";
25495
- function resolveConnectorsDir2() {
25496
- const fromBin = join16(__dirname5, "..", "connectors");
25497
- if (existsSync15(fromBin))
25498
- return fromBin;
25499
- const fromSrc = join16(__dirname5, "..", "..", "connectors");
25500
- if (existsSync15(fromSrc))
25501
- return fromSrc;
25502
- return fromBin;
24156
+ // src/lib/runner.ts
24157
+ var exports_runner = {};
24158
+ __export(exports_runner, {
24159
+ runConnectorCommand: () => runConnectorCommand,
24160
+ parseCommanderHelpOperations: () => parseCommanderHelpOperations,
24161
+ hasConnectorCommandSurface: () => hasConnectorCommandSurface,
24162
+ getConnectorsWithCli: () => getConnectorsWithCli,
24163
+ getConnectorOperations: () => getConnectorOperations,
24164
+ getConnectorCommandHelp: () => getConnectorCommandHelp,
24165
+ getConnectorCliPath: () => getConnectorCliPath,
24166
+ buildEnvWithCredentials: () => buildEnvWithCredentials
24167
+ });
24168
+ import { existsSync as existsSync14, readdirSync as readdirSync8 } from "fs";
24169
+ import { join as join15, dirname as dirname7 } from "path";
24170
+ import { fileURLToPath as fileURLToPath5 } from "url";
24171
+ import { spawn as spawn2 } from "child_process";
24172
+ function resolveConnectorsDir2() {
24173
+ const fromBin = join15(__dirname5, "..", "connectors");
24174
+ if (existsSync14(fromBin))
24175
+ return fromBin;
24176
+ const fromSrc = join15(__dirname5, "..", "..", "connectors");
24177
+ if (existsSync14(fromSrc))
24178
+ return fromSrc;
24179
+ return fromBin;
25503
24180
  }
25504
24181
  function buildInternalHelpText(name, commands) {
25505
24182
  const lines = [
@@ -25518,9 +24195,8 @@ function getInternalCommandRuntime(name) {
25518
24195
  }
25519
24196
  function buildEnvWithCredentials(connectorName, baseEnv) {
25520
24197
  const env = { ...baseEnv };
25521
- const normalizedConnectorName = normalizeConnectorName(connectorName);
25522
- const prefixes = ENV_VAR_NAME_OVERRIDES[normalizedConnectorName] || [
25523
- normalizedConnectorName.toUpperCase().replace(/-/g, "_")
24198
+ const prefixes = ENV_VAR_NAME_OVERRIDES[connectorName] || [
24199
+ connectorName.toUpperCase().replace(/-/g, "_")
25524
24200
  ];
25525
24201
  for (const prefix of prefixes) {
25526
24202
  const canonicalKey = `${prefix}_API_KEY`;
@@ -25541,32 +24217,13 @@ function buildEnvWithCredentials(connectorName, baseEnv) {
25541
24217
  }
25542
24218
  }
25543
24219
  }
25544
- if (getAuthType(normalizedConnectorName) === "oauth") {
25545
- const oauthConfig = getOAuthConfig(normalizedConnectorName);
25546
- const tokens = loadTokens3(normalizedConnectorName);
25547
- for (const { variable } of getEnvVars(normalizedConnectorName)) {
25548
- if (env[variable])
25549
- continue;
25550
- if (variable.endsWith("_CLIENT_ID") && oauthConfig.clientId) {
25551
- env[variable] = oauthConfig.clientId;
25552
- } else if (variable.endsWith("_CLIENT_SECRET") && oauthConfig.clientSecret) {
25553
- env[variable] = oauthConfig.clientSecret;
25554
- } else if (variable.endsWith("_ACCESS_TOKEN") && tokens?.accessToken) {
25555
- env[variable] = tokens.accessToken;
25556
- } else if (variable.endsWith("_REFRESH_TOKEN") && tokens?.refreshToken) {
25557
- env[variable] = tokens.refreshToken;
25558
- } else if (variable.endsWith("_TOKEN_EXPIRES_AT") && tokens?.expiresAt) {
25559
- env[variable] = String(tokens.expiresAt);
25560
- }
25561
- }
25562
- }
25563
24220
  return env;
25564
24221
  }
25565
24222
  function getConnectorCliPath(name) {
25566
- const safeName = normalizeConnectorName(name).replace(/[^a-z0-9-]/g, "");
25567
- const connectorDir = getConnectorPackagePath(CONNECTORS_DIR2, safeName);
25568
- const cliPath = join16(connectorDir, "src", "cli", "index.ts");
25569
- if (existsSync15(cliPath))
24223
+ const safeName = name.replace(/[^a-z0-9-]/g, "");
24224
+ const connectorDir = join15(CONNECTORS_DIR2, `connect-${safeName}`);
24225
+ const cliPath = join15(connectorDir, "src", "cli", "index.ts");
24226
+ if (existsSync14(cliPath))
25570
24227
  return cliPath;
25571
24228
  return null;
25572
24229
  }
@@ -25604,7 +24261,7 @@ function parseCommanderHelpOperations(helpText) {
25604
24261
  inCommands = false;
25605
24262
  continue;
25606
24263
  }
25607
- const row = line.match(/^ {2}(?! )(\S.*?)(?: {2,}(.+))?$/);
24264
+ const row = line.match(/^ {2}(\S.*?)(?: {2,}(.+))?$/);
25608
24265
  if (!row)
25609
24266
  continue;
25610
24267
  const usage = row[1].trim();
@@ -25621,9 +24278,8 @@ function parseCommanderHelpOperations(helpText) {
25621
24278
  return operations;
25622
24279
  }
25623
24280
  function runConnectorCommand(name, args, timeoutMs = 30000) {
25624
- const connectorName = normalizeConnectorName(name);
25625
24281
  getConnectorsHome();
25626
- const internalRuntime = getInternalCommandRuntime(connectorName);
24282
+ const internalRuntime = getInternalCommandRuntime(name);
25627
24283
  if (internalRuntime?.run) {
25628
24284
  return Promise.resolve(internalRuntime.run(args)).then((result) => {
25629
24285
  if (result) {
@@ -25637,125 +24293,17 @@ function runConnectorCommand(name, args, timeoutMs = 30000) {
25637
24293
  success: result.success ?? exitCode === 0
25638
24294
  };
25639
24295
  }
25640
- return runLegacyConnectorCommand(connectorName, args, timeoutMs);
24296
+ return runLegacyConnectorCommand(name, args, timeoutMs);
25641
24297
  });
25642
24298
  }
25643
- return runLegacyConnectorCommand(connectorName, args, timeoutMs);
25644
- }
25645
- async function runConnectorOperation(args) {
25646
- const connectorName = normalizeConnectorName(args.connector);
25647
- const internal = getInternalConnectorDefinition(connectorName);
25648
- if (internal?.operations[args.operation]) {
25649
- try {
25650
- const operationData = await executeConnectorOperation(internal, {
25651
- operation: args.operation,
25652
- input: args.input,
25653
- profile: args.profile
25654
- });
25655
- const commandResult = normalizeOperationReturn(operationData);
25656
- return {
25657
- connector: connectorName,
25658
- operation: args.operation,
25659
- profile: args.profile,
25660
- ...commandResult
25661
- };
25662
- } catch (error2) {
25663
- return {
25664
- connector: connectorName,
25665
- operation: args.operation,
25666
- profile: args.profile,
25667
- stdout: "",
25668
- stderr: error2.message,
25669
- exitCode: 1,
25670
- success: false
25671
- };
25672
- }
25673
- }
25674
- const commandArgs = buildConnectorOperationArgs(args);
25675
- const result = await runConnectorCommand(connectorName, commandArgs, args.timeoutMs ?? 30000);
25676
- const response = {
25677
- ...result,
25678
- connector: connectorName,
25679
- operation: args.operation,
25680
- profile: args.profile
25681
- };
25682
- if (args.parseJson !== false && result.stdout) {
25683
- try {
25684
- response.data = JSON.parse(result.stdout);
25685
- } catch {}
25686
- }
25687
- return response;
25688
- }
25689
- function normalizeOperationReturn(value) {
25690
- if (isRunResult(value)) {
25691
- const result = value;
25692
- const response = {
25693
- ...result
25694
- };
25695
- if (result.stdout) {
25696
- try {
25697
- response.data = JSON.parse(result.stdout);
25698
- } catch {}
25699
- }
25700
- return response;
25701
- }
25702
- return {
25703
- data: value,
25704
- stdout: JSON.stringify(value),
25705
- stderr: "",
25706
- exitCode: 0,
25707
- success: true
25708
- };
25709
- }
25710
- function isRunResult(value) {
25711
- if (!value || typeof value !== "object")
25712
- return false;
25713
- const candidate = value;
25714
- return typeof candidate.stdout === "string" && typeof candidate.stderr === "string" && typeof candidate.exitCode === "number" && typeof candidate.success === "boolean";
25715
- }
25716
- function buildConnectorOperationArgs(args) {
25717
- const commandArgs = [];
25718
- if (args.profile) {
25719
- commandArgs.push("--profile", args.profile);
25720
- }
25721
- commandArgs.push(...args.operation.split(".").filter(Boolean));
25722
- for (const positional of args.input?.args ?? []) {
25723
- commandArgs.push(String(positional));
25724
- }
25725
- let hasFormat = false;
25726
- for (const [key, value] of Object.entries(args.input ?? {})) {
25727
- if (key === "args")
25728
- continue;
25729
- if (value === undefined || value === null)
25730
- continue;
25731
- const flag = `--${key.replace(/_/g, "-").replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}`;
25732
- if (flag === "--format" || flag === "--json")
25733
- hasFormat = true;
25734
- if (typeof value === "boolean") {
25735
- if (value)
25736
- commandArgs.push(flag);
25737
- continue;
25738
- }
25739
- if (Array.isArray(value)) {
25740
- for (const item of value) {
25741
- commandArgs.push(flag, String(item));
25742
- }
25743
- continue;
25744
- }
25745
- commandArgs.push(flag, String(value));
25746
- }
25747
- if (args.parseJson !== false && !hasFormat) {
25748
- commandArgs.push("--format", "json");
25749
- }
25750
- return commandArgs;
24299
+ return runLegacyConnectorCommand(name, args, timeoutMs);
25751
24300
  }
25752
24301
  function runLegacyConnectorCommand(name, args, timeoutMs = 30000) {
25753
- const connectorName = normalizeConnectorName(name);
25754
- const cliPath = getConnectorCliPath(connectorName);
24302
+ const cliPath = getConnectorCliPath(name);
25755
24303
  if (!cliPath) {
25756
24304
  return Promise.resolve({
25757
24305
  stdout: "",
25758
- stderr: `Connector '${connectorName}' not found or has no CLI.`,
24306
+ stderr: `Connector '${name}' not found or has no CLI.`,
25759
24307
  exitCode: 1,
25760
24308
  success: false
25761
24309
  });
@@ -25763,7 +24311,7 @@ function runLegacyConnectorCommand(name, args, timeoutMs = 30000) {
25763
24311
  return new Promise((resolve) => {
25764
24312
  const proc = spawn2("bun", ["run", cliPath, ...args], {
25765
24313
  timeout: timeoutMs,
25766
- env: buildEnvWithCredentials(connectorName, process.env),
24314
+ env: buildEnvWithCredentials(name, process.env),
25767
24315
  stdio: ["pipe", "pipe", "pipe"]
25768
24316
  });
25769
24317
  let stdout = "";
@@ -25793,8 +24341,7 @@ function runLegacyConnectorCommand(name, args, timeoutMs = 30000) {
25793
24341
  });
25794
24342
  }
25795
24343
  async function getConnectorOperations(name) {
25796
- const connectorName = normalizeConnectorName(name);
25797
- const internalRuntime = getInternalCommandRuntime(connectorName);
24344
+ const internalRuntime = getInternalCommandRuntime(name);
25798
24345
  if (internalRuntime?.commands.length) {
25799
24346
  const operations2 = internalRuntime.commands.map((command) => ({
25800
24347
  name: command.name,
@@ -25806,15 +24353,15 @@ async function getConnectorOperations(name) {
25806
24353
  return {
25807
24354
  commands: operations2.map((operation) => operation.name),
25808
24355
  operations: operations2,
25809
- helpText: internalRuntime.helpText ?? buildInternalHelpText(connectorName, internalRuntime.commands),
24356
+ helpText: internalRuntime.helpText ?? buildInternalHelpText(name, internalRuntime.commands),
25810
24357
  hasCli: true
25811
24358
  };
25812
24359
  }
25813
- const cliPath = getConnectorCliPath(connectorName);
24360
+ const cliPath = getConnectorCliPath(name);
25814
24361
  if (!cliPath) {
25815
24362
  return { commands: [], operations: [], helpText: "", hasCli: false };
25816
24363
  }
25817
- const result = await runConnectorCommand(connectorName, ["--help"]);
24364
+ const result = await runConnectorCommand(name, ["--help"]);
25818
24365
  const helpText = result.stdout || result.stderr;
25819
24366
  const operations = parseCommanderHelpOperations(helpText);
25820
24367
  return {
@@ -25825,8 +24372,7 @@ async function getConnectorOperations(name) {
25825
24372
  };
25826
24373
  }
25827
24374
  async function getConnectorCommandHelp(name, command) {
25828
- const connectorName = normalizeConnectorName(name);
25829
- const internalRuntime = getInternalCommandRuntime(connectorName);
24375
+ const internalRuntime = getInternalCommandRuntime(name);
25830
24376
  if (internalRuntime?.getHelp) {
25831
24377
  const help = await internalRuntime.getHelp(command);
25832
24378
  if (help) {
@@ -25837,15 +24383,17 @@ async function getConnectorCommandHelp(name, command) {
25837
24383
  if (runtimeCommand?.helpText) {
25838
24384
  return runtimeCommand.helpText;
25839
24385
  }
25840
- const result = await runConnectorCommand(connectorName, [command, "--help"]);
24386
+ const result = await runConnectorCommand(name, [command, "--help"]);
25841
24387
  return result.stdout || result.stderr;
25842
24388
  }
25843
24389
  function getConnectorsWithCli() {
25844
24390
  const connectors18 = new Set;
25845
24391
  try {
25846
- const dirs = readdirSync9(CONNECTORS_DIR2);
24392
+ const dirs = readdirSync8(CONNECTORS_DIR2);
25847
24393
  for (const dir of dirs) {
25848
- const name = normalizeConnectorName(dir);
24394
+ if (!dir.startsWith("connect-"))
24395
+ continue;
24396
+ const name = dir.replace("connect-", "");
25849
24397
  if (getConnectorCliPath(name)) {
25850
24398
  connectors18.add(name);
25851
24399
  }
@@ -25861,10 +24409,7 @@ function getConnectorsWithCli() {
25861
24409
  var __dirname5, CONNECTORS_DIR2, ENV_VAR_NAME_OVERRIDES;
25862
24410
  var init_runner = __esm(() => {
25863
24411
  init_builtins();
25864
- init_connector();
25865
24412
  init_database();
25866
- init_auth();
25867
- init_connector_resolver();
25868
24413
  __dirname5 = dirname7(fileURLToPath5(import.meta.url));
25869
24414
  CONNECTORS_DIR2 = resolveConnectorsDir2();
25870
24415
  ENV_VAR_NAME_OVERRIDES = {
@@ -32845,10 +31390,6 @@ class Protocol {
32845
31390
  this._progressHandlers.clear();
32846
31391
  this._taskProgressTokens.clear();
32847
31392
  this._pendingDebouncedNotifications.clear();
32848
- for (const info of this._timeoutInfo.values()) {
32849
- clearTimeout(info.timeoutId);
32850
- }
32851
- this._timeoutInfo.clear();
32852
31393
  for (const controller of this._requestHandlerAbortControllers.values()) {
32853
31394
  controller.abort();
32854
31395
  }
@@ -32979,9 +31520,7 @@ class Protocol {
32979
31520
  await capturedTransport?.send(errorResponse);
32980
31521
  }
32981
31522
  }).catch((error2) => this._onerror(new Error(`Failed to send response: ${error2}`))).finally(() => {
32982
- if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
32983
- this._requestHandlerAbortControllers.delete(request.id);
32984
- }
31523
+ this._requestHandlerAbortControllers.delete(request.id);
32985
31524
  });
32986
31525
  }
32987
31526
  _onprogress(notification) {
@@ -33522,69 +32061,13 @@ class AjvJsonSchemaValidator {
33522
32061
  }
33523
32062
  }
33524
32063
 
33525
- // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
33526
- class ExperimentalServerTasks {
33527
- constructor(_server) {
33528
- this._server = _server;
33529
- }
33530
- requestStream(request, resultSchema, options) {
33531
- return this._server.requestStream(request, resultSchema, options);
33532
- }
33533
- createMessageStream(params, options) {
33534
- const clientCapabilities = this._server.getClientCapabilities();
33535
- if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) {
33536
- throw new Error("Client does not support sampling tools capability.");
33537
- }
33538
- if (params.messages.length > 0) {
33539
- const lastMessage = params.messages[params.messages.length - 1];
33540
- const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content];
33541
- const hasToolResults = lastContent.some((c) => c.type === "tool_result");
33542
- const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined;
33543
- const previousContent = previousMessage ? Array.isArray(previousMessage.content) ? previousMessage.content : [previousMessage.content] : [];
33544
- const hasPreviousToolUse = previousContent.some((c) => c.type === "tool_use");
33545
- if (hasToolResults) {
33546
- if (lastContent.some((c) => c.type !== "tool_result")) {
33547
- throw new Error("The last message must contain only tool_result content if any is present");
33548
- }
33549
- if (!hasPreviousToolUse) {
33550
- throw new Error("tool_result blocks are not matching any tool_use from the previous message");
33551
- }
33552
- }
33553
- if (hasPreviousToolUse) {
33554
- const toolUseIds = new Set(previousContent.filter((c) => c.type === "tool_use").map((c) => c.id));
33555
- const toolResultIds = new Set(lastContent.filter((c) => c.type === "tool_result").map((c) => c.toolUseId));
33556
- if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every((id) => toolResultIds.has(id))) {
33557
- throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match");
33558
- }
33559
- }
33560
- }
33561
- return this.requestStream({
33562
- method: "sampling/createMessage",
33563
- params
33564
- }, CreateMessageResultSchema, options);
33565
- }
33566
- elicitInputStream(params, options) {
33567
- const clientCapabilities = this._server.getClientCapabilities();
33568
- const mode = params.mode ?? "form";
33569
- switch (mode) {
33570
- case "url": {
33571
- if (!clientCapabilities?.elicitation?.url) {
33572
- throw new Error("Client does not support url elicitation.");
33573
- }
33574
- break;
33575
- }
33576
- case "form": {
33577
- if (!clientCapabilities?.elicitation?.form) {
33578
- throw new Error("Client does not support form elicitation.");
33579
- }
33580
- break;
33581
- }
33582
- }
33583
- const normalizedParams = mode === "form" && params.mode === undefined ? { ...params, mode: "form" } : params;
33584
- return this.requestStream({
33585
- method: "elicitation/create",
33586
- params: normalizedParams
33587
- }, ElicitResultSchema, options);
32064
+ // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
32065
+ class ExperimentalServerTasks {
32066
+ constructor(_server) {
32067
+ this._server = _server;
32068
+ }
32069
+ requestStream(request, resultSchema, options) {
32070
+ return this._server.requestStream(request, resultSchema, options);
33588
32071
  }
33589
32072
  async getTask(taskId, options) {
33590
32073
  return this._server.getTask({ taskId }, options);
@@ -34641,9 +33124,6 @@ class McpServer {
34641
33124
  annotations = rest.shift();
34642
33125
  }
34643
33126
  } else if (typeof firstArg === "object" && firstArg !== null) {
34644
- if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
34645
- throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
34646
- }
34647
33127
  annotations = rest.shift();
34648
33128
  }
34649
33129
  }
@@ -34736,9 +33216,6 @@ function getZodSchemaObject(schema) {
34736
33216
  if (isZodRawShapeCompat(schema)) {
34737
33217
  return objectFromShape(schema);
34738
33218
  }
34739
- if (!isZodSchemaInstance(schema)) {
34740
- throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
34741
- }
34742
33219
  return schema;
34743
33220
  }
34744
33221
  function promptArgumentsFromSchema(schema) {
@@ -34876,8 +33353,8 @@ class StdioServerTransport {
34876
33353
 
34877
33354
  // src/lib/registry.ts
34878
33355
  init_builtins();
34879
- import { existsSync as existsSync9, readFileSync as readFileSync5 } from "fs";
34880
- import { join as join11, dirname as dirname5 } from "path";
33356
+ import { existsSync as existsSync8, readFileSync as readFileSync3 } from "fs";
33357
+ import { join as join9, dirname as dirname5 } from "path";
34881
33358
  import { fileURLToPath as fileURLToPath3 } from "url";
34882
33359
 
34883
33360
  // src/lib/fuzzy.ts
@@ -34966,9 +33443,6 @@ function expandQuery(tokens) {
34966
33443
  return { original: tokens, expanded: [...synonyms] };
34967
33444
  }
34968
33445
 
34969
- // src/lib/registry.ts
34970
- init_connector_resolver();
34971
-
34972
33446
  // src/lib/connectors/ai-ml.ts
34973
33447
  var connectors = [
34974
33448
  {
@@ -41142,10 +39616,7 @@ function searchConnectors(query, context) {
41142
39616
  return results.slice(0, limit);
41143
39617
  }
41144
39618
  function getConnector(name) {
41145
- if (!isValidConnectorName(name))
41146
- return;
41147
- const normalizedName = normalizeConnectorName(name);
41148
- return CONNECTORS.find((c) => c.name === normalizedName);
39619
+ return CONNECTORS.find((c) => c.name === name);
41149
39620
  }
41150
39621
  var versionsLoaded = false;
41151
39622
  function loadConnectorVersions() {
@@ -41154,17 +39625,17 @@ function loadConnectorVersions() {
41154
39625
  versionsLoaded = true;
41155
39626
  const thisDir = dirname5(fileURLToPath3(import.meta.url));
41156
39627
  const candidates = [
41157
- join11(thisDir, "..", "connectors"),
41158
- join11(thisDir, "..", "..", "connectors")
39628
+ join9(thisDir, "..", "connectors"),
39629
+ join9(thisDir, "..", "..", "connectors")
41159
39630
  ];
41160
- const connectorsDir = candidates.find((d) => existsSync9(d));
39631
+ const connectorsDir = candidates.find((d) => existsSync8(d));
41161
39632
  if (!connectorsDir)
41162
39633
  return;
41163
39634
  for (const connector of CONNECTORS) {
41164
39635
  try {
41165
- const pkgPath = join11(getConnectorPackagePath(connectorsDir, connector.name), "package.json");
41166
- if (existsSync9(pkgPath)) {
41167
- const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
39636
+ const pkgPath = join9(connectorsDir, `connect-${connector.name}`, "package.json");
39637
+ if (existsSync8(pkgPath)) {
39638
+ const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
41168
39639
  connector.version = pkg.version || "0.0.0";
41169
39640
  continue;
41170
39641
  }
@@ -41343,7 +39814,355 @@ function registerDiscoveryTools(server, stripped) {
41343
39814
  // src/mcp/tools/management.ts
41344
39815
  init_zod();
41345
39816
  init_installer();
41346
- init_auth();
39817
+
39818
+ // src/server/auth.ts
39819
+ import { existsSync as existsSync12, readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync9, readdirSync as readdirSync7, rmSync as rmSync3, statSync as statSync5 } from "fs";
39820
+ init_installer();
39821
+ import { join as join13 } from "path";
39822
+
39823
+ // src/lib/lock.ts
39824
+ init_database();
39825
+ import { openSync, closeSync, unlinkSync, existsSync as existsSync11, statSync as statSync4 } from "fs";
39826
+ import { join as join12 } from "path";
39827
+ import { mkdirSync as mkdirSync8 } from "fs";
39828
+ var LOCK_TIMEOUT_MS = 5000;
39829
+ var LOCK_RETRY_MS = 100;
39830
+ var STALE_LOCK_MS = 30000;
39831
+
39832
+ class LockTimeoutError extends Error {
39833
+ connector;
39834
+ constructor(connector) {
39835
+ super(`Could not acquire write lock for connector "${connector}" within ${LOCK_TIMEOUT_MS}ms. Another agent may be writing. Try again shortly.`);
39836
+ this.connector = connector;
39837
+ this.name = "LockTimeoutError";
39838
+ }
39839
+ }
39840
+ function lockPath(connector) {
39841
+ const dir = join12(getConnectorsHome(), `connect-${connector}`);
39842
+ mkdirSync8(dir, { recursive: true });
39843
+ return join12(dir, ".write.lock");
39844
+ }
39845
+ function isStale(path) {
39846
+ try {
39847
+ const stat = statSync4(path);
39848
+ return Date.now() - stat.mtimeMs > STALE_LOCK_MS;
39849
+ } catch {
39850
+ return false;
39851
+ }
39852
+ }
39853
+ function tryAcquire(path) {
39854
+ if (existsSync11(path) && isStale(path)) {
39855
+ try {
39856
+ unlinkSync(path);
39857
+ } catch {}
39858
+ }
39859
+ try {
39860
+ const fd = openSync(path, "wx");
39861
+ closeSync(fd);
39862
+ return true;
39863
+ } catch (e) {
39864
+ if (e.code === "EEXIST")
39865
+ return false;
39866
+ throw e;
39867
+ }
39868
+ }
39869
+ function release(path) {
39870
+ try {
39871
+ unlinkSync(path);
39872
+ } catch {}
39873
+ }
39874
+ async function withWriteLock(connector, fn) {
39875
+ const path = lockPath(connector);
39876
+ const deadline = Date.now() + LOCK_TIMEOUT_MS;
39877
+ while (Date.now() < deadline) {
39878
+ if (tryAcquire(path)) {
39879
+ try {
39880
+ return await fn();
39881
+ } finally {
39882
+ release(path);
39883
+ }
39884
+ }
39885
+ await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_MS));
39886
+ }
39887
+ throw new LockTimeoutError(connector);
39888
+ }
39889
+
39890
+ // src/server/auth.ts
39891
+ init_database();
39892
+ var FETCH_TIMEOUT = 1e4;
39893
+ var oauthStateStore = new Map;
39894
+ var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
39895
+ var GOOGLE_SCOPES = {
39896
+ gmail: [
39897
+ "https://www.googleapis.com/auth/gmail.readonly",
39898
+ "https://www.googleapis.com/auth/gmail.send",
39899
+ "https://www.googleapis.com/auth/gmail.compose",
39900
+ "https://www.googleapis.com/auth/gmail.modify",
39901
+ "https://www.googleapis.com/auth/gmail.labels",
39902
+ "https://mail.google.com/"
39903
+ ].join(" "),
39904
+ googlecalendar: [
39905
+ "https://www.googleapis.com/auth/calendar",
39906
+ "https://www.googleapis.com/auth/calendar.events"
39907
+ ].join(" "),
39908
+ googledrive: [
39909
+ "https://www.googleapis.com/auth/drive",
39910
+ "https://www.googleapis.com/auth/drive.file"
39911
+ ].join(" "),
39912
+ googledocs: [
39913
+ "https://www.googleapis.com/auth/documents",
39914
+ "https://www.googleapis.com/auth/drive.file"
39915
+ ].join(" "),
39916
+ googlesheets: [
39917
+ "https://www.googleapis.com/auth/spreadsheets",
39918
+ "https://www.googleapis.com/auth/drive.file"
39919
+ ].join(" "),
39920
+ googletasks: [
39921
+ "https://www.googleapis.com/auth/tasks"
39922
+ ].join(" "),
39923
+ googlecontacts: [
39924
+ "https://www.googleapis.com/auth/contacts",
39925
+ "https://www.googleapis.com/auth/contacts.readonly"
39926
+ ].join(" "),
39927
+ google: [
39928
+ "openid",
39929
+ "https://www.googleapis.com/auth/userinfo.email",
39930
+ "https://www.googleapis.com/auth/userinfo.profile"
39931
+ ].join(" ")
39932
+ };
39933
+ function getAuthType(name) {
39934
+ const docs = getConnectorDocs(name);
39935
+ if (!docs?.auth)
39936
+ return "apikey";
39937
+ const authLower = docs.auth.toLowerCase();
39938
+ if (authLower.includes("oauth"))
39939
+ return "oauth";
39940
+ if (authLower.includes("bearer token"))
39941
+ return "bearer";
39942
+ return "apikey";
39943
+ }
39944
+ function getConnectorConfigDir(name) {
39945
+ const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
39946
+ return join13(getConnectorsHome(), connectorName);
39947
+ }
39948
+ function getCurrentProfile2(name) {
39949
+ const configDir = getConnectorConfigDir(name);
39950
+ const currentProfileFile = join13(configDir, "current_profile");
39951
+ if (existsSync12(currentProfileFile)) {
39952
+ try {
39953
+ return readFileSync6(currentProfileFile, "utf-8").trim() || "default";
39954
+ } catch {
39955
+ return "default";
39956
+ }
39957
+ }
39958
+ return "default";
39959
+ }
39960
+ function loadProfileConfig(name) {
39961
+ const configDir = getConnectorConfigDir(name);
39962
+ const profile = getCurrentProfile2(name);
39963
+ let flatConfig = {};
39964
+ let dirConfig = {};
39965
+ const profileFile = join13(configDir, "profiles", `${profile}.json`);
39966
+ if (existsSync12(profileFile)) {
39967
+ try {
39968
+ flatConfig = JSON.parse(readFileSync6(profileFile, "utf-8"));
39969
+ } catch {}
39970
+ }
39971
+ const profileDirConfig = join13(configDir, "profiles", profile, "config.json");
39972
+ if (existsSync12(profileDirConfig)) {
39973
+ try {
39974
+ dirConfig = JSON.parse(readFileSync6(profileDirConfig, "utf-8"));
39975
+ } catch {}
39976
+ }
39977
+ if (Object.keys(flatConfig).length === 0 && Object.keys(dirConfig).length === 0) {
39978
+ return {};
39979
+ }
39980
+ return { ...flatConfig, ...dirConfig };
39981
+ }
39982
+ function loadTokens(name) {
39983
+ const configDir = getConnectorConfigDir(name);
39984
+ const profile = getCurrentProfile2(name);
39985
+ const tokensFile = join13(configDir, "profiles", profile, "tokens.json");
39986
+ if (existsSync12(tokensFile)) {
39987
+ try {
39988
+ return JSON.parse(readFileSync6(tokensFile, "utf-8"));
39989
+ } catch {
39990
+ return null;
39991
+ }
39992
+ }
39993
+ const profileConfig = loadProfileConfig(name);
39994
+ if (profileConfig.refreshToken || profileConfig.accessToken) {
39995
+ return {
39996
+ accessToken: profileConfig.accessToken ?? "",
39997
+ refreshToken: profileConfig.refreshToken,
39998
+ expiresAt: profileConfig.expiresAt ?? 0,
39999
+ tokenType: profileConfig.tokenType,
40000
+ scope: profileConfig.scope
40001
+ };
40002
+ }
40003
+ return null;
40004
+ }
40005
+ function getAuthStatus(name) {
40006
+ const authType = getAuthType(name);
40007
+ const docs = getConnectorDocs(name);
40008
+ const envVars = (docs?.envVars || []).map((v) => ({
40009
+ variable: v.variable,
40010
+ description: v.description,
40011
+ set: !!process.env[v.variable]
40012
+ }));
40013
+ const envVarTotalCount = envVars.length;
40014
+ const envVarSetCount = envVars.filter((v) => v.set).length;
40015
+ if (authType === "oauth") {
40016
+ const tokens = loadTokens(name);
40017
+ const config3 = loadProfileConfig(name);
40018
+ const hasTokens = !!tokens?.accessToken || !!config3.accessToken;
40019
+ const hasRefreshToken = !!tokens?.refreshToken || !!config3.refreshToken;
40020
+ const tokenExpiry = tokens?.expiresAt || config3.expiresAt;
40021
+ const hasEnvVar2 = envVars.some((v) => v.set);
40022
+ return {
40023
+ type: "oauth",
40024
+ configured: hasTokens || hasRefreshToken || hasEnvVar2,
40025
+ tokenExpiry,
40026
+ hasRefreshToken,
40027
+ envVars,
40028
+ envVarSetCount,
40029
+ envVarTotalCount
40030
+ };
40031
+ }
40032
+ const config2 = loadProfileConfig(name);
40033
+ const hasKey = Object.values(config2).some((v) => typeof v === "string" && v.length > 0);
40034
+ const hasEnvVar = envVars.some((v) => v.set);
40035
+ return {
40036
+ type: authType,
40037
+ configured: hasKey || hasEnvVar,
40038
+ envVars,
40039
+ envVarSetCount,
40040
+ envVarTotalCount
40041
+ };
40042
+ }
40043
+ async function saveApiKey(name, key, field) {
40044
+ return withWriteLock(name, () => _saveApiKey(name, key, field));
40045
+ }
40046
+ function _saveApiKey(name, key, field) {
40047
+ const configDir = getConnectorConfigDir(name);
40048
+ const profile = getCurrentProfile2(name);
40049
+ const keyField = field || guessKeyField(name);
40050
+ if (keyField === "clientId" || keyField === "clientSecret") {
40051
+ const credentialsFile = join13(configDir, "credentials.json");
40052
+ mkdirSync9(configDir, { recursive: true });
40053
+ let creds = {};
40054
+ if (existsSync12(credentialsFile)) {
40055
+ try {
40056
+ creds = JSON.parse(readFileSync6(credentialsFile, "utf-8"));
40057
+ } catch {}
40058
+ }
40059
+ creds[keyField] = key;
40060
+ writeFileSync5(credentialsFile, JSON.stringify(creds, null, 2));
40061
+ return;
40062
+ }
40063
+ const profileFile = join13(configDir, "profiles", `${profile}.json`);
40064
+ const profileDir = join13(configDir, "profiles", profile);
40065
+ if (existsSync12(profileFile)) {
40066
+ let config2 = {};
40067
+ try {
40068
+ config2 = JSON.parse(readFileSync6(profileFile, "utf-8"));
40069
+ } catch {}
40070
+ config2[keyField] = key;
40071
+ writeFileSync5(profileFile, JSON.stringify(config2, null, 2));
40072
+ return;
40073
+ }
40074
+ if (existsSync12(profileDir)) {
40075
+ const configFile = join13(profileDir, "config.json");
40076
+ let config2 = {};
40077
+ if (existsSync12(configFile)) {
40078
+ try {
40079
+ config2 = JSON.parse(readFileSync6(configFile, "utf-8"));
40080
+ } catch {}
40081
+ }
40082
+ config2[keyField] = key;
40083
+ writeFileSync5(configFile, JSON.stringify(config2, null, 2));
40084
+ return;
40085
+ }
40086
+ mkdirSync9(profileDir, { recursive: true });
40087
+ writeFileSync5(join13(profileDir, "config.json"), JSON.stringify({ [keyField]: key }, null, 2));
40088
+ }
40089
+ function guessKeyField(name) {
40090
+ const docs = getConnectorDocs(name);
40091
+ if (!docs?.envVars.length)
40092
+ return "apiKey";
40093
+ const keyVar = docs.envVars.find((v) => v.variable.includes("API_KEY") || v.variable.includes("API_SECRET") || v.variable.includes("TOKEN") || v.variable.includes("SECRET"));
40094
+ if (keyVar) {
40095
+ const parts = keyVar.variable.toLowerCase().split("_");
40096
+ const withoutPrefix = parts.slice(1);
40097
+ if (withoutPrefix.length > 0) {
40098
+ return withoutPrefix.map((p, i) => i === 0 ? p : p.charAt(0).toUpperCase() + p.slice(1)).join("");
40099
+ }
40100
+ }
40101
+ return "apiKey";
40102
+ }
40103
+ function getOAuthConfig(name) {
40104
+ const configDir = getConnectorConfigDir(name);
40105
+ const credentialsFile = join13(configDir, "credentials.json");
40106
+ if (existsSync12(credentialsFile)) {
40107
+ try {
40108
+ const creds = JSON.parse(readFileSync6(credentialsFile, "utf-8"));
40109
+ return { clientId: creds.clientId, clientSecret: creds.clientSecret };
40110
+ } catch {}
40111
+ }
40112
+ const config2 = loadProfileConfig(name);
40113
+ return {
40114
+ clientId: config2.clientId,
40115
+ clientSecret: config2.clientSecret
40116
+ };
40117
+ }
40118
+ function saveOAuthTokens(name, tokens) {
40119
+ const configDir = getConnectorConfigDir(name);
40120
+ const profile = getCurrentProfile2(name);
40121
+ const profileDir = join13(configDir, "profiles", profile);
40122
+ mkdirSync9(profileDir, { recursive: true });
40123
+ const tokensFile = join13(profileDir, "tokens.json");
40124
+ writeFileSync5(tokensFile, JSON.stringify(tokens, null, 2), { mode: 384 });
40125
+ }
40126
+ async function refreshOAuthToken(name) {
40127
+ return withWriteLock(name, () => _refreshOAuthToken(name));
40128
+ }
40129
+ async function _refreshOAuthToken(name) {
40130
+ const oauthConfig = getOAuthConfig(name);
40131
+ const currentTokens = loadTokens(name);
40132
+ if (!oauthConfig.clientId || !oauthConfig.clientSecret) {
40133
+ throw new Error("OAuth credentials not configured for " + name);
40134
+ }
40135
+ if (!currentTokens?.refreshToken) {
40136
+ throw new Error("No refresh token available. Please re-authenticate.");
40137
+ }
40138
+ const response = await fetch(GOOGLE_TOKEN_URL, {
40139
+ method: "POST",
40140
+ headers: { "Content-Type": "application/x-www-form-urlencoded" },
40141
+ body: new URLSearchParams({
40142
+ client_id: oauthConfig.clientId,
40143
+ client_secret: oauthConfig.clientSecret,
40144
+ refresh_token: currentTokens.refreshToken,
40145
+ grant_type: "refresh_token"
40146
+ }),
40147
+ signal: AbortSignal.timeout(FETCH_TIMEOUT)
40148
+ });
40149
+ if (!response.ok) {
40150
+ const error2 = await response.json().catch(() => ({ error: response.statusText }));
40151
+ throw new Error(`Token refresh failed: ${error2.error_description || error2.error}`);
40152
+ }
40153
+ const data = await response.json();
40154
+ const tokens = {
40155
+ accessToken: data.access_token,
40156
+ refreshToken: currentTokens.refreshToken,
40157
+ expiresAt: Date.now() + data.expires_in * 1000,
40158
+ tokenType: data.token_type,
40159
+ scope: data.scope || currentTokens.scope
40160
+ };
40161
+ saveOAuthTokens(name, tokens);
40162
+ return tokens;
40163
+ }
40164
+
40165
+ // src/mcp/tools/management.ts
41347
40166
  function registerManagementTools(server, stripped) {
41348
40167
  server.registerTool("install_connector", {
41349
40168
  title: "Install Connector",
@@ -41486,11 +40305,9 @@ function registerManagementTools(server, stripped) {
41486
40305
  }
41487
40306
  // src/mcp/tools/auth.ts
41488
40307
  init_zod();
41489
- init_auth();
41490
40308
  init_database();
41491
- init_connector_resolver();
41492
- import { existsSync as existsSync14, readFileSync as readFileSync9 } from "fs";
41493
- import { join as join15 } from "path";
40309
+ import { existsSync as existsSync13, readFileSync as readFileSync7 } from "fs";
40310
+ import { join as join14 } from "path";
41494
40311
  import { spawn } from "child_process";
41495
40312
  function registerAuthTools(server, stripped) {
41496
40313
  server.registerTool("connector_auth_status", {
@@ -41609,7 +40426,7 @@ function registerAuthTools(server, stripped) {
41609
40426
  };
41610
40427
  }
41611
40428
  }
41612
- const tokens = loadTokens3(name);
40429
+ const tokens = loadTokens(name);
41613
40430
  if (tokens?.accessToken && tokens?.refreshToken) {
41614
40431
  if (tokens.expiresAt && Date.now() < tokens.expiresAt - 60000) {
41615
40432
  const mins = Math.floor((tokens.expiresAt - Date.now()) / 60000);
@@ -41626,7 +40443,8 @@ function registerAuthTools(server, stripped) {
41626
40443
  const oauthUrl = `http://localhost:${serverPort}/oauth/${name}/start`;
41627
40444
  if (noBrowser) {
41628
40445
  const connectorsHome = getConnectorsHome();
41629
- const tokenPaths = getConnectorConfigReadDirs(name, connectorsHome).map((dir) => join15(dir, "profiles", "default", "tokens.json"));
40446
+ const connectorDirName = name.startsWith("connect-") ? name : `connect-${name}`;
40447
+ const tokensPath = join14(connectorsHome, connectorDirName, "profiles", "default", "tokens.json");
41630
40448
  let serverRunning = false;
41631
40449
  try {
41632
40450
  await fetch(`http://localhost:${serverPort}/api/connectors`);
@@ -41645,7 +40463,7 @@ function registerAuthTools(server, stripped) {
41645
40463
  const maxAttempts = 120;
41646
40464
  while (attempts < maxAttempts) {
41647
40465
  await new Promise((resolve) => setTimeout(resolve, 500));
41648
- if (tokenPaths.some((tokensPath) => existsSync14(tokensPath))) {
40466
+ if (existsSync13(tokensPath)) {
41649
40467
  break;
41650
40468
  }
41651
40469
  attempts++;
@@ -41658,14 +40476,13 @@ function registerAuthTools(server, stripped) {
41658
40476
  connector: name,
41659
40477
  status: "waiting",
41660
40478
  oauthUrl,
41661
- message: `OAuth server is running on port ${serverPort}. Open the URL to authenticate. Tokens will be saved to ${tokenPaths[0]}.`
40479
+ message: `OAuth server is running on port ${serverPort}. Open the URL to authenticate. Tokens will be saved to ${tokensPath}.`
41662
40480
  }, null, 2)
41663
40481
  }]
41664
40482
  };
41665
40483
  }
41666
40484
  try {
41667
- const tokensPath = tokenPaths.find((path) => existsSync14(path)) ?? tokenPaths[0];
41668
- const tokenData = JSON.parse(readFileSync9(tokensPath, "utf-8"));
40485
+ const tokenData = JSON.parse(readFileSync7(tokensPath, "utf-8"));
41669
40486
  return {
41670
40487
  content: [{
41671
40488
  type: "text",
@@ -41709,7 +40526,6 @@ function registerAuthTools(server, stripped) {
41709
40526
  }
41710
40527
  // src/mcp/tools/operations.ts
41711
40528
  init_zod();
41712
- init_auth();
41713
40529
  init_runner();
41714
40530
  function registerOperationsTools(server, stripped) {
41715
40531
  server.registerTool("list_connector_operations", {
@@ -41996,8 +40812,7 @@ function listWorkflows(db) {
41996
40812
  }
41997
40813
 
41998
40814
  // src/lib/workflow-runner.ts
41999
- import { spawn as nodeSpawn } from "child_process";
42000
- var spawnImpl = nodeSpawn;
40815
+ import { spawn as spawn3 } from "child_process";
42001
40816
  async function runStep(step, previousOutput) {
42002
40817
  return new Promise((resolve) => {
42003
40818
  const args = [...step.args ?? []];
@@ -42005,7 +40820,7 @@ async function runStep(step, previousOutput) {
42005
40820
  args.push("--input", previousOutput.trim().slice(0, 4096));
42006
40821
  }
42007
40822
  const cmdArgs = ["run", step.connector, step.command, ...args, "--format", "json"];
42008
- const proc = spawnImpl("connectors", cmdArgs, { shell: false });
40823
+ const proc = spawn3("connectors", cmdArgs, { shell: false });
42009
40824
  let output = "";
42010
40825
  proc.stdout.on("data", (d) => {
42011
40826
  output += d.toString();
@@ -42047,11 +40862,11 @@ async function runWorkflow(workflow) {
42047
40862
  }
42048
40863
 
42049
40864
  // src/lib/scheduler.ts
42050
- import { spawn as spawn3 } from "child_process";
40865
+ import { spawn as spawn4 } from "child_process";
42051
40866
  async function runConnectorCommand2(connector, command, args) {
42052
40867
  return new Promise((resolve) => {
42053
40868
  const cmdArgs = [connector, command, ...args, "--format", "json"];
42054
- const proc = spawn3("connectors", ["run", ...cmdArgs], { shell: false });
40869
+ const proc = spawn4("connectors", ["run", ...cmdArgs], { shell: false });
42055
40870
  let output = "";
42056
40871
  proc.stdout.on("data", (d) => {
42057
40872
  output += d.toString();