agenttwin 0.3.21 → 0.3.23

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 (411) hide show
  1. package/dist/api.js +2113 -609
  2. package/dist/dashboard/assets/dashboard/agent-home.css +7 -7
  3. package/dist/dashboard/assets/dashboard/bay-morning.webp +0 -0
  4. package/dist/dashboard/assets/dashboard/golden-gate-afternoon.webp +0 -0
  5. package/dist/dashboard/assets/dashboard/golden-gate-portrait.webp +0 -0
  6. package/dist/dashboard/assets/dashboard/moonlit-coast.webp +0 -0
  7. package/dist/dashboard/assets/next/static/chunks/{1250-7571b1a697f6bb4a.js → 1250-a3c859fd20517500.js} +1 -1
  8. package/dist/dashboard/assets/next/static/chunks/{2743-a0efd6f4aeb11cc5.js → 2743-72610a5d5a3f8462.js} +1 -1
  9. package/dist/dashboard/assets/next/static/chunks/5663-403316746afad10e.js +1 -0
  10. package/dist/dashboard/assets/next/static/chunks/app/dashboard/{page-9c11295678539a5f.js → page-0e0392368e0a891e.js} +1 -1
  11. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-4981ea4966b19e3e.js +1 -0
  12. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-dd4ac0f5f36e6bfa.js +1 -0
  13. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/{page-34574448d210c775.js → page-de0fe6d84be21e6a.js} +1 -1
  14. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-360cbffc57981f6b.js +1 -0
  15. package/dist/dashboard/assets/next/static/chunks/app/v2/page-fc4df4912ce3af44.js +1 -0
  16. package/dist/dashboard/assets/next/static/chunks/{webpack-40324749d289e4a5.js → webpack-9e40ef55e5f2fb53.js} +1 -1
  17. package/dist/dashboard/assets/next/static/css/{42045de5f39b50ca.css → 37d81e1d2804cc5f.css} +1 -1
  18. package/dist/dashboard/assets/next/static/css/69ec1bae997c3bb0.css +1 -0
  19. package/dist/dashboard/assets/next/static/css/ad85402a1595e56e.css +1 -0
  20. package/dist/dashboard/assets/next/static/css/{4bbe78c2fe206b92.css → da981fb878a02b8c.css} +1 -1
  21. package/dist/dashboard/assets/next/static/media/bay-morning.82669113.webp +0 -0
  22. package/dist/dashboard/assets/next/static/media/golden-gate-afternoon.0aa49492.webp +0 -0
  23. package/dist/dashboard/assets/next/static/media/golden-gate-portrait.89fc667a.webp +0 -0
  24. package/dist/dashboard/assets/next/static/media/moonlit-coast.09739ef4.webp +0 -0
  25. package/dist/dashboard/index.html +2 -2
  26. package/dist/engine.js +6386 -4974
  27. package/dist/gateway.js +2194 -604
  28. package/dist/twins/catalog.json +6020 -0
  29. package/dist/twins/engine/v2/THIRD-PARTY.txt +25 -0
  30. package/dist/twins/engine/v2/chunks/2CHBP57N.mjs +8 -0
  31. package/dist/twins/engine/v2/chunks/4CPL6MPF.mjs +30 -0
  32. package/dist/twins/engine/v2/chunks/OYLYKZGD.mjs +2 -0
  33. package/dist/twins/engine/v2/chunks/SQSP35HM.mjs +38 -0
  34. package/dist/twins/engine/v2/chunks/YSJQQVUM.mjs +2 -0
  35. package/dist/twins/engine/v2/react-dom_client.mjs +272 -0
  36. package/dist/twins/engine/v2/react-dom_server.mjs +263 -0
  37. package/dist/twins/engine/v2/react.mjs +2 -0
  38. package/dist/twins/engine/v2/react_jsx-runtime.mjs +31 -0
  39. package/dist/twins/engine/v2/volter_world-core.mjs +195 -0
  40. package/dist/twins/engine/v2/volter_world-core_app-route.mjs +2 -0
  41. package/dist/twins/engine/v2/volter_world-core_network-policy.mjs +2 -0
  42. package/dist/twins/engine/v3/THIRD-PARTY.txt +65 -0
  43. package/dist/twins/engine/v3/chunks/2CHBP57N.mjs +8 -0
  44. package/dist/twins/engine/v3/chunks/2YSSPA5O.mjs +65 -0
  45. package/dist/twins/engine/v3/chunks/5PWRY4UK.mjs +154 -0
  46. package/dist/twins/engine/v3/chunks/7XRKSFFJ.mjs +2 -0
  47. package/dist/twins/engine/v3/chunks/AWOWH2H5.mjs +2 -0
  48. package/dist/twins/engine/v3/chunks/C46M5U3Q.mjs +2 -0
  49. package/dist/twins/engine/v3/chunks/MFH2VZPP.mjs +2 -0
  50. package/dist/twins/engine/v3/chunks/MWCO5UV3.mjs +2 -0
  51. package/dist/twins/engine/v3/chunks/N5BL5RDF.mjs +313 -0
  52. package/dist/twins/engine/v3/chunks/O7HGPMXG.mjs +2 -0
  53. package/dist/twins/engine/v3/chunks/OYLYKZGD.mjs +2 -0
  54. package/dist/twins/engine/v3/chunks/PLB7HTON.mjs +8 -0
  55. package/dist/twins/engine/v3/chunks/TY4LDBVH.mjs +7 -0
  56. package/dist/twins/engine/v3/chunks/VDIRUSCM.mjs +2 -0
  57. package/dist/twins/engine/v3/chunks/WGUCFQK6.mjs +2 -0
  58. package/dist/twins/engine/v3/chunks/WPATONSC.mjs +2 -0
  59. package/dist/twins/engine/v3/react_jsx-runtime.mjs +2 -0
  60. package/dist/twins/engine/v3/volter_world-core.mjs +2 -0
  61. package/dist/twins/engine/v3/volter_world-ui.mjs +559 -0
  62. package/dist/twins/packs/ahrefs/LICENSE +202 -0
  63. package/dist/twins/packs/ahrefs/NOTICE +7 -0
  64. package/dist/twins/packs/ahrefs/index.mjs +2 -0
  65. package/dist/twins/packs/ai-gateway/LICENSE +202 -0
  66. package/dist/twins/packs/ai-gateway/NOTICE +7 -0
  67. package/dist/twins/packs/ai-gateway/index.mjs +14 -0
  68. package/dist/twins/packs/airtable/LICENSE +202 -0
  69. package/dist/twins/packs/airtable/NOTICE +7 -0
  70. package/dist/twins/packs/airtable/index.mjs +2 -0
  71. package/dist/twins/packs/algolia/LICENSE +202 -0
  72. package/dist/twins/packs/algolia/NOTICE +7 -0
  73. package/dist/twins/packs/algolia/index.mjs +2 -0
  74. package/dist/twins/packs/ambientcg/LICENSE +202 -0
  75. package/dist/twins/packs/ambientcg/NOTICE +7 -0
  76. package/dist/twins/packs/ambientcg/index.mjs +2 -0
  77. package/dist/twins/packs/anthropic/LICENSE +202 -0
  78. package/dist/twins/packs/anthropic/NOTICE +7 -0
  79. package/dist/twins/packs/anthropic/index.mjs +18 -0
  80. package/dist/twins/packs/assemblyai/LICENSE +202 -0
  81. package/dist/twins/packs/assemblyai/NOTICE +7 -0
  82. package/dist/twins/packs/assemblyai/index.mjs +11 -0
  83. package/dist/twins/packs/aws/LICENSE +202 -0
  84. package/dist/twins/packs/aws/NOTICE +7 -0
  85. package/dist/twins/packs/aws/index.mjs +2 -0
  86. package/dist/twins/packs/azure/LICENSE +202 -0
  87. package/dist/twins/packs/azure/NOTICE +7 -0
  88. package/dist/twins/packs/azure/index.mjs +38 -0
  89. package/dist/twins/packs/azureformrecognizer/LICENSE +202 -0
  90. package/dist/twins/packs/azureformrecognizer/NOTICE +7 -0
  91. package/dist/twins/packs/azureformrecognizer/index.mjs +3 -0
  92. package/dist/twins/packs/bitly/LICENSE +202 -0
  93. package/dist/twins/packs/bitly/NOTICE +7 -0
  94. package/dist/twins/packs/bitly/index.mjs +2 -0
  95. package/dist/twins/packs/bluesky/LICENSE +202 -0
  96. package/dist/twins/packs/bluesky/NOTICE +7 -0
  97. package/dist/twins/packs/bluesky/index.mjs +30 -0
  98. package/dist/twins/packs/calcom/LICENSE +202 -0
  99. package/dist/twins/packs/calcom/NOTICE +7 -0
  100. package/dist/twins/packs/calcom/index.mjs +2 -0
  101. package/dist/twins/packs/clerk/LICENSE +202 -0
  102. package/dist/twins/packs/clerk/NOTICE +7 -0
  103. package/dist/twins/packs/clerk/index.mjs +5 -0
  104. package/dist/twins/packs/cloudflare/LICENSE +202 -0
  105. package/dist/twins/packs/cloudflare/NOTICE +7 -0
  106. package/dist/twins/packs/cloudflare/index.mjs +79 -0
  107. package/dist/twins/packs/cohere/LICENSE +202 -0
  108. package/dist/twins/packs/cohere/NOTICE +7 -0
  109. package/dist/twins/packs/cohere/index.mjs +2 -0
  110. package/dist/twins/packs/datadog/LICENSE +202 -0
  111. package/dist/twins/packs/datadog/NOTICE +7 -0
  112. package/dist/twins/packs/datadog/index.mjs +3 -0
  113. package/dist/twins/packs/deepinfra/LICENSE +202 -0
  114. package/dist/twins/packs/deepinfra/NOTICE +7 -0
  115. package/dist/twins/packs/deepinfra/index.mjs +13 -0
  116. package/dist/twins/packs/deepseek/LICENSE +202 -0
  117. package/dist/twins/packs/deepseek/NOTICE +7 -0
  118. package/dist/twins/packs/deepseek/index.mjs +12 -0
  119. package/dist/twins/packs/discord/LICENSE +202 -0
  120. package/dist/twins/packs/discord/NOTICE +7 -0
  121. package/dist/twins/packs/discord/index.mjs +2 -0
  122. package/dist/twins/packs/duckduckgo/LICENSE +202 -0
  123. package/dist/twins/packs/duckduckgo/NOTICE +7 -0
  124. package/dist/twins/packs/duckduckgo/index.mjs +532 -0
  125. package/dist/twins/packs/dynadot/LICENSE +202 -0
  126. package/dist/twins/packs/dynadot/NOTICE +7 -0
  127. package/dist/twins/packs/dynadot/index.mjs +2 -0
  128. package/dist/twins/packs/e2b/LICENSE +202 -0
  129. package/dist/twins/packs/e2b/NOTICE +7 -0
  130. package/dist/twins/packs/e2b/index.mjs +2 -0
  131. package/dist/twins/packs/elevenlabs/LICENSE +202 -0
  132. package/dist/twins/packs/elevenlabs/NOTICE +7 -0
  133. package/dist/twins/packs/elevenlabs/index.mjs +4 -0
  134. package/dist/twins/packs/expo/LICENSE +202 -0
  135. package/dist/twins/packs/expo/NOTICE +7 -0
  136. package/dist/twins/packs/expo/index.mjs +2 -0
  137. package/dist/twins/packs/fal/LICENSE +202 -0
  138. package/dist/twins/packs/fal/NOTICE +7 -0
  139. package/dist/twins/packs/fal/index.mjs +2 -0
  140. package/dist/twins/packs/figma/LICENSE +202 -0
  141. package/dist/twins/packs/figma/NOTICE +7 -0
  142. package/dist/twins/packs/figma/index.mjs +2 -0
  143. package/dist/twins/packs/firecrawl/LICENSE +202 -0
  144. package/dist/twins/packs/firecrawl/NOTICE +7 -0
  145. package/dist/twins/packs/firecrawl/index.mjs +9 -0
  146. package/dist/twins/packs/fireworks/LICENSE +202 -0
  147. package/dist/twins/packs/fireworks/NOTICE +7 -0
  148. package/dist/twins/packs/fireworks/index.mjs +13 -0
  149. package/dist/twins/packs/fly/LICENSE +202 -0
  150. package/dist/twins/packs/fly/NOTICE +7 -0
  151. package/dist/twins/packs/fly/index.mjs +2 -0
  152. package/dist/twins/packs/gcs/LICENSE +202 -0
  153. package/dist/twins/packs/gcs/NOTICE +7 -0
  154. package/dist/twins/packs/gcs/index.mjs +8 -0
  155. package/dist/twins/packs/gemini/LICENSE +202 -0
  156. package/dist/twins/packs/gemini/NOTICE +7 -0
  157. package/dist/twins/packs/gemini/index.mjs +7 -0
  158. package/dist/twins/packs/github/LICENSE +202 -0
  159. package/dist/twins/packs/github/NOTICE +7 -0
  160. package/dist/twins/packs/github/index.mjs +75153 -0
  161. package/dist/twins/packs/googleads/LICENSE +202 -0
  162. package/dist/twins/packs/googleads/NOTICE +7 -0
  163. package/dist/twins/packs/googleads/index.mjs +3 -0
  164. package/dist/twins/packs/googlemaps/LICENSE +202 -0
  165. package/dist/twins/packs/googlemaps/NOTICE +7 -0
  166. package/dist/twins/packs/googlemaps/index.mjs +2 -0
  167. package/dist/twins/packs/googleoauth/LICENSE +202 -0
  168. package/dist/twins/packs/googleoauth/NOTICE +7 -0
  169. package/dist/twins/packs/googleoauth/index.mjs +2 -0
  170. package/dist/twins/packs/hackernews/LICENSE +202 -0
  171. package/dist/twins/packs/hackernews/NOTICE +7 -0
  172. package/dist/twins/packs/hackernews/index.mjs +35 -0
  173. package/dist/twins/packs/huggingface/LICENSE +202 -0
  174. package/dist/twins/packs/huggingface/NOTICE +7 -0
  175. package/dist/twins/packs/huggingface/index.mjs +9 -0
  176. package/dist/twins/packs/inngest/LICENSE +202 -0
  177. package/dist/twins/packs/inngest/NOTICE +7 -0
  178. package/dist/twins/packs/inngest/index.mjs +2 -0
  179. package/dist/twins/packs/instagram/LICENSE +202 -0
  180. package/dist/twins/packs/instagram/NOTICE +7 -0
  181. package/dist/twins/packs/instagram/index.mjs +2 -0
  182. package/dist/twins/packs/jira/LICENSE +202 -0
  183. package/dist/twins/packs/jira/NOTICE +7 -0
  184. package/dist/twins/packs/jira/index.mjs +2 -0
  185. package/dist/twins/packs/langfuse/LICENSE +202 -0
  186. package/dist/twins/packs/langfuse/NOTICE +7 -0
  187. package/dist/twins/packs/langfuse/index.mjs +2 -0
  188. package/dist/twins/packs/linear/LICENSE +202 -0
  189. package/dist/twins/packs/linear/NOTICE +7 -0
  190. package/dist/twins/packs/linear/index.mjs +52866 -0
  191. package/dist/twins/packs/linkedin/LICENSE +202 -0
  192. package/dist/twins/packs/linkedin/NOTICE +7 -0
  193. package/dist/twins/packs/linkedin/index.mjs +78 -0
  194. package/dist/twins/packs/livekit/LICENSE +202 -0
  195. package/dist/twins/packs/livekit/NOTICE +7 -0
  196. package/dist/twins/packs/livekit/index.mjs +2 -0
  197. package/dist/twins/packs/mailgun/LICENSE +202 -0
  198. package/dist/twins/packs/mailgun/NOTICE +7 -0
  199. package/dist/twins/packs/mailgun/index.mjs +13 -0
  200. package/dist/twins/packs/mapbox/LICENSE +202 -0
  201. package/dist/twins/packs/mapbox/NOTICE +7 -0
  202. package/dist/twins/packs/mapbox/index.mjs +2 -0
  203. package/dist/twins/packs/merge/LICENSE +202 -0
  204. package/dist/twins/packs/merge/NOTICE +7 -0
  205. package/dist/twins/packs/merge/index.mjs +4 -0
  206. package/dist/twins/packs/mistral/LICENSE +202 -0
  207. package/dist/twins/packs/mistral/NOTICE +7 -0
  208. package/dist/twins/packs/mistral/index.mjs +6 -0
  209. package/dist/twins/packs/mixpanel/LICENSE +202 -0
  210. package/dist/twins/packs/mixpanel/NOTICE +8 -0
  211. package/dist/twins/packs/mixpanel/index.mjs +2 -0
  212. package/dist/twins/packs/mongodb/LICENSE +202 -0
  213. package/dist/twins/packs/mongodb/NOTICE +7 -0
  214. package/dist/twins/packs/mongodb/index.mjs +8 -0
  215. package/dist/twins/packs/moonshot/LICENSE +202 -0
  216. package/dist/twins/packs/moonshot/NOTICE +7 -0
  217. package/dist/twins/packs/moonshot/index.mjs +18 -0
  218. package/dist/twins/packs/notion/LICENSE +202 -0
  219. package/dist/twins/packs/notion/NOTICE +7 -0
  220. package/dist/twins/packs/notion/index.mjs +2 -0
  221. package/dist/twins/packs/npm-registry/LICENSE +202 -0
  222. package/dist/twins/packs/npm-registry/NOTICE +7 -0
  223. package/dist/twins/packs/npm-registry/index.mjs +2 -0
  224. package/dist/twins/packs/oa-treasury/LICENSE +202 -0
  225. package/dist/twins/packs/oa-treasury/NOTICE +8 -0
  226. package/dist/twins/packs/oa-treasury/index.mjs +16 -0
  227. package/dist/twins/packs/openai/LICENSE +202 -0
  228. package/dist/twins/packs/openai/NOTICE +7 -0
  229. package/dist/twins/packs/openai/index.mjs +3473 -0
  230. package/dist/twins/packs/openrouter/LICENSE +202 -0
  231. package/dist/twins/packs/openrouter/NOTICE +7 -0
  232. package/dist/twins/packs/openrouter/index.mjs +2 -0
  233. package/dist/twins/packs/openweather/LICENSE +202 -0
  234. package/dist/twins/packs/openweather/NOTICE +7 -0
  235. package/dist/twins/packs/openweather/index.mjs +2 -0
  236. package/dist/twins/packs/paypal/LICENSE +202 -0
  237. package/dist/twins/packs/paypal/NOTICE +7 -0
  238. package/dist/twins/packs/paypal/index.mjs +51 -0
  239. package/dist/twins/packs/pinecone/LICENSE +202 -0
  240. package/dist/twins/packs/pinecone/NOTICE +7 -0
  241. package/dist/twins/packs/pinecone/index.mjs +2 -0
  242. package/dist/twins/packs/plain/LICENSE +202 -0
  243. package/dist/twins/packs/plain/NOTICE +8 -0
  244. package/dist/twins/packs/plain/index.mjs +18426 -0
  245. package/dist/twins/packs/planetscale/LICENSE +202 -0
  246. package/dist/twins/packs/planetscale/NOTICE +7 -0
  247. package/dist/twins/packs/planetscale/index.mjs +18 -0
  248. package/dist/twins/packs/polar/LICENSE +202 -0
  249. package/dist/twins/packs/polar/NOTICE +7 -0
  250. package/dist/twins/packs/polar/index.mjs +2 -0
  251. package/dist/twins/packs/polyhaven/LICENSE +202 -0
  252. package/dist/twins/packs/polyhaven/NOTICE +7 -0
  253. package/dist/twins/packs/polyhaven/index.mjs +3 -0
  254. package/dist/twins/packs/postmark/LICENSE +202 -0
  255. package/dist/twins/packs/postmark/NOTICE +7 -0
  256. package/dist/twins/packs/postmark/index.mjs +12 -0
  257. package/dist/twins/packs/reddit/LICENSE +202 -0
  258. package/dist/twins/packs/reddit/NOTICE +7 -0
  259. package/dist/twins/packs/reddit/index.mjs +324 -0
  260. package/dist/twins/packs/redis/LICENSE +202 -0
  261. package/dist/twins/packs/redis/NOTICE +7 -0
  262. package/dist/twins/packs/redis/index.mjs +2 -0
  263. package/dist/twins/packs/replicate/LICENSE +202 -0
  264. package/dist/twins/packs/replicate/NOTICE +7 -0
  265. package/dist/twins/packs/replicate/index.mjs +2 -0
  266. package/dist/twins/packs/resend/LICENSE +202 -0
  267. package/dist/twins/packs/resend/NOTICE +7 -0
  268. package/dist/twins/packs/resend/index.mjs +139 -0
  269. package/dist/twins/packs/runhuman/LICENSE +202 -0
  270. package/dist/twins/packs/runhuman/NOTICE +7 -0
  271. package/dist/twins/packs/runhuman/index.mjs +3 -0
  272. package/dist/twins/packs/scrapecreators/LICENSE +202 -0
  273. package/dist/twins/packs/scrapecreators/NOTICE +7 -0
  274. package/dist/twins/packs/scrapecreators/index.mjs +2 -0
  275. package/dist/twins/packs/segment/LICENSE +202 -0
  276. package/dist/twins/packs/segment/NOTICE +8 -0
  277. package/dist/twins/packs/segment/index.mjs +2 -0
  278. package/dist/twins/packs/sendblue/LICENSE +202 -0
  279. package/dist/twins/packs/sendblue/NOTICE +7 -0
  280. package/dist/twins/packs/sendblue/index.mjs +2 -0
  281. package/dist/twins/packs/sendgrid/LICENSE +202 -0
  282. package/dist/twins/packs/sendgrid/NOTICE +8 -0
  283. package/dist/twins/packs/sendgrid/index.mjs +4 -0
  284. package/dist/twins/packs/sentry/LICENSE +202 -0
  285. package/dist/twins/packs/sentry/NOTICE +7 -0
  286. package/dist/twins/packs/sentry/index.mjs +5 -0
  287. package/dist/twins/packs/sigstore/LICENSE +202 -0
  288. package/dist/twins/packs/sigstore/NOTICE +7 -0
  289. package/dist/twins/packs/sigstore/index.mjs +12 -0
  290. package/dist/twins/packs/slack/LICENSE +202 -0
  291. package/dist/twins/packs/slack/NOTICE +7 -0
  292. package/dist/twins/packs/slack/index.mjs +66 -0
  293. package/dist/twins/packs/smtp/LICENSE +202 -0
  294. package/dist/twins/packs/smtp/NOTICE +7 -0
  295. package/dist/twins/packs/smtp/index.mjs +3 -0
  296. package/dist/twins/packs/snowflake/LICENSE +202 -0
  297. package/dist/twins/packs/snowflake/NOTICE +8 -0
  298. package/dist/twins/packs/snowflake/index.mjs +30 -0
  299. package/dist/twins/packs/stigg/LICENSE +202 -0
  300. package/dist/twins/packs/stigg/NOTICE +8 -0
  301. package/dist/twins/packs/stigg/index.mjs +22194 -0
  302. package/dist/twins/packs/stream/LICENSE +202 -0
  303. package/dist/twins/packs/stream/NOTICE +7 -0
  304. package/dist/twins/packs/stream/index.mjs +2 -0
  305. package/dist/twins/packs/stripe/LICENSE +202 -0
  306. package/dist/twins/packs/stripe/NOTICE +7 -0
  307. package/dist/twins/packs/stripe/index.mjs +211 -0
  308. package/dist/twins/packs/supabase/LICENSE +202 -0
  309. package/dist/twins/packs/supabase/NOTICE +7 -0
  310. package/dist/twins/packs/supabase/index.mjs +2 -0
  311. package/dist/twins/packs/supermemory/LICENSE +202 -0
  312. package/dist/twins/packs/supermemory/NOTICE +7 -0
  313. package/dist/twins/packs/supermemory/index.mjs +2 -0
  314. package/dist/twins/packs/svix/LICENSE +202 -0
  315. package/dist/twins/packs/svix/NOTICE +7 -0
  316. package/dist/twins/packs/svix/index.mjs +2 -0
  317. package/dist/twins/packs/tavily/LICENSE +202 -0
  318. package/dist/twins/packs/tavily/NOTICE +7 -0
  319. package/dist/twins/packs/tavily/index.mjs +2 -0
  320. package/dist/twins/packs/telegram/LICENSE +202 -0
  321. package/dist/twins/packs/telegram/NOTICE +7 -0
  322. package/dist/twins/packs/telegram/index.mjs +11 -0
  323. package/dist/twins/packs/temporal/LICENSE +202 -0
  324. package/dist/twins/packs/temporal/NOTICE +7 -0
  325. package/dist/twins/packs/temporal/index.mjs +44 -0
  326. package/dist/twins/packs/tiktok/LICENSE +202 -0
  327. package/dist/twins/packs/tiktok/NOTICE +7 -0
  328. package/dist/twins/packs/tiktok/index.mjs +2 -0
  329. package/dist/twins/packs/tinybird/LICENSE +202 -0
  330. package/dist/twins/packs/tinybird/NOTICE +7 -0
  331. package/dist/twins/packs/tinybird/index.mjs +50 -0
  332. package/dist/twins/packs/togetherai/LICENSE +202 -0
  333. package/dist/twins/packs/togetherai/NOTICE +7 -0
  334. package/dist/twins/packs/togetherai/index.mjs +11 -0
  335. package/dist/twins/packs/tremendous/LICENSE +202 -0
  336. package/dist/twins/packs/tremendous/NOTICE +7 -0
  337. package/dist/twins/packs/tremendous/index.mjs +2 -0
  338. package/dist/twins/packs/tripo/LICENSE +202 -0
  339. package/dist/twins/packs/tripo/NOTICE +7 -0
  340. package/dist/twins/packs/tripo/index.mjs +9 -0
  341. package/dist/twins/packs/tunnel/LICENSE +202 -0
  342. package/dist/twins/packs/tunnel/NOTICE +7 -0
  343. package/dist/twins/packs/tunnel/index.mjs +2 -0
  344. package/dist/twins/packs/twelvelabs/LICENSE +202 -0
  345. package/dist/twins/packs/twelvelabs/NOTICE +7 -0
  346. package/dist/twins/packs/twelvelabs/index.mjs +5 -0
  347. package/dist/twins/packs/twilio/LICENSE +202 -0
  348. package/dist/twins/packs/twilio/NOTICE +7 -0
  349. package/dist/twins/packs/twilio/index.mjs +2 -0
  350. package/dist/twins/packs/twitch/LICENSE +202 -0
  351. package/dist/twins/packs/twitch/NOTICE +7 -0
  352. package/dist/twins/packs/twitch/index.mjs +68 -0
  353. package/dist/twins/packs/upstash/LICENSE +202 -0
  354. package/dist/twins/packs/upstash/NOTICE +7 -0
  355. package/dist/twins/packs/upstash/index.mjs +14 -0
  356. package/dist/twins/packs/upstashvector/LICENSE +202 -0
  357. package/dist/twins/packs/upstashvector/NOTICE +7 -0
  358. package/dist/twins/packs/upstashvector/index.mjs +3 -0
  359. package/dist/twins/packs/vercel/LICENSE +202 -0
  360. package/dist/twins/packs/vercel/NOTICE +7 -0
  361. package/dist/twins/packs/vercel/index.mjs +10 -0
  362. package/dist/twins/packs/veriff/LICENSE +202 -0
  363. package/dist/twins/packs/veriff/NOTICE +7 -0
  364. package/dist/twins/packs/veriff/index.mjs +2 -0
  365. package/dist/twins/packs/vgauth/LICENSE +202 -0
  366. package/dist/twins/packs/vgauth/NOTICE +7 -0
  367. package/dist/twins/packs/vgauth/index.mjs +2 -0
  368. package/dist/twins/packs/vital/LICENSE +202 -0
  369. package/dist/twins/packs/vital/NOTICE +7 -0
  370. package/dist/twins/packs/vital/index.mjs +2 -0
  371. package/dist/twins/packs/volteridentity/LICENSE +202 -0
  372. package/dist/twins/packs/volteridentity/NOTICE +7 -0
  373. package/dist/twins/packs/volteridentity/index.mjs +2 -0
  374. package/dist/twins/packs/webrisk/LICENSE +202 -0
  375. package/dist/twins/packs/webrisk/NOTICE +7 -0
  376. package/dist/twins/packs/webrisk/index.mjs +2 -0
  377. package/dist/twins/packs/worldlabs/LICENSE +202 -0
  378. package/dist/twins/packs/worldlabs/NOTICE +7 -0
  379. package/dist/twins/packs/worldlabs/index.mjs +2 -0
  380. package/dist/twins/packs/x/LICENSE +202 -0
  381. package/dist/twins/packs/x/NOTICE +7 -0
  382. package/dist/twins/packs/x/index.mjs +63 -0
  383. package/dist/twins/packs/xai/LICENSE +202 -0
  384. package/dist/twins/packs/xai/NOTICE +7 -0
  385. package/dist/twins/packs/xai/index.mjs +4 -0
  386. package/dist/twins/packs/xidentity/LICENSE +202 -0
  387. package/dist/twins/packs/xidentity/NOTICE +8 -0
  388. package/dist/twins/packs/xidentity/index.mjs +209 -0
  389. package/dist/twins/packs/youtube/LICENSE +202 -0
  390. package/dist/twins/packs/youtube/NOTICE +7 -0
  391. package/dist/twins/packs/youtube/index.mjs +5 -0
  392. package/dist/worker.js +442 -18
  393. package/dist/world-host.js +928 -91
  394. package/package.json +6 -5
  395. package/dist/dashboard/assets/dashboard/bay-morning.png +0 -0
  396. package/dist/dashboard/assets/dashboard/golden-gate-afternoon.png +0 -0
  397. package/dist/dashboard/assets/dashboard/golden-gate-portrait.png +0 -0
  398. package/dist/dashboard/assets/dashboard/moonlit-coast.png +0 -0
  399. package/dist/dashboard/assets/next/static/chunks/2868-424d32cfc8ae81c9.js +0 -1
  400. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-f9fca2c08f779fa0.js +0 -1
  401. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-bc480c9258e5cc4d.js +0 -1
  402. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-f04c0b236abaead3.js +0 -1
  403. package/dist/dashboard/assets/next/static/chunks/app/v2/page-07c8054d57c9089b.js +0 -1
  404. package/dist/dashboard/assets/next/static/css/4af3c8ca0da0f48b.css +0 -1
  405. package/dist/dashboard/assets/next/static/css/6b8edde77e493a51.css +0 -1
  406. package/dist/dashboard/assets/next/static/media/bay-morning.1a9f358c.png +0 -0
  407. package/dist/dashboard/assets/next/static/media/golden-gate-afternoon.3e7cea58.png +0 -0
  408. package/dist/dashboard/assets/next/static/media/golden-gate-portrait.7941528f.png +0 -0
  409. package/dist/dashboard/assets/next/static/media/moonlit-coast.bbe901a1.png +0 -0
  410. /package/dist/dashboard/assets/next/static/{5ub3D2yzS8DE7w2qZd1nv → GTd0IQ6HYyhE_2HqcgFno}/_buildManifest.js +0 -0
  411. /package/dist/dashboard/assets/next/static/{5ub3D2yzS8DE7w2qZd1nv → GTd0IQ6HYyhE_2HqcgFno}/_ssgManifest.js +0 -0
