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,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-veriff
2
+
3
+ Contains @volter/twin-veriff 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{createHash as Ie}from"node:crypto";import{applyTwinWrite as be,projectResources as Q}from"../../engine/v2/volter_world-core.mjs";import{nodeBuiltin as ve}from"../../engine/v2/volter_world-core.mjs";function $(){return ve("node:crypto")}var y="x-auth-client",g="x-hmac-signature";function b(e,t){return $().createHmac("sha256",t).update(e,"utf8").digest("hex")}function L(e,t){return $().createHmac("sha256",t).update(e).digest("hex")}function Y(e,t){let n=Buffer.from(e,"utf8"),i=Buffer.from(t,"utf8");return n.length!==i.length?!1:$().timingSafeEqual(Uint8Array.from(n),Uint8Array.from(i))}function C(e,t,n){return t==null||t===""?"missing":Y(b(e,n),t)?null:"mismatch"}function H(e,t){let n=JSON.stringify(e);return{body:n,headers:{"content-type":"application/json",[y]:t.apiKey,[g]:b(n,t.sharedSecret)}}}var M="veriff",D="11111111-2222-4333-8444-555555555555",_="abcdef12-abcd-abcd-abcd-abcdef012345",z="https://alchemy.veriff.com",we="https://stationapi.veriff.com";function h(e,t=200){return{status:t,body:{status:"success",...e}}}function d(e,t,n){return{status:t,body:{status:"fail",code:n,message:e}}}var v={1302:"Only HTTPS return URLs are allowed.",1401:"Image is not in valid `base64`.",1402:"Image context is not supported.",1500:"`vendorData` field cannot be more than 1000 symbols. We require only non-semantic data to be submitted (UUID-s etc., that can not be resolved or used outside the customer's domain)",1501:"`vendorData` must be a string. We require only non-semantic data to be submitted (UUID-s etc., that can not be resolved or used outside the customer's domain)"},a={generic:"1101",invalidHmac:"1812",notCompleted:"1305",inProgress:"1306",badTransition:"1304",invalidBase64:"1401",unsupportedContext:"1402",httpsOnlyCallback:"1302",vendorDataLength:"1500",vendorDataType:"1501"};function R(e,t){return d("Resource not found",404,a.generic)}var W=["approved","declined","resubmission_requested","review","expired","abandoned"],ee=new Set(W),te={approved:9001,declined:9102,resubmission_requested:9103,expired:9104,abandoned:9121,review:null},ne={started:7001,submitted:7002},A="submitted",Ae=new Set(["created","started","approved","declined","resubmission_requested","expired","abandoned"]),Re={created:new Set(["started","submitted","expired","abandoned"]),started:new Set(["submitted","expired","abandoned"]),submitted:new Set([...W]),resubmission_requested:new Set(["started","submitted","expired","abandoned"])};function G(e,t){return Re[e]?.has(t)??!1}function k(e,t){return Q(M,t).filter(n=>n.type===e).filter(n=>n.deleted!==!0)}function T(e,t,n){return k(e,n).find(i=>i.id===t)}async function I(e,t,n,i,s){await be(M,{operation:`set.${e}`,subjectType:e,subjectId:t,fields:n,...s?{occurredAt:s}:{},actor:{kind:"agent"}},i)}function ie(e){let{type:t,updatedAt:n,id:i,deleted:s,...r}=e;return r}function X(e){if(e===void 0||e==="")return{};try{let t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function x(e,t){let n=new Set(Q(M,t.root).filter(i=>i.type===e).map(i=>i.id));for(let i=0;;i+=1){let s=Ie("sha256").update(`${e}:${t.occurredAt??""}:${n.size}:${i}`).digest("hex"),r=`${s.slice(0,8)}-${s.slice(8,12)}-4${s.slice(13,16)}-${(parseInt(s[16],16)&3|8).toString(16)}${s.slice(17,20)}-${s.slice(20,32)}`;if(!n.has(r))return r}}function O(e){return{status:e.status,id:e.sessionId,url:e.url,sessionToken:e.sessionToken,host:e.host,endUserId:e.endUserId??null,vendorData:e.vendorData??null}}function B(e){return{id:e.sessionId,attemptId:e.decisionAttemptId??null,vendorData:e.vendorData??null,endUserId:e.endUserId??null,status:e.status,code:e.decisionCode??null,reason:e.decisionReason??null,reasonCode:e.decisionReasonCode??null,decisionTime:e.decisionTime??null,acceptanceTime:e.acceptanceTime??null,submissionTime:e.submissionTime??null,person:e.decidedPerson??null,document:e.decidedDocument??null,additionalVerifiedData:e.additionalVerifiedData??null,riskLabels:e.riskLabels??null,comments:e.comments??[]}}function F(e){let{mediaId:t,kind:n,content:i,...s}=ie(e);return{id:t,...s}}function De(e){return{id:e.attemptId,status:e.status,userDefinedData:e.userDefinedData??[],createdTime:e.createdTime??null}}function _e(e,t){return!(e==="POST"&&t.length===1&&t[0]==="sessions")}function Ve(e,t,n){return e!=="GET"&&e!=="DELETE"?n:t[1]??""}async function j(e){let{method:t,root:n,occurredAt:i}=e,s=e.readOnly??!1,r=e.sharedSecret??_,c=e.apiKey??D,o=e.body??"",f;try{f=new URL(e.path,"http://twin.local")}catch{return d("Validation failed",400,a.generic)}let u=f.pathname.replace(/^\/v1(\/|$)/,"/").replace(/^\/+|\/+$/g,"").split("/").filter(Boolean),p={};for(let[l,E]of Object.entries(e.headers??{}))E!==void 0&&(p[l.toLowerCase()]=E);let m={root:n,occurredAt:i,apiKey:c,sharedSecret:r};if(u[0]==="_twin"){if(s&&t!=="GET")return d("this twin was started read-only; omit readOnly to accept writes",405,a.generic);let l=X(o);return l===null?d("Validation failed",400,a.generic):Le(e,u,l,m)}if(!p[y])return d("Mandatory X-AUTH-CLIENT header containing the API key is missing from the request.",401,a.generic);if(_e(t,u)&&C(Ve(t,u,o),p[g],r)!==null)return d("Invalid HMAC signature",401,a.invalidHmac);if(s&&(t!=="GET"&&t!=="HEAD"))return d("this twin was started read-only; omit readOnly to accept writes",405,a.generic);let S=X(o);if(S===null)return d("Validation failed",400,a.generic);if(u[0]==="sessions"){if(t==="POST"&&u.length===1)return Fe(S,m);if(u.length>=2&&u.length<=3){let l=u[1],E=T("session",l,n);if(!E)return d("Resource not found",404,a.generic);if(u.length===2)return t==="PATCH"?ke(E,S,m):t==="DELETE"?xe(E,m):R(t,e.path);let V=u[2];if(t==="GET"&&V==="decision")return Ne(E);if(t==="GET"&&V==="person")return h({person:E.decidedPerson??null});if(t==="GET"&&V==="attempts"){let U=k("attempt",n).filter(P=>P.sessionId===l).sort((P,ye)=>String(ye.createdTime??"").localeCompare(String(P.createdTime??""))).map(De);return h({verifications:U})}if(V==="media"){if(t==="GET")return Z(U=>U.sessionId===l,n);if(t==="POST")return $e(E,S,m)}return R(t,e.path)}return R(t,e.path)}if(u[0]==="attempts"&&u.length===3&&u[2]==="media"&&t==="GET"){let l=u[1];return T("attempt",l,n)?Z(E=>E.attemptId===l,n):d("Resource not found",404,a.generic)}if(u[0]==="media"&&u.length===2&&t==="GET"){let l=T("media",u[1],n);return l?{status:200,body:{mimetype:l.mimetype,content:l.content}}:d("Resource not found",404,a.generic)}return R(t,e.path)}var Ce=1e3;async function Fe(e,t){let n=e.verification;if(n==null||typeof n!="object"||Array.isArray(n))return d("Validation failed",400,a.generic);let i=n;if(i.vendorData!==void 0&&i.vendorData!==null){if(typeof i.vendorData!="string")return d(v[1501],400,a.vendorDataType);if(i.vendorData.length>Ce)return d(v[1500],400,a.vendorDataLength)}if(i.callback!==void 0&&i.callback!==null){if(typeof i.callback!="string")return d("Validation failed",400,a.generic);let o;try{o=new URL(i.callback)}catch{return d(v[1302],400,a.httpsOnlyCallback)}if(o.protocol!=="https:")return d(v[1302],400,a.httpsOnlyCallback)}let s=x("session",t),r=Oe(s);await I("session",s,{sessionId:s,status:"created",url:`${z}/v/${r}`,host:z,sessionToken:r,vendorData:i.vendorData??null,endUserId:i.endUserId??null,callback:i.callback??null,tag:i.tag??null,hintPerson:i.person??null,hintDocument:i.document??null,createdTime:t.occurredAt??null},t.root,t.occurredAt);let c=T("session",s,t.root);return h({verification:O(c)},201)}function Oe(e){let t=n=>Buffer.from(JSON.stringify(n)).toString("base64url");return`${t({alg:"HS256",typ:"JWT"})}.${t({session_id:e})}.${Buffer.from(e).toString("base64url")}`}async function ke(e,t,n){let s=(t.verification??{}).status;if(typeof s!="string"||s!==A)return d("Validation failed",400,a.generic);let r=String(e.status);if(r===A)return d("Session has already been submitted",400,a.generic);if(!G(r,A))return d(`Cannot transition to "${A}" status.`,400,a.badTransition);await I("session",String(e.sessionId),{status:A,submissionTime:n.occurredAt??null},n.root,n.occurredAt);let c=T("session",String(e.sessionId),n.root);return await re(c,"submitted",n),h({verification:O(c)})}async function xe(e,t){let n=String(e.status);return Ae.has(n)?(await I("session",String(e.sessionId),{deleted:!0},t.root,t.occurredAt),h({verification:{id:e.sessionId}})):n==="submitted"?d("Session in progress.",400,a.inProgress):d("Session is not in a completed status.",400,a.notCompleted)}function Ne(e){return ee.has(String(e.status))?h({verification:B(e)}):h({verification:null})}function Z(e,t){let n=k("media",t).filter(e);return h({images:n.filter(i=>i.kind==="image").map(F),videos:n.filter(i=>i.kind==="video").map(F),nfcDocuments:n.filter(i=>i.kind==="nfc").map(F)})}var Ue=new Set(["address-front","document-and-face","document-and-face-pre","document-back","document-back-barcode","document-back-barcode-pre","document-back-pre","document-back-qrcode","document-back-qrcode-pre","document-front","document-front-face-cropped","document-front-pre","document-front-qrcode","document-front-qrcode-pre","face","face-cropped","face-nfc","face-pre","face-reference","registry-face"]),Pe=/^data:([\w.+-]+\/[\w.+-]+);base64,(.*)$/s;async function $e(e,t,n){let i=t.image;if(i==null||typeof i!="object"||Array.isArray(i))return d("Validation failed",400,a.generic);let s=i;if(typeof s.context!="string"||!Ue.has(s.context))return d(v[1402],400,a.unsupportedContext);if(typeof s.content!="string"||s.content==="")return d(v[1401],400,a.invalidBase64);let r=Pe.exec(s.content),c=r?.[1]??"image/jpeg",o=r?.[2]??s.content;if(!/^[A-Za-z0-9+/]*={0,2}$/.test(o)||o.length===0)return d(v[1401],400,a.invalidBase64);if(String(e.status)!=="created"&&String(e.status)!=="started"&&String(e.status)!=="resubmission_requested")return d("Session has already been submitted",409,a.generic);let f=x("media",n);return await I("media",f,{mediaId:f,sessionId:e.sessionId,attemptId:e.currentAttemptId??null,kind:"image",name:s.context,context:s.context,timestamp:null,size:Buffer.from(o,"base64").length,mimetype:c,content:o,url:`${we}/v1/media/${f}`},n.root,n.occurredAt),h({image:F(T("media",f,n.root))})}async function se(e,t,n,i){let s=e.callback;if(typeof s!="string"||s==="")return;let r=H(t,{apiKey:i.apiKey??D,sharedSecret:i.sharedSecret??_}),c=x("delivery",i);await I("delivery",c,{deliveryId:c,sessionId:e.sessionId,kind:n,url:s,body:r.body,headers:r.headers},i.root,i.occurredAt)}async function re(e,t,n){let i={id:String(e.sessionId),attemptId:String(e.currentAttemptId??e.sessionId),feature:"selfid",code:ne[t],action:t,vendorData:e.vendorData??null};await se(e,i,"event",n)}async function Le(e,t,n,i){let{method:s}=e;if(s==="POST"&&t[1]==="sessions"&&t[3]==="decision"&&t.length===4){let r=t[2],c=T("session",r,i.root);if(!c)return d("Resource not found",404,a.generic);let o=n.status;if(typeof o!="string"||!ee.has(o))return d("Validation failed",400,a.generic);let f=String(c.status);if(!G(f,o))return d(`Cannot transition to "${o}" status.`,400,a.badTransition);let u=x("attempt",i),p=i.occurredAt??null;await I("attempt",u,{attemptId:u,sessionId:r,status:o,userDefinedData:n.userDefinedData??[],createdTime:p},i.root,i.occurredAt),await I("session",r,{status:o,decisionCode:te[o],decisionAttemptId:u,currentAttemptId:u,decisionTime:p,acceptanceTime:p,decisionReason:n.reason??null,decisionReasonCode:n.reasonCode??null,...n.person!==void 0?{decidedPerson:n.person}:{},...n.document!==void 0?{decidedDocument:n.document}:{},...n.riskLabels!==void 0?{riskLabels:n.riskLabels}:{},...n.additionalVerifiedData!==void 0?{additionalVerifiedData:n.additionalVerifiedData}:{}},i.root,i.occurredAt);let m=T("session",r,i.root),w={status:"success",verification:B(m)};return await se(m,w,"decision",i),h({verification:B(m)})}if(s==="POST"&&t[1]==="sessions"&&t[3]==="event"&&t.length===4){let r=T("session",t[2],i.root);if(!r)return d("Resource not found",404,a.generic);if(n.action!=="started")return d("Validation failed",400,a.generic);if(!G(String(r.status),"started"))return d('Cannot transition to "started" status.',400,a.badTransition);await I("session",String(r.sessionId),{status:"started"},i.root,i.occurredAt);let o=T("session",String(r.sessionId),i.root);return await re(o,"started",i),h({verification:O(o)})}if(s==="GET"&&t[1]==="sessions"&&t.length===3){let r=T("session",t[2],i.root);return r?h({verification:O(r)}):d("Resource not found",404,a.generic)}if(s==="GET"&&t[1]==="deliveries"&&t.length===2){let r=new URL(e.path,"http://twin.local").searchParams.get("sessionId"),c=k("delivery",i.root).filter(o=>r===null||o.sessionId===r).map(o=>ie(o));return h({deliveries:c})}return R(s,e.path)}import{serveHttp as mt}from"../../engine/v2/volter_world-core.mjs";import{worldNow as He,statefulTwinManifest as Ge}from"../../engine/v2/volter_world-core.mjs";function oe(e,t){return{"content-type":"application/json",[y]:t.apiKey,[g]:b(e,t.sharedSecret)}}function Be(e,t){if(!/^\/(v1\/)?media\/[^/]+$/.test(e.split("?")[0]??""))return!1;let n=t;return typeof n?.mimetype=="string"&&typeof n?.content=="string"}function ae(e={}){let t=e.readOnly??!1,n=e.sharedSecret??_,i=e.apiKey??D;return async function(r){let c=new URL(r.url);if(r.method==="GET"&&c.pathname.replace(/\/+$/,"")==="/twin")return Response.json(Ge({vendor:"veriff",twinOf:"Veriff's Station API v1",stores:"verification sessions and their decision lifecycle"}));let o=r.method==="GET"||r.method==="HEAD"?"":await r.text(),f={};r.headers.forEach((S,l)=>{f[l.toLowerCase()]=S});let u=c.pathname+(c.search||""),{status:p,body:m}=await j({method:r.method,path:u,body:o,headers:f,readOnly:t,sharedSecret:n,apiKey:i,occurredAt:He(),...e.root!==void 0?{root:e.root}:{}});if(p===200&&Be(u,m)){let S=new Uint8Array(Buffer.from(m.content,"base64"));return new Response(S,{status:p,headers:{"content-type":m.mimetype,[y]:i,[g]:L(S,n)}})}let w=JSON.stringify(m);return new Response(w,{status:p,headers:oe(w,{apiKey:i,sharedSecret:n})})}}import{assertBudgetGuardIntact as At,confirmAction as Rt,deployableEntries as Dt,observeResources as Ke,ownFields as qe,twinResources as Ye}from"../../engine/v2/volter_world-core.mjs";import{declareRateBudget as Me,rateBudgetPath as St,rateBudgetWeight as yt,RateBudget as vt}from"../../engine/v2/volter_world-core.mjs";import{RateBudgetError as fe}from"../../engine/v2/volter_world-core.mjs";var We="veriff",de=6e4,ce=60,ue=300,J={deleteSession:12,other:2},N={windowMs:de,ceiling:ce,defaultWeight:J.other,maxRetryAfterSeconds:ue,rules:[{match:"^DELETE /sessions/",weight:J.deleteSession}],reason:`Veriff publishes two scalar limits, neither of them in the API reference (both read 2026-08-20). devdocs.veriff.com/docs/general-faq: "Enterprise customer: 600 sessions per minute", "Self-Serve customer: 30 sessions per minute". devdocs.veriff.com/apidocs/v1sessionsid-3 (DELETE /v1/sessions/{id}): "This endpoint is rate limited: 10 sessions per 24 hours and 5 sessions per 1 hour". The ceiling is pinned to the SELF-SERVE tier \u2014 60 weighted units / 60s at defaultWeight 2 = 30 calls a minute, exactly that documented cap \u2014 because a pack cannot know which contract the credential in front of it is on, and the enterprise number is not a floor anyone is entitled to. That is also identical to the kernel's undeclared fallback, so this declaration buys weighting, not permission. Veriff publishes NO limit for the read endpoints (decision polling, attempts, media), so those are not widened on the strength of an absence. DELETE costs 12 so one window admits 5 rather than 30 \u2014 a JUDGEMENT CALL, not a published cost: the real cap is 5/hour and 10/day, which a 60-second rolling window structurally cannot enforce, so staying under it remains the caller's responsibility and the weight only stops a delete LOOP inside the first window. Veriff documents its 429 body ({"status":"fail","code":"1004","message":"Too many requests."}) but NO Retry-After and NO X-RateLimit-* response headers anywhere in the published reference; the kernel reads those names if present and never assumes them, and a bare 429 still arms the cooldown.`};Me(We,N);var K="veriff",ze=new Set(["delivery","attempt","media"]);function q(e,t,n){return e!=="GET"&&e!=="DELETE"?n??"":t.replace(/^\/+/,"").split("/")[1]??""}function le(e){return{type:"session",id:String(e.id),fields:{sessionId:e.id,status:e.status,decisionCode:e.code??null,decisionAttemptId:e.attemptId??null,decisionTime:e.decisionTime??null,acceptanceTime:e.acceptanceTime??null,submissionTime:e.submissionTime??null,decisionReason:e.reason??null,decisionReasonCode:e.reasonCode??null,decidedPerson:e.person??null,decidedDocument:e.document??null,riskLabels:e.riskLabels??null,vendorData:e.vendorData??null,endUserId:e.endUserId??null}}}function me(e,t){return{type:"attempt",id:String(t.id),fields:{attemptId:t.id,sessionId:e,status:t.status,userDefinedData:t.userDefinedData??[],createdTime:t.createdTime??null}}}function pe(e,t,n){return{type:"media",id:String(t.id),fields:{mediaId:t.id,sessionId:e,attemptId:t.attemptId??null,kind:n,name:t.name??null,context:t.context??null,timestamp:t.timestamp??null,size:t.size??null,mimetype:t.mimetype??null,url:t.url??null}}}var Xe="2026-08-01T00:00:00.000Z";async function Ze(e,t){let n=[];for(let i of t){let r=(await e("GET",`/sessions/${i}/decision`)).verification;r&&r.id&&n.push(le(r))}return n}async function Qe(e,t){let n=[];for(let i of t){let s=await e("GET",`/sessions/${i}/attempts`),r=Array.isArray(s.verifications)?s.verifications:[];for(let c of r)c?.id&&n.push(me(i,c))}return n}async function et(e,t){let n=[];for(let i of t){let s=await e("GET",`/sessions/${i}/media`);for(let[r,c]of[["images","image"],["videos","video"],["nfcDocuments","nfc"]]){let o=Array.isArray(s[r])?s[r]:[];for(let f of o)f?.id&&n.push(pe(i,f,c))}}return n}async function he(e,t={}){let n=t.occurredAt??Xe,i=t.sessionIds??[],s=await Ze(e,i),r=await Qe(e,i),c=await et(e,i),o=[...s,...r,...c],f=Ke(K,o,{...t.root!==void 0?{root:t.root}:{},at:n,batch:`obs:${K}:${n}`});return{observed:o.length,deltasAppended:f.appended}}function Ee(e){if(ze.has(e.subject.type)||e.subject.type!=="session")return null;let t=e.fields??{},n=t.status;if(n==="submitted")return{method:"PATCH",path:`/sessions/${String(t.sessionId??e.subject.id)}`,body:{verification:{status:"submitted"}}};if(t.deleted===!0)return{method:"DELETE",path:`/sessions/${String(t.sessionId??e.subject.id)}`};if(n==="created"){let i={};return t.vendorData!=null&&(i.vendorData=t.vendorData),t.endUserId!=null&&(i.endUserId=t.endUserId),t.callback!=null&&(i.callback=t.callback),t.hintPerson!=null&&(i.person=t.hintPerson),t.hintDocument!=null&&(i.document=t.hintDocument),{method:"POST",path:"/sessions",body:{verification:i}}}return null}function ge(e){return async(t,n,i)=>{let s=await e({method:t,path:n.startsWith("/v1/")?n:`/v1${n}`,headers:{accept:"application/json","content-type":"application/json","x-auth-client":"twin"},...i===void 0?{}:{body:JSON.stringify(i)}});try{return JSON.parse(s.body||"{}")}catch{return{status:s.status<300?"success":"fail"}}}}async function Te(e,t={}){let n=[];for(let i of Ye(K,t.root)){if(i.type!=="session")continue;let s=qe(i),r=typeof s.sessionId=="string"?s.sessionId:i.id;r&&n.push(r)}return he(ge(e),{sessionIds:[...new Set([...n,...t.sessionIds??[]])].sort(),...t.root!==void 0?{root:t.root}:{},occurredAt:t.occurredAt??new Date().toISOString()})}async function Se(e,t,n){let i=ge(e),s=Ee(t);if(!s){let p=t.operation??`${t.subject.type}.update`;return{externalId:t.subject.id,data:{performed:!1,reason:`${p} is authored by Veriff, never by a client \u2014 there is no endpoint to push it to`}}}let r=n.resolve(t.subject.type,t.subject.id),c=s.path.replace(/\/sessions\/[^/]+/,`/sessions/${encodeURIComponent(r)}`),o=await i(s.method,c,s.body);if(o.status!=="success")throw new Error(`veriff ${s.method} ${c} refused: ${String(o.status??"no status")} ${String(o.message??"")}`.trim());let f=o.verification??{};return{externalId:typeof f.id=="string"?f.id:r,data:o}}import{registerPack as tt}from"../../engine/v2/volter_world-core.mjs";var nt={protocol:"2",refresh:{every:"5m",webhook:!0,onDemand:{atMost:"30s"}},stateSystem:{perform:Se,refresh:Te},roundTrip:{method:"POST",path:"/v1/sessions",body:{verification:{vendorData:"round-trip"}},headers:{"x-auth-client":"round-trip"}},auth:{in:"signature",algorithm:"hmac-sha256",encoding:"hex",header:g,canonical:({method:e,path:t,body:n})=>{let i=t.replace(/^\/v1(?=\/|$)/,"");return e==="POST"&&i==="/sessions"?null:q(e,i,n)}},parityOrigin:"http://twin",vendor:"veriff",rateBudget:N,transport:"rest",archetype:"crud",bin:"world-veriff",resources:["session","attempt","media","delivery"],specSource:"docs.veriff.com / devdocs.veriff.com (hand-authored from the published Station API reference), cross-checked against the real consumer dub (apps/web/lib/veriff/*, app/api/veriff/webhook/*)",description:"Veriff Station API twin \u2014 sessions, the created\u2192submitted\u2192approved/declined decision lifecycle, HMAC-signed request auth and decision/event webhooks, attempts and media. Watchlist/AML screening is a filed todo area, deliberately unmodeled.",adoption:{pypi:[],sdks:["@veriff/js-sdk"],scopes:["@veriff/"],envStems:["VERIFF"]},hosts:[{host:"stationapi.veriff.com"},{host:"api.veriff.me"}],browserRouting:{apiPathPrefix:"/v1/",loaderHost:"https://stationapi.veriff.com"}};tt(nt);export{ae 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-vgauth
2
+
3
+ Contains @volter/twin-vgauth 1.0.0 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
+ var se=Object.defineProperty;var ce=(e,t)=>{for(var n in t)se(e,n,{get:t[n],enumerable:!0})};import{packOf as ke,registerPack as ve}from"../../engine/v3/volter_world-core.mjs";var de={initial:"free",transitions:[]},T={Account:{state:{"plan.status":de},notState:["authenticated","backend","spendPolicy.overageEnabled","entitlements.generation"]}};var P={vendor:"vgauth",service:"vgauth",body:{},spanning:["path"],ids:{template:"{uuid}"},time:"unix-ms",answerHeaders:{"Cache-Control":"no-store","Referrer-Policy":"no-referrer","Strict-Transport-Security":"max-age=31536000; includeSubDomains","X-Content-Type-Options":"nosniff"},error:{error:"{message}"},gap:{status:404,message:"Not found"},notFound:{status:404,message:"Not found"},readOnly:{status:403,message:"This twin was started read-only; writes are refused."},list:{style:"envelope",envelope:{data:"{data}"},limit:{param:"limit",default:20,max:100}},deleted:{},resources:{Account:{...T.Account,storedAs:"account",idPrefix:"",refresh:{get:"accountProjection",known:!0}},_settings:{idPrefix:""},_nonce:{idPrefix:""},_handoff:{idPrefix:""},_invitation_usage:{idPrefix:"",unique:[{fields:["host"],refusal:{status:409,message:"Invitation quota exists."}}]}},unmodeled:["internalAccountIdentity","verify","relayToken","relayGrant","relaySession"],vendorBacked:{none:"The served account snapshot is read through accountProjection under its bearer identity; its resource declares that refresh. Identity belongs to Clerk. Invitation quotas and opaque handoffs are private bookkeeping with no vendor read-back API."},discovery:{twinOf:"Volter\u2019s vgai-auth Cloudflare Worker at auth.videogame.ai: the native account PKCE broker, Clerk proxy, account projection, collaboration handoffs and the editor\u2019s source-defined refusals.",behavior:"The life and Editor recipe serve the source-shipped non-production Free/100 catalog (scripts/run-managed-services-dev.ts:71-73) on the service-bound account path; these are not production catalog values or its allowance.",stores:"operator settings, first-read managed account snapshots, opaque handoffs, nonce occurrences and invitation quotas; Clerk owns identities and sessions",identity:"A Clerk session JWT, verified through the World\u2019s Clerk JWKS. POST /_twin/configuration sets the Worker\u2019s provider and binding configuration; the deployed public client is vgai-editor."},doors:[{id:"configuration",method:"POST",path:"/_twin/configuration",note:"Worker provider settings: Clerk keys/API, callback and OAuth URLs; freePlan supplies an explicit deployment catalog entry (name and includedCredits); the life and Editor recipe use the source-shipped non-production Free/100 catalog, not production values; billingBound=false selects the separate no-binding branch. Client id stays vgai-editor; accounts are created by the first authenticated read, not this door."}],rateBudget:{reason:"No service-wide allowance in the pinned Worker source; conservative fallback.",windowMs:6e4,ceiling:30,defaultWeight:1,maxRetryAfterSeconds:60},descriptor:{protocol:"3",transport:"rest",archetype:"proxy",bin:"world-vgauth",resources:["Account"],specSource:"spec/openapi.json, written from volter-ai/vgai-engine 8623e308 packages/vgai-auth/src/worker.ts (spec/SOURCE.md)",description:"Volter managed account OAuth broker and collaboration authority at auth.videogame.ai, with Clerk as its upstream identity provider.",adoption:{sdks:[],envStems:[]},hosts:[{host:"auth.videogame.ai"}],endpointEnv:{name:"VOLTER_ACCOUNT_URL",note:"Volter Editor managed-account-defaults.ts derives VOLTER_OAUTH_ISSUER_URL and VOLTER_AUTH_URL from this URL."},credentialDoor:{path:"/_twin/configuration",body:{},fill:{}}}};var U={generatedBy:"scripts/derive-pack.ts",spec:"openapi.json",format:"openapi",version:"8623e308",resources:[{name:"Account",schema:"Account",fields:[{name:"alerts",type:"array",nullable:!1},{name:"authenticated",type:"boolean",nullable:!1,required:!0},{name:"backend",type:"string",nullable:!1,required:!0},{name:"credits",type:"object",nullable:!1,required:!0},{name:"entitlements",type:"object",nullable:!1,required:!0},{name:"organizations",type:"array",nullable:!1,required:!0},{name:"plan",type:"object",nullable:!1,required:!0},{name:"spendPolicy",type:"object",nullable:!1,required:!0},{name:"user",type:"object",nullable:!1,required:!0}],stateCandidates:[],expandable:[]}],operations:[{id:"clerkFrontendApiProxy",method:"get",path:"/__clerk/{path}",pathParams:["path"],query:[],body:[{name:"body",type:"blob",required:!1}],bodyEncoding:"none",successStatus:200,emptySuccess:!0,class:"computed",family:"proxy"},{id:"clerkFrontendApiProxyPost",method:"post",path:"/__clerk/{path}",pathParams:["path"],query:[],body:[{name:"body",type:"blob",required:!1}],bodyEncoding:"none",successStatus:200,emptySuccess:!0,class:"non-resource",family:"proxy"},{id:"clerkFrontendApiProxyPut",method:"put",path:"/__clerk/{path}",pathParams:["path"],query:[],body:[{name:"body",type:"blob",required:!1}],bodyEncoding:"none",successStatus:200,emptySuccess:!0,class:"non-resource",family:"proxy"},{id:"clerkFrontendApiProxyPatch",method:"patch",path:"/__clerk/{path}",pathParams:["path"],query:[],body:[{name:"body",type:"blob",required:!1}],bodyEncoding:"none",successStatus:200,emptySuccess:!0,class:"non-resource",family:"proxy"},{id:"clerkFrontendApiProxyDelete",method:"delete",path:"/__clerk/{path}",pathParams:["path"],query:[],body:[{name:"body",type:"blob",required:!1}],bodyEncoding:"none",successStatus:200,emptySuccess:!0,class:"delete",family:"proxy"},{id:"clerkFrontendApiProxyHead",method:"head",path:"/__clerk/{path}",pathParams:["path"],query:[],body:[{name:"body",type:"blob",required:!1}],bodyEncoding:"none",successStatus:200,emptySuccess:!0,class:"non-resource",family:"proxy"},{id:"clerkFrontendApiProxyOptions",method:"options",path:"/__clerk/{path}",pathParams:["path"],query:[],body:[{name:"body",type:"blob",required:!1}],bodyEncoding:"none",successStatus:200,emptySuccess:!0,class:"non-resource",family:"proxy"},{id:"clerkFrontendApiProxyTrace",method:"trace",path:"/__clerk/{path}",pathParams:["path"],query:[],body:[{name:"body",type:"blob",required:!1}],bodyEncoding:"none",successStatus:200,emptySuccess:!0,class:"non-resource",family:"proxy"},{id:"accountOAuthMetadata",method:"get",path:"/.well-known/oauth-authorization-server",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed",family:"discovery"},{id:"accountAuthorize",method:"get",path:"/account/authorize",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed",family:"account"},{id:"accountCallback",method:"get",path:"/account/callback",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed",family:"account"},{id:"accountToken",method:"post",path:"/account/token",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"non-resource",family:"account"},{id:"collaborationCallback",method:"get",path:"/collaboration/callback",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed",family:"collaboration"},{id:"collaborationHandoff",method:"post",path:"/collaboration/handoff",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:201,class:"non-resource",family:"collaboration"},{id:"collaborationInvitation",method:"post",path:"/collaboration/invitations",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:201,class:"non-resource",family:"collaboration"},{id:"collaborationRedeem",method:"post",path:"/collaboration/redeem",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"non-resource",family:"collaboration"},{id:"collaborationVerify",method:"get",path:"/collaboration/verify",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed",family:"collaboration"},{id:"inferenceGrant",method:"post",path:"/inference/grant",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"non-resource",family:"inference"},{id:"internalAccountIdentity",method:"get",path:"/internal/account-identity",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed",family:"other"},{id:"relayGrant",method:"post",path:"/relay/grant",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"non-resource",family:"other"},{id:"relaySession",method:"post",path:"/relay/session",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"non-resource",family:"other"},{id:"relayToken",method:"post",path:"/relay/token",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"non-resource",family:"other"},{id:"accountProjection",method:"get",path:"/v1/account",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,answers:{resource:"Account",list:!1},class:"retrieve",resource:"Account",family:"projection"},{id:"verify",method:"get",path:"/verify",pathParams:[],query:[],body:[],bodyEncoding:"none",successStatus:200,class:"computed",family:"other"}]};import{createPackFetch as be}from"../../engine/v3/volter_world-core.mjs";var f="https://auth.videogame.ai",y=e=>Date.parse(e.occurredAt),s=(e,t)=>Response.json({error:t},{status:e,headers:{"Cache-Control":"no-store"}}),A=e=>new Response(null,{status:302,headers:{Location:e,"Cache-Control":"no-store"}}),l=e=>({clerkApi:"",billingBound:!0,invitationRateLimit:!0,providerClientId:"akukThq5UTCOrmaO",authorizationEndpoint:`${f}/__clerk/oauth/authorize`,tokenEndpoint:"https://clerk.auth.videogame.ai/oauth/token",webCallback:"https://workspace.videogame.ai/auth/callback",...e.get("_settings","deployment")??{},clientId:"vgai-editor"}),C=e=>l(e).clerkApi||"https://api.clerk.com";async function _(e){let t=await e.create("_nonce",{},"handoff.nonce");return e.secret(`vgauth:nonce:${t.id}`)}async function v(e,t){let n=e.crypto.base62From(await _(e),64);return await e.record("_handoff",{payload:t},e.crypto.sha256(n)),n}async function w(e,t){return typeof t!="string"?null:e.get("_handoff",e.crypto.sha256(t))?.payload??null}var I=(e,t)=>e.crypto.digest("sha256",t,"base64url"),q=(e,t=512)=>typeof e=="string"&&e.length>0&&e.length<=t&&!/[\x00-\x1f\x7f]/.test(e),h=e=>typeof e=="string"&&/^[A-Za-z0-9._:-]{1,200}$/.test(e);function x(e,t){if(typeof t!="string"||t.length>2048)return null;try{let n=new URL(t);if(n.username||n.password||n.search||n.hash)return null;let r=n.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(n.hostname)&&n.pathname==="/__editor/account/browser-authorization/callback",o=n.protocol==="https:"&&l(e).webCallback&&n.toString()===new URL(l(e).webCallback).toString();return r||o?n.toString():null}catch{return null}}function S(e){if(typeof e!="string"||e.length>2048)return null;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname==="/__vgai_share/callback"&&/(?:^|\.)(?:ngrok(?:-free)?\.(?:app|dev)|trycloudflare\.com)$/i.test(t.hostname)&&!t.username&&!t.password&&!t.search&&!t.hash?t.toString():null}catch{return null}}async function g(e,t){let n=l(e);if(!n.clerkKey)return s(500,"Clerk is not configured.");if(t??=/^Bearer\s+(.+)$/i.exec(e.call.request.headers.get("Authorization")?.trim()??"")?.[1]?.trim(),!t)return s(401,"Unauthorized");try{let r=await e.vendorFetch(`${C(e)}/v1/jwks`,{headers:{Authorization:`Bearer ${n.clerkKey}`}});if(!r.ok)return s(401,"Unauthorized");let o=e.crypto.jwtVerify(t,await r.json(),{now:Math.floor(y(e)/1e3)});return!o.valid||!o.payload?.sub||n.authorizedParties?.length&&!n.authorizedParties.includes(o.payload.azp)?s(401,"Unauthorized"):String(o.payload.sub)}catch{return s(401,"Unauthorized")}}async function R(e,t){let n=l(e),r=async d=>{let p=await e.vendorFetch(`${C(e)}${d}`,{headers:{Authorization:`Bearer ${n.clerkKey}`}});if(!p.ok)throw new Error(`Clerk twin organization reader failed (${p.status}).`);return p.json()},o=await r(`/v1/users/${encodeURIComponent(t)}`),a=o.email_addresses?.find(d=>d.id===o.primary_email_address_id)?.email_address??o.email_addresses?.[0]?.email_address;if(typeof a!="string")return null;let c=[o.first_name,o.last_name].filter(Boolean).join(" "),i=await r(`/v1/users/${encodeURIComponent(t)}/organization_memberships?limit=100`),u=await Promise.all((i.data??[]).slice(0,100).map(async d=>{let p=d.organization;if(!h(p?.id)||typeof p.name!="string")throw new Error("Clerk twin returned an invalid organization membership.");let m=await r(`/v1/organizations/${encodeURIComponent(p.id)}/domains?limit=50`);return{id:p.id,name:p.name,...p.slug?{slug:p.slug}:{},role:d.role??"org:member",domains:(m.data??[]).slice(0,50).map(k=>({name:k.name.toLowerCase(),verified:k.verification?.status==="verified",enrollmentMode:k.enrollment_mode}))}}));return{id:t,email:a,...c?{name:c}:{},organizations:u}}var z=(e,t)=>e.vendorFetch(l(e).tokenEndpoint,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t.toString()});function j(e){return!e||!h(e.id)||typeof e.email!="string"||e.email.length>320||e.name!==void 0&&(typeof e.name!="string"||e.name.length>200)||!Array.isArray(e.organizations)||e.organizations.length>100?!1:e.organizations.every(t=>t&&h(t.id)&&typeof t.name=="string"&&t.name.length<=200&&(t.slug===void 0||typeof t.slug=="string"&&t.slug.length<=200)&&typeof t.role=="string"&&t.role.length<=200&&Array.isArray(t.domains)&&t.domains.length<=50&&t.domains.every(n=>n&&typeof n.name=="string"&&n.name.length<=253&&typeof n.verified=="boolean"&&["manual_invitation","automatic_invitation","automatic_suggestion","enterprise_sso"].includes(n.enrollmentMode)))}function O(e){if(typeof e!="string"||e.length>4096)return null;try{let t=new URL(e),n=new URLSearchParams(t.hash.slice(1)).get("token");return t.protocol!=="https:"||!["/","/index.html"].includes(t.pathname)||!/(?:^|\.)(?:ngrok(?:-free)?\.(?:app|dev)|trycloudflare\.com)$/i.test(t.hostname)||t.username||t.password||t.search||!n||n.length<32?null:t.toString()}catch{return null}}async function L(e,t,n){let r=y(e),o=e.occurredAt.slice(0,13),a=o.slice(0,10),c=e.crypto.sha256(n),{row:i}=await e.createUnique("_invitation_usage",{host:t,hour:"",day:"",hourCount:0,dayCount:0,recipients:{}},"invitation.quota.open"),u=0;return await e.change("_invitation_usage",String(i.id),d=>{let p=d.hour===o?Number(d.hourCount):0,m=d.day===a?Number(d.dayCount):0,k=Object.fromEntries(Object.entries(d.recipients??{}).filter(([,ie])=>r-Number(ie)<3e5));return u=k[c]?3e5-(r-k[c]):p>=20?36e5-r%36e5:m>=50?864e5-r%864e5:0,u>0?void 0:{hour:o,day:a,hourCount:p+1,dayCount:m+1,recipients:{...k,[c]:r}}},"invitation.quota.reserve"),u>0?Math.max(1,Math.ceil(u/1e3)):0}async function $(e,t){let n=await e.vendorFetch(`${C(e)}/v1/users/${encodeURIComponent(t)}`,{headers:{Authorization:`Bearer ${l(e).clerkKey}`}});if(!n.ok)throw new Error("Managed account identity reader failed.");return(await n.json()).private_metadata?.vgaiManagedServices===!0}async function V(e,t){let n;try{n=await t()}catch(o){n=s(502,o instanceof Error?o.message:"Authorization failed")}let r=new Headers(n.headers);return r.set("Cache-Control","no-store"),r.set("Referrer-Policy","no-referrer"),r.set("Strict-Transport-Security","max-age=31536000; includeSubDomains"),r.set("X-Content-Type-Options","nosniff"),new Response(n.body,{status:n.status,statusText:n.statusText,headers:r})}var F={};ce(F,{configuration:()=>ue});async function ue(e){let t=e.body,{clientId:n,billingUrl:r,...o}=e.get("_settings","deployment")??{},a=["clerkKey","publishableKey","clerkApi","providerClientId","authorizationEndpoint","tokenEndpoint","webCallback","billingBound","invitationRateLimit","authorizedParties","freePlan"];if(t.freePlan!==void 0){let i=t.freePlan;if(!i||typeof i.name!="string"||!i.name.trim()||!Number.isSafeInteger(i.includedCredits)||Number(i.includedCredits)<0)return e.reply({error:"A Free catalog entry needs a name and non-negative integer includedCredits."},400)}let c=Object.fromEntries(a.filter(i=>t[i]!==void 0).map(i=>[i,t[i]]));return await e.record("_settings",{...o,...c},"deployment"),e.reply({configured:!0})}async function N(e){let t=new URL(e.call.request.url).searchParams,n=x(e,t.get("redirect_uri")),r=t.get("state"),o=t.get("code_challenge");if(t.get("response_type")!=="code"||t.get("client_id")!==l(e).clientId||t.get("code_challenge_method")!=="S256"||!n||!q(r)||!o||!/^[A-Za-z0-9_-]{43,128}$/.test(o))return s(400,"Invalid editor account authorization request.");let a=e.crypto.digest("sha512",await _(e),"base64url").slice(0,64),c=await v(e,{kind:"account-state",redirectUri:n,clientState:r,clientChallenge:o,providerVerifier:a,expiresAt:y(e)+6e5}),i=new URL(l(e).authorizationEndpoint);for(let[u,d]of Object.entries({response_type:"code",client_id:l(e).providerClientId,redirect_uri:`${f}/account/callback`,state:c,code_challenge:I(e,a),code_challenge_method:"S256",scope:"openid profile email user:org:read"}))i.searchParams.set(u,d);return A(i.toString())}async function B(e){let t=new URL(e.call.request.url).searchParams,n=await w(e,t.get("state")),r=t.get("code");if(!n||n.kind!=="account-state"||!x(e,n.redirectUri)||!q(n.clientState)||!/^[A-Za-z0-9_-]{43,128}$/.test(n.clientChallenge??"")||typeof n.providerVerifier!="string"||n.providerVerifier.length<43||typeof n.expiresAt!="number"||n.expiresAt<=y(e)||!q(r,2048))return s(400,"This editor account authorization is invalid or expired.");let o=await v(e,{kind:"account-code",providerCode:r,redirectUri:n.redirectUri,clientChallenge:n.clientChallenge,providerVerifier:n.providerVerifier,expiresAt:y(e)+12e4}),a=new URL(n.redirectUri);return a.searchParams.set("code",o),a.searchParams.set("state",n.clientState),A(a.toString())}async function G(e){let t=new URLSearchParams(e.text),n=l(e);if(t.get("client_id")!==n.clientId)return s(401,"invalid_client");let r=new URLSearchParams({client_id:n.providerClientId});if(t.get("grant_type")==="authorization_code"){let a=await w(e,t.get("code"));if(!a||a.kind!=="account-code"||!x(e,a.redirectUri)||typeof a.expiresAt!="number"||a.expiresAt<=y(e)||t.get("redirect_uri")!==a.redirectUri||I(e,t.get("code_verifier")??"")!==a.clientChallenge)return s(400,"invalid_grant");r.set("grant_type","authorization_code"),r.set("code",a.providerCode),r.set("redirect_uri",`${f}/account/callback`),r.set("code_verifier",a.providerVerifier)}else if(t.get("grant_type")==="refresh_token"&&t.get("refresh_token"))r.set("grant_type","refresh_token"),r.set("refresh_token",t.get("refresh_token"));else return s(400,"unsupported_grant_type");let o=await z(e,r);return new Response(await o.text(),{status:o.status,headers:{"Content-Type":o.headers.get("Content-Type")??"application/json"}})}async function H(e){let t=await g(e);return t instanceof Response?t:e.reply({userId:t})}async function M(e){let t=await g(e);if(t instanceof Response)return t;let n=e.body,r=S(n.callbackUrl);if(!r||!h(n.sessionId)||!h(n.invitationId))return s(400,"Invalid collaboration handoff binding.");let o=e.crypto.digest("sha512",await _(e),"base64url").slice(0,64),a=y(e)+6e5,c={callbackUrl:r,sessionId:n.sessionId,invitationId:n.invitationId,hostUserId:t,expiresAt:a},i=await v(e,{kind:"state",...c,verifier:o}),u=new URL(l(e).authorizationEndpoint);for(let[p,m]of Object.entries({response_type:"code",client_id:l(e).providerClientId,redirect_uri:`${f}/collaboration/callback`,state:i,code_challenge:I(e,o),code_challenge_method:"S256",scope:"openid profile email user:org:read"}))u.searchParams.set(p,m);let d=await v(e,{kind:"invitation-delivery",...c});return e.reply({authorizationUrl:u.toString(),deliveryAuthorization:d,expiresAt:a},201)}async function K(e){let t=await g(e);if(t instanceof Response)return t;let n=l(e);if(n.clerkApi)return s(503,"The Clerk twin does not deliver public invitation email.");if(!n.publishableKey)return s(503,"Clerk invitation delivery is not configured.");let r=e.body,o=typeof r.emailAddress=="string"?r.emailAddress.trim().toLowerCase():"",a=O(r.redirectUrl),c=S(r.callbackUrl);if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)||o.length>320||!a||!c||!h(r.sessionId)||!h(r.invitationId)||typeof r.deliveryAuthorization!="string"||!r.deliveryAuthorization||r.deliveryAuthorization.length>32768||new URL(a).origin!==new URL(c).origin||typeof r.expiresAt!="number"||r.expiresAt<=y(e)||r.expiresAt>y(e)+864e5)return s(400,"Invalid collaboration invitation delivery request.");let i=await w(e,r.deliveryAuthorization);if(!i||i.kind!=="invitation-delivery"||!S(i.callbackUrl)||!h(i.sessionId)||!h(i.invitationId)||!h(i.hostUserId)||typeof i.expiresAt!="number"||i.expiresAt<=y(e)||i.hostUserId!==t||i.callbackUrl!==c||i.sessionId!==r.sessionId||i.invitationId!==r.invitationId)return s(401,"Invalid or expired invitation delivery authorization.");if(!n.invitationRateLimit)return s(503,"Collaboration invitation rate limiting is not configured.");let u=await L(e,t,o);if(u)return Response.json({error:"Invitation delivery rate limit exceeded."},{status:429,headers:{"Retry-After":String(u),"Cache-Control":"no-store"}});let d=await e.vendorFetch(`${C(e)}/v1/invitations`,{method:"POST",headers:{Authorization:`Bearer ${n.clerkKey}`,"Content-Type":"application/json"},body:JSON.stringify({email_address:o,redirect_url:a,notify:!0,ignore_existing:!0,expires_in_days:1})});if(!d.ok){let m=await d.json().catch(()=>null);return s(502,m?.errors?.[0]?.long_message??m?.errors?.[0]?.message??"Authorization failed")}let p=await d.json();return e.reply({id:p.id,status:p.status,emailAddress:p.email_address},201)}async function D(e){let t=new URL(e.call.request.url).searchParams,n=await w(e,t.get("state")),r=t.get("code");if(!n||n.kind!=="state"||!S(n.callbackUrl)||!h(n.sessionId)||!h(n.invitationId)||!h(n.hostUserId)||typeof n.verifier!="string"||typeof n.expiresAt!="number"||n.expiresAt<=y(e)||!r)return s(400,"This collaboration authorization is invalid or expired.");let o=await z(e,new URLSearchParams({grant_type:"authorization_code",client_id:l(e).providerClientId,code:r,redirect_uri:`${f}/collaboration/callback`,code_verifier:n.verifier})),a=await o.json().catch(()=>null);if(!o.ok||typeof a?.access_token!="string")return s(401,"VGAI account authorization failed.");let c=await g(e,a.access_token);if(c instanceof Response)return c;let i=await R(e,c);if(!i)return s(403,"The authenticated VGAI account has no public profile.");let u=await v(e,{kind:"grant",sessionId:n.sessionId,invitationId:n.invitationId,hostUserId:n.hostUserId,participant:i,jti:e.crypto.digest("sha256",await _(e),"base64url").slice(0,32),expiresAt:y(e)+12e4}),d=new URL(n.callbackUrl);return d.hash=`grant=${encodeURIComponent(u)}`,A(d.toString())}async function W(e){let t=e.body,n=await w(e,t.grant);return!n||n.kind!=="grant"||!h(n.sessionId)||!h(n.invitationId)||!h(n.hostUserId)||!h(n.jti)||typeof n.expiresAt!="number"||n.expiresAt<=y(e)||!h(t.sessionId)||!h(t.invitationId)||t.sessionId!==n.sessionId||t.invitationId!==n.invitationId||!j(n.participant)?s(401,"Invalid or expired collaboration grant."):e.reply({participant:n.participant,jti:n.jti,hostUserId:n.hostUserId})}async function J(e){return e.reply({issuer:f,authorization_endpoint:`${f}/account/authorize`,token_endpoint:`${f}/account/token`,response_types_supported:["code"],grant_types_supported:["authorization_code","refresh_token"],token_endpoint_auth_methods_supported:["none"],code_challenge_methods_supported:["S256"],scopes_supported:["openid","profile","email","user:org:read"]})}async function X(e){let t=await g(e);return t instanceof Response?t:l(e).billingBound?s(404,"Not found"):s(503,"Managed-service admission is unavailable.")}async function Z(e){let t=await g(e);if(t instanceof Response)return t;let n=await R(e,t);if(!n)return s(403,"The authenticated VGAI account has no public profile.");let{organizations:r,...o}=n,a=l(e);if(!a.billingBound)return e.reply({authenticated:!0,backend:"live",user:o,organizations:r,plan:{id:"free",name:"Free",status:"free"},credits:{included:0,purchased:0,used:0,reserved:0,remaining:0},spendPolicy:{overageEnabled:!1,monthlyLimitCredits:0,alertThresholds:[]},entitlements:{generation:!0}});if(!a.freePlan)return s(503,"The managed VGAI account ledger is unavailable.");let c=await $(e,t),i=e.row("Account",t);if(i){let u=e.own(i),d={...u,user:o,organizations:r,entitlements:{generation:c}};JSON.stringify(d)!==JSON.stringify(u)&&await e.write("Account",t,d,"accountProjection")}else{let u=a.freePlan.includedCredits;await e.write("Account",t,{authenticated:!0,backend:"live",user:o,organizations:r,plan:{id:"free",name:a.freePlan.name,status:"free"},credits:{included:u,purchased:0,used:0,reserved:0,remaining:u},spendPolicy:{overageEnabled:!1,monthlyLimitCredits:0,alertThresholds:[50,80,100]},alerts:[],entitlements:{generation:c}},"accountProjection")}return e.reply(e.own(e.row("Account",t)))}async function b(e){let t=l(e);if(!t.clerkKey)return s(503,"Clerk Frontend API proxy is not configured.");try{let n=new URL(e.call.request.url),r=`https://frontend-api.clerk.dev${n.pathname.slice(8)||"/"}${n.search}`,o=new Headers(e.call.request.headers);o.set("Clerk-Proxy-Url","https://auth.videogame.ai/__clerk"),o.set("Clerk-Secret-Key",t.clerkKey),o.set("X-Forwarded-For",e.call.request.headers.get("CF-Connecting-IP")??"");let a=e.call.request,c=a.body===null?void 0:await a.clone().arrayBuffer();return await e.vendorFetch(r,{method:a.method,body:c,headers:o,signal:a.signal,redirect:"manual"})}catch{return s(502,"Clerk Frontend API proxy is unavailable.")}}async function Q(e){return b(e)}async function Y(e){return b(e)}async function ee(e){return b(e)}async function te(e){return b(e)}async function ne(e){return b(e)}async function re(e){return b(e)}async function oe(e){return b(e)}var ae={accountAuthorize:N,accountCallback:B,accountOAuthMetadata:J,accountProjection:Z,accountToken:G,clerkFrontendApiProxy:b,clerkFrontendApiProxyDelete:te,clerkFrontendApiProxyHead:ne,clerkFrontendApiProxyOptions:re,clerkFrontendApiProxyPatch:ee,clerkFrontendApiProxyPost:Q,clerkFrontendApiProxyPut:Y,clerkFrontendApiProxyTrace:oe,collaborationCallback:D,collaborationHandoff:M,collaborationInvitation:K,collaborationRedeem:W,collaborationVerify:H,inferenceGrant:X};function E(e={}){return be({manifest:P,surface:U,handlers:ae,doors:F,around:V},e)}import{grpc as Ge,serveHttp as He}from"../../engine/v3/volter_world-core.mjs";var Qe=ve(ke(P,U));export{E as createTwinFetch};