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,7 @@
1
+ @agenttwin/twin-runhuman
2
+
3
+ Contains @volter/twin-runhuman 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,3 @@
1
+ import{createRequire as __atReq}from'node:module';const require=__atReq(import.meta.url);
2
+ import{createHash as Ae,createHmac as Ie,randomBytes as Be,timingSafeEqual as Je}from"node:crypto";import{applyTwinWrite as He,applyTwinWriteAtomic as Y,projectResources as ee,worldNow as Fe}from"../../engine/v2/volter_world-core.mjs";function V(e){return e===null?"null":Array.isArray(e)?"array":typeof e=="number"&&Number.isNaN(e)?"nan":typeof e}function de(e,n,s,o){let t=r=>o.push(s?`${s}: ${r}`:r);switch(n.kind){case"unknown":return;case"string":case"number":case"boolean":(typeof e!==n.kind||n.kind==="number"&&Number.isNaN(e))&&t(`Expected ${n.kind}, received ${V(e)}`);return;case"enum":typeof e!="string"?t(`Expected ${n.values.map(r=>`'${r}'`).join(" | ")}, received ${V(e)}`):n.values.includes(e)||t(`Invalid enum value. Expected ${n.values.map(r=>`'${r}'`).join(" | ")}, received '${e}'`);return;case"object":(typeof e!="object"||e===null||Array.isArray(e))&&t("Invalid input");return;case"array":if(!Array.isArray(e)){t(`Expected array, received ${V(e)}`);return}e.forEach((r,i)=>de(r,n.of,s?`${s}.${i}`:String(i),o));return}}function L(e,n){let s=e??{},o=[];if(typeof s!="object"||Array.isArray(s))o.push(`Expected object, received ${V(s)}`);else{let r=s;for(let[i,a]of Object.entries(n)){let u=r[i];if(u===void 0){a.required&&o.push(`${i}: Required`);continue}let d=o.length;if(de(u,a,i,o),o.length===d&&a.refine){let l=a.refine(u);l&&o.push(`${i}: ${l}`)}}}return o.length===0?void 0:{status:400,body:{error:`Invalid request body: ${o.join("; ")}`,statusCode:400,code:"FST_ERR_VALIDATION"}}}function le(e){let n=e??{};if(!(typeof n=="object"&&!Array.isArray(n)))return{status:400,body:{error:"Invalid request body: Invalid input",statusCode:400,code:"FST_ERR_VALIDATION"}}}var I={kind:"string"},W={kind:"number"},A={kind:"boolean"},P={kind:"object"},K={kind:"enum",values:["inherit","always","never"]},De=["desktop","mobile","both"],$e=["ios","android","pc","mac"],Pe=["english","spanish"],Le=["tester-portal","mobile-app","slack","discord-activity"],pe={projectId:I,organizationId:I,url:I,description:I,template:I,templateContent:I,targetDurationMinutes:W,maxExtensionMinutes:W,outputSchema:P,resultsTemplate:I,deviceClass:{kind:"enum",values:De},screenSize:{kind:"unknown"},attachments:{kind:"array",of:P},metadata:{kind:"object",refine:e=>{let n=e.captureMode;return n===void 0||n==="supplier"||n==="external"?void 0:"metadata.captureMode must be supplier or external"}},additionalValidationInstructions:I,githubRepos:{kind:"array",of:I},githubRepo:I,autoCreateGithubIssuesRepo:I,githubToken:I,commitSha:I,enableCodeContext:A,prNumbers:{kind:"array",of:W},issueNumbers:{kind:"array",of:W},checkTestability:A,requiredDevices:{kind:"array",of:{kind:"enum",values:$e}},requiredLanguages:{kind:"array",of:{kind:"enum",values:Pe}},requireSocialVideos:A,requireSideload:A,requiresRunhumanApkInstall:A,autoCreateGithubIssues:A,autoCreateGithubFeedback:A,autoCreateJiraFeedback:A,autoCreateJiraIssues:A,autoCreateLinearIssues:A,enhancedVideo:A,enhanceInstructions:A,autoCreateOnlyTesterSurfaced:A,reopenIssuesOnDuplicate:A,commentOnDuplicate:A,slackNotification:P,emailOnCompletion:K,inAppOnCompletion:K,emailOnFailure:K,inAppOnFailure:K},fe={claimSource:{kind:"enum",values:Le,required:!0}},me={action:{kind:"enum",values:["clear_and_release","clear_and_cancel","save_and_cancel","platform_issue"],required:!0},note:{kind:"string",required:!0}},ge={job:P,prefillTemplate:I,clientInfo:P};var E="runhuman";var Ge=15,We=5,he=120,be=12,Ke=.0085,Ve=360,Ye=1440*60,Xe=5,Qe=new Set(["pending","preparing","queued","waiting","working","overdue","admin_hold"]),Ze=new Set(["completed","cancelled","expired","failed"]),c=(e,n)=>({status:e,body:n}),qe=()=>c(404,{error:"Not found"});function T(e){return{status:404,body:{error:"Not found"},headers:{"x-twin-gap":`runhuman twin does not model ${e}`}}}function x(){return c(405,{error:"Method Not Allowed",message:"twin is read-only; omit --read-only to accept writes"})}var Z=(e,n,s,o)=>c(e,{error:s,statusCode:e,code:n,...o?{details:o}:{}});function U(e){if(e===void 0||e.trim()==="")return{ok:!0,value:void 0};try{return{ok:!0,value:JSON.parse(e)}}catch{return{ok:!1,response:Z(400,"FST_ERR_CTP_INVALID_JSON_BODY","Body is not valid JSON but content-type is set to 'application/json'")}}}function R(e,n,s){return(s??ee(E,n)).filter(o=>o.type===e&&typeof o.doc=="object"&&o.doc!==null).map(o=>o.doc)}function h(e,n,s){let o=ee(E,s).find(t=>t.type===e&&t.id===`${e}:${n}`);return o&&typeof o.doc=="object"&&o.doc!==null?o.doc:void 0}async function S(e,n,s,o,t){await He(E,{operation:o,subjectType:e,subjectId:`${e}:${n}`,fields:{doc:_(s)},...t.occurredAt?{occurredAt:t.occurredAt}:{},actor:{kind:"system"}},t.root)}function _(e){return JSON.parse(JSON.stringify(e))}function et(e){let n=Ae("sha256").update(`runhuman-twin:${e}`).digest("hex"),s=(parseInt(n[16],16)&3|8).toString(16);return`${n.slice(0,8)}-${n.slice(8,12)}-4${n.slice(13,16)}-${s}${n.slice(17,20)}-${n.slice(20,32)}`}function C(e,n,s){let o=new Set(s.filter(r=>r.type===e).map(r=>r.id)),t=o.size;for(;;){let r=et(`${e}:${w(n)}:${t}`);if(!o.has(`${e}:${r}`))return r;t+=1}}var w=e=>e.occurredAt??Fe(),ye=e=>Buffer.from(e).toString("base64url");async function Se(e){let n=h("setting","jwt_secret",e)?.secret;if(typeof n=="string")return n;let{value:s}=await Y(E,o=>{let t=o.find(i=>i.type==="setting"&&i.id==="setting:jwt_secret")?.doc;if(typeof t?.secret=="string")return{kind:"skip",value:t.secret};let r=Be(32).toString("hex");return{kind:"write",value:r,write:{operation:"setting.jwt_secret",subjectType:"setting",subjectId:"setting:jwt_secret",fields:{doc:{secret:r}},actor:{kind:"system"}}}},e);return s}function tt(e,n,s,o){let t=ye(JSON.stringify({alg:"HS256",typ:"JWT"})),r=ye(JSON.stringify({sub:n,...s?{email:s}:{},iat:o,exp:o+Ye})),i=Ie("sha256",e).update(`${t}.${r}`).digest("base64url");return`${t}.${r}.${i}`}function rt(e,n,s){let o=n.split(".");if(o.length!==3)return{ok:!1,reason:"malformed"};let t;try{t=JSON.parse(Buffer.from(o[1],"base64url").toString("utf8")),JSON.parse(Buffer.from(o[0],"base64url").toString("utf8"))}catch{return{ok:!1,reason:"malformed"}}let r=Ie("sha256",e).update(`${o[0]}.${o[1]}`).digest(),i=Buffer.from(o[2],"base64url");return i.length!==r.length||!Je(i,r)?{ok:!1,reason:"invalid_signature"}:typeof t.exp=="number"&&t.exp<=s?{ok:!1,reason:"expired"}:typeof t.nbf=="number"&&t.nbf>s?{ok:!1,reason:"not_yet_valid"}:{ok:!0,sub:String(t.sub??"")}}var O=(e,n)=>e.headers?.[n]??e.headers?.[n.toLowerCase()],nt=e=>e.startsWith("rh_pat_"),te=e=>!nt(e)&&!e.startsWith("rh_svc_")&&(e.startsWith("rh_")||e.startsWith("qa_live_")),j=e=>c(401,{error:"Unauthorized",message:e});function ot(e){let n=O(e,"authorization");if(!n)return{ok:!1,response:j("Missing Authorization header. Include your API key as: Authorization: Bearer <your-key>")};let s=n.split(" ");if(s.length!==2||s[0]!=="Bearer")return{ok:!1,response:j("Invalid Authorization header format. Use: Authorization: Bearer <your-key>")};let o=s[1];if(!te(o))return{ok:!1,response:j("Invalid API key format")};let t=R("api_key",e.root).find(r=>r.key===o&&r.isActive!==!1);return t?{ok:!0,principal:{kind:"apiKey",apiKey:t}}:{ok:!1,response:j("Invalid or inactive API key")}}function ve(e){let n=O(e,"authorization");if(!n)return{ok:!1,response:j("Missing Authorization header")};if(!n.startsWith("Bearer "))return{ok:!1,response:j("Invalid Authorization header format. Expected: Bearer <token>")};if(n.startsWith("Bearer clerk_")){let s=`clerk_${n.slice(13)}`,o=R("user",e.root).find(t=>t.clerkId===s);return o?{ok:!0,principal:{kind:"user",user:o}}:{ok:!1,response:j("User not found. Create user with createMockUser() first.")}}return{ok:!1,response:j("Invalid token format")}}function re(e){let n=O(e,"authorization")?.split(" ")[1];return n&&te(n)?ot(e):ve(e)}function ne(e,n){return Array.isArray(e.organizationIds)&&e.organizationIds.includes(n)}function we(e){let n=O(e,"host");return n?`${O(e,"x-forwarded-proto")??(n.startsWith("127.0.0.1")||n.startsWith("localhost")?"http":"https")}://${n}`:"https://runhuman.com"}function Te(e,n){let s=we(e),o=n.metadata??{};return o.publicToken&&!o.publicTokenDisabled?`${s}/j/${n.id}/${o.publicToken}`:n.projectId?`${s}/dashboard/${n.projectId}/jobs/${n.id}`:`${s}/dashboard/jobs/${n.id}`}function st(e){return e?.hasActiveSubscription===!0}function Re(e,n,s){let o=e.metadata?{...e.metadata}:void 0;o&&delete o.testerToken;let t={...e,...o?{metadata:o}:{}};if(st(n))return{job:t,richResultsGated:!1};let r={...t,keyMoments:[]};return delete r.transcription,delete r.conversationHistory,r.sessionEvents&&(r.sessionEvents={...r.sessionEvents,screenshots:[],consoleMessages:[],networkRequests:[]}),n?{job:r,richResultsGated:!0,ownerOrganizationName:String(n.name),viewerIsOrganizationOwner:s!==void 0&&s===n.ownerUserId}:{job:r,richResultsGated:!0,viewerIsOrganizationOwner:!1}}function je(e){if(!Array.isArray(e))return;let n=e.filter(s=>s?.role==="user").map(s=>String(s.content??"").trim()).filter(s=>s.length>0);return n.length>0?n.join(`
3
+ `):void 0}function Ee(e){return(Array.isArray(e.livekitRecordingSessions)?e.livekitRecordingSessions:[]).length>0||e.livekitRecordingUrl?"ready":e.egressRequestStartMs||e.livekitEgressId?"processing":"none"}function it(e,n,s){let o=n.projectId?h("project",String(n.projectId),e.root):void 0,t=Oe(n,e.root),r=Re(n,t,s),{sessionEvents:i,conversationHistory:a,assignedTester:u,assignedTesterName:d,...l}=r.job;return _({...l,testerData:i,conversationHistory:a,testerResponse:je(a),testerAlias:r.job.testerAlias,testerAvatarUrl:r.job.testerAvatarUrl,jobUrl:Te(e,r.job),projectName:o?.name,richResultsGated:r.richResultsGated,ownerOrganizationName:r.ownerOrganizationName,viewerIsOrganizationOwner:r.viewerIsOrganizationOwner,normalizedData:void 0,recordingStatus:Ee(n)})}function at(e,n,s){let o=n.projectId?h("project",String(n.projectId),e.root):void 0,t=Re(n,Oe(n,e.root),s),r=t.job;return _({id:r.id,url:r.url,description:r.description,augmentedDescription:r.augmentedDescription,status:r.status,modifier:r.modifier??void 0,result:r.result,error:r.error,claimedAt:r.claimedAt,completedAt:r.completedAt,testDurationSeconds:r.testDurationSeconds,costUsd:r.costUsd,testerData:r.sessionEvents,testerResponse:je(r.conversationHistory),testerAlias:r.testerAlias,testerAvatarUrl:r.testerAvatarUrl,jobUrl:Te(e,r),projectName:o?.name,targetDurationMinutes:r.targetDurationMinutes,maxExtensionMinutes:r.maxExtensionMinutes,responseDeadline:r.responseDeadline,keyMoments:r.keyMoments,transcription:r.transcription,conversationHistory:r.conversationHistory,richResultsGated:t.richResultsGated,ownerOrganizationName:t.ownerOrganizationName,viewerIsOrganizationOwner:t.viewerIsOrganizationOwner,deviceClass:r.deviceClass,requiredDevices:r.requiredDevices,requiredLanguages:r.requiredLanguages,requireSocialVideos:r.requireSocialVideos,requireSideload:r.requireSideload,extractedIssues:r.extractedIssues,createdIssues:r.createdIssues,normalizedData:void 0,passStatus:r.passStatus,recordingStatus:Ee(n)})}function Oe(e,n){if(e.billedOrganizationId)return h("organization",String(e.billedOrganizationId),n);let s=e.projectId?h("project",String(e.projectId),n):void 0;return s?h("organization",String(s.organizationId),n):void 0}function ut(e,n,s){if(!n.projectId)return c(403,{error:"Forbidden",message:"Job has no associated project"});let o=h("project",String(n.projectId),e.root);if(!o)return c(403,{error:"Forbidden",message:"Project not found"});if(s.kind==="user")return ne(s.user,o.organizationId)?void 0:c(403,{error:"Forbidden",message:"You do not have permission to access this job"});if(o.organizationId!==s.apiKey.organizationId)return c(403,{error:"Forbidden",message:"API key organization does not match job project organization"})}async function ct(e){let n=U(e.body);if(!n.ok)return n.response;let s=L(n.value,pe);if(s)return s;let o=re(e);if(!o.ok)return o.response;if(e.readOnly)return x();let t=n.value??{},r=o.principal;if(t.requiresRunhumanApkInstall===!0)return c(403,{error:"requiresRunhumanApkInstall is an internal-only flag",code:"RUNHUMAN_SELF_TEST_FORBIDDEN"});let i=t.githubRepos??(typeof t.githubRepo=="string"?[t.githubRepo]:void 0);if(r.kind==="user"&&!t.projectId&&!t.organizationId)return c(400,{error:"Missing required field: projectId or organizationId",message:"This auth method requires either projectId or organizationId. Use an API key for automatic project resolution.",code:"PAT_REQUIRES_PROJECT_OR_ORG"});let a;if(typeof t.projectId=="string"&&t.projectId.length>0){if(a=h("project",t.projectId,e.root),!a||a.deletedAt)return c(404,{error:"Project not found"});if(r.kind==="apiKey"){if(!a.organizationId)return c(403,{error:"Access denied: Project has no organization"});if(a.organizationId!==r.apiKey.organizationId)return c(403,{error:"Access denied: API key organization does not match project organization"})}else{if(!h("organization",String(a.organizationId),e.root))return c(403,{error:"Project organization not found",code:"ORG_NOT_FOUND"});if(!ne(r.user,a.organizationId))return c(403,{error:"You do not have permission to create jobs in this organization",code:"MISSING_PERMISSION"})}}else return i?.length?T("project auto-creation from githubRepos"):r.kind==="user"&&t.organizationId?c(400,{error:"Missing required field: githubRepos is required when using organizationId for project auto-creation",code:"PAT_ORG_REQUIRES_GITHUB_REPOS"}):c(400,{error:"Missing project information"});let u=String(a.id),d=String(a.organizationId);if(t.requireSideload===!0||t.requireSocialVideos===!0)return T("sideload / social-video tier gates");if(t.template!==void 0||t.templateContent!==void 0)return T("job templates");if(t.prNumbers?.length||t.issueNumbers?.length)return T("PR/issue test-plan generation");if(t.enhanceInstructions===!0)return T("KB-enhanced instructions");if(i?.length)return T("GitHub repository access checks");if(t.outputSchema!==void 0&&t.outputSchema!==null)return T("outputSchema validation");if(t.attachments!==void 0)return T("attachment validation");if(t.screenSize!==void 0&&t.screenSize!==null&&t.deviceClass==null)return T("legacy screenSize mapping");if(t.autoCreateGithubIssues===!0||t.autoCreateJiraIssues===!0||t.autoCreateLinearIssues===!0||t.autoCreateGithubFeedback===!0||t.autoCreateJiraFeedback===!0)return T("issue-tracker integrations");let l=t.metadata??{},p={...l,source:l.source??"api-async",sourceCreatedAt:l.sourceCreatedAt??w(e),commitSha:t.commitSha===void 0?l.commitSha:t.commitSha,enableCodeContext:t.enableCodeContext===void 0?l.enableCodeContext:t.enableCodeContext},f=t.url??a.defaultUrl,m=t.description,y=t.deviceClass,g=t.targetDurationMinutes,k=t.maxExtensionMinutes;if(!f||!m)return c(400,{error:"Missing required fields: url and description are required (either directly or via template)"});try{let M=new URL(f.trim());if(M.protocol!=="http:"&&M.protocol!=="https:")return c(400,{error:`Invalid URL protocol "${M.protocol}". URL must start with http:// or https://`})}catch{return c(400,{error:"Invalid URL format. URL must start with http:// or https://"})}if(g!==void 0&&k!==void 0&&g+k>he)return c(400,{error:`Total session time (targetDurationMinutes + maxExtensionMinutes) cannot exceed ${he} minutes. Got ${g} + ${k} = ${g+k}.`,code:"SYSTEM_LIMIT_EXCEEDED"});let v=t.requiredDevices;if(p.captureMode==="external"&&B({deviceClass:y,requiredDevices:v})!=="desktop-only")return Z(400,"VALIDATION_ERROR","External capture requires a desktop browser assignment.");let N=w(e),D=h("organization",d,e.root)?.isInternal===!0,J=p.source==="scheduler"||p.source==="bulk-test-queue",H=p.source==="qa-test-action"||p.source==="issue-tester-action",Q=(J?-10:0)+(D?-50:0),F=H?30:Ve,{value:b}=await Y(E,M=>{if(R("job",void 0,M).filter(ce=>ce.billedOrganizationId===d&&Qe.has(String(ce.status))).length+1>be)return{kind:"skip",value:{ok:!1}};let ae=C("job",e,M),ue=_({id:ae,url:f.trim(),description:m,targetDurationMinutes:g??Ge,maxExtensionMinutes:k??We,outputSchema:null,resultsTemplate:t.resultsTemplate??null,priorityScore:Q,expiresAt:new Date(Date.parse(N)+F*6e4).toISOString(),deviceClass:y,additionalValidationInstructions:t.additionalValidationInstructions,userId:r.kind==="user"?r.user.id:void 0,apiKeyId:r.kind==="apiKey"?r.apiKey.id:void 0,projectId:u,billedOrganizationId:d,metadata:{...p,...t.slackNotification?{slackNotification:t.slackNotification}:{}},autoCreateOnlyTesterSurfaced:t.autoCreateOnlyTesterSurfaced,reopenIssuesOnDuplicate:t.reopenIssuesOnDuplicate,commentOnDuplicate:t.commentOnDuplicate,autoCreateEnhancedVideo:t.enhancedVideo,requiredDevices:v,requiredLanguages:t.requiredLanguages,emailOnCompletion:t.emailOnCompletion,inAppOnCompletion:t.inAppOnCompletion,emailOnFailure:t.emailOnFailure,inAppOnFailure:t.inAppOnFailure,status:"pending",version:1,createdAt:N,updatedAt:N,conversationHistory:[]});return{kind:"write",value:{ok:!0,job:ue},write:{operation:"job.create",subjectType:"job",subjectId:`job:${ae}`,fields:{doc:ue},occurredAt:N,actor:{kind:"system"}}}},e.root);if(!b.ok)return Z(429,"ACTIVE_JOB_LIMIT",`Active job limit reached: an organization may have at most ${be} active jobs at once. Wait for in-flight jobs to finish before creating more.`);let G=dt(y,v),$=a.defaultUrl?lt(f,String(a.defaultUrl),String(a.name)):void 0;return c(201,_({jobId:b.job.id,message:"Job created successfully. Use GET /api/jobs/:id to check status.",...G?{warnings:[G]}:{},...$?{projectUrlMismatch:$}:{}}))}function B(e){if(e.requiresRunhumanApkInstall===!0)return"desktop-only";let n=Array.isArray(e.requiredDevices)?e.requiredDevices:[];if(n.length>0){let s=n.some(t=>t==="ios"||t==="android"),o=n.some(t=>t==="pc"||t==="mac");if(s&&o)return"any";if(s)return"mobile-only";if(o)return"desktop-only"}return e.deviceClass==="mobile"?"mobile-only":e.deviceClass==="desktop"?"desktop-only":"any"}function dt(e,n){if(!n?.length)return;let s=B({requiredDevices:n});if(!n.some(a=>a in q)||e!=="desktop"&&e!=="mobile"||B({deviceClass:e})===s)return;let t={"mobile-only":"mobile only","desktop-only":"desktop only",any:"either desktop or mobile"}[s],r=e==="desktop"?"Desktop":"Mobile",i=n.map(a=>q[a]??a).join(", ");return`Device Class is set to ${r}, but the required device(s) ${i} force the claim surface to ${t}. Required devices win \u2014 this job will be claimable from ${t}.`}function lt(e,n,s){let o=t=>t.startsWith("www.")?t.slice(4):t;try{let t=new URL(e).hostname.toLowerCase(),r=new URL(n).hostname.toLowerCase();return o(t)===o(r)?void 0:{targetHost:t,projectDefaultHost:r,projectName:s}}catch{return}}function _e(e,n,s){let o=re(e);if(!o.ok)return o.response;let t=h("job",n,e.root);if(!t)return c(404,{error:"Job not found"});if(s==="details"||t.projectId){let i=ut(e,t,o.principal);if(i)return i}let r=o.principal.kind==="user"?String(o.principal.user.id):void 0;return c(200,s==="details"?it(e,t,r):at(e,t,r))}var pt=["id","status","modifier","url","description","createdAt","updatedAt","apiKeyId","projectId","testerAlias","testerAvatarUrl","testerProfileId","costUsd","testDurationSeconds","completedAt","claimedAt","error","passStatus","outputSchema","githubRepos","metadata","augmentedDescription"];function ft(e,n,s){let o=re(e);if(!o.ok)return o.response;let t=h("project",n,e.root);if(!t||t.deletedAt)return c(404,{error:"Project not found"});if(o.principal.kind==="apiKey"?t.organizationId!==o.principal.apiKey.organizationId:!ne(o.principal.user,t.organizationId))return c(403,{error:"Access denied"});let r=parseInt(s.get("limit")||"50",10)||50,i=Math.min(Math.max(1,r),100),a=Math.max(0,parseInt(s.get("offset")||"0",10)||0),u=R("job",e.root).filter(l=>l.projectId===n).sort((l,p)=>String(p.createdAt).localeCompare(String(l.createdAt))||String(p.id).localeCompare(String(l.id))),d=u.slice(a,a+i).map(l=>{let p={};for(let m of pt)l[m]!==void 0&&(p[m]=l[m]);let f=l.result;return f&&(p.result=_({explanation:f.explanation,data:f.data,text:f.text})),p});return c(200,{items:d,pagination:{total:u.length,limit:i,offset:a,hasMore:a+d.length<u.length}})}var mt={tester_not_found:{status:403,error:"Not a tester"},tester_not_active:{status:403,error:"Tester not active"},tester_invisible:{status:403,error:"Tester is invisible"},tester_has_active_job:{status:409,error:"Tester already has an active job"},job_not_found:{status:404,error:"Job not found"},job_already_claimed:{status:409,error:"Job already claimed"},job_not_available:{status:409,error:"Job not available"},pool_requirements_not_met:{status:403,error:"Pool requirements not met"},mobile_only:{status:403,error:"Mobile only"},desktop_only:{status:403,error:"Desktop only"}},q={ios:"iOS",android:"Android",pc:"PC",mac:"Mac"},gt={english:"English",spanish:"Spanish"};async function ht(e,n){let s=U(e.body);if(!s.ok)return s.response;let o=L(s.value,fe);if(o)return o;let t=ve(e);if(!t.ok)return t.response;if(t.principal.kind!=="user")return c(401,{error:"Authentication required"});if(e.readOnly)return x();let r=t.principal.user,i=String((s.value??{}).claimSource??"tester-portal"),a=R("tester_profile",e.root).find(m=>m.userId===r.id);if(!a)return c(403,{code:"tester_not_found",error:"Not a tester",details:"You must be an approved tester to claim jobs"});let u=await Se(e.root),d=w(e),l=tt(u,String(r.id),r.email,Math.floor(Date.parse(d)/1e3)),{value:p}=await Y(E,m=>{let y=(b,G,$)=>({kind:"skip",value:{ok:!1,code:b,message:G,...$?{details:$}:{}}});if(a.status!=="active")return y("tester_not_active",`Tester status is: ${a.status}`);if(a.availability==="invisible")return y("tester_invisible","Tester is invisible \u2014 set status to Online before claiming");let g=m.find(b=>b.type==="job"&&b.id===`job:${n}`)?.doc;if(!g)return y("job_not_found","Job not found");if(g.testerProfileId)return y("job_already_claimed","Job already claimed");if(g.status!=="pending"&&g.status!=="waiting")return y("job_not_available",`Job status is: ${g.status}`);let k=B(g);if(k==="mobile-only"&&i!=="mobile-app")return y("mobile_only","Mobile-only jobs can only be claimed via the mobile app");if(k==="desktop-only"&&i==="mobile-app")return y("desktop_only","Dual-device self-tests must be claimed from the tester portal on a computer");let v=[],N=a.devices??[],ie=a.languages??[],D=g.requiredDevices??[];D.length>0&&!D.some(b=>N.includes(b))&&v.push(`Missing device(s): ${D.map(b=>q[b]??b).join(", ")}`);let J=(g.requiredLanguages??[]).filter(b=>!ie.includes(b));if(J.length>0&&v.push(`Missing language(s): ${J.map(b=>gt[b]??b).join(", ")}`),v.length>0)return y("pool_requirements_not_met","Tester does not meet pool requirements",v);let H=R("job",void 0,m).find(b=>b.testerProfileId===a.id&&b.status==="working");if(H)return y("tester_has_active_job",`Already working on job "${H.id}"`);let Q=(Number(g.targetDurationMinutes)+Number(g.maxExtensionMinutes))*6e4,F=_({...g,status:"working",testerProfileId:a.id,assignedTester:a.alias,assignedTesterName:a.alias,testerAlias:a.alias,testerAvatarUrl:a.avatarUrl??void 0,claimedAt:d,lastActivity:d,responseDeadline:new Date(Date.parse(d)+Q).toISOString(),expiresAt:void 0,claimSource:i,version:Number(g.version??0)+1,updatedAt:d,metadata:{...g.metadata??{},testerToken:l}});return{kind:"write",value:{ok:!0,job:F},write:{operation:"job.claim",subjectType:"job",subjectId:`job:${n}`,fields:{doc:F},occurredAt:d,actor:{kind:"human",id:String(r.id)}}}},e.root);if(!p.ok){let m=mt[p.code];return c(m.status,{code:p.code,error:m.error,details:p.details??p.message})}let f=p.job;return c(200,{message:"Job claimed successfully",job:{id:f.id,url:f.url,description:f.description,targetDurationMinutes:f.targetDurationMinutes,status:f.status,claimedAt:f.claimedAt},webTestLink:`${we(e)}/tester/test/${f.id}?testerToken=${encodeURIComponent(l)}`})}async function z(e,n,s){let o=O(e,"authorization"),t=o?.startsWith("Bearer ")?o.substring(7):void 0;if(!t)return{ok:!1,response:c(401,{error:"Unauthorized",message:"Missing testerToken \u2014 send Authorization: Bearer <token>"})};let r=rt(await Se(e.root),t,Math.floor(Date.parse(w(e))/1e3));if(!r.ok)return{ok:!1,response:c(401,{error:"Unauthorized",message:"Invalid or expired testerToken",reason:r.reason})};let i=h("job",n,e.root);if(i&&i.metadata?.testerToken===t){let a=O(e,"x-tester-surface");if(a!==void 0){let u=["tester-portal","mobile-app","slack","discord-activity"];if(!u.includes(a))return{ok:!1,response:c(400,{error:"Bad Request",message:`Invalid X-Tester-Surface header. Expected one of: ${u.join(", ")}`})};let d=B(i);if(d==="mobile-only"&&a!=="mobile-app")return{ok:!1,response:c(403,{code:"mobile_only",error:"Mobile only",message:"This job can only be tested on the mobile tester app."})};if(d==="desktop-only"&&a==="mobile-app")return{ok:!1,response:c(403,{code:"desktop_only",error:"Desktop only",message:"This job can only be tested in a desktop browser."})}}return{ok:!0,job:i,token:t,sub:r.sub}}return i&&s?{ok:!1,response:c(s.code,{error:s.error})}:{ok:!1,response:c(404,{error:"Job not found"})}}async function bt(e,n){let s=await z(e,n);if(!s.ok)return s.response;let o=s.job.billedOrganizationId?h("organization",String(s.job.billedOrganizationId),e.root):void 0;return c(200,_({...s.job,description:s.job.augmentedDescription??s.job.description,organizationName:o?.name}))}var yt=["status","modifier","lastActivity","conversationHistory","result","keyMoments","phases","userRating","userFeedback","testerAppStartTime","testerAppEndTime","actualPageLoadTime"];function ke(e){let n={};for(let s of yt)e[s]!==void 0&&(n[s]=e[s]);return n}async function _t(e,n){let s=U(e.body);if(!s.ok)return s.response;let o=le(s.value);if(o)return o;let t=await z(e,n);if(!t.ok)return t.response;if(e.readOnly)return x();let r=t.job,i={...s.value??{}};if(delete i.organizationName,delete i.sensorShortCode,r.modifier==="admin_terminated")return c(409,{adminTerminated:!0,message:"This job was ended by an admin and can no longer be submitted."});Array.isArray(i.conversationHistory)&&(i.conversationHistory=i.conversationHistory.map(l=>({...l,testerId:r.assignedTester})));let a=w(e);if(i.lastActivity=a,i.status==="completed"&&r.status==="overdue"&&i.modifier!=="late_submission")return c(409,{overdue:!0,message:"This job is overdue \u2014 its response deadline passed. You can still submit your results as a late submission."});if(i.status==="completed"&&r.status==="completed")return c(200,{success:!0,job:_({id:r.id,status:r.status,result:r.result})});if(i.status==="completed"){if(!["pass","fail","not_applicable"].includes(String(r.passStatus)))return c(400,{error:"Cannot complete job without an AI verdict",message:"Job has no server-recorded Pass/Fail result yet; AI processing must finish before completion."});let l=O(e,"idempotency-key"),p={...r,...ke(i),status:r.status,result:i.result??r.result,keyMoments:i.keyMoments??r.keyMoments,metadata:l?{...r.metadata??{},submitIdempotencyKey:l}:r.metadata,updatedAt:a},f=kt(p,a);f?await S("job",n,f,"job.complete",e):await S("job",n,p,"job.tester_update",e);let m=h("job",n,e.root)??p;return c(200,{success:!0,job:_({id:m.id??n,status:m.status??"completed",result:m.result})})}let u=ke(i);if(u.testerAppStartTime&&!r.testerAppStartTime){let l=(Number(r.targetDurationMinutes)+Number(r.maxExtensionMinutes))*6e4;u.responseDeadline=new Date(Number(u.testerAppStartTime)+l).toISOString()}let d={...r,...u,updatedAt:a};return await S("job",n,d,"job.tester_update",e),c(200,{success:!0,job:_({id:d.id,status:d.status,result:d.result})})}function kt(e,n){let s=String(e.status);if(s==="completed"||!["working","overdue","admin_hold"].includes(s))return;let o=Number(e.targetDurationMinutes),t=Number(e.maxExtensionMinutes),r=(o+t)*60,i=0;if(e.claimedAt)if(s==="overdue"||s==="admin_hold")i=r;else{let u=e.testerAppStartTime&&e.testerAppEndTime?Number(e.testerAppStartTime):Date.parse(String(e.claimedAt)),d=e.testerAppStartTime&&e.testerAppEndTime?Number(e.testerAppEndTime):Date.parse(n);i=Math.min(Math.ceil(Math.max(0,d-u)/1e3),r)}let a=i*Ke;return{...e,status:"completed",...s==="overdue"?{modifier:"late_submission"}:{},completedAt:n,testDurationSeconds:i,costUsd:a,...e.billedOrganizationId?{billedAt:n,billedAmountCents:Math.round(a*100),billingIdempotencyKey:e.id}:{},updatedAt:n}}var At=e=>`pipeline__${e.replace(/:/g,"_")}`;async function xe(e,n,s,o){let t=At(String(n.id)),r=h("pipeline_run",t,e.root);return r&&r.state!=="completed"&&r.state!=="failed"||await S("pipeline_run",t,{processingJobId:t,jobId:n.id,mode:s,triggeredBy:o,state:"waiting",enqueuedAt:w(e)},"pipeline.enqueue",e),t}async function It(e,n){let s=U(e.body);if(!s.ok)return s.response;let o=L(s.value,ge);if(o)return o;let t=await z(e,n,{code:403,error:"Invalid testerToken for job"});if(!t.ok)return t.response;if(e.readOnly)return x();let r=s.value??{},i=t.job;r.clientInfo&&(i={...i,metadata:{...i.metadata??{},testerClient:r.clientInfo},updatedAt:w(e)},await S("job",n,i,"job.client_info",e));let a=await xe(e,i,"extract","tester");return c(200,{processingJobId:a,status:"processing",message:"Processing started. Poll /api/tester/jobs/:jobId/processing/:processingJobId for status."})}async function St(e,n){let s=U(e.body);if(!s.ok)return s.response;let o=s.value??void 0;if(!o||o.action!=="reprocess"&&o.action!=="continue")return c(400,{error:"Bad Request",message:"action must be one of: reprocess, continue"});let t=await z(e,n);if(!t.ok)return t.response;if(e.readOnly)return x();let r=t.job;if(r.status!=="working"&&r.status!=="overdue")return c(409,{error:"Conflict",message:`Cannot review issues for a job in status "${r.status}". Job must be "working" or "overdue".`});if(!Array.isArray(r.extractedIssues)||!Array.isArray(r.extractedFeedback))return c(409,{error:"Conflict",message:"Issue review is not available until extraction has run."});let i=(m,y)=>{let g=new Map((Array.isArray(y)?y:[]).map(k=>[k.id,k]));return m.map(k=>{let v=g.get(k.id);return v?_({...k,reviewStatus:v.status,testerComment:v.status==="revise"?v.comment:void 0}):k})},a=i(r.extractedIssues,o.decisions),u=i(r.extractedFeedback,o.feedbackDecisions),d=m=>m.reviewStatus==="accepted"||m.reviewStatus==="declined";if(o.action==="continue"&&(!a.every(d)||!u.every(d)))return c(400,{error:"Bad Request",message:"Every issue and feedback item must be accepted or declined before continuing."});let l=Number((r.metadata??{}).issueReview?.rerunCount??0),p=o.action==="reprocess"?l+1:l;if(await S("job",n,{...r,extractedIssues:a,extractedFeedback:u,updatedAt:w(e)},"job.issue_review",e),o.action==="reprocess")return T("issue-review reprocess (AI re-extraction with guidance)");let f=await xe(e,{...r},"finalize","tester");return c(200,{processingJobId:f,rerunCount:p,softCapReached:p>=Xe})}async function vt(e,n,s){let o=await z(e,n,{code:403,error:"Invalid testerToken for job"});if(!o.ok)return o.response;let t=h("pipeline_run",s,e.root);if(!t)return c(404,{error:"Processing job not found"});if(t.jobId!==n)return c(403,{error:"Processing job does not belong to this job"});if(t.state==="waiting"&&!e.readOnly){let u=h("job",n,e.root),d=w(e),l;if(t.mode==="extract"){let p=u.result??{explanation:"",data:{}};l={...u,result:p,extractedIssues:[],extractedFeedback:[],updatedAt:d}}else{let p=u.result?.data??{},f=p.success===!0?"pass":p.success===!1?"fail":"not_applicable";l={...u,passStatus:f,updatedAt:d}}await S("job",n,l,`pipeline.${t.mode}`,e),t={...t,state:"completed",finishedAt:d,resultSummary:{isComplete:!0}},await S("pipeline_run",s,t,"pipeline.complete",e)}if(t.state==="waiting"||t.state==="active")return c(200,{status:"processing",logs:[]});if(t.state==="failed")return c(200,{status:"failed",error:t.error??"Pipeline run failed",logs:[]});let r=h("job",n,e.root);if(!r)return c(200,{status:"failed",error:`Job ${n} disappeared after completion`,logs:[]});let i=["id","status","keyMoments","result","testerAppStartTime","testerAppEndTime","metadata","extractedIssues","extractedFeedback"],a={};for(let u of i)r[u]!==void 0&&(a[u]=r[u]);return c(200,{status:"completed",result:{job:a,isComplete:!0},logs:[]})}async function wt(e,n){let s=U(e.body);if(!s.ok)return s.response;let o=L(s.value,me);if(o)return o;let t=s.value,r=String(t.action),i=String(t.note??"").trim();if(!i)return c(400,{error:"Bad Request",message:`A note is required for action "${r}"`});let a=await z(e,n);if(!a.ok)return a.response;if(e.readOnly)return x();let u=a.job;if(u.status==="overdue")return c(409,{error:"Conflict",message:`Cannot end an overdue job. Use POST /api/tester/jobs/${n}/decline-late-submission to drop, or re-submit results.`});if(u.status!=="working")return Ze.has(String(u.status))?c(200,{success:!0,action:r,status:u.status,alreadyTerminal:!0}):c(409,{error:"Conflict",message:`Cannot end job in status "${u.status}". Job must be in "working" status.`});let d=w(e),l;if(r==="clear_and_release"){let p={...u.metadata??{}};delete p.testerToken,l={...u,status:"waiting",metadata:p,conversationHistory:[],extractionAttempts:0,warningsSent:0,lastActivity:d,updatedAt:d};for(let f of["testerProfileId","assignedTester","assignedTesterName","testerAlias","testerAvatarUrl","claimedAt","livekitRoomName","livekitEgressId","responseDeadline"])delete l[f]}else r==="platform_issue"?l={...u,status:"failed",modifier:"platform_issue",error:i,lastActivity:d,completedAt:d,costUsd:0,updatedAt:d}:l={...u,status:"cancelled",modifier:"tester_cancellation",error:i,lastActivity:d,completedAt:d,costUsd:0,updatedAt:d};return await S("job",n,l,`job.end.${r}`,e),c(200,{success:!0,action:r,status:l.status})}async function Tt(e,n){if(e.readOnly)return x();let s=U(e.body);if(!s.ok)return s.response;let o=s.value??{},t=ee(E,e.root),r=u=>typeof u=="string"&&u.length>0?u:void 0,i=w(e),a=(u,d)=>d!==void 0&&h(u,d,e.root)?c(409,{error:`${u} ${d} already exists`}):void 0;if(n==="organizations"){let u=a("organization",r(o.id));if(u)return u;let d=r(o.id)??C("organization",e,t),l=_({id:d,name:r(o.name)??"Twin Organization",ownerUserId:r(o.ownerUserId),isInternal:o.isInternal===!0,hasActiveSubscription:o.hasActiveSubscription===!0,createdAt:i});return await S("organization",d,l,"seed.organization",e),c(201,l)}if(n==="projects"){let u=r(o.organizationId);if(!u||!h("organization",u,e.root))return c(404,{error:"organization not found; seed it first via POST /_twin/organizations"});let d=a("project",r(o.id));if(d)return d;let l=r(o.id)??C("project",e,t),p=_({id:l,organizationId:u,name:r(o.name)??"Twin Project",defaultUrl:r(o.defaultUrl),createdAt:i});return await S("project",l,p,"seed.project",e),c(201,p)}if(n==="api-keys"){let u=r(o.organizationId);if(!u||!h("organization",u,e.root))return c(404,{error:"organization not found; seed it first via POST /_twin/organizations"});let d=r(o.key)??`rh_${Ae("sha256").update(`runhuman-twin:api_key:${w(e)}:${t.filter(m=>m.type==="api_key").length}`).digest("hex").slice(0,48)}`;if(!te(d))return c(400,{error:"an RH1 API key starts with rh_ (not rh_pat_ / rh_svc_) or qa_live_"});let l=a("api_key",r(o.id));if(l)return l;if(R("api_key",e.root,t).some(m=>m.key===d))return c(409,{error:"that API key already exists"});let p=r(o.id)??C("api_key",e,t),f={id:p,key:d,organizationId:u,name:r(o.name)??"twin key",isActive:!0,createdAt:i};return await S("api_key",p,f,"seed.api_key",e),c(201,f)}if(n==="testers"){let u=r(o.email);if(!u)return c(400,{error:"email is required"});let d=R("user",e.root,t).find(g=>g.email===u),l=String(d?.id??r(o.userId)??C("user",e,t)),p=_({id:l,email:u,clerkId:`clerk_${u}`,organizationIds:Array.isArray(o.organizationIds)?o.organizationIds:[],createdAt:i});await S("user",l,p,"seed.user",e);let f=R("tester_profile",e.root,t).find(g=>g.userId===l),m=String(f?.id??C("tester_profile",e,t)),y=_({id:m,userId:l,alias:r(o.alias)??u.split("@")[0],status:r(o.status)??"active",availability:r(o.availability)??"online",devices:Array.isArray(o.devices)?o.devices:["pc","mac"],languages:Array.isArray(o.languages)?o.languages:["english"],avatarUrl:r(o.avatarUrl),createdAt:i});return await S("tester_profile",m,y,"seed.tester_profile",e),c(201,{user:p,testerProfile:y,authorization:`Bearer clerk_${u}`})}if(n==="settings"){let u=r(o.jwtSecret);if(!u)return c(400,{error:"jwtSecret is required"});let{value:d}=await Y(E,l=>{let p=l.find(f=>f.type==="setting"&&f.id==="setting:jwt_secret")?.doc;return typeof p?.secret=="string"?{kind:"skip",value:p.secret===u?c(200,{setting:"jwt_secret"}):c(409,{error:"this world already signs tester tokens with another jwtSecret"})}:{kind:"write",value:c(201,{setting:"jwt_secret"}),write:{operation:"seed.jwt_secret",subjectType:"setting",subjectId:"setting:jwt_secret",fields:{doc:{secret:u}},...e.occurredAt?{occurredAt:e.occurredAt}:{},actor:{kind:"system"}}}},e.root);return d}return c(404,{error:"unknown seed; one of organizations, projects, api-keys, testers, settings"})}async function oe(e){let n=new URL(e.path,"http://twin.local"),s=n.pathname.replace(/\/+$/,"")||"/",o=s.split("/").filter(Boolean).map(l=>decodeURIComponent(l)),t=e.method.toUpperCase();if(o[0]==="_twin"&&o.length===2&&t==="POST")return Tt(e,o[1]);if(o[0]!=="api")return qe();let[,r,i,a,u,d]=o;if(r==="jobs"){if(o.length===2&&t==="POST")return ct(e);if(o.length===3&&t==="GET")return _e(e,i,"details");if(o.length===4&&a==="status"&&t==="GET")return _e(e,i,"status");if(o.length===4&&a==="claim"&&t==="POST")return ht(e,i)}if(r==="projects"&&o.length===4&&a==="jobs"&&t==="GET")return ft(e,i,n.searchParams);if(r==="tester"&&i==="jobs"&&a){if(o.length===4&&t==="GET")return bt(e,a);if(o.length===4&&t==="PATCH")return _t(e,a);if(o.length===5&&u==="process-results"&&t==="POST")return It(e,a);if(o.length===6&&u==="processing"&&t==="GET")return vt(e,a,d);if(o.length===5&&u==="issue-review"&&t==="POST")return St(e,a);if(o.length===5&&u==="end"&&t==="POST")return wt(e,a)}return{status:404,body:{error:"Not found"},headers:{"x-twin-gap":`runhuman twin does not model ${t} ${s}`}}}import{createTwinFetchFromHandler as Rt,serveHttp as Bt,statefulTwinManifest as jt}from"../../engine/v2/volter_world-core.mjs";function Ue(e={}){return Rt(oe,{...e,manifest:jt({vendor:"runhuman",twinOf:"the Runhuman 1 API (runhuman.com/api)",stores:"organizations, projects, API keys, testers, and jobs through their claim \u2192 results pipeline \u2192 completion lifecycle",identity:"Authenticate as RH1 does: `Authorization: Bearer rh_\u2026` API keys bound to an organization, and web users (the tester side) in RH1's Clerk mock-mode form `Bearer clerk_<email>`; the tester's per-job testerToken comes from the claim. RH1 creates organizations, projects, keys and testers outside the job API, so a world seeds them with POST /_twin/organizations {name, id?}, /_twin/projects {organizationId, name, id?, defaultUrl?}, /_twin/api-keys {organizationId, key?}, /_twin/testers {email, alias?, devices?, organizationIds?}.",notes:"The AI results pipeline is folded into GET /api/tester/jobs/:jobId/processing/:processingJobId (the first read completes the run); time-driven monitors (claim-window expiry, overdue) and integrations are not modelled and answer RH1's JSON 404 with an x-twin-gap header."})})}import{observeResource as Xt}from"../../engine/v2/volter_world-core.mjs";import{declareRateBudget as Et,rateBudgetPath as Ft,rateBudgetWeight as Gt,RateBudget as Wt}from"../../engine/v2/volter_world-core.mjs";import{RateBudgetError as ze}from"../../engine/v2/volter_world-core.mjs";var Ot="runhuman",Ne=6e4,Me=60,Ce=300,X={createJob:5,mutation:3,read:2},se={windowMs:Ne,ceiling:Me,defaultWeight:X.read,maxRetryAfterSeconds:Ce,rules:[{match:"^POST /api/jobs$",weight:X.createJob},{match:"^(POST|PUT|PATCH|DELETE) ",weight:X.mutation}],reason:'Runhuman documents two per-IP limits (volter-ai/runhuman api.mdx "Rate Limiting", docs/rate-limiting.md): 200 requests/minute per route and 500 requests/minute aggregate, 429 + Retry-After past them. Per-IP, not per-key, so a per-key ledger stays at the kernel fallback, well under both: 60 weighted units per minute; reads 2, writes 3, job creation 5 (each dispatches a paid human tester).'};Et(Ot,se);export{Ue 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-scrapecreators
2
+
3
+ Contains @volter/twin-scrapecreators 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 We}from"node:crypto";import{applyTwinWrite as B,projectResources as Ve}from"../../engine/v2/volter_world-core.mjs";var K="Invalid API key",M="Looks like you're out of credits :( You'll need to buy more to continue using the service.",ce=["unknown-key","twin-unknown"];function Ge(t,e){if(!t)return;let r=e.toLowerCase();for(let[o,n]of Object.entries(t))if(o.toLowerCase()===r)return n}function ue(t){return Ge(t,"x-api-key")??void 0}function N(t){let e=ue(t);return e===void 0?t===void 0?{ok:!0,key:"twin-implicit"}:{ok:!1,status:401,message:K}:e.trim()?ce.includes(e)?{ok:!1,status:402,message:M}:{ok:!0,key:e}:{ok:!1,status:401,message:K}}import{createHash as Le}from"node:crypto";function l(t){let e=typeof t=="string"?t:JSON.stringify(t);return Le("sha256").update(e).digest("hex")}function f(t,e){return parseInt(l(t).slice(0,12),16)%e}function d(t,e,r){return e+f(t,Math.max(1,r-e+1))}function p(t,e){return e[f(t,e.length)]}function h(t){return t.trim().replace(/^@+/,"").trim().toLowerCase()}var le=["doesnotexist","nonexistent","twin-missing"];function G(t){let e=h(t);return le.some(r=>e.startsWith(r))}var R=["Ada","Bo","Cleo","Dev","Esme","Finn","Gus","Hana","Ines","Jae"],L=["Barnes","Cortez","Duval","Ellery","Fontaine","Gray","Holt","Ito","Jarvis","Kade"],pe=["product design","endurance running","home coffee","indie games","urban gardening","film photography","trail maps","synth patches","bread baking","open source"],Y=["Austin, TX","Lisbon","Toronto","Berlin","Melbourne","Chicago, IL","Seoul","Bristol","Denver, CO","Osaka"];function y(t,e,r){return`https://cdn.twin.scrapecreators.test/${t}/${l(`avatar:${t}:${e}`).slice(0,24)}/${r}.jpg`}function S(t,e){let r=h(e),o=`${t}:${r}`,n=p(`first:${o}`,R),s=p(`last:${o}`,L),a=p(`topic:${o}`,pe),i=p(`city:${o}`,Y),c=d(`followers:${o}`,120,48e5),u=d(`posts:${o}`,3,9400);return{platform:t,handle:r,platformId:I(t,r),displayName:`${n} ${s}`,description:`${a} \xB7 ${i} \xB7 @${r}`,followers:c,posts:u,views:c*d(`vmult:${o}`,3,90),likes:Math.floor(c*d(`lmult:${o}`,2,40)),avatarUrl:y(t,r,720),verified:f(`verified:${o}`,5)===0,createdAt:1420070400+f(`created:${o}`,25e7)}}function J(t,e){return`${S(t,e).displayName.replace(/[^A-Za-z]/g,"").toLowerCase()}${f(`hn:${t}:${e}`,9e3)+100}`}function I(t,e){let r=l(`pid:${t}:${e}`);switch(t){case"youtube":return`UC${Buffer.from(r.slice(0,32),"hex").toString("base64url").slice(0,22)}`;case"tiktok":return String(6500000000000000000n+BigInt(parseInt(r.slice(0,15),16)%4e17));case"instagram":return String(1e9+parseInt(r.slice(0,12),16)%8e9);case"twitter":return String(7e8+parseInt(r.slice(0,12),16)%15e8);case"linkedin":return`ACoAA${Buffer.from(r.slice(0,20),"hex").toString("base64url").slice(0,15)}`}}function j(t,e={}){let r=S("youtube",t),o=`https://cdn.twin.scrapecreators.test/youtube/${l(`avatar:youtube:${r.handle}`).slice(0,24)}`,n=e.displayHandle??(t.trim().replace(/^@+/,"")||r.handle);return{channelId:e.channelId??r.platformId,channel:`http://www.youtube.com/@${n}`,name:r.displayName,avatar:{image:{sources:[{url:`${o}/48.jpg`,width:48,height:48},{url:`${o}/176.jpg`,width:176,height:176},{url:`${o}/720.jpg`,width:720,height:720}],processor:{borderImageProcessor:{circular:!0}}},avatarImageSize:"AVATAR_SIZE_XL",loggingDirectives:{trackingParams:l(`tp:${r.handle}`).slice(0,32),visibility:{types:"12"}}},description:r.description,subscriberCount:r.followers,subscriberCountText:`${x(r.followers)} subscribers`,videoCount:r.posts,videoCountText:`${x(r.posts)} videos`,viewCount:r.views,viewCountText:`${r.views.toLocaleString("en-US")} views`,joinedDateText:`Joined ${oe(r.createdAt)}`,tags:r.description,email:null,store:"",twitter:"",instagram:"",links:[],country:p(`country:youtube:${r.handle}`,je)}}var je=["United States","United Kingdom","Canada","Germany","Japan","Australia"];function z(t,e=!1){let r=S("instagram",t),o={username:r.handle,id:r.platformId,full_name:r.displayName,biography:r.description,profile_pic_url:r.avatarUrl,profile_pic_url_hd:y("instagram",r.handle,1080),edge_followed_by:{count:r.followers},edge_follow:{count:d(`following:instagram:${r.handle}`,12,3400)},edge_owner_to_timeline_media:{count:r.posts,page_info:{has_next_page:r.posts>12,end_cursor:l(`cursor:${r.handle}`).slice(0,40)},edges:[]},is_verified:r.verified,is_private:!1,is_business_account:f(`biz:${r.handle}`,3)===0};return e?{data:{user:o},status:"ok"}:{data:{user:{...o,bio_links:[],edge_related_profiles:{edges:[]}}},status:"ok"}}function H(t){let e=S("tiktok",t);return{user:{id:e.platformId,shortId:"",uniqueId:e.handle,nickname:e.displayName,avatarLarger:y("tiktok",e.handle,1080),avatarMedium:y("tiktok",e.handle,720),avatarThumb:y("tiktok",e.handle,100),signature:e.description,createTime:e.createdAt,verified:e.verified,secUid:Buffer.from(l(`sec:${e.handle}`).slice(0,40),"hex").toString("base64url"),ftc:!1,relation:0,openFavorite:!1,commentSetting:0,commerceUserInfo:{commerceUser:!1},duetSetting:0,stitchSetting:0,privateAccount:!1,secret:!1,isADVirtual:!1,roomId:"",ttSeller:!1,downloadSetting:0,profileTab:{showMusicTab:!1,showQuestionTab:!1,showPlayListTab:!1},followingVisibility:1,nickNameModifyTime:e.createdAt,isEmbedBanned:!1,canExpPlaylist:!0,profileEmbedPermission:1,language:"en",eventList:[],suggestAccountBind:!1,isOrganization:0},stats:{followerCount:e.followers,followingCount:d(`following:tiktok:${e.handle}`,4,1800),heart:e.likes,heartCount:e.likes,videoCount:e.posts,diggCount:d(`digg:tiktok:${e.handle}`,0,12e3),friendCount:d(`friend:tiktok:${e.handle}`,0,400)},itemList:[]}}function X(t){let e=S("twitter",t),r=y("twitter",e.handle,400);return{__typename:"User",id:Buffer.from(`User:${e.platformId}`).toString("base64"),rest_id:e.platformId,is_blue_verified:e.verified,profile_image_shape:"Circle",avatar:{image_url:r},legacy:{created_at:F(e.createdAt),default_profile:!1,default_profile_image:!1,description:e.description,entities:{description:{urls:[]},url:{urls:[]}},fast_followers_count:0,favourites_count:d(`favs:${e.handle}`,10,9e4),followers_count:e.followers,friends_count:d(`friends:${e.handle}`,12,6e3),has_custom_timelines:!0,is_translator:!1,listed_count:d(`listed:${e.handle}`,0,4e3),location:p(`loc:${e.handle}`,Y),media_count:d(`media:${e.handle}`,0,5e3),name:e.displayName,normal_followers_count:e.followers,pinned_tweet_ids_str:[],possibly_sensitive:!1,profile_banner_url:`https://cdn.twin.scrapecreators.test/twitter/${l(`banner:${e.handle}`).slice(0,24)}/banner.jpg`,profile_image_url_https:r,profile_interstitial_type:"",screen_name:e.handle,statuses_count:e.posts,translator_type:"none",url:"",verified:!1,withheld_in_countries:[]},tipjar_settings:{is_enabled:!1},legacy_extended_profile:{},is_profile_translatable:!1,has_hidden_subscriptions_on_profile:!1,verification_info:{is_identity_verified:e.verified},highlights_info:{can_highlight_tweets:!0,highlighted_tweets:"0"},user_seed_tweet_count:0,business_account:{},creator_subscriptions_count:0}}function Z(t){let e=S("linkedin",t);return{name:e.displayName,image:e.avatarUrl,location:p(`loc:linkedin:${e.handle}`,Y),followers:e.followers,connections:e.followers>500?"500+":String(e.followers),about:e.description,recentPosts:[],experience:[],articles:[],activity:[],education:[],publications:[],projects:[],recommendations:[],similarProfiles:[]}}function v(t,e,r,o){let n=`${t}:${e}`,s=o?h(o):`${p(`h1:${n}`,R)}${f(`h2:${n}`,1e3)}`.toLowerCase(),a=p(`ctopic:${n}`,pe),i=d(`cviews:${n}`,40,124e5);return{platform:t,url:e,contentId:r,handle:s,platformId:I(t,s),title:`${a} \u2014 part ${1+f(`cpart:${n}`,40)}`,description:`A post about ${a}. #${a.replace(/\s+/g,"")}`,thumbnailUrl:`https://cdn.twin.scrapecreators.test/${t}/content/${l(n).slice(0,24)}/thumb.jpg`,views:i,likes:Math.floor(i/d(`clike:${n}`,8,120)),comments:Math.floor(i/d(`ccom:${n}`,200,4e3)),publishedAt:1609459200+f(`cpub:${n}`,16e7)}}function Q(t,e){let r=v("youtube",t,e);return{id:r.contentId,thumbnail:r.thumbnailUrl,url:t,publishDate:new Date(r.publishedAt*1e3).toISOString(),publishDateText:oe(r.publishedAt),type:"video",title:r.title,description:r.description,descriptionLinks:[],commentCountText:x(r.comments),commentCountInt:r.comments,likeCountText:x(r.likes),likeCountInt:r.likes,viewCountText:`${r.views.toLocaleString("en-US")} views`,viewCountInt:r.views,collaborators:[],channel:{id:I("youtube",r.handle),url:`https://www.youtube.com/@${r.handle}`,handle:`@${r.handle}`,title:`${p(`cf:${t}`,R)} ${p(`cl:${t}`,L)}`},thumbnailUrl:r.thumbnailUrl,chapters:[],watchNextVideos:[],keywords:[],genre:"People & Blogs",durationMs:de(t),durationFormatted:He(de(t)),most_replayed:null,captionTracks:[]}}function q(t,e){let r=v("instagram",t,e),o=f(`igvideo:${t}`,2)===0;return{data:{xdt_shortcode_media:{__typename:o?"GraphVideo":"GraphImage",id:String(d(`igid:${t}`,10**12,9*10**12)),shortcode:r.contentId,taken_at_timestamp:r.publishedAt,display_url:r.thumbnailUrl,thumbnail_src:r.thumbnailUrl,owner:{id:I("instagram",r.handle),username:r.handle,full_name:r.title},edge_media_preview_like:{count:r.likes},edge_media_to_comment:{count:r.comments},edge_media_to_caption:{edges:[{node:{text:r.description}}]},video_play_count:o?r.views:0,video_view_count:o?r.views:0,is_video:o,dimensions:{height:1350,width:1080}}},status:"ok"}}function ee(t,e,r){let o=v("twitter",t,e,r);return{__typename:"Tweet",rest_id:o.contentId,core:{user_results:{result:{__typename:"User",rest_id:o.platformId,core:{screen_name:o.handle,name:`${p(`tf:${t}`,R)} ${p(`tl:${t}`,L)}`,created_at:F(o.publishedAt-1e7)}}}},views:{count:String(o.views),state:"EnabledWithCount"},legacy:{created_at:F(o.publishedAt),conversation_id_str:o.contentId,full_text:o.description,favorite_count:o.likes,reply_count:o.comments,retweet_count:Math.floor(o.likes/6),quote_count:Math.floor(o.likes/20),bookmark_count:Math.floor(o.likes/9),lang:"en",is_quote_status:!1,possibly_sensitive:!1}}}function te(t,e,r){let o=v("tiktok",t,e,r);return{aweme_detail:{aweme_id:o.contentId,desc:o.description,create_time:o.publishedAt,create_time_utc:me(o.publishedAt),author:{uid:o.platformId,unique_id:o.handle,nickname:o.title,avatar_thumb:{url_list:[y("tiktok",o.handle,100)]}},statistics:{aweme_id:o.contentId,play_count:o.views,digg_count:o.likes,comment_count:o.comments,share_count:Math.floor(o.likes/12),collect_count:Math.floor(o.likes/5)},video:{cover:{url_list:[o.thumbnailUrl]},duration:d(`tdur:${t}`,3e3,18e4),play_addr:{uri:o.contentId,url_list:[`${o.thumbnailUrl.replace("thumb.jpg","play.mp4")}`]}},status:{is_delete:!1,allow_share:!0,is_private:!1},music:{id_str:l(`music:${t}`).slice(0,19),title:"original sound"}},status_code:0}}function re(t,e){let r=v("linkedin",t,e);return{name:r.title,headline:r.title,description:r.description,datePublished:new Date(r.publishedAt*1e3).toISOString(),likeCount:r.likes,commentCount:r.comments,repostCount:Math.floor(r.likes/15),url:t,author:{name:`${p(`lf:${t}`,R)} ${p(`ll:${t}`,L)}`,url:`https://www.linkedin.com/in/${r.handle}`,followers:d(`lfoll:${t}`,100,9e5),image:y("linkedin",r.handle,400)}}}function de(t){return d(`dur:${t}`,15e3,36e5)}function He(t){let e=Math.floor(t/1e3),r=o=>String(o).padStart(2,"0");return`${r(Math.floor(e/3600))}:${r(Math.floor(e%3600/60))}:${r(e%60)}`}function x(t){return t>=1e6?`${Math.round(t/1e5)/10}M`:t>=1e3?`${Math.round(t/100)/10}K`:String(t)}var fe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function oe(t){let e=new Date(t*1e3);return`${fe[e.getUTCMonth()]} ${e.getUTCDate()}, ${e.getUTCFullYear()}`}function F(t){let e=new Date(t*1e3),r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],o=n=>String(n).padStart(2,"0");return`${r[e.getUTCDay()]} ${fe[e.getUTCMonth()]} ${o(e.getUTCDate())} ${o(e.getUTCHours())}:${o(e.getUTCMinutes())}:${o(e.getUTCSeconds())} +0000 ${e.getUTCFullYear()}`}function me(t){return new Date(t*1e3).toISOString().replace("T"," ").replace(/\.\d+Z$/,"")}var he=["youtube","instagram","tiktok","twitter","linkedin"];function ne(t){return he.includes(t)}var T="scrapecreators",Ke=new Set(["/v1/account/credit-balance","/v1/account/get-api-usage","/v1/account/get-daily-usage-count","/v1/account/get-most-used-routes"]),D="1970-01-01T00:00:00.000Z",be=1e6,ge=1;function g(t,e){return{status:t,body:{success:!1,message:e}}}function O(t,e){return{status:t,body:{message:e}}}function Ye(t){if(!t?.trim())return{};try{let e=JSON.parse(t);return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function ke(t){let e=w(t);if(!e)return null;let r=e.hostname.replace(/^www\./,"");if(r==="youtu.be")return e.pathname.slice(1).split("/")[0]||null;if(r!=="youtube.com"&&r!=="m.youtube.com")return null;let o=e.searchParams.get("v");return o||(e.pathname.match(/^\/(?:shorts|live|embed)\/([^/?]+)/)?.[1]??null)}function Se(t){let e=w(t);return!e||e.hostname.replace(/^www\./,"")!=="instagram.com"?null:e.pathname.match(/^\/(?:p|reel|reels|tv)\/([^/?]+)/)?.[1]??null}function ve(t){let e=w(t);if(!e||!e.hostname.replace(/^www\./,"").endsWith("tiktok.com"))return null;let r=e.pathname.match(/^\/@([^/]+)\/(?:video|photo)\/([^/?]+)/);return r?{handle:r[1],awemeId:r[2]}:null}function Ce(t){let e=w(t);if(!e)return null;let r=e.hostname.replace(/^www\./,"");if(r!=="twitter.com"&&r!=="x.com")return null;let o=e.pathname.match(/^\/([^/]+)\/status(?:es)?\/([^/?]+)/);return o?{handle:o[1],tweetId:o[2]}:null}function $e(t){let e=w(t);if(!e||!e.hostname.replace(/^www\./,"").endsWith("linkedin.com"))return null;let r=e.pathname.match(/^\/posts\/([^/?]+)/);return r?r[1]:e.pathname.match(/^\/feed\/update\/([^/?]+)/)?.[1]??null}function Te(t){let e=w(t);return!e||!e.hostname.replace(/^www\./,"").endsWith("linkedin.com")?null:e.pathname.match(/^\/in\/([^/?]+)/)?.[1]??null}function w(t){if(!t?.trim())return null;try{let e=new URL(t.trim());return e.protocol==="http:"||e.protocol==="https:"?e:null}catch{return null}}function A(t,e){return Ve(T,t).filter(r=>r.type===e)}function W(t){let e=A(t,"account").find(r=>r.id==="account");return e?{remaining:Number(e.remaining),rev:Number(e.rev??0)}:{remaining:be,rev:0}}async function Ae(t,e){let{rev:r}=W(e.root);await B(T,{operation:"account.credits",subjectType:"account",subjectId:"account",fields:{id:"account",remaining:t,rev:r+1},occurredAt:e.occurredAt??D,actor:{kind:"system"}},e.root)}async function P(t,e){if(t.readOnly)return;let r=A(t.root,"usage"),o=r.reduce((i,c)=>Math.max(i,Number(c.seq??0)),0)+1,n=t.occurredAt??D,s=new Set(r.map(i=>String(i.id))),a="";for(let i=0;i<8&&(a=`use_${We("sha256").update(`scrapecreators-twin-usage:${e.endpoint}:${e.statusCode}:${e.credits}:${n}:${o}:${i}`).digest("hex").slice(0,16)}`,!!s.has(a));i+=1);try{await B(T,{operation:"usage.append",subjectType:"usage",subjectId:a,fields:{id:a,...e,method:e.method??"GET",seq:o,timestamp:n},occurredAt:n,actor:{kind:"system"}},t.root)}catch{}}function Ee(t){return A(t,"usage").map(e=>({id:String(e.id),endpoint:String(e.endpoint),statusCode:Number(e.statusCode),credits:Number(e.credits),method:String(e.method??"GET"),timestamp:String(e.timestamp),seq:Number(e.seq??0)})).sort((e,r)=>e.seq-r.seq)}function Je(t){let e=80+f(`dur:${t.endpoint}:${t.seq}`,1400);return{id:t.id,endpoint:t.endpoint,http_method:t.method,status_code:t.statusCode,success:t.statusCode>=200&&t.statusCode<300,credits:t.credits,duration_ms:e,duration_secs:Math.round(e/1e3),request_payload:Ze(String(t.endpoint)),request_time:t.timestamp,response_time:new Date(Date.parse(t.timestamp)+e).toISOString(),created_at:t.timestamp}}var ze=8;function Xe(t){let e=ze*36e5;return Math.floor((t+e)/864e5)*864e5-e}function Ze(t){let e=t.indexOf("?");if(e<0)return{};let r={};for(let[o,n]of new URLSearchParams(t.slice(e+1)))r[o]=n;return r}function _e(t,e){let r=[...e.searchParams.entries()].filter(([o])=>o!=="cache_max_age").sort(([o],[n])=>o.localeCompare(n));return`GET ${t}?${r.map(([o,n])=>`${o}=${n}`).join("&")}`}var ye={"1d":1,"3d":3,"7d":7,"14d":14,"30d":30};function Qe(t,e,r,o){let n=A(o,"cache").find(i=>i.key===t);if(!n)return null;let s=String(n.cachedAt),a=r-Date.parse(s);return!Number.isFinite(a)||a<0?null:a<=e*864e5?{body:n.body,cachedAt:s}:null}async function qe(t,e,r){let o=r.occurredAt??D;try{await B(T,{operation:"cache.store",subjectType:"cache",subjectId:`cache_${l(t).slice(0,16)}`,fields:{id:`cache_${l(t).slice(0,16)}`,key:t,body:e,cachedAt:o},occurredAt:o,actor:{kind:"system"}},r.root)}catch{}}function xe(t,e,r){let o=`${t}:${h(e)}`,n=A(r,"profile").find(s=>s.key===o);return n?n.body:null}function U(t,e,r){let o=`${t}:${Re(e)}`,n=A(r,"content").find(s=>s.key===o);return n?n.body:null}function Re(t){let e=w(t);if(!e)return t.trim();e.hostname=e.hostname.toLowerCase();for(let r of["utm_source","utm_medium","utm_campaign","si","feature","igshid","t"])e.searchParams.delete(r);return e.pathname=e.pathname.replace(/\/$/,""),e.toString()}var _=t=>({ok:!1,status:400,message:`${t} is required`}),C=t=>({ok:!1,status:404,message:`${t} not found`}),et="restricted";function tt(t){return h(t).startsWith(et)}function $(t,e,r,o,n={}){let s=n.subjectKey??h(e),a=xe(t,s,r.root);return a?{ok:!0,payload:a}:tt(s)?{ok:!0,restricted:!0,payload:{message:"This profile is restricted",handle:s}}:G(s)?{ok:!1,status:404,message:`Profile ${s} doesn't exist`}:{ok:!0,payload:o(s)}}function we(t,e,r){let o=e.searchParams.get("handle"),n=e.searchParams.get("url");switch(t){case"/v1/tiktok/profile":{let s=e.searchParams.get("user_id");if(!o&&!s)return _("handle or user_id");if(!o&&s){let a=`uid:${s}`;return $("tiktok",a,r,()=>{let i=J("tiktok",a),c=H(i);return{...c,user:{...c.user,id:s,uniqueId:i}}},{subjectKey:a})}return $("tiktok",o,r,H)}case"/v1/instagram/profile":{if(!o)return _("handle");let s=e.searchParams.get("trim")==="true";return $("instagram",o,r,a=>z(a,s))}case"/v1/youtube/channel":{let s=e.searchParams.get("channelId"),a=n?w(n)?.pathname.match(/^\/@([^/?]+)/)?.[1]??null:null,i=o??a??s;if(!i)return _("channelId, handle or url");if(!o&&!a&&s){let c=`ucid:${s}`;return $("youtube",c,r,()=>j(c,{channelId:s,displayHandle:J("youtube",c)}),{subjectKey:c})}return $("youtube",i,r,c=>j(c,{displayHandle:i.trim().replace(/^@+/,"")}))}case"/v1/twitter/profile":return o?$("twitter",o,r,X):_("handle");case"/v1/linkedin/profile":{if(!n)return _("url");let s=Te(n);if(!s)return C("LinkedIn profile");let a=xe("linkedin",s,r.root);return a?{ok:!0,payload:a}:G(s)?{ok:!1,status:404,message:`Profile ${s} doesn't exist`}:{ok:!0,payload:Z(s)}}case"/v1/youtube/video":{if(!n)return _("url");let s=U("youtube",n,r.root);if(s)return{ok:!0,payload:s};let a=ke(n);return a?a.toLowerCase().startsWith("agerestricted")?{ok:!1,status:403,message:"This video is age restricted"}:{ok:!0,payload:Q(n,a)}:C("Video")}case"/v1/instagram/post":{if(!n)return _("url");let s=U("instagram",n,r.root);if(s)return{ok:!0,payload:s};let a=Se(n);return a?{ok:!0,payload:q(n,a)}:C("Post")}case"/v1/twitter/tweet":{if(!n)return _("url");let s=U("twitter",n,r.root);if(s)return{ok:!0,payload:s};let a=Ce(n);return a?{ok:!0,payload:ee(n,a.tweetId,a.handle)}:C("Tweet")}case"/v2/tiktok/video":{if(!n)return _("url");let s=U("tiktok",n,r.root);if(s)return{ok:!0,payload:s};let a=ve(n);return a?{ok:!0,payload:te(n,a.awemeId,a.handle)}:C("Video")}case"/v1/linkedin/post":{if(!n)return _("url");let s=U("linkedin",n,r.root);if(s)return{ok:!0,payload:s};let a=$e(n);return a?{ok:!0,payload:re(n,a)}:C("Post")}default:return null}}async function rt(t,e,r,o){let n=`${t}${e.search}`;if(!o.ok)return await P(r,{endpoint:n,statusCode:o.status,credits:0}),g(o.status,o.message);let{remaining:s}=W(r.root),a=Date.parse(r.occurredAt??D),i=o.restricted===!0,c=e.searchParams.get("cache_max_age");if(c!==null&&!(c in ye))return await P(r,{endpoint:n,statusCode:400,credits:0}),g(400,"cache_max_age must be one of 1d, 3d, 7d, 14d, 30d");let u=c?ye[c]:null;if(u!==null&&!i){let E=Qe(_e(t,e),u,a,r.root);if(E)return await P(r,{endpoint:n,statusCode:200,credits:0}),{status:200,body:{success:!0,credits_remaining:s,credits_charged:0,cached:!0,cached_at:E.cachedAt,...E.body}}}if(s<ge)return await P(r,{endpoint:n,statusCode:402,credits:0}),g(402,M);let m=r.readOnly?0:ge,k=s-m;return r.readOnly||(await Ae(k,r),u!==null&&!i&&await qe(_e(t,e),o.payload,r)),await P(r,{endpoint:n,statusCode:200,credits:m}),i?{status:200,body:{success:!1,credits_remaining:k,credits_charged:m,...o.payload}}:{status:200,body:{success:!0,credits_remaining:k,credits_charged:m,...o.payload}}}async function se(t){let e=t.method.toUpperCase(),r=new URL(t.path,"http://twin.local"),o=r.pathname.replace(/^\/api(?=\/)/,"").replace(/\/+$/,"")||"/";if(e==="GET"&&Ke.has(o)){let a=t.headers===void 0?"twin-implicit":t.headers["x-api-key"]??t.headers["X-Api-Key"]??"";if(!String(a).trim())return o==="/v1/account/credit-balance"?g(500,"apiKey is required"):O(401,"Missing x-api-key header");let i=N(t.headers);return ot(o,r,t,i.ok)}let n=o==="/twin/profile"||o==="/twin/content"||o==="/twin/credits";if(!n&&!(e==="GET"&&we(o,r,t)!==null))return O(404,"Not Found");let s=N(t.headers);if(!s.ok)return g(s.status,s.message);if(n)return e!=="POST"?O(404,"Not Found"):t.readOnly?g(405,"twin is read-only"):nt(o,t);if(e==="GET"){let a=we(o,r,t);if(a)return rt(o,r,t,a)}return O(404,"Not Found")}async function ot(t,e,r,o=!0){let n=Ee(r.root);switch(t){case"/v1/account/credit-balance":{let s=o?W(r.root).remaining:0;return{status:200,body:{success:!0,creditCount:s,message:`You have ${s} credits remaining.`}}}case"/v1/account/get-api-usage":{let s=e.searchParams.get("endpoint"),a=e.searchParams.get("statusCode"),i=Math.max(1,Number(e.searchParams.get("page")??"1")||1),c=n.filter(m=>s?m.endpoint.includes(s):!0).filter(m=>a?m.statusCode===Number(a):!0),u=100;return{status:200,body:c.slice((i-1)*u,i*u).map(Je)}}case"/v1/account/get-daily-usage-count":{let s=new Map;for(let i of n){let c=Xe(Date.parse(String(i.timestamp))),u=s.get(c)??{start:c,credits:0,requests:0};u.credits+=i.credits,u.requests+=1,s.set(c,u)}return{status:200,body:[...s.values()].sort((i,c)=>i.start-c.start).map(i=>({usage_date:new Date(i.start).toISOString(),total_credits:String(i.credits),request_count:String(i.requests)}))}}case"/v1/account/get-most-used-routes":{let s=new Map;for(let i of n){let c=String(i.endpoint).split("?")[0],u=s.get(c)??{base_endpoint:c,count:0,credits:0};u.count+=1,u.credits+=i.credits,s.set(c,u)}return{status:200,body:[...s.values()].sort((i,c)=>c.count-i.count||i.base_endpoint.localeCompare(c.base_endpoint)).slice(0,20).map(i=>({base_endpoint:i.base_endpoint,call_count:String(i.count),total_credits:String(i.credits)}))}}default:return O(404,"Not Found")}}async function nt(t,e){let r=Ye(e.body),o=e.occurredAt??D;if(t==="/twin/credits"){let u=Number(r.remaining);return!Number.isFinite(u)||u<0?g(400,"remaining must be a non-negative number"):(await Ae(Math.floor(u),e),{status:200,body:{success:!0,creditCount:Math.floor(u)}})}let n=String(r.platform??"");if(!ne(n))return g(400,"platform must be one of youtube, instagram, tiktok, twitter, linkedin");if(!r.body||typeof r.body!="object")return g(400,"body is required");if(t==="/twin/profile"){let u=h(String(r.handle??""));if(!u)return g(400,"handle is required");let m=`${n}:${u}`,k=`prof_${l(m).slice(0,16)}`;return{status:200,body:await B(T,{operation:"profile.upsert",subjectType:"profile",subjectId:k,fields:{id:k,key:m,platform:n,handle:u,body:r.body},occurredAt:o,actor:{kind:"system"}},e.root)}}let s=String(r.url??"");if(!s)return g(400,"url is required");let a=`${n}:${Re(s)}`,i=`cont_${l(a).slice(0,16)}`;return{status:200,body:await B(T,{operation:"content.upsert",subjectType:"content",subjectId:i,fields:{id:i,key:a,platform:n,url:s,body:r.body},occurredAt:o,actor:{kind:"system"}},e.root)}}import{serveHttp as Ot}from"../../engine/v2/volter_world-core.mjs";import{createTwinFetchFromHandler as st,statefulTwinManifest as at,withRequestScopes as it}from"../../engine/v2/volter_world-core.mjs";function Ie(t={}){return it(st(se,{...t,manifest:at({vendor:"scrapecreators",twinOf:"the ScrapeCreators social-scraping API",stores:"deterministic profile/post payloads per platform handle or URL"})}),{refuse:()=>Response.json({success:!1,message:"this request is read-only"},{status:405})})}import{confirmAction as Vt,deployableEntries as Kt,observeResources as pt,ownFields as ft,twinResources as mt}from"../../engine/v2/volter_world-core.mjs";import{declareRateBudget as ct,rateBudgetPath as Ft,rateBudgetWeight as Gt,RateBudget as Lt}from"../../engine/v2/volter_world-core.mjs";import{RateBudgetError as Be}from"../../engine/v2/volter_world-core.mjs";var ut="scrapecreators",Pe=6e4,Ue=60,Oe=300,b={tiktokAudience:52,googleAdDetails:50,instagramReplies:30,aiTranscript:22,downloadMedia:20,other:2},V={windowMs:Pe,ceiling:Ue,defaultWeight:b.other,maxRetryAfterSeconds:Oe,rules:[{match:"^[A-Z]+ /v1/tiktok/user/audience$",weight:b.tiktokAudience},{match:"^[A-Z]+ /v1/google/company/ads$",weight:b.googleAdDetails,whenQueryPresent:["get_ad_details"]},{match:"^[A-Z]+ /v2/instagram/post/comments$",weight:b.instagramReplies,whenQueryPresent:["include_replies"]},{match:"^[A-Z]+ /v1/tiktok/video/transcript$",weight:b.aiTranscript,whenQueryPresent:["use_ai_as_fallback"]},{match:"^[A-Z]+ /v2/tiktok/video$",weight:b.downloadMedia,whenQueryPresent:["download_media"]},{match:"^[A-Z]+ /v1/instagram/post$",weight:b.downloadMedia,whenQueryPresent:["download_media"]}],reason:`ScrapeCreators publishes NO scalar rate limit. Its entire published guidance (docs.scrapecreators.com/introduction) is "Scrape Creators does not enforce API rate limits. For now, we recommend keeping usage below 500 concurrent requests" \u2014 a concurrency suggestion, not a rate \u2014 and no Retry-After or X-RateLimit-* headers appear on live responses. So there is no vendor number to be more permissive than, and this declaration deliberately reproduces the kernel fallback's rate exactly: 60 weighted units / 60s at 2 units per ordinary call = 30 calls per minute. That is a sizing decision, not a model of a vendor limit. What this budget really guards is MONEY, not a lockout: ScrapeCreators is credit-metered and answers HTTP 402 once a prepaid balance is exhausted, so weights are the vendor's own credit costs at 2 units per credit, taken from the first-party OpenAPI document: /v1/tiktok/user/audience 26 credits (52 units), /v1/google/company/ads 25 with get_ad_details (50 units), /v2/instagram/post/comments 15 with include_replies (30 units), /v1/tiktok/video/transcript 11 with use_ai_as_fallback (22 units), /v2/tiktok/video and /v1/instagram/post 10 with download_media (20 units), everything else 1 credit (2 units). The ceiling is 60 so the dearest documented endpoint is still callable rather than refused outright.`};ct(ut,V);var ht="1970-01-01T00:00:00.000Z";var gt={youtube:{path:"/v1/youtube/channel",param:"handle"},instagram:{path:"/v1/instagram/profile",param:"handle"},tiktok:{path:"/v1/tiktok/profile",param:"handle"},twitter:{path:"/v1/twitter/profile",param:"handle"},linkedin:{path:"/v1/linkedin/profile",param:"url"}};function _t(t){if(t.platform==="linkedin"){if(!t.url)return null;let e=t.url.match(/\/in\/([^/?]+)/);return e?h(e[1]):null}return t.handle?h(t.handle):null}async function yt(t,e){let r=[];for(let o of e){let n=gt[o.platform];if(!n)continue;let s=n.param==="url"?o.url:o.handle;if(!s)continue;let a=_t(o);if(!a)continue;let i=await t({method:"GET",path:`${n.path}?${n.param}=${encodeURIComponent(s)}`});if(i.status<200||i.status>=300)continue;let c=i.data;if(!c||c.success===!1)continue;let{success:u,credits_remaining:m,credits_charged:k,cached:E,cached_at:St,...Fe}=c,ae=`${o.platform}:${a}`,ie=`prof_${l(ae).slice(0,16)}`;r.push({type:"profile",id:ie,fields:{id:ie,key:ae,platform:o.platform,handle:a,body:Fe,source:"connector"}})}return r}async function De(t,e={}){let r=e.targets??e.accounts??[],o=await yt(t,r),n=(s=>pt("scrapecreators",o,{...e.root!==void 0?{root:e.root}:{},at:s,batch:`obs:scrapecreators:${s}`}))(e.occurredAt??ht);return{observed:o.length,deltasAppended:n.appended}}function wt(t){return async e=>{let r=await t({method:e.method,path:e.path,headers:{accept:"application/json","content-type":"application/json","x-api-key":"twin"},...e.body===void 0?{}:{body:JSON.stringify(e.body)}}),o={};try{o=JSON.parse(r.body||"{}")}catch{o={}}return{status:r.status,data:o}}}async function Me(t,e={}){let r=[],o=new Set;for(let n of mt("scrapecreators",e.root)){if(n.type!=="profile")continue;let s=ft(n),a=typeof s.platform=="string"?s.platform:"",i=typeof s.handle=="string"?s.handle:"";if(!a||!i)continue;let c=`${a}:${i}`;o.has(c)||(o.add(c),r.push({platform:a,handle:i}))}return De(wt(t),{targets:r.sort((n,s)=>`${n.platform}:${n.handle}`.localeCompare(`${s.platform}:${s.handle}`)),...e.root!==void 0?{root:e.root}:{},occurredAt:e.occurredAt??new Date().toISOString()})}async function Ne(t,e,r){let o=e.operation??`${e.subject.type}.update`;return{externalId:e.subject.id,data:{performed:!1,reason:`${o} has nowhere to go: ScrapeCreators publishes no write endpoint at all, so this stays this world's own record (scrapecreators.connector.push_vendor_writes)`}}}import{registerPack as bt}from"../../engine/v2/volter_world-core.mjs";var kt={protocol:"2",refresh:{every:"1h",webhook:!1,onDemand:{atMost:"60s"}},stateSystem:{perform:Ne,refresh:Me},roundTrip:{method:"GET",path:"/v1/instagram/profile?handle=roundtrip",headers:{"x-api-key":"round-trip"}},parityOrigin:"http://twin",vendor:"scrapecreators",rateBudget:V,transport:"rest",archetype:"crud",bin:"world-scrapecreators",resources:["profile","content","cache","account","usage"],specSource:"ScrapeCreators' first-party OpenAPI document (docs.scrapecreators.com/openapi.json \u2014 183 paths / 186 operations across 36 platform tag groups, measured 2026-09-02), plus the introduction page's status-code table and the caching page. The twin models the social-profile and social-content lookups a real consumer reaches for (Dub's partner-platform profile + bounty content pipeline) across youtube/instagram/tiktok/twitter/linkedin, the /v1/account/* credit + usage reports, the shared success/error envelope and the credit + cache_max_age billing semantics \u2014 deterministic synthetic profiles seeded by handle, in vendor-faithful per-platform response shapes.",description:"ScrapeCreators twin \u2014 deterministic, offline replicas of the ScrapeCreators social-scraping API in vendor-faithful per-platform response shapes, with the real x-api-key gate, the success/credits_remaining/credits_charged envelope, credit metering (402), cache_max_age hits at 0 credits, and 400/401/402/404 error semantics. Unmodeled platforms 404 like the vendor.",adoption:{pypi:[],sdks:["@scrapecreators/cli"],envStems:["SCRAPECREATORS"]},hosts:[{host:"api.scrapecreators.com"}],browserRouting:{apiPathPrefix:"/v1/",loaderHost:"https://api.scrapecreators.com"}};bt(kt);export{Ie as createTwinFetch};
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,8 @@
1
+ @agenttwin/twin-segment
2
+
3
+ Contains @volter/twin-segment 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.
8
+ The upstream package declares Apache-2.0 but ships no LICENSE file; LICENSE is the license's standard text.