@@ -0,0 +1,13 @@
1
+ import{createRequire as __atReq}from'node:module';const require=__atReq(import.meta.url);
2
+ import{applyTwinWrite as Se,projectResources as N,nodeBuiltin as ke}from"../../engine/v2/volter_world-core.mjs";import{projectResources as K,nodeBuiltin as be,worldNow as it,deliveryTraceHeaders as ye}from"../../engine/v2/volter_world-core.mjs";import{appDestination as he,appFetch as _e}from"../../engine/v2/volter_world-core_app-route.mjs";import{worldEgressRefusal as we}from"../../engine/v2/volter_world-core_network-policy.mjs";var V="mailgun";function H(){return be("node:crypto")}var A=["accepted","clicked","complained","delivered","opened","permanent_fail","temporary_fail","unsubscribe"];function Y(e,t){return e==="failed"?t==="temporary"?"temporary_fail":"permanent_fail":e==="unsubscribed"?"unsubscribe":A.includes(e)?e:null}var J="key-twin0000000000000000000000000000000";function Q(e){let t=K(V,e).find(r=>r.type==="account"&&r.id==="account"),n=t?t.http_signing_key:void 0;return typeof n=="string"&&n!==""?n:J}function X(e,t,n){return H().createHmac("sha256",n).update(`${e}${t}`,"utf8").digest("hex")}function z(e,t,n){return H().createHash("sha256").update(`${e}.${t}.${n}`,"utf8").digest("hex").slice(0,50)}function Z(e,t,n,r){let o=Y(t,n);return o?K(V,r).filter(u=>u.type==="webhook"&&u._deleted!==!0).filter(u=>u.domain===e&&u.webhook_id===o).map(u=>({id:String(u.webhook_id),urls:(Array.isArray(u.urls)?u.urls:[]).map(String)})):[]}var ve=async(e,t,n)=>{if(!(!he(e)&&we(e)!==null))try{await _e(e,{method:"POST",headers:{...n,...ye()},body:t})}catch{}};function q(e,t,n){let r=String(t),o=z(String(e.id??""),r,n),u={signature:{timestamp:r,token:o,signature:X(r,o,n)},"event-data":e};return{body:JSON.stringify(u),payload:u}}async function L(e,t,n){let r=typeof t.severity=="string"?t.severity:void 0,o=Z(e,String(t.event??""),r,n.root);if(o.length===0)return[];let u=n.deliver??ve,s=Math.floor(Date.parse(n.occurredAt)/1e3),{body:a,payload:i}=q(t,Number.isFinite(s)?s:0,Q(n.root)),l=[];for(let c of o)for(let m of c.urls)await u(m,a,{"content-type":"application/json","user-agent":"mailgun/twin"}),l.push({url:m,body:a,payload:i});return l}function P(e,t){return e==="bounces"?{events:["accepted","failed"],reason:"suppress-bounce",severity:"permanent"}:e==="complaints"?{events:["accepted","failed"],reason:"suppress-complaint",severity:"permanent"}:e==="unsubscribes"?{events:["accepted","failed"],reason:"suppress-unsubscribe",severity:"permanent"}:t?{events:["accepted"]}:{events:["accepted","delivered"]}}var $="mailgun",re="2026-01-01T00:00:00.000Z",oe=["bounces","complaints","unsubscribes","whitelists"],Ee={bounces:"bounce",complaints:"complaint",unsubscribes:"unsubscribe",whitelists:"whitelist"};function d(e,t=404){return{status:t,body:{message:e}}}function w(){return d("Not Found",404)}function ae(e,t){if(!e)return;let n=t.toLowerCase();for(let[r,o]of Object.entries(e))if(r.toLowerCase()===n)return o}function M(e,t){return{get:n=>e.find(([r])=>r===n)?.[1],getAll:n=>e.filter(([r])=>r===n).map(([,r])=>r),has:n=>e.some(([r])=>r===n),keys:()=>[...new Set(e.map(([n])=>n))],json:()=>t}}function Te(e,t){let n=e??"",r=t??"",o=r.toLowerCase();if(o.includes("application/json"))try{let a=JSON.parse(n),i=Array.isArray(a)?[]:Object.entries(a).map(([l,c])=>[l,typeof c=="string"?c:JSON.stringify(c)]);return M(i,a)}catch{return M([],null)}if(o.includes("multipart/form-data")){let a=r.match(/boundary\s*=\s*"?([^";]+)"?/i);return M(a?Me(n,a[1]):[],null)}let u=n.trim();if(u.startsWith("{")||u.startsWith("["))try{let a=JSON.parse(n),i=Array.isArray(a)?[]:Object.entries(a).map(([l,c])=>[l,typeof c=="string"?c:JSON.stringify(c)]);return M(i,a)}catch{}let s=[];for(let[a,i]of new URLSearchParams(n))s.push([a,i]);return M(s,null)}function Me(e,t){let n=[];for(let r of e.split(`--${t}`)){let o=r.replace(/^\r\n/,"");if(o===""||o.startsWith("--"))continue;let u=o.indexOf(`\r
3
+ \r
4
+ `);if(u===-1)continue;let s=o.slice(0,u),a=o.slice(u+4).replace(/\r\n$/,""),i=s.match(/name="([^"]*)"/)?.[1];i!==void 0&&n.push([i,a])}return n}function xe(){return ke("node:crypto")}function v(e){return xe().createHash("sha256").update(e,"utf8").digest("hex")}function ue(e){return new Date(e).toUTCString()}function R(e){return new Date(e).toUTCString().replace(/GMT$/,"UTC")}function I(e,t,n,r){let o=new Set(N($,r).filter(u=>u.type===e).map(u=>u.id));for(let u=0;u<1e3;u++){let s=n(v(u===0?t:`${t}#${u}`));if(!o.has(s))return s}throw new Error(`mailgun twin: could not mint a free ${e} id`)}function $e(e,t,n,r){let o=n.replace(/[-:TZ.]/g,"").slice(0,14),u=new Set(N($,r).filter(s=>s.type==="message").map(s=>String(s.message_id??"")));for(let s=0;s<1e3;s++){let a=`<${o}.${v(s===0?t:`${t}#${s}`).slice(0,16)}@${e}>`;if(!u.has(a))return a}throw new Error("mailgun twin: could not mint a free message id")}function y(e,t){return N($,t).filter(n=>n.type===e&&!n.id.startsWith("_")&&n._deleted!==!0)}function b(e,t,n){return y(e,n).find(r=>r.id===t)}var Ae=new Set(["bounce","complaint","unsubscribe","whitelist","list_member","webhook","template","template_version","account"]);function _(e){let t={};for(let[n,r]of Object.entries(e))!n.startsWith("_")&&n!=="type"&&n!=="updatedAt"&&(t[n]=r);return Ae.has(String(e.type))&&delete t.id,t}var je=new Set(["domain.create","message.send","event.accepted","event.delivered","event.failed","bounce.create","complaint.create","unsubscribe.create","whitelist.create","webhook.create","route.create","mailing_list.create","list_member.create","template.create","template_version.create","api_key.create","api_key.regenerate_public","account.rotate_signing_key","account.regenerate_public_key"]);async function p(e,t,n,r,o){let u=N($,o.root).find(l=>l.type===e&&l.id===t),s=Number(u?._rev??0)+1,a=je.has(r)?{_deleted:!1}:{},{resource:i}=await Se($,{operation:r,subjectType:e,subjectId:t,fields:{...a,...n,_rev:s},occurredAt:o.occurredAt??re,actor:{kind:"agent"}},o.root);return _(i)}async function x(e,t,n,r){let o=y(e,r.root).filter(t);for(let u of o)await p(e,String(u.id),{_deleted:!0},n,r);return o.length}var Oe=[["webhook",(e,t)=>e.domain===t],["bounce",(e,t)=>e._domain===t],["complaint",(e,t)=>e._domain===t],["unsubscribe",(e,t)=>e._domain===t],["whitelist",(e,t)=>e._domain===t],["template",(e,t)=>e._domain===t],["template_version",(e,t)=>e._domain===t],["message",(e,t)=>e.domain===t],["event",(e,t)=>e._domain===t]];function Ie(e){let t=ae(e,"authorization");if(t===void 0)return null;let n=/^Basic\s+(.+)$/i.exec(t.trim());if(!n)return d("Invalid private key",401);let r="";try{r=Buffer.from(n[1],"base64").toString("utf8")}catch{return d("Invalid private key",401)}let o=r.indexOf(":"),u=o===-1?r:r.slice(0,o);return(o===-1?"":r.slice(o+1)).trim()===""||u!=="api"&&u.trim()===""?d("Invalid private key",401):null}function k(e,t){return b("domain",e.toLowerCase(),t)}function Ne(e){return[{record_type:"TXT",name:e,value:"v=spf1 include:mailgun.org ~all",valid:"unknown",is_active:!0,cached:[]},{record_type:"TXT",name:`mx._domainkey.${e}`,value:"k=rsa; p=MIGfMA0GCSqGSIb3DQEB",valid:"unknown",is_active:!0,cached:[]},{record_type:"CNAME",name:`email.${e}`,value:"mailgun.org",valid:"unknown",is_active:!0,cached:[]}]}function Re(){return[{record_type:"MX",priority:"10",value:"mxa.mailgun.org",valid:"unknown",is_active:!0,cached:[]},{record_type:"MX",priority:"10",value:"mxb.mailgun.org",valid:"unknown",is_active:!0,cached:[]}]}function ce(e){let t=_(e),n=t.domain_id,r=t.domain_type;return delete t.domain_id,delete t.domain_type,r!==void 0&&(t.type=r),{...t,id:n??e.id,name:e.id}}function j(e){return{domain:ce(e),sending_dns_records:e.sending_dns_records??[],receiving_dns_records:e.receiving_dns_records??[]}}async function Le(e,t){for(let[n,r]of Oe)await x(n,o=>r(o,e),`${n}.delete`,t);await p("domain",e,{_deleted:!0},"domain.delete",t)}async function F(e){let t=e.method.toUpperCase(),[n,r]=e.path.split("?"),o=(n??"/").replace(/\/{2,}/g,"/").replace(/\/+$/,"")||"/",u=new URLSearchParams(r??""),s=o.replace(/^\/+/,"").split("/").map(m=>decodeURIComponent(m)),a=e.occurredAt??re,i=Te(e.body,ae(e.headers,"content-type"));if(e.readOnly&&t!=="GET")return d("twin is read-only; omit readOnly to accept writes",405);let l=Ie(e.headers);if(l)return l;let c=s[0];if(c==="v3"){if(s[1]==="domains")return await Pe(s,t,i,u,e,a);if(s[1]==="routes")return await He(s,t,i,u,e,a);if(s[1]==="lists")return await Ye(s,t,i,u,e,a);if(s[1]==="ips"||s[1]==="ip_pools")return w();if(s[1]==="stats"&&s[2]==="total"&&s.length===3&&t==="GET")return{status:200,body:me(null,u,e.root,a)};if(s.length>=2)return await Ge(s,t,i,u,e,a)}if(c==="v4"){if(s[1]==="domains")return await Ce(s,t,i,u,e,a);if(s[1]==="address"&&s[2]==="validate")return ze(s,t,u)}if(c==="v1"){if(s[1]==="keys")return await Qe(s,t,i,e,a);if(s[1]==="analytics"&&s[2]==="tags")return await Xe(s,t,i,u,e,a)}if(c==="v5"&&s[1]==="accounts"&&s[2]==="http_signing_key"){if(t==="GET")return{status:200,body:{http_signing_key:ee(e.root)}};if(t==="POST"){let m=`key-${v(`rotate.${ee(e.root)}.${a}`).slice(0,32)}`;return await p("account","account",{http_signing_key:m},"account.rotate_signing_key",e),{status:200,body:{message:"Rotated HTTP signing key",http_signing_key:m}}}}return w()}function ee(e){let n=b("account","account",e)?.http_signing_key;return typeof n=="string"&&n!==""?n:"key-twin0000000000000000000000000000000"}async function Pe(e,t,n,r,o,u){let s=(e[2]??"").toLowerCase();if(e.length===2)return w();let a=k(s,o.root);if(e.length===3&&t==="DELETE")return a?(await Le(s,o),{status:200,body:{message:"domain has been deleted"}}):d("domain not found",404);if(!a)return d("domain not found",404);if(e.length===4&&e[3]==="connection"){if(t==="GET")return{status:200,body:{connection:{require_tls:a.require_tls===!0,skip_verification:a.skip_verification===!0}}};if(t==="PUT"){let i={};if(n.has("require_tls")&&(i.require_tls=n.get("require_tls")==="true"),n.has("skip_verification")&&(i.skip_verification=n.get("skip_verification")==="true"),Object.keys(i).length===0)return d("Missing parameter: require_tls or skip_verification",400);await p("domain",s,i,"domain.update_connection",o);let l=k(s,o.root);return{status:200,body:{message:"Domain connection settings have been updated, may take 10 minutes to fully propagate",require_tls:l.require_tls===!0,skip_verification:l.skip_verification===!0}}}}if(e[3]==="tracking"){let i=a.tracking??le();if(e.length===4&&t==="GET")return{status:200,body:{tracking:i}};if(e.length===5&&t==="PUT"){let l=e[4];if(!["open","click","unsubscribe"].includes(l))return d("Not Found",404);let c=n.get("active");if(c===void 0)return d("Missing parameter: active",400);let m={...i,[l]:{...i[l],active:c==="yes"||c==="true"}};return await p("domain",s,{tracking:m},"domain.update_tracking",o),{status:200,body:{message:"Domain tracking settings have been updated",[l]:m[l]}}}}if(e[3]==="webhooks")return await Ve(s,e,t,n,o,u);if(e[3]==="messages"&&e.length===5){let i=b("message",e[4],o.root);if(!i||i.domain!==s)return d("Message not found",404);if(t==="GET")return{status:200,body:De(i)};if(t==="POST"){let l=n.getAll("to");return l.length===0?d("Missing parameter: 'to'",400):{status:200,body:{id:(await G(s,{from:String(i.from??""),to:l,subject:String(i.subject??""),text:String(i["body-plain"]??""),html:String(i["body-html"]??""),options:{},tags:[]},o,u)).id,message:"Queued. Thank you."}}}}return e[3]==="templates"?await Je(s,e,t,n,r,o,u):w()}function le(){return{open:{active:!1},click:{active:!1},unsubscribe:{active:!1,html_footer:`
5
+ <br>
6
+ <p><a href="%unsubscribe_url%">unsubscribe</a></p>
7
+ `,text_footer:`
8
+
9
+ To unsubscribe click: <%unsubscribe_url%>
10
+
11
+ `}}}async function Ce(e,t,n,r,o,u){if(e.length===2&&t==="GET"){let a=y("domain",o.root),i=Number(r.get("limit")??"100");return{status:200,body:{items:a.slice(0,Number.isFinite(i)&&i>0?i:100).map(ce),total_count:a.length}}}if(e.length===2&&t==="POST"){let a=(n.get("name")??"").toLowerCase();if(a==="")return d("Missing parameter: 'name'",400);if(k(a,o.root))return d("Domain already exists",400);let i=await p("domain",a,{name:a,domain_id:v(`domain.${a}`).slice(0,24),state:"unverified",domain_type:n.get("type")??"custom",created_at:ue(u),is_disabled:!1,smtp_login:`postmaster@${a}`,smtp_password:v(`smtp.${a}`).slice(0,16),wildcard:n.get("wildcard")==="true",spam_action:n.get("spam_action")??"disabled",web_scheme:n.get("web_scheme")??"http",web_prefix:"email",require_tls:n.get("require_tls")==="true",skip_verification:n.get("skip_verification")==="true",tracking:le(),sending_dns_records:Ne(a),receiving_dns_records:Re()},"domain.create",o);return{status:200,body:{message:"Domain created successfully",...j({...i,id:a,type:"domain"})}}}let s=(e[2]??"").toLowerCase();if(e.length===3){let a=k(s,o.root);if(t==="GET")return a?{status:200,body:j(a)}:d("domain not found",404);if(t==="PUT"){if(!a)return d("domain not found",404);let i={};for(let l of["spam_action","web_scheme"])n.has(l)&&(i[l]=n.get(l));return n.has("wildcard")&&(i.wildcard=n.get("wildcard")==="true"),Object.keys(i).length===0?d("Missing parameters",400):(await p("domain",s,i,"domain.update",o),{status:200,body:{message:"Domain has been updated",...j(k(s,o.root))}})}}if(e.length===4&&e[3]==="verify"&&t==="PUT"){let a=k(s,o.root);if(!a)return d("domain not found",404);let i=l=>Array.isArray(l)?l.map(c=>({...c,valid:"valid"})):[];return await p("domain",s,{state:"active",sending_dns_records:i(a.sending_dns_records),receiving_dns_records:i(a.receiving_dns_records)},"domain.verify",o),{status:200,body:{message:"Domain DNS records have been updated",...j(k(s,o.root))}}}return w()}async function Ge(e,t,n,r,o,u){let s=(e[1]??"").toLowerCase(),a=e[2];return k(s,o.root)?(a==="messages"||a==="messages.mime")&&e.length===3&&t==="POST"?await Ue(s,a==="messages.mime",n,o,u):a==="events"&&e.length===3&&t==="GET"?Fe(s,r,o.root):a==="stats"&&e[3]==="total"&&t==="GET"?{status:200,body:me(s,r,o.root,u)}:oe.includes(a??"")?await Be(s,a,e,t,n,r,o,u):w():d("domain not found",404)}async function Ue(e,t,n,r,o){if(t){let c=n.get("message"),m=n.getAll("to");if(m.length===0)return d("Missing parameter: 'to'",400);if(c===void 0||c==="")return d("Missing parameter: 'message'",400);let f=h=>new RegExp(`^${h}:\\s*(.*)$`,"im").exec(c)?.[1]?.trim()??"";return{status:200,body:{id:(await G(e,{from:f("From"),to:m,subject:f("Subject"),text:c.split(/\r?\n\r?\n/).slice(1).join(`
12
+
13
+ `),html:"",options:{},tags:[]},r,o)).id,message:"Queued. Thank you."}}}let u=n.get("from")??"",s=n.getAll("to");if(u==="")return d("Missing mandatory parameter: from",400);if(s.length===0)return d("invalid 'to' address",400);if(!n.has("subject"))return d("Missing mandatory parameter: subject",400);if(!(n.has("text")||n.has("html")||n.has("template")||n.has("amp-html")))return d("Need at least one of 'text', 'html', 'amp-html' or 'template' parameters specified",400);let i={};for(let c of n.keys())(c.startsWith("o:")||c.startsWith("h:")||c.startsWith("v:")||c.startsWith("t:"))&&(i[c]=n.get(c));return{status:200,body:{id:(await G(e,{from:u,to:s,subject:n.get("subject")??"",text:n.get("text")??"",html:n.get("html")??"",options:i,tags:n.getAll("o:tag")},r,o)).id,message:"Queued. Thank you."}}}function de(e,t,n){let r=`${e}|${t.toLowerCase()}`;return b("bounce",r,n)?"bounces":b("complaint",r,n)?"complaints":b("unsubscribe",r,n)?"unsubscribes":null}async function G(e,t,n,r){let o=`${e}|${t.from}|${t.to.join(",")}|${t.subject}|${t.text}|${t.html}|${r}`,u=$e(e,o,r,n.root),s=I("message",`storage.${u}`,l=>l.slice(0,40),n.root);await p("message",s,{domain:e,message_id:u,storage_key:s,from:t.from,to:t.to,recipients:t.to.join(", "),subject:t.subject,"body-plain":t.text,"body-html":t.html,tags:t.tags,options:t.options,created_at:r},"message.send",n);let a=t.options["o:testmode"]==="yes"||t.options["o:testmode"]==="true",i=0;for(let l of t.to){let c=de(e,E(l),n.root),m=P(c,a);for(let f of m.events){i+=1;let g=I("event",`${s}|${l}|${f}|${i}`,S=>S.slice(0,22),n.root),h={id:g,timestamp:Date.parse(r)/1e3+i/1e3,event:f,"log-level":f==="failed"?"error":"info",recipient:E(l),"recipient-domain":E(l).split("@")[1]??"",domain:e,tags:t.tags,"user-variables":{},flags:{"is-authenticated":!0,"is-routed":!1,"is-system-test":!1,"is-test-mode":a},envelope:{transport:"smtp",sender:E(t.from),targets:E(l)},message:{headers:{to:l,"message-id":u.replace(/^<|>$/g,""),from:t.from,subject:t.subject},attachments:[],size:t.text.length+t.html.length},storage:{key:s,url:`https://storage.api.mailgun.net/v3/domains/${e}/messages/${s}`},...f==="failed"?{severity:m.severity,reason:m.reason,"delivery-status":{code:605,message:`Not delivering to previously ${m.reason==="suppress-bounce"?"bounced":m.reason==="suppress-complaint"?"complained":"unsubscribed"} address`,description:""}}:{},...f==="delivered"?{"delivery-status":{code:250,message:"OK",description:"","attempt-no":1,"session-seconds":.1,tls:!0}}:{}};await p("event",g,{...h,_domain:e,_seq:i,_messageKey:s},`event.${f}`,n),await L(e,h,{occurredAt:r,...n.root!==void 0?{root:n.root}:{},...n.deliver?{deliver:n.deliver}:{}})}}return{id:u,storageKey:s}}function E(e){let t=/<([^>]+)>/.exec(e);return(t?t[1]:e).trim().toLowerCase()}function De(e){let t=Array.isArray(e.to)?e.to.join(", "):String(e.to??"");return{"Content-Type":"text/html; charset=ascii",From:String(e.from??""),"Message-Id":String(e.message_id??""),"Mime-Version":"1.0",Subject:String(e.subject??""),To:t,sender:E(String(e.from??"")),recipients:t,from:String(e.from??""),subject:String(e.subject??""),"body-html":String(e["body-html"]??""),"body-plain":String(e["body-plain"]??""),"stripped-html":String(e["body-html"]??""),"stripped-text":String(e["body-plain"]??""),"stripped-signature":"","message-headers":[["From",String(e.from??"")],["To",t],["Subject",String(e.subject??"")],["Message-Id",String(e.message_id??"")]],attachments:[]}}var te=100;function Fe(e,t,n){let r=y("event",n).filter(f=>f._domain===e).sort((f,g)=>Number(g.timestamp??0)-Number(f.timestamp??0)||Number(f._seq??0)-Number(g._seq??0)),o=t.get("event");if(o){let f=new Set(o.split(/\s+OR\s+|\s+/).filter(Boolean));r=r.filter(g=>f.has(String(g.event)))}let u=t.get("recipient");u&&(r=r.filter(f=>String(f.recipient)===u.toLowerCase())),t.get("ascending")==="yes"&&(r=r.reverse());let s=Number(t.get("limit")??te),a=Number.isFinite(s)&&s>0?Math.min(s,300):te,i=Number(Buffer.from(t.get("page")??"","base64url").toString("utf8")||"0")||0,l=r.slice(i,i+a).map(f=>_(f)),c=f=>Buffer.from(String(Math.max(0,f)),"utf8").toString("base64url"),m=f=>`https://api.mailgun.net/v3/${e}/events?page=${c(f)}&limit=${a}`;return{status:200,body:{items:l,paging:{first:m(0),last:m(Math.max(0,r.length-a)),next:m(i+a),previous:m(i-a)}}}}function me(e,t,n,r){let o=y("event",n).filter(i=>e===null||i._domain===e),u=t.getAll("event"),s=u.length>0?u:["accepted","delivered","failed"],a={time:r};for(let i of s){let l=o.filter(c=>String(c.event)===i).length;a[i]=i==="failed"?{permanent:{total:l},temporary:{total:0}}:{total:l,outgoing:l,incoming:0}}return{start:r,end:r,resolution:t.get("resolution")??"day",stats:[a]}}var ne={bounces:"Address not found in bounces table",complaints:"Address not found in complaints table",unsubscribes:"Address not found in unsubscribers table",whitelists:"Address not found in whitelists table"},We={bounces:"Bounce",complaints:"Complaint",unsubscribes:"Unsubscribe",whitelists:"Whitelist"};async function Be(e,t,n,r,o,u,s,a){let i=Ee[t],l=c=>`${e}|${c.toLowerCase()}`;if(n.length===3&&r==="GET"){let c=y(i,s.root).filter(g=>g._domain===e),m=Number(u.get("limit")??"100"),f=Number.isFinite(m)&&m>0?m:100;return{status:200,body:{items:c.slice(0,f).map(g=>_(g)),paging:{}}}}if(n.length===3&&r==="POST"){let c=o.json(),m=Array.isArray(c)?c:c!==null?[c]:[Object.fromEntries(o.keys().map(g=>[g,o.get(g)]))],f=[];for(let g of m){let h=String(g.address??"");if(h==="")return d("Missing parameter: 'address'",400);f.push(h),await p(i,l(h),{_domain:e,address:h.toLowerCase(),created_at:R(a),...t==="bounces"?{code:String(g.code??"550"),error:String(g.error??"Address rejected")}:{},...t==="unsubscribes"?{tags:g.tags!==void 0?Array.isArray(g.tags)?g.tags:[String(g.tags)]:["*"]}:{},...t==="whitelists"?{value:h.toLowerCase(),reason:String(g.reason??"twin")}:{}},`${i}.create`,s)}return m.length>1?{status:200,body:{message:`${m.length} addresses have been added to the ${t} table`}}:t==="whitelists"?{status:200,body:{message:"Address/Domain has been added to the whitelists table",type:"address",value:f[0].toLowerCase()}}:{status:200,body:{message:`Address has been added to the ${t} table`,address:f[0]}}}if(n.length===3&&r==="DELETE"){let c=y(i,s.root).filter(m=>m._domain===e);for(let m of c)await p(i,String(m.id),{_deleted:!0},`${i}.delete`,s);return{status:200,body:{message:`All ${t} has been deleted`}}}if(n.length===4){let c=n[3],m=b(i,l(c),s.root);if(r==="GET")return m?{status:200,body:_(m)}:d(ne[t],404);if(r==="DELETE")return m?(await p(i,l(c),{_deleted:!0},`${i}.delete`,s),{status:200,body:{message:`${We[t]} has been removed`,address:c.toLowerCase()}}):{status:200,body:{message:ne[t]}}}return w()}function U(e){return e==="unsubscribed"?"unsubscribe":A.includes(e)?e:null}var Ke=["admin","basic","sending","developer"];async function Ve(e,t,n,r,o,u){let s=a=>`${e}|${a}`;if(t.length===4&&n==="GET"){let a={};for(let i of y("webhook",o.root).filter(l=>l.domain===e))a[String(i.webhook_id)]={urls:i.urls};return{status:200,body:{webhooks:a}}}if(t.length===4&&n==="POST"){let a=r.get("id")??"",i=r.getAll("url");if(a==="")return d("Missing parameter: 'id'",400);let l=U(a);return l===null?d(`Invalid webhook id: ${a}`,400):i.length===0?d("Missing parameter: 'url'",400):b("webhook",s(l),o.root)?d("Webhook already exists",400):(await p("webhook",s(l),{domain:e,webhook_id:l,urls:i,created_at:R(u)},"webhook.create",o),{status:200,body:{message:"Webhook has been created",webhook:{urls:i}}})}if(t.length===5){let a=U(t[4])??t[4],i=b("webhook",s(a),o.root);if(n==="GET")return i?{status:200,body:{webhook:{urls:i.urls}}}:d("Webhook not found",404);if(n==="PUT"){if(!i)return d("Webhook not found",404);let l=r.getAll("url");return l.length===0?d("Missing parameter: 'url'",400):(await p("webhook",s(a),{urls:l},"webhook.update",o),{status:200,body:{message:"Webhook has been updated",webhook:{urls:l}}})}if(n==="DELETE")return i?(await p("webhook",s(a),{_deleted:!0},"webhook.delete",o),{status:200,body:{message:"Webhook has been deleted",webhook:{urls:i.urls}}}):d("Webhook not found",404)}return w()}async function He(e,t,n,r,o,u){if(e.length===3&&e[2]==="match"&&t==="GET"){let s=r.get("address")??"";if(s==="")return d("Missing parameter: 'address'",400);let a=y("route",o.root).slice().sort((i,l)=>Number(i.priority??0)-Number(l.priority??0)).find(i=>fe(String(i.expression),s));return a?{status:200,body:{route:_(a)}}:d("Route not found",404)}if(e.length===2&&t==="GET"){let s=y("route",o.root).sort((c,m)=>Number(c.priority??0)-Number(m.priority??0)),a=Number(r.get("limit")??"100"),i=Number.isFinite(a)&&a>0?a:100,l=Number(r.get("skip")??"0")||0;return{status:200,body:{items:s.slice(l,l+i).map(c=>_(c)),total_count:s.length}}}if(e.length===2&&t==="POST"){let s=n.get("expression")??"",a=n.getAll("action");if(s==="")return d("Missing parameter: 'expression'",400);if(a.length===0)return d("Missing parameter: 'action'",400);let i=I("route",`${s}|${a.join(",")}|${u}`,c=>c.slice(0,24),o.root);return{status:200,body:{message:"Route has been created",route:await p("route",i,{id:i,expression:s,actions:a,description:n.get("description")??"",priority:Number(n.get("priority")??"0")||0,created_at:R(u)},"route.create",o)}}}if(e.length===3){let s=e[2],a=b("route",s,o.root);if(t==="GET")return a?{status:200,body:{route:_(a)}}:d("Route not found",404);if(t==="PUT"){if(!a)return d("Route not found",404);let i={};n.has("expression")&&(i.expression=n.get("expression")),n.has("description")&&(i.description=n.get("description")),n.has("priority")&&(i.priority=Number(n.get("priority"))||0);let l=n.getAll("action");return l.length>0&&(i.actions=l),Object.keys(i).length===0?d("Missing parameters",400):{status:200,body:{message:"Route has been updated",...await p("route",s,i,"route.update",o)}}}if(t==="DELETE")return a?(await p("route",s,{_deleted:!0},"route.delete",o),{status:200,body:{message:"Route has been deleted",id:s}}):d("Route not found",404)}return w()}function fe(e,t){if(/catch_all\(\s*\)/.test(e))return!0;let n=/match_recipient\("((?:[^"\\]|\\.)*)"\)/.exec(e);if(!n)return!1;try{return new RegExp(n[1].replace(/\\"/g,'"')).test(t)}catch{return!1}}async function Ye(e,t,n,r,o,u){if(e.length===3&&e[2]==="pages"&&t==="GET"){let i=y("mailing_list",o.root),l=Number(r.get("limit")??"100"),c=Number.isFinite(l)&&l>0?l:100,m=i.slice(0,c).map(S=>_(S)),f=S=>`https://api.mailgun.net/v3/lists/pages?address=${encodeURIComponent(S)}&limit=${c}`,g=String(m[0]?.address??""),h=String(m[m.length-1]?.address??"");return{status:200,body:{items:m,paging:{first:f(g),last:f(h),next:f(h),previous:f(g)}}}}if(e.length===2&&t==="GET"){let i=y("mailing_list",o.root);return{status:200,body:{items:i.map(l=>_(l)),total_count:i.length}}}if(e.length===2&&t==="POST"){let i=(n.get("address")??"").toLowerCase();return i===""?d("Missing parameter: 'address'",400):b("mailing_list",i,o.root)?d("Mailing list already exists",400):{status:200,body:{message:"Mailing list has been created",list:await p("mailing_list",i,{address:i,name:n.get("name")??"",description:n.get("description")??"",access_level:n.get("access_level")??"readonly",reply_preference:n.get("reply_preference")??"list",created_at:R(u),members_count:0},"mailing_list.create",o)}}}let s=(e[2]??"").toLowerCase(),a=b("mailing_list",s,o.root);if(e.length===3){if(t==="GET")return a?{status:200,body:{list:_(a)}}:d("Mailing list not found",404);if(t==="PUT"){if(!a)return d("Mailing list not found",404);let i={};for(let c of["name","description","access_level","reply_preference"])n.has(c)&&(i[c]=n.get(c));return Object.keys(i).length===0?d("Missing parameters",400):{status:200,body:{message:"Mailing list has been updated",list:await p("mailing_list",s,i,"mailing_list.update",o)}}}if(t==="DELETE")return a?(await x("list_member",i=>i._list===s,"list_member.delete",o),await p("mailing_list",s,{_deleted:!0},"mailing_list.delete",o),{status:200,body:{message:"Mailing list has been deleted",address:s}}):d("Mailing list not found",404)}if(!a)return d("Mailing list not found",404);if(e[3]==="members"){let i=l=>`${s}|${l.toLowerCase()}`;if(e.length===4&&t==="GET"){let l=y("list_member",o.root).filter(f=>f._list===s),c=Number(r.get("limit")??"100"),m=Number.isFinite(c)&&c>0?c:100;return{status:200,body:{items:l.slice(0,m).map(f=>_(f)),total_count:l.length}}}if(e.length===4&&t==="POST"){let l=(n.get("address")??"").toLowerCase();if(l==="")return d("Missing parameter: 'address'",400);let c=b("list_member",i(l),o.root),m=n.get("upsert")==="yes"||n.get("upsert")==="true";if(c&&!m)return d("Address already exists",400);let f=await p("list_member",i(l),{_list:s,address:l,name:n.get("name")??"",vars:se(n.get("vars")),subscribed:n.get("subscribed")!=="no"&&n.get("subscribed")!=="false"},"list_member.create",o);return await ie(s,o),{status:200,body:{message:"Mailing list member has been created",member:f}}}if(e.length===5&&e[4]==="pages"&&t==="GET"){let l=y("list_member",o.root).filter(T=>T._list===s),c=Number(r.get("limit")??"100"),m=Number.isFinite(c)&&c>0?c:100,f=l.slice(0,m).map(T=>_(T)),g=T=>`https://api.mailgun.net/v3/lists/${s}/members/pages?address=${encodeURIComponent(T)}&limit=${m}`,h=String(f[0]?.address??""),S=String(f[f.length-1]?.address??"");return{status:200,body:{items:f,paging:{first:g(h),last:g(S),next:g(S),previous:g(h)}}}}if(e.length===5){let l=e[4].toLowerCase(),c=b("list_member",i(l),o.root);if(t==="GET")return c?{status:200,body:{member:_(c)}}:d("Member not found",404);if(t==="PUT"){if(!c)return d("Member not found",404);let m={};return n.has("name")&&(m.name=n.get("name")),n.has("vars")&&(m.vars=se(n.get("vars"))),n.has("subscribed")&&(m.subscribed=n.get("subscribed")!=="no"&&n.get("subscribed")!=="false"),Object.keys(m).length===0?d("Missing parameters",400):{status:200,body:{message:"Mailing list member has been updated",member:await p("list_member",i(l),m,"list_member.update",o)}}}if(t==="DELETE")return c?(await p("list_member",i(l),{_deleted:!0},"list_member.delete",o),await ie(s,o),{status:200,body:{message:"Mailing list member has been deleted",member:{address:l}}}):d("Member not found",404)}}return w()}function se(e){if(!e)return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}async function ie(e,t){let n=y("list_member",t.root).filter(r=>r._list===e).length;await p("mailing_list",e,{members_count:n},"mailing_list.count",t)}async function Je(e,t,n,r,o,u,s){let a=c=>`${e}|${c}`;if(t.length===4&&n==="GET")return{status:200,body:{items:y("template",u.root).filter(m=>m._domain===e).map(m=>C(m,u.root)),paging:{}}};if(t.length===4&&n==="POST"){let c=r.get("name")??"";if(c==="")return d("Missing parameter: 'name'",400);if(b("template",a(c),u.root))return d("Template already exists",400);let m=await p("template",a(c),{_domain:e,name:c,description:r.get("description")??"",createdAt:s,createdBy:"twin",template_id:v(`template.${e}.${c}`).slice(0,24)},"template.create",u);if(r.has("template")){let f=r.get("tag")??"initial";await p("template_version",`${a(c)}|${f}`,{_domain:e,_template:c,tag:f,template:r.get("template"),engine:r.get("engine")??"handlebars",comment:r.get("comment")??"",active:!0,createdAt:s,version_id:v(`version.${e}.${c}.${f}`).slice(0,24)},"template_version.create",u)}return{status:200,body:{message:"template has been stored",template:C(b("template",a(c),u.root),u.root)}}}if(t.length===4&&n==="DELETE")return await x("template_version",c=>c._domain===e,"template_version.delete",u),await x("template",c=>c._domain===e,"template.delete",u),{status:200,body:{message:"domain template deleted"}};let i=t[4]??"",l=b("template",a(i),u.root);if(t.length===5){if(n==="GET")return l?{status:200,body:{template:C(l,u.root,o.get("active")==="yes")}}:d("template not found",404);if(n==="PUT")return l?r.has("description")?(await p("template",a(i),{description:r.get("description")},"template.update",u),{status:200,body:{message:"template has been updated",template:{name:i}}}):d("Missing parameter: 'description'",400):d("template not found",404);if(n==="DELETE")return l?(await x("template_version",c=>c._domain===e&&c._template===i,"template_version.delete",u),await p("template",a(i),{_deleted:!0},"template.delete",u),{status:200,body:{message:"template has been deleted",template:{name:i}}}):d("template not found",404)}if(t[5]==="versions"){if(!l)return d("template not found",404);if(t.length===6&&n==="GET"){let c=D(e,i,u.root).map(m=>ge(m));return{status:200,body:{template:{name:i,versions:c},paging:{}}}}if(t.length===6&&n==="POST"){let c=r.get("tag")??"";return c===""?d("Missing parameter: 'tag'",400):r.has("template")?b("template_version",`${a(i)}|${c}`,u.root)?d("Template version already exists",400):(await p("template_version",`${a(i)}|${c}`,{_domain:e,_template:i,tag:c,template:r.get("template"),engine:r.get("engine")??"handlebars",comment:r.get("comment")??"",active:r.get("active")==="yes"||D(e,i,u.root).length===0,createdAt:s,version_id:v(`version.${e}.${i}.${c}`).slice(0,24)},"template_version.create",u),{status:200,body:{message:"new version of the template has been stored",template:{name:i,version:{tag:c}}}}):d("Missing parameter: 'template'",400)}if(t.length===7){let c=t[6],m=b("template_version",`${a(i)}|${c}`,u.root);if(n==="GET")return m?{status:200,body:{template:{name:i,version:pe(m)}}}:d("version not found",404);if(n==="PUT"){if(!m)return d("version not found",404);let f={};return r.has("template")&&(f.template=r.get("template")),r.has("comment")&&(f.comment=r.get("comment")),r.has("active")&&(f.active=r.get("active")==="yes"),Object.keys(f).length===0?d("Missing parameters",400):(await p("template_version",`${a(i)}|${c}`,f,"template_version.update",u),{status:200,body:{message:"version has been updated",template:{name:i,version:{tag:c}}}})}if(n==="DELETE")return m?(await p("template_version",`${a(i)}|${c}`,{_deleted:!0},"template_version.delete",u),{status:200,body:{message:"version has been deleted",template:{name:i,version:{tag:c}}}}):d("version not found",404)}}return w()}function D(e,t,n){return y("template_version",n).filter(r=>r._domain===e&&r._template===t)}function pe(e){return{tag:e.tag,template:e.template,engine:e.engine,comment:e.comment,active:e.active,createdAt:e.createdAt,id:e.version_id}}function ge(e){return{tag:e.tag,engine:e.engine,comment:e.comment,active:e.active,createdAt:e.createdAt,id:e.version_id}}function C(e,t,n=!1){let r=String(e.name??""),o=String(e._domain??""),u=D(o,r,t),s=u.find(a=>a.active===!0);return{name:r,description:e.description,createdAt:e.createdAt,createdBy:e.createdBy,id:e.template_id,...n&&s?{version:pe(s)}:{versions:u.map(ge)}}}async function Qe(e,t,n,r,o){if(e.length===2&&t==="GET"){let u=y("api_key",r.root).map(s=>_(s));return{status:200,body:{items:u,total_count:u.length}}}if(e.length===2&&t==="POST"){let u=n.get("role")??"";if(u==="")return d("Missing parameter: 'role'",400);if(!Ke.includes(u))return d(`Invalid role: ${u}`,400);let s=I("api_key",`${u}|${n.get("description")??""}|${o}`,i=>`key_${i.slice(0,24)}`,r.root),a=`key-${v(`secret.${s}`).slice(0,32)}`;return await p("api_key",s,{role:u,description:n.get("description")??"",kind:"user",created_at:ue(o),_secret:a,requestor:"twin"},"api_key.create",r),{status:200,body:{message:"Key created",key:{..._(b("api_key",s,r.root)),secret:a}}}}if(e.length===3){let u=e[2];if(u==="public"&&t==="POST"){let s=`key-${v(`public.${o}`).slice(0,32)}`;return await p("account","account",{public_key:s},"account.regenerate_public_key",r),{status:200,body:{message:"Public key regenerated",key:s}}}if(t==="DELETE")return b("api_key",u,r.root)?(await p("api_key",u,{_deleted:!0},"api_key.delete",r),{status:200,body:{message:"Key deleted"}}):d("Key not found",404)}return w()}async function Xe(e,t,n,r,o,u){if(e.length===4&&e[3]==="limits"&&t==="GET")return{status:200,body:{limit:4e3,count:O(o.root).length}};if(e.length!==3)return w();if(t==="POST")return{status:200,body:{items:O(o.root),pagination:{next:"",previous:""}}};if(t==="PUT"){let s=n.get("tag")??"";return s===""?d("Missing parameter: 'tag'",400):O(o.root).some(a=>a.tag===s)?(await p("tag",s,{tag:s,description:n.get("description")??""},"tag.update",o),{status:200,body:{message:"Tag updated"}}):d("Tag not found",404)}if(t==="DELETE"){let s=r.get("tag")??n.get("tag")??"";return s===""?d("Missing parameter: 'tag'",400):O(o.root).some(a=>a.tag===s)?(await p("tag",s,{tag:s,_hiddenBefore:u},"tag.delete",o),{status:200,body:{message:"Tag deleted"}}):d("Tag not found",404)}return w()}function O(e){let t=new Map(y("tag",e).filter(o=>typeof o._hiddenBefore=="string").map(o=>[String(o.tag),String(o._hiddenBefore)])),n=new Map(y("tag",e).map(o=>[String(o.tag),String(o.description??"")])),r=new Map;for(let o of y("message",e))for(let u of Array.isArray(o.tags)?o.tags:[]){let s=String(u),a=t.get(s);a!==void 0&&String(o.created_at??"")<=a||r.set(s,(r.get(s)??0)+1)}return[...r.entries()].sort((o,u)=>o[0].localeCompare(u[0])).map(([o,u])=>({tag:o,description:n.get(o)??"","total-count":u}))}function ze(e,t,n){if(e.length!==3||t!=="GET")return w();let r=n.get("address")??"";if(r==="")return d("Missing parameter: 'address'",400);let o=/^[^\s@]+@[^\s@.]+\.[^\s@]+$/.test(r),[u,s]=r.split("@"),a=/mailinator|guerrillamail|10minutemail/i.test(s??""),i=["admin","info","support","sales","postmaster","abuse"].includes((u??"").toLowerCase());return{status:200,body:{address:r,is_disposable_address:a,is_role_address:i,reason:o?[]:["unparseable"],result:o?"deliverable":"undeliverable",risk:o?a?"high":i?"medium":"low":"high",engagement:null}}}import{serveHttp as pt}from"../../engine/v2/volter_world-core.mjs";import{createTwinFetchFromHandler as tt,statefulTwinManifest as nt}from"../../engine/v2/volter_world-core.mjs";import{projectResources as Ze}from"../../engine/v2/volter_world-core.mjs";var qe="mailgun";function et(e){let t={};for(let[n,r]of Object.entries(e))!n.startsWith("_")&&n!=="type"&&n!=="updatedAt"&&(t[n]=r);return t}function W(e){return Ze(qe,e).filter(t=>t.type==="message"&&!t.id.startsWith("_")&&t._deleted!==!0).map(et).sort((t,n)=>String(n.created_at??"").localeCompare(String(t.created_at??"")))}function B(e){let t=tt(F,{...e,manifest:nt({vendor:"mailgun",twinOf:"the Mailgun v3/v4 email API",stores:"domains, sent + stored messages, delivery events, the four suppression tables, webhooks, routes, mailing lists and templates"}),stores:{messages:()=>W(e.root)}});return async function(r){try{return await t(r)}catch(o){return new Response(JSON.stringify({message:`Internal server error: ${String(o)}`}),{status:500,headers:{"content-type":"application/json"}})}}}import{confirmAction as wt,pendingActions as vt,projectResources as St,syncPull as kt}from"../../engine/v2/volter_world-core.mjs";import{bundleClient as Mt,fileResponse as xt,filePathOf as $t}from"../../engine/v2/volter_world-core.mjs";import{serveHttp as jt}from"../../engine/v2/volter_world-core.mjs";export{B as createTwinFetch};
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,7 @@
1
+ @agenttwin/twin-mapbox
2
+
3
+ Contains @volter/twin-mapbox 0.1.37 by Volter (https://github.com/volter-ai),
4
+ licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ Modified by AgentTwin: bundled and minified into one file; only code reachable from the pack's
7
+ fetch factory is included; shared modules are imported from the AgentTwin twin engine.
@@ -0,0 +1,2 @@
1
+ import{createRequire as __atReq}from'node:module';const require=__atReq(import.meta.url);
2
+ import{applyTwinWrite as be,projectResources as xe}from"../../engine/v2/volter_world-core.mjs";function fe(e,t){if(!e)return;let n=t.toLowerCase();for(let[o,s]of Object.entries(e))if(o.toLowerCase()===n)return s}function me(e,t){let n=e.searchParams.get("access_token");if(n!==null)return n;let o=fe(t,"authorization");if(o?.toLowerCase().startsWith("bearer "))return o.slice(7)}function pe(e){return/^(pk|sk|tk)\.[A-Za-z0-9._-]{4,}$/.test(e)}function te(e,t){let n=me(e,t);return n===void 0?t===void 0?{ok:!0,token:"pk.twin-implicit"}:{ok:!1,status:401,message:"Not Authorized - No Token"}:n.trim()?n==="rate-limited"?{ok:!1,status:429,message:"Rate limit exceeded"}:n==="forbidden"?{ok:!1,status:403,message:"Forbidden"}:pe(n)?{ok:!0,token:n}:{ok:!1,status:401,message:"Not Authorized - Invalid Token"}:{ok:!1,status:401,message:"Not Authorized - No Token"}}import{createHash as ye}from"node:crypto";function h(e){let t=typeof e=="string"?e:JSON.stringify(e);return ye("sha256").update(t).digest("hex").slice(0,16)}function T(e){return e.trim().toLowerCase().replace(/\s+/g," ")}function x(e){return Math.round(e*1e6)/1e6}function oe(e){let t=h(e),n=parseInt(t.slice(0,8),16),o=parseInt(t.slice(8,16),16),s=x(n%36e6/1e5-180),r=x(o%17e6/1e5-85);return[s,r]}var D=[{mapbox_id:"dXJuOm1ieGFkcjphZGRyXzEyM19tYXJrZXQ",name:"123 Market St",name_preferred:"123 Market Street",full_address:"123 Market St, San Francisco, California 94105, United States",feature_type:"address",coordinates:[-122.396742,37.793779],place:"San Francisco",region_code:"CA",region_name:"California",postcode:"94105",country:"United States",country_code:"US",address_number:"123",street:"Market St"},{mapbox_id:"dXJuOm1ieHBsYzpsb3NhbmdlbGVz",name:"Los Angeles",name_preferred:"Los Angeles",full_address:"Los Angeles, California, United States",feature_type:"place",coordinates:[-118.242766,34.053691],place:"Los Angeles",region_code:"CA",region_name:"California",postcode:"90012",country:"United States",country_code:"US"},{mapbox_id:"dXJuOm1ieHBsYzpuZXd5b3Jr",name:"New York",name_preferred:"New York City",full_address:"New York, New York, United States",feature_type:"place",coordinates:[-73.990593,40.740121],place:"New York",region_code:"NY",region_name:"New York",postcode:"10001",country:"United States",country_code:"US"},{mapbox_id:"dXJuOm1ieHBsYzpsb25kb24",name:"London",name_preferred:"London",full_address:"London, England, United Kingdom",feature_type:"place",coordinates:[-.127625,51.507322],place:"London",region_code:"ENG",region_name:"England",postcode:"EC1",country:"United Kingdom",country_code:"GB"},{mapbox_id:"dXJuOm1ieHBsYzp0b2t5bw",name:"Tokyo",name_preferred:"Tokyo",full_address:"Tokyo, Japan",feature_type:"place",coordinates:[139.691711,35.689499],place:"Tokyo",region_code:"13",region_name:"Tokyo",postcode:"100-0001",country:"Japan",country_code:"JP"}],ge=["nowhere","zzzznoresult","zero_results","this-place-does-not-exist"];function B(e){let t=T(e);return ge.some(n=>t.includes(n))}function I(e){let t=T(e);for(let n of D)if(t.includes(T(n.name))||T(n.full_address).includes(t)&&t.length>=3)return n;return null}function Q(e){return D.find(t=>t.mapbox_id===e)??null}function U(e){let t=D[0],n=Number.POSITIVE_INFINITY;for(let o of D){let s=(o.coordinates[0]-e[0])**2+(o.coordinates[1]-e[1])**2;s<n&&(n=s,t=o)}return t}function L(){return D}function ne(e){let t={place:{name:e.place,mapbox_id:`${e.mapbox_id}_place`},region:{name:e.region_name,region_code:e.region_code,region_code_full:`${e.country_code}-${e.region_code}`},postcode:{name:e.postcode},country:{name:e.country,country_code:e.country_code,country_code_alpha_3:he(e.country_code)}};return e.address_number&&(t.address={name:e.name,address_number:e.address_number,street_name:e.street??""}),e.street&&(t.street={name:e.street}),t}function he(e){return{US:"USA",GB:"GBR",JP:"JPN"}[e]??e}function S(e){return{type:"Feature",id:e.mapbox_id,geometry:{type:"Point",coordinates:e.coordinates},properties:{mapbox_id:e.mapbox_id,feature_type:e.feature_type,name:e.name,name_preferred:e.name_preferred,full_address:e.full_address,address_line1:e.feature_type==="address"?e.name:void 0,place_formatted:`${e.place}, ${e.region_name} ${e.postcode}, ${e.country}`,coordinates:{longitude:e.coordinates[0],latitude:e.coordinates[1],accuracy:e.feature_type==="address"?"rooftop":"point"},context:ne(e)}}}function X(e){let t=oe(T(e)),n=`synth_${h(e)}`,o=h(e),s=[{name:"California",region_code:"CA"},{name:"New York",region_code:"NY"},{name:"Texas",region_code:"TX"},{name:"Washington",region_code:"WA"}],r=s[parseInt(o.slice(0,2),16)%s.length],i=String(1e4+parseInt(o.slice(2,6),16)%89999);return{type:"Feature",id:n,geometry:{type:"Point",coordinates:t},properties:{mapbox_id:n,feature_type:"address",name:e,name_preferred:e,full_address:`${e}, ${r.name} ${i}, United States`,address_line1:e,place_formatted:`${r.name} ${i}, United States`,coordinates:{longitude:t[0],latitude:t[1],accuracy:"point"},context:{place:{name:r.name,mapbox_id:`${n}_place`},region:{name:r.name,region_code:r.region_code,region_code_full:`US-${r.region_code}`},postcode:{name:i},country:{name:"United States",country_code:"US",country_code_alpha_3:"USA"}}}}}function O(e,t){let o=g=>g*Math.PI/180,s=o(t[1]-e[1]),r=o(t[0]-e[0]),i=o(e[1]),l=o(t[1]),p=Math.sin(s/2)**2+Math.cos(i)*Math.cos(l)*Math.sin(r/2)**2;return Math.round(2*6371e3*Math.asin(Math.sqrt(p)))}function k(e){return Math.round(e/1e3/40*3600*10)/10}function G(e){if(!e)return null;let t=e.trim().match(/^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);if(!t)return null;let n=Number(t[1]),o=Number(t[2]);return!Number.isFinite(o)||!Number.isFinite(n)||o<-90||o>90||n<-180||n>180?null:[n,o]}function J(e){let t=[0,0],n="",o=(s,r)=>{let i=Math.round(s*1e5)-Math.round(r*1e5);i=i<0?~(i<<1):i<<1;let l="";for(;i>=32;)l+=String.fromCharCode((32|i&31)+63),i>>=5;return l+=String.fromCharCode(i+63),l};for(let[s,r]of e)n+=o(r,t[0]),n+=o(s,t[1]),t=[r,s];return n}function Y(e,t){let[n,o]=e;return{type:"Polygon",coordinates:[[[x(n),x(o+t)],[x(n+t),x(o)],[x(n),x(o-t)],[x(n-t),x(o)],[x(n),x(o+t)]]]}}var se="mapbox",ae="1970-01-01T00:00:00.000Z",$="twinuser",V="NOTICE: \xA9 2024 Mapbox and its suppliers. All rights reserved. (twin)";function m(e){return{status:200,body:e}}function c(e,t){return{status:e,body:{message:t}}}function v(e){return{type:"FeatureCollection",features:e,attribution:V}}function E(e){if(!e?.trim())return{};try{let t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function _e(e,t){let n=e.searchParams.get("q"),o=["address_number","street","block","place","region","postcode","locality","neighborhood","country"],s=o.some(w=>e.searchParams.get(w));if(!n&&!s)return c(422,"q is a required parameter for forward geocoding.");let r=n??o.map(w=>e.searchParams.get(w)).filter(Boolean).join(" ");if(B(r))return m(v([]));let i=ve(r,t);if(i)return m(v([i]));let l=I(r),p=Math.max(1,Math.min(10,Number(e.searchParams.get("limit")??"5")||5)),g=l?S(l):X(r);return m(v([g].slice(0,p)))}function we(e){let t=e.searchParams.get("longitude"),n=e.searchParams.get("latitude");if(t===null||n===null||!Number.isFinite(Number(t))||!Number.isFinite(Number(n)))return c(422,"longitude and latitude are required parameters for reverse geocoding.");let o=[Number(t),Number(n)],s=U(o),r=S(s);return r.geometry={type:"Point",coordinates:[x(o[0]),x(o[1])]},r.properties.coordinates={longitude:x(o[0]),latitude:x(o[1]),accuracy:"point"},m(v([r]))}function Te(e){let t;try{t=e?.trim()?JSON.parse(e):null}catch{return c(422,"Batch geocoding expects valid JSON.")}if(!Array.isArray(t))return c(422,"Batch geocoding expects a JSON array of query objects.");if(t.length>1e3)return c(422,"Batch geocoding allows up to 1000 queries per request.");let n=t.map(o=>{if(o.longitude!==void 0&&o.latitude!==void 0)return v([S(U([Number(o.longitude),Number(o.latitude)]))]);let s=String(o.q??"");if(!s||B(s))return v([]);let r=I(s);return v([r?S(r):X(s)])});return m({batch:n})}function ve(e,t){let n=T(e),o=R("geocode",t).find(s=>s.normalized===n);return o?o.feature:null}function re(e){return{type:"Feature",id:`${e.feature_type}.${h(e.mapbox_id)}`,geometry:{type:"Point",coordinates:e.coordinates},properties:{accuracy:e.feature_type==="address"?"rooftop":void 0},place_type:[e.feature_type],relevance:1,text:e.name,place_name:e.full_address,center:e.coordinates,context:[{id:`place.${h(e.place)}`,text:e.place},{id:`region.${h(e.region_name)}`,text:e.region_name,short_code:`${e.country_code}-${e.region_code}`},{id:`postcode.${h(e.postcode)}`,text:e.postcode},{id:`country.${h(e.country)}`,text:e.country,short_code:e.country_code.toLowerCase()}]}}function Pe(e){let t=e.match(/^\/geocoding\/v5\/mapbox\.places\/(.+)\.json$/);if(!t)return c(404,"Not Found");let n=decodeURIComponent(t[1]),o=G(n),s,r;if(o)s=[re(U(o))],r=o;else{if(!n.trim())return c(422,"query is required.");if(r=[n],B(n))s=[];else{let i=I(n);s=[re(i??L()[0])]}}return m({type:"FeatureCollection",query:r,features:s,attribution:V})}function Me(e){let t=e.searchParams.get("q"),n=e.searchParams.get("session_token");if(!t)return c(422,"q is a required parameter.");if(!n)return c(422,"session_token is a required parameter.");let o=T(t),s=L().filter(l=>T(l.name).includes(o)||T(l.full_address).includes(o)),i=(s.length?s:[L()[0]]).slice(0,5).map(l=>({name:l.name,name_preferred:l.name_preferred,mapbox_id:l.mapbox_id,feature_type:l.feature_type,address:l.address_number?l.name:void 0,full_address:l.full_address,place_formatted:`${l.place}, ${l.region_name} ${l.postcode}, ${l.country}`,context:{country:{name:l.country,country_code:l.country_code},region:{name:l.region_name,region_code:l.region_code},place:{name:l.place},postcode:{name:l.postcode}},language:"en",maki:"marker"}));return m({suggestions:i,attribution:V})}function $e(e,t){if(!t.searchParams.get("session_token"))return c(422,"session_token is a required parameter.");let o=Q(e);return o?m(v([S(o)])):c(404,"Not Found")}function Ee(e){if(!e)return c(404,"Not Found");let t=L().slice(0,2).map(n=>{let o=S(n);return o.properties.feature_type="poi",o.properties.poi_category=[e],o});return m(v(t))}function Ae(e){let t=e.searchParams.get("q");if(!t)return c(422,"q is a required parameter.");if(B(t))return m(v([]));let n=I(t);return m(v([n?S(n):X(t)]))}function Se(e){let t=e.searchParams.get("longitude"),n=e.searchParams.get("latitude");if(t===null||n===null)return c(422,"longitude and latitude are required parameters.");let o=U([Number(t),Number(n)]);return m(v([S(o)]))}var W=["driving-traffic","driving","walking","cycling"];function Z(e){return e.split(";").map(t=>G(t))}function ke(e,t,n){if(!W.includes(e))return c(422,`Profile not found: mapbox/${e}`);let o=Z(t);if(o.length<2||o.some(y=>y===null))return c(422,"Coordinates must be a semicolon-separated list of at least two lng,lat pairs.");let s=o,r=n.searchParams.get("geometries")??"polyline",i=0,l=[];for(let y=0;y<s.length-1;y++){let _=Math.max(1,O(s[y],s[y+1]));i+=_,l.push({distance:_,duration:k(_),summary:"",steps:[],weight:k(_)})}let p=k(i),g=r==="geojson"?{type:"LineString",coordinates:s}:J(s),w=s.map(y=>({name:"",location:y,distance:0}));return m({code:"Ok",routes:[{distance:i,duration:p,weight:p,weight_name:"auto",geometry:g,legs:l}],waypoints:w,uuid:h(t)})}function Ne(e,t,n){if(!W.includes(e))return c(422,`Profile not found: mapbox/${e}`);let o=Z(t);if(o.length<2||o.some(y=>y===null))return c(422,"Coordinates must be a semicolon-separated list of at least two lng,lat pairs.");let s=e==="driving-traffic"?10:25;if(o.length>s)return c(422,`A maximum of ${s} coordinates is allowed for the ${e} profile.`);let r=o,i=y=>y&&y!=="all"?y.split(";").map(Number):r.map((_,C)=>C),l=i(n.searchParams.get("sources")),p=i(n.searchParams.get("destinations")),g=l.map(y=>p.map(_=>k(Math.max(1,O(r[y],r[_]))))),w=l.map(y=>p.map(_=>O(r[y],r[_])));return m({code:"Ok",durations:g,distances:w,sources:l.map(y=>({name:"",location:r[y],distance:0})),destinations:p.map(y=>({name:"",location:r[y],distance:0}))})}function Fe(e,t,n){if(!W.includes(e))return c(422,`Profile not found: mapbox/${e}`);let o=G(t);if(!o)return c(422,"Coordinates must be a single lng,lat pair.");let s=n.searchParams.get("contours_minutes"),r=n.searchParams.get("contours_meters");if(!s&&!r)return c(422,"Either contours_minutes or contours_meters is required.");let i=(s??r).split(",").map(Number);if(i.length>4||i.some(g=>!Number.isFinite(g)))return c(422,"Up to four numeric contours are allowed.");let l=n.searchParams.get("polygons")==="true",p=i.slice().sort((g,w)=>w-g).map((g,w)=>{let y=g/(s?60:5e4)*.05+.005,_={contour:g,color:"#bf4040","fill-color":"#bf4040","fill-opacity":.33,opacity:.33,metric:s?"time":"distance",fillColor:"#bf4040",fillOpacity:.33};if(l)return{type:"Feature",properties:_,geometry:Y(o,y)};let C=Y(o,y).coordinates[0];return{type:"Feature",properties:_,geometry:{type:"LineString",coordinates:C},id:`iso_${w}`}});return m({type:"FeatureCollection",features:p})}function Oe(e,t,n){if(!W.includes(e))return c(422,`Profile not found: mapbox/${e}`);let o=Z(t);if(o.length<2||o.length>100||o.some(p=>p===null))return c(422,"Map Matching expects between 2 and 100 lng,lat coordinates.");let s=o,r=0;for(let p=0;p<s.length-1;p++)r+=Math.max(1,O(s[p],s[p+1]));let l=(n.searchParams.get("geometries")??"polyline")==="geojson"?{type:"LineString",coordinates:s}:J(s);return m({code:"Ok",matchings:[{confidence:.95,distance:r,duration:k(r),weight:k(r),weight_name:"auto",geometry:l,legs:[]}],tracepoints:s.map((p,g)=>({matchings_index:0,waypoint_index:g,alternatives_count:0,name:"",location:p}))})}function Re(e,t){if(!W.includes(e))return c(422,`Profile not found: mapbox/${e}`);let n=Z(t);if(n.length<2||n.length>12||n.some(r=>r===null))return c(422,"Optimization v1 expects between 2 and 12 lng,lat coordinates.");let o=n,s=0;for(let r=0;r<o.length-1;r++)s+=Math.max(1,O(o[r],o[r+1]));return m({code:"Ok",trips:[{distance:s,duration:k(s),geometry:J(o),legs:[]}],waypoints:o.map((r,i)=>({name:"",location:r,trips_index:0,waypoint_index:i}))})}function Ce(e,t,n){let o=G(t.replace(/\.json$/,""));if(!o)return c(422,"Coordinates must be a lng,lat pair.");if(!e)return c(404,"Not Found");let s=Math.max(1,Math.min(50,Number(n.searchParams.get("limit")??"5")||5)),r=Array.from({length:Math.min(s,3)},(i,l)=>{let p=(l+1)*1e-4,g=[x(o[0]+p),x(o[1]+p)];return{type:"Feature",id:`tq_${l}`,geometry:{type:"Point",coordinates:g},properties:{tilequery:{distance:O(o,g),geometry:"point",layer:"poi_label"},name:`Feature ${l}`}}});return m(v(r))}function Be(e){let t=e.match(/\/static\/.*\/(\d+)x(\d+)(?:@2x)?(?:\.[a-z0-9]+)?$/);if(!t)return c(422,"Static image request must include a {width}x{height} size segment.");let n=Number(t[1]),o=Number(t[2]);return n>1280||o>1280?c(422,"Static image dimensions cannot exceed 1280x1280."):m({contentType:"image/png",width:n,height:o,twinNote:"twin returns image metadata, not rendered raster pixels"})}function Ie(e){let t=e.match(/^\/v4\/([^/]+)\.json$/);if(!t)return c(404,"Not Found");let n=t[1];return m({tilejson:"2.2.0",name:n,scheme:"xyz",tiles:[`https://api.mapbox.com/v4/${n}/{z}/{x}/{y}.vector.pbf`],minzoom:0,maxzoom:16,bounds:[-180,-85,180,85],center:[0,0,2],attribution:V})}function Ue(e){let t=e.match(/^\/fonts\/v1\/([^/]+)\/(.+)\/(\d+)-(\d+)\.pbf$/);if(!t)return c(404,"Not Found");let n=Number(t[3]),o=Number(t[4]);return o-n!==255?c(422,"Glyph ranges must span exactly 256 codepoints (e.g. 0-255)."):m({contentType:"application/x-protobuf",font:decodeURIComponent(t[2]),range:`${n}-${o}`,twinNote:"twin returns glyph metadata, not the binary SDF protobuf"})}function Le(){return m(["DIN Pro Regular","DIN Pro Medium","DIN Pro Bold","Arial Unicode MS Regular"])}function R(e,t){return xe(se,t).filter(n=>n.type===e&&n._deleted!==!0)}function j(e,t){return R(e,t).map(n=>P(n))}function N(e,t,n){return R(e,n).find(o=>o.id===t)}async function A(e,t,n,o,s){let{resource:r}=await be(se,{operation:t,subjectType:n,subjectId:o,fields:s,occurredAt:e.occurredAt??ae,actor:{kind:"system"}},e.root);return r}async function z(e,t,n,o){await A(e,t,n,o,{_deleted:!0})}function P(e){if(!e)return null;let{type:t,updatedAt:n,normalized:o,_deleted:s,...r}=e;return r}async function q(e){let t=e.method.toUpperCase(),n=new URL(e.path,"http://twin.local"),o=n.pathname;o=o.replace(/^\/api(?=\/)/,"");let s=te(n,e.headers);if(!s.ok)return c(s.status,s.message);let r=e.occurredAt??ae,i=()=>e.readOnly?c(405,"twin is read-only"):null;if(t==="POST"&&o==="/twin/geocode"){let u=i();if(u)return u;let a=E(e.body),d=String(a.query??""),f=a.feature;if(!d||!f)return c(422,"query and feature are required");let b=T(d),M=`geocode_${h(b)}`,F=await A(e,"geocode.upsert","geocode",M,{id:M,normalized:b,query:d,feature:f});return m(F)}if(t==="GET"){if(o==="/search/geocode/v6/forward")return _e(n,e.root);if(o==="/search/geocode/v6/reverse")return we(n);if(o.startsWith("/geocoding/v5/mapbox.places/"))return Pe(o);if(o==="/search/searchbox/v1/suggest")return Me(n);if(o==="/search/searchbox/v1/forward")return Ae(n);if(o==="/search/searchbox/v1/reverse")return Se(n);let u=o.match(/^\/search\/searchbox\/v1\/retrieve\/(.+)$/);if(u)return $e(decodeURIComponent(u[1]),n);let a=o.match(/^\/search\/searchbox\/v1\/category\/(.+)$/);if(a)return Ee(decodeURIComponent(a[1]));let d=o.match(/^\/directions\/v5\/mapbox\/([^/]+)\/(.+)$/);if(d)return ke(d[1],d[2],n);let f=o.match(/^\/directions-matrix\/v1\/mapbox\/([^/]+)\/(.+)$/);if(f)return Ne(f[1],f[2],n);let b=o.match(/^\/isochrone\/v1\/mapbox\/([^/]+)\/(.+)$/);if(b)return Fe(b[1],b[2],n);let M=o.match(/^\/matching\/v5\/mapbox\/([^/]+)\/(.+)$/);if(M)return Oe(M[1],M[2],n);let F=o.match(/^\/optimized-trips\/v1\/mapbox\/([^/]+)\/(.+)$/);if(F)return Re(F[1],F[2]);let K=o.match(/^\/v4\/([^/]+)\/tilequery\/(.+)$/);if(K)return Ce(K[1],K[2],n);if(/^\/v4\/[^/]+\.json$/.test(o))return Ie(o);if(o.includes("/static/"))return Be(o);if(o===`/fonts/v1/${$}`)return Le();if(/^\/fonts\/v1\/[^/]+\/.+\/\d+-\d+\.pbf$/.test(o))return Ue(o)}if(t==="POST"){if(o==="/search/geocode/v6/batch")return Te(e.body);if(o==="/optimized-trips/v2"){let u=i();if(u)return u;let a=E(e.body);return!Array.isArray(a.locations)||!Array.isArray(a.services??a.shipments)?c(422,"Optimization v2 requires locations and services/shipments arrays."):{status:202,body:{id:`opt_${h(JSON.stringify(a))}`,status:"processing"}}}}if(o===`/datasets/v1/${$}`){if(t==="GET")return m(j("dataset",e.root));if(t==="POST"){let u=i();if(u)return u;let a=E(e.body),d=`ds_${h(`${a.name??""}:${R("dataset",e.root).length}:${r}`)}`,f=await A(e,"dataset.create","dataset",d,{id:d,owner:$,name:a.name??null,description:a.description??null,created:r,modified:r,features:0,bounds:null});return{status:200,body:P(f)}}}let l=o.match(/^\/datasets\/v1\/[^/]+\/([^/]+)$/);if(l){let u=l[1],a=N("dataset",u,e.root);if(t==="GET")return a?m(P(a)):c(404,"Not Found");if(t==="PATCH"){let d=i();if(d)return d;if(!a)return c(404,"Not Found");let f=E(e.body),b=await A(e,"dataset.update","dataset",u,{...f.name!==void 0?{name:f.name}:{},...f.description!==void 0?{description:f.description}:{},modified:r});return m(P(b))}if(t==="DELETE"){let d=i();return d||(a?(await z(e,"dataset.delete","dataset",u),{status:204,body:null}):c(404,"Not Found"))}}let p=o.match(/^\/datasets\/v1\/[^/]+\/([^/]+)\/features$/);if(p&&t==="GET"){let u=p[1];if(!N("dataset",u,e.root))return c(404,"Not Found");let a=R("dsfeature",e.root).filter(d=>d.datasetId===u).map(d=>d.feature);return m({type:"FeatureCollection",features:a})}let g=o.match(/^\/datasets\/v1\/[^/]+\/([^/]+)\/features\/([^/]+)$/);if(g){let u=g[1],a=g[2],d=`dsf_${u}_${a}`;if(t==="PUT"){let f=i();if(f)return f;if(!N("dataset",u,e.root))return c(404,"Not Found");let b=E(e.body);if(!b.geometry||typeof b.geometry!="object")return c(422,"A GeoJSON Feature with a geometry is required.");let M={type:"Feature",id:a,geometry:b.geometry,properties:b.properties??{}};return await A(e,"dsfeature.upsert","dsfeature",d,{id:d,datasetId:u,featureId:a,feature:M}),m(M)}if(t==="GET"){let f=N("dsfeature",d,e.root);return f?m(f.feature):c(404,"Not Found")}if(t==="DELETE"){let f=i();return f||(N("dsfeature",d,e.root)?(await z(e,"dsfeature.delete","dsfeature",d),{status:204,body:null}):c(404,"Not Found"))}}if(o===`/styles/v1/${$}`){if(t==="GET")return m(j("style",e.root));if(t==="POST"){let u=i();if(u)return u;let a=E(e.body),d=`style_${h(`${a.name??""}:${R("style",e.root).length}:${r}`)}`,f=await A(e,"style.create","style",d,{id:d,owner:$,version:a.version??8,name:a.name??null,metadata:a.metadata??{},sources:a.sources??{},layers:a.layers??[],created:r,modified:r,visibility:a.visibility??"private",draft:!1,protected:!1});return{status:201,body:P(f)}}}let w=o.match(/^\/styles\/v1\/[^/]+\/([^/]+)$/);if(w){let u=w[1],a=N("style",u,e.root);if(t==="GET")return a?m(P(a)):c(404,"Style not found");if(t==="PATCH"){let d=i();if(d)return d;if(!a)return c(404,"Style not found");let f=E(e.body),b=await A(e,"style.update","style",u,{...f.name!==void 0?{name:f.name}:{},...f.layers!==void 0?{layers:f.layers}:{},...f.sources!==void 0?{sources:f.sources}:{},...f.metadata!==void 0?{metadata:f.metadata}:{},modified:r});return m(P(b))}if(t==="DELETE"){let d=i();return d||(a?(await z(e,"style.delete","style",u),{status:204,body:null}):c(404,"Style not found"))}}if(o===`/scopes/v1/${$}`&&t==="GET")return m([{id:"styles:read",description:"Read styles"},{id:"styles:write",description:"Create/modify styles"},{id:"datasets:read",description:"Read datasets"},{id:"datasets:write",description:"Create/modify datasets"},{id:"tokens:read",description:"Read tokens"},{id:"tokens:write",description:"Create/modify tokens"}]);if(o===`/tokens/v2/${$}`){if(t==="GET")return m(j("token",e.root));if(t==="POST"){let u=i();if(u)return u;let a=E(e.body);if(!Array.isArray(a.scopes))return c(422,"scopes must be an array.");let d=h(`${a.note??""}:${R("token",e.root).length}:${r}`),f=`tok_${d}`,b=a.scopes.some(F=>F.includes(":write")||F.includes(":list"))?"sk":"pk",M=await A(e,"token.create","token",f,{note:a.note??null,usage:b,scopes:a.scopes,token:`${b}.${d}.${h(d).slice(0,12)}`,created:r,modified:r,client:"api",default:!1,allowedUrls:a.allowedUrls??[]});return{status:201,body:P(M)}}}let y=o.match(/^\/tokens\/v2\/[^/]+\/([^/]+)$/);if(y){let u=y[1],a=N("token",u,e.root);if(t==="PATCH"){let d=i();if(d)return d;if(!a)return c(404,"Not Found");let f=E(e.body),b=await A(e,"token.update","token",u,{...f.note!==void 0?{note:f.note}:{},...f.scopes!==void 0?{scopes:f.scopes}:{},modified:r});return m(P(b))}if(t==="DELETE"){let d=i();return d||(a?(await z(e,"token.delete","token",u),{status:204,body:null}):c(404,"Not Found"))}}if(o==="/tilesets/v1"&&t==="GET")return m(j("tileset",e.root));let _=o.match(/^\/tilesets\/v1\/([^/]+)$/);if(_){let u=_[1],a=N("tileset",u,e.root);if(t==="POST"){let d=i();if(d)return d;let f=E(e.body);if(!f.recipe||!f.name)return c(422,"recipe and name are required to create a tileset.");let b=await A(e,"tileset.create","tileset",u,{id:u,type:"vector",name:f.name,description:f.description??"",recipe:f.recipe,created:r,modified:r,status:"queued",visibility:"private"});return m({message:`Successfully created empty tileset ${u}.`,tileset:P(b)})}if(t==="DELETE"){let d=i();return d||(a?(await z(e,"tileset.delete","tileset",u),{status:200,body:{message:`Tileset ${u} deleted.`}}):c(404,"Not Found"))}}if(o===`/uploads/v1/${$}/credentials`&&t==="POST"){let u=i();if(u)return u;let a=`_pending/${$}/${h(r)}`;return m({bucket:"tilestream-tilesets-production",key:a,accessKeyId:`ASIA${h(a).slice(0,12).toUpperCase()}`,secretAccessKey:h(`secret:${a}`),sessionToken:h(`session:${a}`),url:`https://tilestream-tilesets-production.s3.amazonaws.com/${a}`})}if(o===`/uploads/v1/${$}`){if(t==="GET")return m(j("upload",e.root));if(t==="POST"){let u=i();if(u)return u;let a=E(e.body);if(!a.tileset||!a.url)return c(422,"tileset and url are required to create an upload.");let d=h(`${a.tileset}:${R("upload",e.root).length}:${r}`),f=await A(e,"upload.create","upload",`up_${d}`,{tileset:a.tileset,name:a.name??null,owner:$,complete:!1,error:null,created:r,modified:r,progress:0});return{status:201,body:P(f)}}}let C=o.match(/^\/uploads\/v1\/[^/]+\/([^/]+)$/);if(C&&C[1]!=="credentials"){let u=C[1],a=N("upload",u,e.root);if(t==="GET")return a?m(P(a)):c(404,"Not Found");if(t==="DELETE"){let d=i();return d||(a?(await z(e,"upload.delete","upload",u),{status:204,body:null}):c(404,"Not Found"))}}return c(404,`Not Found: ${t} ${o}`)}import{serveHttp as et}from"../../engine/v2/volter_world-core.mjs";import{worldNow as Ge,statefulTwinManifest as ze}from"../../engine/v2/volter_world-core.mjs";function ie(e={}){return async function(n){let o=new URL(n.url);if(n.method==="GET"&&o.pathname.replace(/\/+$/,"")==="/twin")return Response.json(ze({vendor:"mapbox",twinOf:"the Mapbox API",stores:"deterministic geocoding/directions answers in GeoJSON FeatureCollection shapes"}));let s=n.method==="GET"?"":await n.text(),r={};n.headers.forEach((l,p)=>{r[p]=l});let i=await q({method:n.method,path:o.pathname+o.search,body:s,readOnly:e.readOnly??!1,occurredAt:Ge(),headers:r,...e.root!==void 0?{root:e.root}:{}});return new Response(JSON.stringify(i.body),{status:i.status,headers:{"content-type":"application/json"}})}}import{confirmAction as lt,pendingActions as ft,syncPull as mt}from"../../engine/v2/volter_world-core.mjs";import{declareRateBudget as De,rateBudgetPath as st,rateBudgetWeight as at,RateBudget as it}from"../../engine/v2/volter_world-core.mjs";import{RateBudgetError as le}from"../../engine/v2/volter_world-core.mjs";var Xe="mapbox",ce=6e4,de=200,ue=300,H={geocodeRead:1,styleRead:1,styleWrite:5,other:2},ee={windowMs:ce,ceiling:de,defaultWeight:H.other,maxRetryAfterSeconds:ue,rules:[{match:"^(POST|PATCH|PUT|DELETE) /styles/v1/",weight:H.styleWrite},{match:"^GET /search/geocode/",weight:H.geocodeRead},{match:"^GET /styles/v1/",weight:H.styleRead}],reason:"Mapbox documents a default Geocoding API limit of 1,000 requests/minute and, for the Styles API, a read limit of 2,000/minute with a WRITE limit of 50/minute (429 over either). 200 weighted units / 60s prices reads at 1, so the ceiling is 20% of the geocoding limit and 10% of the styles read limit; a styles WRITE costs 5, capping writes at 40/minute \u2014 80% of the vendor's own 50/minute write limit, which pricing a write like a read would have exceeded fourfold."};De(Xe,ee);export{ie as createTwinFetch};
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,7 @@
1
+ @agenttwin/twin-merge
2
+
3
+ Contains @volter/twin-merge 1.0.2 by Volter (https://github.com/volter-ai),
4
+ licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ Modified by AgentTwin: bundled and minified into one file; only code reachable from the pack's
7
+ fetch factory is included; shared modules are imported from the AgentTwin twin engine.