agenttwin 0.3.21 → 0.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (411) hide show
  1. package/dist/api.js +2113 -609
  2. package/dist/dashboard/assets/dashboard/agent-home.css +7 -7
  3. package/dist/dashboard/assets/dashboard/bay-morning.webp +0 -0
  4. package/dist/dashboard/assets/dashboard/golden-gate-afternoon.webp +0 -0
  5. package/dist/dashboard/assets/dashboard/golden-gate-portrait.webp +0 -0
  6. package/dist/dashboard/assets/dashboard/moonlit-coast.webp +0 -0
  7. package/dist/dashboard/assets/next/static/chunks/{1250-7571b1a697f6bb4a.js → 1250-a3c859fd20517500.js} +1 -1
  8. package/dist/dashboard/assets/next/static/chunks/{2743-a0efd6f4aeb11cc5.js → 2743-72610a5d5a3f8462.js} +1 -1
  9. package/dist/dashboard/assets/next/static/chunks/5663-403316746afad10e.js +1 -0
  10. package/dist/dashboard/assets/next/static/chunks/app/dashboard/{page-9c11295678539a5f.js → page-0e0392368e0a891e.js} +1 -1
  11. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-4981ea4966b19e3e.js +1 -0
  12. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-dd4ac0f5f36e6bfa.js +1 -0
  13. package/dist/dashboard/assets/next/static/chunks/app/v2/dashboard/{page-34574448d210c775.js → page-de0fe6d84be21e6a.js} +1 -1
  14. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-360cbffc57981f6b.js +1 -0
  15. package/dist/dashboard/assets/next/static/chunks/app/v2/page-fc4df4912ce3af44.js +1 -0
  16. package/dist/dashboard/assets/next/static/chunks/{webpack-40324749d289e4a5.js → webpack-9e40ef55e5f2fb53.js} +1 -1
  17. package/dist/dashboard/assets/next/static/css/{42045de5f39b50ca.css → 37d81e1d2804cc5f.css} +1 -1
  18. package/dist/dashboard/assets/next/static/css/69ec1bae997c3bb0.css +1 -0
  19. package/dist/dashboard/assets/next/static/css/ad85402a1595e56e.css +1 -0
  20. package/dist/dashboard/assets/next/static/css/{4bbe78c2fe206b92.css → da981fb878a02b8c.css} +1 -1
  21. package/dist/dashboard/assets/next/static/media/bay-morning.82669113.webp +0 -0
  22. package/dist/dashboard/assets/next/static/media/golden-gate-afternoon.0aa49492.webp +0 -0
  23. package/dist/dashboard/assets/next/static/media/golden-gate-portrait.89fc667a.webp +0 -0
  24. package/dist/dashboard/assets/next/static/media/moonlit-coast.09739ef4.webp +0 -0
  25. package/dist/dashboard/index.html +2 -2
  26. package/dist/engine.js +6386 -4974
  27. package/dist/gateway.js +2194 -604
  28. package/dist/twins/catalog.json +6020 -0
  29. package/dist/twins/engine/v2/THIRD-PARTY.txt +25 -0
  30. package/dist/twins/engine/v2/chunks/2CHBP57N.mjs +8 -0
  31. package/dist/twins/engine/v2/chunks/4CPL6MPF.mjs +30 -0
  32. package/dist/twins/engine/v2/chunks/OYLYKZGD.mjs +2 -0
  33. package/dist/twins/engine/v2/chunks/SQSP35HM.mjs +38 -0
  34. package/dist/twins/engine/v2/chunks/YSJQQVUM.mjs +2 -0
  35. package/dist/twins/engine/v2/react-dom_client.mjs +272 -0
  36. package/dist/twins/engine/v2/react-dom_server.mjs +263 -0
  37. package/dist/twins/engine/v2/react.mjs +2 -0
  38. package/dist/twins/engine/v2/react_jsx-runtime.mjs +31 -0
  39. package/dist/twins/engine/v2/volter_world-core.mjs +195 -0
  40. package/dist/twins/engine/v2/volter_world-core_app-route.mjs +2 -0
  41. package/dist/twins/engine/v2/volter_world-core_network-policy.mjs +2 -0
  42. package/dist/twins/engine/v3/THIRD-PARTY.txt +65 -0
  43. package/dist/twins/engine/v3/chunks/2CHBP57N.mjs +8 -0
  44. package/dist/twins/engine/v3/chunks/2YSSPA5O.mjs +65 -0
  45. package/dist/twins/engine/v3/chunks/5PWRY4UK.mjs +154 -0
  46. package/dist/twins/engine/v3/chunks/7XRKSFFJ.mjs +2 -0
  47. package/dist/twins/engine/v3/chunks/AWOWH2H5.mjs +2 -0
  48. package/dist/twins/engine/v3/chunks/C46M5U3Q.mjs +2 -0
  49. package/dist/twins/engine/v3/chunks/MFH2VZPP.mjs +2 -0
  50. package/dist/twins/engine/v3/chunks/MWCO5UV3.mjs +2 -0
  51. package/dist/twins/engine/v3/chunks/N5BL5RDF.mjs +313 -0
  52. package/dist/twins/engine/v3/chunks/O7HGPMXG.mjs +2 -0
  53. package/dist/twins/engine/v3/chunks/OYLYKZGD.mjs +2 -0
  54. package/dist/twins/engine/v3/chunks/PLB7HTON.mjs +8 -0
  55. package/dist/twins/engine/v3/chunks/TY4LDBVH.mjs +7 -0
  56. package/dist/twins/engine/v3/chunks/VDIRUSCM.mjs +2 -0
  57. package/dist/twins/engine/v3/chunks/WGUCFQK6.mjs +2 -0
  58. package/dist/twins/engine/v3/chunks/WPATONSC.mjs +2 -0
  59. package/dist/twins/engine/v3/react_jsx-runtime.mjs +2 -0
  60. package/dist/twins/engine/v3/volter_world-core.mjs +2 -0
  61. package/dist/twins/engine/v3/volter_world-ui.mjs +559 -0
  62. package/dist/twins/packs/ahrefs/LICENSE +202 -0
  63. package/dist/twins/packs/ahrefs/NOTICE +7 -0
  64. package/dist/twins/packs/ahrefs/index.mjs +2 -0
  65. package/dist/twins/packs/ai-gateway/LICENSE +202 -0
  66. package/dist/twins/packs/ai-gateway/NOTICE +7 -0
  67. package/dist/twins/packs/ai-gateway/index.mjs +14 -0
  68. package/dist/twins/packs/airtable/LICENSE +202 -0
  69. package/dist/twins/packs/airtable/NOTICE +7 -0
  70. package/dist/twins/packs/airtable/index.mjs +2 -0
  71. package/dist/twins/packs/algolia/LICENSE +202 -0
  72. package/dist/twins/packs/algolia/NOTICE +7 -0
  73. package/dist/twins/packs/algolia/index.mjs +2 -0
  74. package/dist/twins/packs/ambientcg/LICENSE +202 -0
  75. package/dist/twins/packs/ambientcg/NOTICE +7 -0
  76. package/dist/twins/packs/ambientcg/index.mjs +2 -0
  77. package/dist/twins/packs/anthropic/LICENSE +202 -0
  78. package/dist/twins/packs/anthropic/NOTICE +7 -0
  79. package/dist/twins/packs/anthropic/index.mjs +18 -0
  80. package/dist/twins/packs/assemblyai/LICENSE +202 -0
  81. package/dist/twins/packs/assemblyai/NOTICE +7 -0
  82. package/dist/twins/packs/assemblyai/index.mjs +11 -0
  83. package/dist/twins/packs/aws/LICENSE +202 -0
  84. package/dist/twins/packs/aws/NOTICE +7 -0
  85. package/dist/twins/packs/aws/index.mjs +2 -0
  86. package/dist/twins/packs/azure/LICENSE +202 -0
  87. package/dist/twins/packs/azure/NOTICE +7 -0
  88. package/dist/twins/packs/azure/index.mjs +38 -0
  89. package/dist/twins/packs/azureformrecognizer/LICENSE +202 -0
  90. package/dist/twins/packs/azureformrecognizer/NOTICE +7 -0
  91. package/dist/twins/packs/azureformrecognizer/index.mjs +3 -0
  92. package/dist/twins/packs/bitly/LICENSE +202 -0
  93. package/dist/twins/packs/bitly/NOTICE +7 -0
  94. package/dist/twins/packs/bitly/index.mjs +2 -0
  95. package/dist/twins/packs/bluesky/LICENSE +202 -0
  96. package/dist/twins/packs/bluesky/NOTICE +7 -0
  97. package/dist/twins/packs/bluesky/index.mjs +30 -0
  98. package/dist/twins/packs/calcom/LICENSE +202 -0
  99. package/dist/twins/packs/calcom/NOTICE +7 -0
  100. package/dist/twins/packs/calcom/index.mjs +2 -0
  101. package/dist/twins/packs/clerk/LICENSE +202 -0
  102. package/dist/twins/packs/clerk/NOTICE +7 -0
  103. package/dist/twins/packs/clerk/index.mjs +5 -0
  104. package/dist/twins/packs/cloudflare/LICENSE +202 -0
  105. package/dist/twins/packs/cloudflare/NOTICE +7 -0
  106. package/dist/twins/packs/cloudflare/index.mjs +79 -0
  107. package/dist/twins/packs/cohere/LICENSE +202 -0
  108. package/dist/twins/packs/cohere/NOTICE +7 -0
  109. package/dist/twins/packs/cohere/index.mjs +2 -0
  110. package/dist/twins/packs/datadog/LICENSE +202 -0
  111. package/dist/twins/packs/datadog/NOTICE +7 -0
  112. package/dist/twins/packs/datadog/index.mjs +3 -0
  113. package/dist/twins/packs/deepinfra/LICENSE +202 -0
  114. package/dist/twins/packs/deepinfra/NOTICE +7 -0
  115. package/dist/twins/packs/deepinfra/index.mjs +13 -0
  116. package/dist/twins/packs/deepseek/LICENSE +202 -0
  117. package/dist/twins/packs/deepseek/NOTICE +7 -0
  118. package/dist/twins/packs/deepseek/index.mjs +12 -0
  119. package/dist/twins/packs/discord/LICENSE +202 -0
  120. package/dist/twins/packs/discord/NOTICE +7 -0
  121. package/dist/twins/packs/discord/index.mjs +2 -0
  122. package/dist/twins/packs/duckduckgo/LICENSE +202 -0
  123. package/dist/twins/packs/duckduckgo/NOTICE +7 -0
  124. package/dist/twins/packs/duckduckgo/index.mjs +532 -0
  125. package/dist/twins/packs/dynadot/LICENSE +202 -0
  126. package/dist/twins/packs/dynadot/NOTICE +7 -0
  127. package/dist/twins/packs/dynadot/index.mjs +2 -0
  128. package/dist/twins/packs/e2b/LICENSE +202 -0
  129. package/dist/twins/packs/e2b/NOTICE +7 -0
  130. package/dist/twins/packs/e2b/index.mjs +2 -0
  131. package/dist/twins/packs/elevenlabs/LICENSE +202 -0
  132. package/dist/twins/packs/elevenlabs/NOTICE +7 -0
  133. package/dist/twins/packs/elevenlabs/index.mjs +4 -0
  134. package/dist/twins/packs/expo/LICENSE +202 -0
  135. package/dist/twins/packs/expo/NOTICE +7 -0
  136. package/dist/twins/packs/expo/index.mjs +2 -0
  137. package/dist/twins/packs/fal/LICENSE +202 -0
  138. package/dist/twins/packs/fal/NOTICE +7 -0
  139. package/dist/twins/packs/fal/index.mjs +2 -0
  140. package/dist/twins/packs/figma/LICENSE +202 -0
  141. package/dist/twins/packs/figma/NOTICE +7 -0
  142. package/dist/twins/packs/figma/index.mjs +2 -0
  143. package/dist/twins/packs/firecrawl/LICENSE +202 -0
  144. package/dist/twins/packs/firecrawl/NOTICE +7 -0
  145. package/dist/twins/packs/firecrawl/index.mjs +9 -0
  146. package/dist/twins/packs/fireworks/LICENSE +202 -0
  147. package/dist/twins/packs/fireworks/NOTICE +7 -0
  148. package/dist/twins/packs/fireworks/index.mjs +13 -0
  149. package/dist/twins/packs/fly/LICENSE +202 -0
  150. package/dist/twins/packs/fly/NOTICE +7 -0
  151. package/dist/twins/packs/fly/index.mjs +2 -0
  152. package/dist/twins/packs/gcs/LICENSE +202 -0
  153. package/dist/twins/packs/gcs/NOTICE +7 -0
  154. package/dist/twins/packs/gcs/index.mjs +8 -0
  155. package/dist/twins/packs/gemini/LICENSE +202 -0
  156. package/dist/twins/packs/gemini/NOTICE +7 -0
  157. package/dist/twins/packs/gemini/index.mjs +7 -0
  158. package/dist/twins/packs/github/LICENSE +202 -0
  159. package/dist/twins/packs/github/NOTICE +7 -0
  160. package/dist/twins/packs/github/index.mjs +75153 -0
  161. package/dist/twins/packs/googleads/LICENSE +202 -0
  162. package/dist/twins/packs/googleads/NOTICE +7 -0
  163. package/dist/twins/packs/googleads/index.mjs +3 -0
  164. package/dist/twins/packs/googlemaps/LICENSE +202 -0
  165. package/dist/twins/packs/googlemaps/NOTICE +7 -0
  166. package/dist/twins/packs/googlemaps/index.mjs +2 -0
  167. package/dist/twins/packs/googleoauth/LICENSE +202 -0
  168. package/dist/twins/packs/googleoauth/NOTICE +7 -0
  169. package/dist/twins/packs/googleoauth/index.mjs +2 -0
  170. package/dist/twins/packs/hackernews/LICENSE +202 -0
  171. package/dist/twins/packs/hackernews/NOTICE +7 -0
  172. package/dist/twins/packs/hackernews/index.mjs +35 -0
  173. package/dist/twins/packs/huggingface/LICENSE +202 -0
  174. package/dist/twins/packs/huggingface/NOTICE +7 -0
  175. package/dist/twins/packs/huggingface/index.mjs +9 -0
  176. package/dist/twins/packs/inngest/LICENSE +202 -0
  177. package/dist/twins/packs/inngest/NOTICE +7 -0
  178. package/dist/twins/packs/inngest/index.mjs +2 -0
  179. package/dist/twins/packs/instagram/LICENSE +202 -0
  180. package/dist/twins/packs/instagram/NOTICE +7 -0
  181. package/dist/twins/packs/instagram/index.mjs +2 -0
  182. package/dist/twins/packs/jira/LICENSE +202 -0
  183. package/dist/twins/packs/jira/NOTICE +7 -0
  184. package/dist/twins/packs/jira/index.mjs +2 -0
  185. package/dist/twins/packs/langfuse/LICENSE +202 -0
  186. package/dist/twins/packs/langfuse/NOTICE +7 -0
  187. package/dist/twins/packs/langfuse/index.mjs +2 -0
  188. package/dist/twins/packs/linear/LICENSE +202 -0
  189. package/dist/twins/packs/linear/NOTICE +7 -0
  190. package/dist/twins/packs/linear/index.mjs +52866 -0
  191. package/dist/twins/packs/linkedin/LICENSE +202 -0
  192. package/dist/twins/packs/linkedin/NOTICE +7 -0
  193. package/dist/twins/packs/linkedin/index.mjs +78 -0
  194. package/dist/twins/packs/livekit/LICENSE +202 -0
  195. package/dist/twins/packs/livekit/NOTICE +7 -0
  196. package/dist/twins/packs/livekit/index.mjs +2 -0
  197. package/dist/twins/packs/mailgun/LICENSE +202 -0
  198. package/dist/twins/packs/mailgun/NOTICE +7 -0
  199. package/dist/twins/packs/mailgun/index.mjs +13 -0
  200. package/dist/twins/packs/mapbox/LICENSE +202 -0
  201. package/dist/twins/packs/mapbox/NOTICE +7 -0
  202. package/dist/twins/packs/mapbox/index.mjs +2 -0
  203. package/dist/twins/packs/merge/LICENSE +202 -0
  204. package/dist/twins/packs/merge/NOTICE +7 -0
  205. package/dist/twins/packs/merge/index.mjs +4 -0
  206. package/dist/twins/packs/mistral/LICENSE +202 -0
  207. package/dist/twins/packs/mistral/NOTICE +7 -0
  208. package/dist/twins/packs/mistral/index.mjs +6 -0
  209. package/dist/twins/packs/mixpanel/LICENSE +202 -0
  210. package/dist/twins/packs/mixpanel/NOTICE +8 -0
  211. package/dist/twins/packs/mixpanel/index.mjs +2 -0
  212. package/dist/twins/packs/mongodb/LICENSE +202 -0
  213. package/dist/twins/packs/mongodb/NOTICE +7 -0
  214. package/dist/twins/packs/mongodb/index.mjs +8 -0
  215. package/dist/twins/packs/moonshot/LICENSE +202 -0
  216. package/dist/twins/packs/moonshot/NOTICE +7 -0
  217. package/dist/twins/packs/moonshot/index.mjs +18 -0
  218. package/dist/twins/packs/notion/LICENSE +202 -0
  219. package/dist/twins/packs/notion/NOTICE +7 -0
  220. package/dist/twins/packs/notion/index.mjs +2 -0
  221. package/dist/twins/packs/npm-registry/LICENSE +202 -0
  222. package/dist/twins/packs/npm-registry/NOTICE +7 -0
  223. package/dist/twins/packs/npm-registry/index.mjs +2 -0
  224. package/dist/twins/packs/oa-treasury/LICENSE +202 -0
  225. package/dist/twins/packs/oa-treasury/NOTICE +8 -0
  226. package/dist/twins/packs/oa-treasury/index.mjs +16 -0
  227. package/dist/twins/packs/openai/LICENSE +202 -0
  228. package/dist/twins/packs/openai/NOTICE +7 -0
  229. package/dist/twins/packs/openai/index.mjs +3473 -0
  230. package/dist/twins/packs/openrouter/LICENSE +202 -0
  231. package/dist/twins/packs/openrouter/NOTICE +7 -0
  232. package/dist/twins/packs/openrouter/index.mjs +2 -0
  233. package/dist/twins/packs/openweather/LICENSE +202 -0
  234. package/dist/twins/packs/openweather/NOTICE +7 -0
  235. package/dist/twins/packs/openweather/index.mjs +2 -0
  236. package/dist/twins/packs/paypal/LICENSE +202 -0
  237. package/dist/twins/packs/paypal/NOTICE +7 -0
  238. package/dist/twins/packs/paypal/index.mjs +51 -0
  239. package/dist/twins/packs/pinecone/LICENSE +202 -0
  240. package/dist/twins/packs/pinecone/NOTICE +7 -0
  241. package/dist/twins/packs/pinecone/index.mjs +2 -0
  242. package/dist/twins/packs/plain/LICENSE +202 -0
  243. package/dist/twins/packs/plain/NOTICE +8 -0
  244. package/dist/twins/packs/plain/index.mjs +18426 -0
  245. package/dist/twins/packs/planetscale/LICENSE +202 -0
  246. package/dist/twins/packs/planetscale/NOTICE +7 -0
  247. package/dist/twins/packs/planetscale/index.mjs +18 -0
  248. package/dist/twins/packs/polar/LICENSE +202 -0
  249. package/dist/twins/packs/polar/NOTICE +7 -0
  250. package/dist/twins/packs/polar/index.mjs +2 -0
  251. package/dist/twins/packs/polyhaven/LICENSE +202 -0
  252. package/dist/twins/packs/polyhaven/NOTICE +7 -0
  253. package/dist/twins/packs/polyhaven/index.mjs +3 -0
  254. package/dist/twins/packs/postmark/LICENSE +202 -0
  255. package/dist/twins/packs/postmark/NOTICE +7 -0
  256. package/dist/twins/packs/postmark/index.mjs +12 -0
  257. package/dist/twins/packs/reddit/LICENSE +202 -0
  258. package/dist/twins/packs/reddit/NOTICE +7 -0
  259. package/dist/twins/packs/reddit/index.mjs +324 -0
  260. package/dist/twins/packs/redis/LICENSE +202 -0
  261. package/dist/twins/packs/redis/NOTICE +7 -0
  262. package/dist/twins/packs/redis/index.mjs +2 -0
  263. package/dist/twins/packs/replicate/LICENSE +202 -0
  264. package/dist/twins/packs/replicate/NOTICE +7 -0
  265. package/dist/twins/packs/replicate/index.mjs +2 -0
  266. package/dist/twins/packs/resend/LICENSE +202 -0
  267. package/dist/twins/packs/resend/NOTICE +7 -0
  268. package/dist/twins/packs/resend/index.mjs +139 -0
  269. package/dist/twins/packs/runhuman/LICENSE +202 -0
  270. package/dist/twins/packs/runhuman/NOTICE +7 -0
  271. package/dist/twins/packs/runhuman/index.mjs +3 -0
  272. package/dist/twins/packs/scrapecreators/LICENSE +202 -0
  273. package/dist/twins/packs/scrapecreators/NOTICE +7 -0
  274. package/dist/twins/packs/scrapecreators/index.mjs +2 -0
  275. package/dist/twins/packs/segment/LICENSE +202 -0
  276. package/dist/twins/packs/segment/NOTICE +8 -0
  277. package/dist/twins/packs/segment/index.mjs +2 -0
  278. package/dist/twins/packs/sendblue/LICENSE +202 -0
  279. package/dist/twins/packs/sendblue/NOTICE +7 -0
  280. package/dist/twins/packs/sendblue/index.mjs +2 -0
  281. package/dist/twins/packs/sendgrid/LICENSE +202 -0
  282. package/dist/twins/packs/sendgrid/NOTICE +8 -0
  283. package/dist/twins/packs/sendgrid/index.mjs +4 -0
  284. package/dist/twins/packs/sentry/LICENSE +202 -0
  285. package/dist/twins/packs/sentry/NOTICE +7 -0
  286. package/dist/twins/packs/sentry/index.mjs +5 -0
  287. package/dist/twins/packs/sigstore/LICENSE +202 -0
  288. package/dist/twins/packs/sigstore/NOTICE +7 -0
  289. package/dist/twins/packs/sigstore/index.mjs +12 -0
  290. package/dist/twins/packs/slack/LICENSE +202 -0
  291. package/dist/twins/packs/slack/NOTICE +7 -0
  292. package/dist/twins/packs/slack/index.mjs +66 -0
  293. package/dist/twins/packs/smtp/LICENSE +202 -0
  294. package/dist/twins/packs/smtp/NOTICE +7 -0
  295. package/dist/twins/packs/smtp/index.mjs +3 -0
  296. package/dist/twins/packs/snowflake/LICENSE +202 -0
  297. package/dist/twins/packs/snowflake/NOTICE +8 -0
  298. package/dist/twins/packs/snowflake/index.mjs +30 -0
  299. package/dist/twins/packs/stigg/LICENSE +202 -0
  300. package/dist/twins/packs/stigg/NOTICE +8 -0
  301. package/dist/twins/packs/stigg/index.mjs +22194 -0
  302. package/dist/twins/packs/stream/LICENSE +202 -0
  303. package/dist/twins/packs/stream/NOTICE +7 -0
  304. package/dist/twins/packs/stream/index.mjs +2 -0
  305. package/dist/twins/packs/stripe/LICENSE +202 -0
  306. package/dist/twins/packs/stripe/NOTICE +7 -0
  307. package/dist/twins/packs/stripe/index.mjs +211 -0
  308. package/dist/twins/packs/supabase/LICENSE +202 -0
  309. package/dist/twins/packs/supabase/NOTICE +7 -0
  310. package/dist/twins/packs/supabase/index.mjs +2 -0
  311. package/dist/twins/packs/supermemory/LICENSE +202 -0
  312. package/dist/twins/packs/supermemory/NOTICE +7 -0
  313. package/dist/twins/packs/supermemory/index.mjs +2 -0
  314. package/dist/twins/packs/svix/LICENSE +202 -0
  315. package/dist/twins/packs/svix/NOTICE +7 -0
  316. package/dist/twins/packs/svix/index.mjs +2 -0
  317. package/dist/twins/packs/tavily/LICENSE +202 -0
  318. package/dist/twins/packs/tavily/NOTICE +7 -0
  319. package/dist/twins/packs/tavily/index.mjs +2 -0
  320. package/dist/twins/packs/telegram/LICENSE +202 -0
  321. package/dist/twins/packs/telegram/NOTICE +7 -0
  322. package/dist/twins/packs/telegram/index.mjs +11 -0
  323. package/dist/twins/packs/temporal/LICENSE +202 -0
  324. package/dist/twins/packs/temporal/NOTICE +7 -0
  325. package/dist/twins/packs/temporal/index.mjs +44 -0
  326. package/dist/twins/packs/tiktok/LICENSE +202 -0
  327. package/dist/twins/packs/tiktok/NOTICE +7 -0
  328. package/dist/twins/packs/tiktok/index.mjs +2 -0
  329. package/dist/twins/packs/tinybird/LICENSE +202 -0
  330. package/dist/twins/packs/tinybird/NOTICE +7 -0
  331. package/dist/twins/packs/tinybird/index.mjs +50 -0
  332. package/dist/twins/packs/togetherai/LICENSE +202 -0
  333. package/dist/twins/packs/togetherai/NOTICE +7 -0
  334. package/dist/twins/packs/togetherai/index.mjs +11 -0
  335. package/dist/twins/packs/tremendous/LICENSE +202 -0
  336. package/dist/twins/packs/tremendous/NOTICE +7 -0
  337. package/dist/twins/packs/tremendous/index.mjs +2 -0
  338. package/dist/twins/packs/tripo/LICENSE +202 -0
  339. package/dist/twins/packs/tripo/NOTICE +7 -0
  340. package/dist/twins/packs/tripo/index.mjs +9 -0
  341. package/dist/twins/packs/tunnel/LICENSE +202 -0
  342. package/dist/twins/packs/tunnel/NOTICE +7 -0
  343. package/dist/twins/packs/tunnel/index.mjs +2 -0
  344. package/dist/twins/packs/twelvelabs/LICENSE +202 -0
  345. package/dist/twins/packs/twelvelabs/NOTICE +7 -0
  346. package/dist/twins/packs/twelvelabs/index.mjs +5 -0
  347. package/dist/twins/packs/twilio/LICENSE +202 -0
  348. package/dist/twins/packs/twilio/NOTICE +7 -0
  349. package/dist/twins/packs/twilio/index.mjs +2 -0
  350. package/dist/twins/packs/twitch/LICENSE +202 -0
  351. package/dist/twins/packs/twitch/NOTICE +7 -0
  352. package/dist/twins/packs/twitch/index.mjs +68 -0
  353. package/dist/twins/packs/upstash/LICENSE +202 -0
  354. package/dist/twins/packs/upstash/NOTICE +7 -0
  355. package/dist/twins/packs/upstash/index.mjs +14 -0
  356. package/dist/twins/packs/upstashvector/LICENSE +202 -0
  357. package/dist/twins/packs/upstashvector/NOTICE +7 -0
  358. package/dist/twins/packs/upstashvector/index.mjs +3 -0
  359. package/dist/twins/packs/vercel/LICENSE +202 -0
  360. package/dist/twins/packs/vercel/NOTICE +7 -0
  361. package/dist/twins/packs/vercel/index.mjs +10 -0
  362. package/dist/twins/packs/veriff/LICENSE +202 -0
  363. package/dist/twins/packs/veriff/NOTICE +7 -0
  364. package/dist/twins/packs/veriff/index.mjs +2 -0
  365. package/dist/twins/packs/vgauth/LICENSE +202 -0
  366. package/dist/twins/packs/vgauth/NOTICE +7 -0
  367. package/dist/twins/packs/vgauth/index.mjs +2 -0
  368. package/dist/twins/packs/vital/LICENSE +202 -0
  369. package/dist/twins/packs/vital/NOTICE +7 -0
  370. package/dist/twins/packs/vital/index.mjs +2 -0
  371. package/dist/twins/packs/volteridentity/LICENSE +202 -0
  372. package/dist/twins/packs/volteridentity/NOTICE +7 -0
  373. package/dist/twins/packs/volteridentity/index.mjs +2 -0
  374. package/dist/twins/packs/webrisk/LICENSE +202 -0
  375. package/dist/twins/packs/webrisk/NOTICE +7 -0
  376. package/dist/twins/packs/webrisk/index.mjs +2 -0
  377. package/dist/twins/packs/worldlabs/LICENSE +202 -0
  378. package/dist/twins/packs/worldlabs/NOTICE +7 -0
  379. package/dist/twins/packs/worldlabs/index.mjs +2 -0
  380. package/dist/twins/packs/x/LICENSE +202 -0
  381. package/dist/twins/packs/x/NOTICE +7 -0
  382. package/dist/twins/packs/x/index.mjs +63 -0
  383. package/dist/twins/packs/xai/LICENSE +202 -0
  384. package/dist/twins/packs/xai/NOTICE +7 -0
  385. package/dist/twins/packs/xai/index.mjs +4 -0
  386. package/dist/twins/packs/xidentity/LICENSE +202 -0
  387. package/dist/twins/packs/xidentity/NOTICE +8 -0
  388. package/dist/twins/packs/xidentity/index.mjs +209 -0
  389. package/dist/twins/packs/youtube/LICENSE +202 -0
  390. package/dist/twins/packs/youtube/NOTICE +7 -0
  391. package/dist/twins/packs/youtube/index.mjs +5 -0
  392. package/dist/worker.js +442 -18
  393. package/dist/world-host.js +928 -91
  394. package/package.json +6 -5
  395. package/dist/dashboard/assets/dashboard/bay-morning.png +0 -0
  396. package/dist/dashboard/assets/dashboard/golden-gate-afternoon.png +0 -0
  397. package/dist/dashboard/assets/dashboard/golden-gate-portrait.png +0 -0
  398. package/dist/dashboard/assets/dashboard/moonlit-coast.png +0 -0
  399. package/dist/dashboard/assets/next/static/chunks/2868-424d32cfc8ae81c9.js +0 -1
  400. package/dist/dashboard/assets/next/static/chunks/app/docs/[[...slug]]/page-f9fca2c08f779fa0.js +0 -1
  401. package/dist/dashboard/assets/next/static/chunks/app/onboarding/page-bc480c9258e5cc4d.js +0 -1
  402. package/dist/dashboard/assets/next/static/chunks/app/v2/onboarding/page-f04c0b236abaead3.js +0 -1
  403. package/dist/dashboard/assets/next/static/chunks/app/v2/page-07c8054d57c9089b.js +0 -1
  404. package/dist/dashboard/assets/next/static/css/4af3c8ca0da0f48b.css +0 -1
  405. package/dist/dashboard/assets/next/static/css/6b8edde77e493a51.css +0 -1
  406. package/dist/dashboard/assets/next/static/media/bay-morning.1a9f358c.png +0 -0
  407. package/dist/dashboard/assets/next/static/media/golden-gate-afternoon.3e7cea58.png +0 -0
  408. package/dist/dashboard/assets/next/static/media/golden-gate-portrait.7941528f.png +0 -0
  409. package/dist/dashboard/assets/next/static/media/moonlit-coast.bbe901a1.png +0 -0
  410. /package/dist/dashboard/assets/next/static/{5ub3D2yzS8DE7w2qZd1nv → GTd0IQ6HYyhE_2HqcgFno}/_buildManifest.js +0 -0
  411. /package/dist/dashboard/assets/next/static/{5ub3D2yzS8DE7w2qZd1nv → GTd0IQ6HYyhE_2HqcgFno}/_ssgManifest.js +0 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,7 @@
1
+ @agenttwin/twin-airtable
2
+
3
+ Contains @volter/twin-airtable 0.1.37 by Volter (https://github.com/volter-ai),
4
+ licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ Modified by AgentTwin: bundled and minified into one file; only code reachable from the pack's
7
+ fetch factory is included; shared modules are imported from the AgentTwin twin engine.
@@ -0,0 +1,2 @@
1
+ import{createRequire as __atReq}from'node:module';const require=__atReq(import.meta.url);
2
+ import{applyTwinWrite as Be,projectResources as Ue,worldNow as Me}from"../../engine/v2/volter_world-core.mjs";import{createHash as Ge}from"node:crypto";var F=class extends Error{constructor(e){super(e),this.name="FormulaUnsupportedError"}},O=class extends Error{constructor(e){super(e),this.name="FormulaMalformedError"}},M=class extends Error{field;constructor(e){super(`unknown field reference {${e}}`),this.field=e,this.name="FormulaUnknownFieldError"}},Ee={AND:{min:1,max:null},OR:{min:1,max:null},NOT:{min:1,max:1},LOWER:{min:1,max:1},UPPER:{min:1,max:1},TRIM:{min:1,max:1},LEN:{min:1,max:1},FIND:{min:2,max:2},BLANK:{min:0,max:0},TRUE:{min:0,max:0},FALSE:{min:0,max:0}},Le=Object.keys(Ee),we=["!=",">=","<=","=",">","<"];function De(t){let e=[],r=0;for(;r<t.length;){let n=t[r];if(/\s/.test(n)){r+=1;continue}if(n==="{"){let i=t.indexOf("}",r+1);if(i===-1)throw new O("unterminated {field reference}");e.push({kind:"field",value:t.slice(r+1,i)}),r=i+1;continue}if(n==='"'||n==="'"){let i=r+1,u="";for(;i<t.length&&t[i]!==n;){if(t[i]==="\\"&&i+1<t.length){u+=t[i+1],i+=2;continue}u+=t[i],i+=1}if(i>=t.length)throw new O("unterminated string literal");e.push({kind:"string",value:u}),r=i+1;continue}if(/[0-9]/.test(n)||n==="-"&&/[0-9]/.test(t[r+1]??"")){let i=/^-?\d+(\.\d+)?/.exec(t.slice(r));e.push({kind:"number",value:Number(i[0])}),r+=i[0].length;continue}let a=we.find(i=>t.startsWith(i,r));if(a){e.push({kind:"op",value:a}),r+=a.length;continue}if(n==="("||n===")"||n===","){e.push({kind:"punct",value:n}),r+=1;continue}if(/[A-Za-z_]/.test(n)){let i=/^[A-Za-z_][A-Za-z0-9_]*/.exec(t.slice(r));e.push({kind:"ident",value:i[0]}),r+=i[0].length;continue}throw new F(`unsupported character ${JSON.stringify(n)} \u2014 the airtable twin evaluates only the documented subset (see airtable-formula.ts)`)}return e}function Y(t){return t==null?!1:typeof t=="boolean"?t:typeof t=="number"?t!==0&&!Number.isNaN(t):typeof t=="string"?t!=="":Array.isArray(t)?t.length>0:!0}function D(t){return typeof t=="number"?t:typeof t=="boolean"?t?1:0:t==null?"":Array.isArray(t)?t.map(e=>String(e)).join(","):typeof t=="object"?JSON.stringify(t):String(t)}var ne=class{tokens;knownFields;at=0;constructor(e,r){this.tokens=e,this.knownFields=r}parse(){let e=this.comparison();if(this.at<this.tokens.length)throw new O(`unexpected trailing input at token ${this.at}`);return e}peek(){return this.tokens[this.at]}next(){return this.tokens[this.at++]}comparison(){let e=this.value(),r=this.peek();if(r?.kind!=="op")return e;if(this.next(),!we.includes(r.value))throw new O(`unsupported operator ${r.value}`);return{kind:"compare",op:r.value,left:e,right:this.value()}}value(){let e=this.next();if(!e)throw new O("unexpected end of formula");if(e.kind==="number"||e.kind==="string")return{kind:"literal",value:e.value};if(e.kind==="field")return this.field(e.value);if(e.kind==="punct"&&e.value==="("){let r=this.comparison(),n=this.next();if(n?.kind!=="punct"||n.value!==")")throw new O("unbalanced parentheses");return r}if(e.kind==="ident"){let r=this.peek();return r?.kind==="punct"&&r.value==="("?this.call(e.value.toUpperCase()):this.field(e.value)}throw new O(`unsupported token ${JSON.stringify(e.value)}`)}field(e){if(this.knownFields&&!this.knownFields.has(e))throw new M(e);return{kind:"field",name:e}}call(e){this.next();let r=[];if(!(this.peek()?.kind==="punct"&&this.peek().value===")"))for(;;){r.push(this.comparison());let i=this.peek();if(i?.kind==="punct"&&i.value===","){this.next();continue}break}let n=this.next();if(n?.kind!=="punct"||n.value!==")")throw new O(`unbalanced parentheses in ${e}()`);let a=Ee[e];if(!a)throw new F(`function ${e}() is outside the subset this twin evaluates (supported: ${Le.join(", ")})`);if(r.length<a.min||a.max!==null&&r.length>a.max){let i=a.max===null?`at least ${a.min}`:`${a.min}`;throw new F(`${e}() takes ${i} argument(s), got ${r.length}`)}return{kind:"call",name:e,args:r}}};function N(t,e){switch(t.kind){case"literal":return t.value;case"field":return Object.prototype.hasOwnProperty.call(e,t.name)?e[t.name]:null;case"compare":{let r=D(N(t.left,e)),n=D(N(t.right,e));switch(t.op){case"=":return r===n;case"!=":return r!==n;case">":return r>n;case">=":return r>=n;case"<":return r<n;default:return r<=n}}default:{let r=()=>t.args.map(n=>N(n,e));switch(t.name){case"AND":return r().every(Y);case"OR":return r().some(Y);case"NOT":return!Y(N(t.args[0],e));case"LOWER":return String(D(N(t.args[0],e))).toLowerCase();case"UPPER":return String(D(N(t.args[0],e))).toUpperCase();case"TRIM":return String(D(N(t.args[0],e))).trim();case"LEN":return String(D(N(t.args[0],e))).length;case"FIND":return String(D(N(t.args[1],e))).indexOf(String(D(N(t.args[0],e))))+1;case"BLANK":return"";case"TRUE":return!0;default:return!1}}}}function Te(t,e){return new ne(De(t),e).parse()}function ie(t,e){let r=Te(t,e);return n=>Y(N(r,n))}var se=["singleLineText","email","url","multilineText","number","percent","currency","singleSelect","multipleSelects","singleCollaborator","multipleCollaborators","multipleRecordLinks","date","dateTime","phoneNumber","multipleAttachments","checkbox","formula","createdTime","rollup","count","lookup","multipleLookupValues","autoNumber","barcode","rating","richText","duration","lastModifiedTime","button","createdBy","lastModifiedBy","externalSyncSource","aiText"],Fe=new Set(se);function oe(t){return Fe.has(t)}var ae=new Set(["formula","rollup","count","lookup","multipleLookupValues","autoNumber","createdTime","lastModifiedTime","createdBy","lastModifiedBy","button","externalSyncSource","aiText"]);var de="Invalid request: parameter validation failed. Check your request data.";var z=5;var ce=30;var Oe="airtable";var J=100,G={id:"usrTwinAirtable01",email:"twin@airtable.test",name:"Airtable Twin User"};function q(t,e,r){return{status:t,body:{error:{type:e,message:r}}}}var S=t=>q(404,"NOT_FOUND",t),f=()=>q(422,"INVALID_REQUEST_UNKNOWN",de),Ie=t=>q(422,"INVALID_REQUEST_UNKNOWN",`[twin gap] ${t}`);function me(t,e){return Ue(Oe,e).filter(r=>r.type===t)}function $(t,e){return me(t,e).filter(r=>r._deleted!==!0)}function ke(t,e){return me(t,e)}async function _(t,e,r,n,a){let i=me(t,n).find(d=>d.id===e),u=typeof i?.rev=="number"?i.rev+1:1;await Be(Oe,{operation:`set.${t}`,subjectType:t,subjectId:e,fields:{...r,rev:u},...a?{occurredAt:a}:{},actor:{kind:"agent"}},n)}var Ae="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";function Ne(t,e){let r=Ge("sha256").update(t).digest(),n="";for(let a=0;a<e;a+=1)n+=Ae[r[a%r.length]%Ae.length];return n}function L(t,e,r){for(let n=1;n<1e6;n+=1){let a=t+Ne(`${t}:${e}:${n}`,14);if(!r.has(a))return a}throw new Error(`airtable twin: exhausted id space for prefix ${t}`)}var j=(t,e)=>new Set(ke(t,e).map(r=>String(r.id)));function Se(t){let e=new Set;for(let r of ke("table",t))for(let n of Array.isArray(r.viewDefs)?r.viewDefs:[])typeof n?.id=="string"&&e.add(n.id);return e}function Re(t,e){return $("base",e).find(r=>r.id===t)}function fe(t,e){return $("table",e).filter(r=>r.baseId===t)}function Q(t,e,r){return fe(t,r).find(n=>n.id===e||n.name===e)}function U(t){return Array.isArray(t.fieldDefs)?t.fieldDefs:[]}function X(t,e){return U(t).find(r=>r.id===e||r.name===e)}function P(t,e){return $("record",e).filter(r=>r.tableId===t)}function je(t,e,r){let n={};for(let a of U(t)){let i=e[a.id];i==null||i===""||Array.isArray(i)&&i.length===0||r.only&&!r.only.has(a.id)&&!r.only.has(a.name)||(n[r.byFieldId?a.id:a.name]=r.asString?W(i):i)}return n}function W(t){return t==null?"":Array.isArray(t)?t.map(e=>W(e)).join(", "):typeof t=="object"?JSON.stringify(t):String(t)}function $e(t,e,r,n){if(e===null)return{ok:!0,value:null};if(ae.has(t))return{ok:!1};let a=i=>typeof i=="number"&&Number.isFinite(i)?{ok:!0,value:i}:r&&typeof i=="string"&&i.trim()!==""&&Number.isFinite(Number(i))?{ok:!0,value:Number(i)}:{ok:!1};switch(t){case"singleLineText":case"multilineText":case"richText":case"email":case"url":case"phoneNumber":return typeof e=="string"?{ok:!0,value:e}:r?{ok:!0,value:W(e)}:{ok:!1};case"number":case"percent":case"currency":case"rating":case"duration":return a(e);case"checkbox":return typeof e=="boolean"?{ok:!0,value:e}:r&&typeof e=="string"?{ok:!0,value:e.toLowerCase()==="true"}:{ok:!1};case"date":case"dateTime":return typeof e=="string"&&!Number.isNaN(Date.parse(e))?{ok:!0,value:e}:{ok:!1};case"singleSelect":{if(typeof e!="string")return{ok:!1};let i=xe(n);return i&&!i.has(e)&&!r?{ok:!1}:{ok:!0,value:e}}case"multipleSelects":{let i=Array.isArray(e)?e:r&&typeof e=="string"?[e]:null;if(!i||!i.every(d=>typeof d=="string"))return{ok:!1};let u=xe(n);return u&&!r&&!i.every(d=>u.has(d))?{ok:!1}:{ok:!0,value:i}}case"multipleRecordLinks":case"multipleAttachments":case"multipleCollaborators":return Array.isArray(e)?{ok:!0,value:e}:{ok:!1};case"singleCollaborator":case"barcode":return typeof e=="object"?{ok:!0,value:e}:{ok:!1};default:return{ok:!1}}}function xe(t){let e=t?.choices;return Array.isArray(e)?new Set(e.map(r=>String(r?.name??""))):null}function be(t,e,r){if(e==null)return{ok:!0,cells:{}};if(typeof e!="object"||Array.isArray(e))return{ok:!1,response:f()};let n={};for(let[a,i]of Object.entries(e)){let u=X(t,a);if(!u)return{ok:!1,response:f()};let d=$e(u.type,i,r,u.options);if(!d.ok)return{ok:!1,response:f()};n[u.id]=d.value}return{ok:!0,cells:n}}function K(t,e,r,n){let a={id:String(e.id),createdTime:String(e.createdTime),fields:je(t,e.cells??{},r)};return r.commentCount&&(a.commentCount=$("comment",n).filter(i=>i.recordId===e.id).length),a}function pe(t,e){let r=[...t.getAll(`${e}[]`),...t.getAll(e)];for(let[n,a]of t)new RegExp(`^${e}\\[(\\d+)\\]$`).exec(n)&&r.push(a);return r}function We(t){let e=new Map;for(let[n,a]of t){let i=/^sort\[(\d*)\]\[(field|direction)\]$/.exec(n)??/^sort\[(field|direction)()\]$/.exec(n);if(!i)continue;let u=/^sort\[(\d*)\]\[/.test(n)?i[1]:"0",d=/^sort\[(\d*)\]\[/.test(n)?i[2]:i[1],A=e.get(u)??{};A[d]=a,e.set(u,A)}let r=[];for(let n of[...e.keys()].sort()){let a=e.get(n);if(!a.field)return{ok:!1};let i=a.direction??"asc";if(i!=="asc"&&i!=="desc")return{ok:!1};r.push({field:a.field,direction:i})}return{ok:!0,sorts:r}}function He(t){let e=new URLSearchParams;for(let[r,n]of Object.entries(t))if(n!=null){if(r==="sort"&&Array.isArray(n)){n.forEach((a,i)=>{let u=a;u?.field!==void 0&&e.append(`sort[${i}][field]`,String(u.field)),u?.direction!==void 0&&e.append(`sort[${i}][direction]`,String(u.direction))});continue}if(Array.isArray(n)){for(let a of n)e.append(`${r}[]`,String(a));continue}e.append(r,String(n))}return e}function Ve(t,e){return`itr${Ne(`offset:${t}:${e}`,14)}/${e}`}function Ye(t){let e=t.indexOf("/");if(e===-1||!t.startsWith("itr"))return null;let r=t.slice(e+1);return r.startsWith("rec")?r:null}function _e(t,e,r){let n=e.get("returnFieldsByFieldId")==="true",a=e.get("cellFormat")??"json";if(a!=="json"&&a!=="string"||a==="string"&&(!e.get("timeZone")||!e.get("userLocale")))return f();let i=e.get("pageSize"),u=J;if(i!==null){let l=Number(i);if(!Number.isFinite(l)||l<1||l>J)return f();u=Math.floor(l)}let d=e.get("maxRecords"),A=Number.POSITIVE_INFINITY;if(d!==null){let l=Number(d);if(!Number.isFinite(l)||l<1)return f();A=Math.floor(l)}let c=pe(e,"fields"),x=c.length>0?new Set(c):void 0,R=We(e);if(!R.ok)return f();let C=pe(e,"recordMetadata");if(C.some(l=>l!=="commentCount"))return f();let T=P(String(t.id),r),E=e.get("view");if(E!==null){let l=Array.isArray(t.viewDefs)?t.viewDefs:[];if(l.length===0)return Ie("view: the twin holds no view definitions for this table, so no view name can be resolved (airtable.connector.pull_views)");if(!l.find(g=>g.id===E||g.name===E))return f()}let h=e.get("filterByFormula");if(h!==null&&h!==""){let l=new Set;for(let m of U(t))l.add(m.name),l.add(m.id);let I;try{I=ie(h,l)}catch(m){if(m instanceof M||m instanceof O)return f();if(m instanceof F)return Ie(`filterByFormula: ${m.message}`);throw m}let g=m=>{let k=m.cells??{},B={};for(let v of U(t))B[v.name]=k[v.id]??null,B[v.id]=k[v.id]??null;return B};T=T.filter(m=>I(g(m)))}for(let l of[...R.sorts].reverse()){let I=X(t,l.field);if(!I)return f();T=[...T].sort((g,m)=>{let k=g.cells?.[I.id],B=m.cells?.[I.id],v=ze(k,B);return l.direction==="desc"?-v:v})}Number.isFinite(A)&&(T=T.slice(0,A));let p=0,y=e.get("offset");if(y!==null&&y!==""){let l=Ye(y);if(l===null)return f();let I=T.findIndex(g=>g.id===l);if(I===-1)return f();p=I}let s=T.slice(p,p+u),o=T[p+u],b={byFieldId:n,...x?{only:x}:{},...a==="string"?{asString:!0}:{},...C.includes("commentCount")?{commentCount:!0}:{}},w={records:s.map(l=>K(t,l,b,r))};return o&&(w.offset=Ve(String(t.id),String(o.id))),{status:200,body:w}}function ze(t,e){let r=t==null||t==="",n=e==null||e==="";return r&&n?0:r?-1:n?1:typeof t=="number"&&typeof e=="number"?t-e:W(t).localeCompare(W(e))}function Z(t){return{id:String(t.id),name:t.name,...t.description!==void 0&&t.description!==null?{description:t.description}:{},primaryFieldId:t.primaryFieldId,fields:U(t).map(e=>({id:e.id,name:e.name,type:e.type,...e.description!==void 0?{description:e.description}:{},...e.options!==void 0?{options:e.options}:{}})),views:(Array.isArray(t.viewDefs)?t.viewDefs:[]).map(e=>({id:e.id,name:e.name,type:e.type}))}}function le(t){return{id:String(t.id),author:t.author,text:t.text,createdTime:t.createdTime,lastUpdatedTime:t.lastUpdatedTime??null,...t.parentCommentId?{parentCommentId:t.parentCommentId}:{}}}function ue(t,e,r){if(!t||typeof t!="object")return{ok:!1,response:f()};let n=t,a=n.name,i=n.type;if(typeof a!="string"||a==="")return{ok:!1,response:f()};if(typeof i!="string"||!oe(i))return{ok:!1,response:f()};let u=L("fld",`${r}:${a}`,e);return e.add(u),{ok:!0,def:{id:u,name:a,type:i,...typeof n.description=="string"?{description:n.description}:{},...n.options!==void 0&&n.options!==null?{options:n.options}:{}}}}function Je(t){if(!t)return{};try{let e=JSON.parse(t);return e&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}}async function he(t){let{method:e,root:r,occurredAt:n}=t,a=t.readOnly??!1,i=e!=="GET"&&e!=="HEAD",u;try{u=new URL(t.path,"http://twin.local")}catch{return f()}let d=u.pathname.replace(/^\/+|\/+$/g,"").split("/").filter(Boolean).map(p=>decodeURIComponent(p)),A=u.searchParams,c=Je(t.body),x=n??Me();if(a&&i)return q(405,"INVALID_PERMISSIONS","[twin] this twin was started read-only; omit readOnly to accept writes");if(c===null)return f();if(d[0]!=="v0")return S(`Cannot ${e} ${u.pathname}`);if(d[1]==="meta"){if(d[2]==="whoami"&&d.length===3&&e==="GET")return{status:200,body:{id:G.id,email:G.email}};if(d[2]==="bases"){if(d.length===3&&e==="GET")return{status:200,body:{bases:$("base",r).map(o=>({id:String(o.id),name:o.name,permissionLevel:o.permissionLevel??"create"}))}};if(d.length===3&&e==="POST"){let s=c.name,o=c.tables;if(typeof s!="string"||s===""||!Array.isArray(o)||o.length===0||typeof c.workspaceId!="string"||c.workspaceId==="")return f();let b=L("app",`${c.workspaceId}:${s}`,j("base",r)),w=j("table",r),l=Se(r),I=[];for(let g of o){let m=g;if(typeof m.name!="string"||m.name===""||!Array.isArray(m.fields)||m.fields.length===0||I.some(H=>H.name===m.name))return f();let k=L("tbl",`${b}:${m.name}`,w);w.add(k);let B=new Set,v=new Set,re=[];for(let H of m.fields){let V=ue(H,B,`${k}`);if(!V.ok)return V.response;if(v.has(V.def.name))return f();v.add(V.def.name),re.push(V.def)}I.push({id:k,name:m.name,fields:re,primaryFieldId:re[0].id,...typeof m.description=="string"?{description:m.description}:{},viewDefs:[{id:L("viw",`${k}:Grid view`,l),name:"Grid view",type:"grid"}]});for(let H of I[I.length-1].viewDefs)l.add(H.id)}await _("base",b,{baseId:b,name:s,permissionLevel:"create",workspaceId:c.workspaceId},r,n);for(let g of I)await _("table",g.id,{tableId:g.id,baseId:b,name:g.name,primaryFieldId:g.primaryFieldId,fieldDefs:g.fields,viewDefs:g.viewDefs,...g.description!==void 0?{description:g.description}:{}},r,n);return{status:200,body:{id:b,tables:I.map(g=>Z($("table",r).find(m=>m.id===g.id)))}}}let p=d[3];if(!p)return S(`Cannot ${e} ${u.pathname}`);let y=Re(p,r);if(d[4]==="tables"&&d.length===5){if(!y)return S(`Could not find base "${p}"`);if(e==="GET")return{status:200,body:{tables:fe(p,r).map(Z)}};if(e==="POST"){let s=c.name;if(typeof s!="string"||s===""||!Array.isArray(c.fields)||c.fields.length===0||fe(p,r).some(g=>g.name===s))return f();let o=L("tbl",`${p}:${s}`,j("table",r)),b=new Set,w=new Set,l=[];for(let g of c.fields){let m=ue(g,b,o);if(!m.ok)return m.response;if(w.has(m.def.name))return f();w.add(m.def.name),l.push(m.def)}let I=[{id:L("viw",`${o}:Grid view`,Se(r)),name:"Grid view",type:"grid"}];return await _("table",o,{tableId:o,baseId:p,name:s,primaryFieldId:l[0].id,fieldDefs:l,viewDefs:I,...typeof c.description=="string"?{description:c.description}:{}},r,n),{status:200,body:Z($("table",r).find(g=>g.id===o))}}}if(d[4]==="tables"&&d.length===6&&e==="PATCH"){if(!y)return S(`Could not find base "${p}"`);let s=Q(p,d[5],r);if(!s)return S(`Could not find table "${d[5]}" in base "${p}"`);let o={};return typeof c.name=="string"&&c.name!==""&&(o.name=c.name),typeof c.description=="string"&&(o.description=c.description),Object.keys(o).length===0?f():(await _("table",String(s.id),o,r,n),{status:200,body:Z($("table",r).find(b=>b.id===s.id))})}if(d[4]==="tables"&&d[6]==="fields"&&d.length===7&&e==="POST"){if(!y)return S(`Could not find base "${p}"`);let s=Q(p,d[5],r);if(!s)return S(`Could not find table "${d[5]}" in base "${p}"`);let o=U(s);if(typeof c.name=="string"&&o.some(w=>w.name===c.name))return f();let b=ue(c,new Set(o.map(w=>w.id)),`${s.id}:${o.length}`);return b.ok?(await _("table",String(s.id),{fieldDefs:[...o,b.def]},r,n),{status:200,body:{id:b.def.id,name:b.def.name,type:b.def.type,...b.def.options?{options:b.def.options}:{}}}):b.response}if(d[4]==="tables"&&d[6]==="fields"&&d.length===8&&e==="PATCH"){if(!y)return S(`Could not find base "${p}"`);let s=Q(p,d[5],r);if(!s)return S(`Could not find table "${d[5]}" in base "${p}"`);let o=U(s),b=o.find(l=>l.id===d[7]||l.name===d[7]);if(!b)return S(`Could not find field "${d[7]}" in table "${s.id}"`);if(typeof c.name!="string"&&typeof c.description!="string")return f();let w={...b,...typeof c.name=="string"&&c.name!==""?{name:c.name}:{},...typeof c.description=="string"?{description:c.description}:{}};return await _("table",String(s.id),{fieldDefs:o.map(l=>l.id===b.id?w:l)},r,n),{status:200,body:{id:w.id,name:w.name,type:w.type,...w.description!==void 0?{description:w.description}:{}}}}}return S(`Cannot ${e} ${u.pathname}`)}let R=d[1];if(!R||d.length<3)return S(`Cannot ${e} ${u.pathname}`);if(!Re(R,r))return S(`Could not find base "${R}"`);let T=Q(R,d[2],r);if(!T)return S(`Could not find table "${d[2]}" in base "${R}"`);let E=String(T.id);if(d.length===3){if(e==="GET")return _e(T,A,r);if(e==="POST")return Ke(T,c,r,x,n);if(e==="PATCH"||e==="PUT")return Qe(T,c,e==="PUT",r,x,n);if(e==="DELETE"){let p=pe(A,"records");if(p.length===0||new Set(p).size!==p.length)return f();for(let s of p)if(!P(E,r).some(o=>o.id===s))return S(`Record "${s}" not found in table "${E}"`);let y=[];for(let s of p)await _("record",s,{_deleted:!0,baseId:R,tableId:E},r,n),y.push({id:s,deleted:!0});return{status:200,body:{records:y}}}}if(d.length===4&&d[3]==="listRecords"&&e==="POST")return _e(T,He(c),r);let h=d[3];if(d.length===4&&h){let p=P(E,r).find(y=>y.id===h);if(e==="GET"){if(!p)return S(`Record "${h}" not found in table "${E}"`);let y=A.get("cellFormat")??"json";return y!=="json"&&y!=="string"||y==="string"&&(!A.get("timeZone")||!A.get("userLocale"))?f():{status:200,body:K(T,p,{byFieldId:A.get("returnFieldsByFieldId")==="true",...y==="string"?{asString:!0}:{}},r)}}if(e==="PATCH"||e==="PUT"){if(!p)return S(`Record "${h}" not found in table "${E}"`);let y=be(T,c.fields,c.typecast===!0);if(!y.ok)return y.response;let s=e==="PUT"?y.cells:{...p.cells??{},...y.cells};await _("record",h,{baseId:R,tableId:E,cells:s,_replace:e==="PUT"},r,n);let o=P(E,r).find(b=>b.id===h);return{status:200,body:K(T,o,{byFieldId:c.returnFieldsByFieldId===!0},r)}}if(e==="DELETE")return p?(await _("record",h,{_deleted:!0,baseId:R,tableId:E},r,n),{status:200,body:{id:h,deleted:!0}}):S(`Record "${h}" not found in table "${E}"`)}if(d.length>=5&&d[4]==="comments"&&h){if(!P(E,r).find(s=>s.id===h))return S(`Record "${h}" not found in table "${E}"`);let y=()=>$("comment",r).filter(s=>s.recordId===h);if(d.length===5){if(e==="GET"){let s=A.get("pageSize"),o=J;if(s!==null){let m=Number(s);if(!Number.isFinite(m)||m<1||m>J)return f();o=Math.floor(m)}let b=y(),w=0,l=A.get("offset");if(l!==null&&l!==""){let m=b.findIndex(k=>k.id===l);if(m===-1)return f();w=m}let I=b.slice(w,w+o),g=b[w+o];return{status:200,body:{comments:I.map(le),offset:g?String(g.id):""}}}if(e==="POST"){if(typeof c.text!="string"||c.text===""||c.parentCommentId!==void 0&&!y().some(o=>o.id===c.parentCommentId))return f();let s=L("com",`${h}:${c.text}`,j("comment",r));return await _("comment",s,{commentId:s,baseId:R,tableId:E,recordId:h,text:c.text,author:{id:G.id,email:G.email,name:G.name},createdTime:x,lastUpdatedTime:null,...typeof c.parentCommentId=="string"?{parentCommentId:c.parentCommentId}:{}},r,n),{status:200,body:le($("comment",r).find(o=>o.id===s))}}}if(d.length===6){let s=d[5];if(!y().find(b=>b.id===s))return S(`Comment "${s}" not found on record "${h}"`);if(e==="PATCH")return typeof c.text!="string"||c.text===""?f():(await _("comment",s,{text:c.text,lastUpdatedTime:x},r,n),{status:200,body:le($("comment",r).find(b=>b.id===s))});if(e==="DELETE")return await _("comment",s,{_deleted:!0},r,n),{status:200,body:{id:s,deleted:!0}}}}return S(`Cannot ${e} ${u.pathname}`)}async function Ke(t,e,r,n,a){let i=String(t.id),u=e.typecast===!0,d=e.returnFieldsByFieldId===!0,A=e.records===void 0||e.records===null,c=A?[{fields:e.fields}]:Array.isArray(e.records)?e.records:[];if(!A&&c.length===0||A&&(e.fields===void 0||e.fields===null))return f();let x=[];for(let E of c){let h=E;if(!h||typeof h!="object"||h.fields===void 0)return f();let p=be(t,h.fields,u);if(!p.ok)return p.response;x.push(p.cells)}let R=j("record",r),C=[];for(let E of x){let h=L("rec",`${i}:${R.size}:${JSON.stringify(E)}`,R);R.add(h),await _("record",h,{recordId:h,baseId:t.baseId,tableId:i,cells:E,createdTime:n},r,a),C.push({id:h})}let T=E=>K(t,P(i,r).find(h=>h.id===E),{byFieldId:d},r);return A?{status:200,body:T(C[0].id)}:{status:200,body:{records:C.map(E=>T(E.id))}}}async function Qe(t,e,r,n,a,i){let u=String(t.id),d=e.typecast===!0,A=e.returnFieldsByFieldId===!0;if(!Array.isArray(e.records)||e.records.length===0)return f();let c=e.performUpsert,x=null;if(c!=null){let s=c.fieldsToMergeOn;if(!Array.isArray(s)||s.length<1||s.length>3||!s.every(o=>typeof o=="string"&&X(t,o)!==void 0))return f();x=s.map(o=>X(t,o).id)}let R=[],C=new Set;for(let s of e.records){let o=s;if(!o||typeof o!="object"||o.fields===void 0)return f();let b=be(t,o.fields,d);if(!b.ok)return b.response;if(typeof o.id=="string"){if(!P(u,n).some(w=>w.id===o.id))return S(`Record "${o.id}" not found in table "${u}"`);if(C.has(o.id))return f();C.add(o.id)}else if(!x)return f();R.push({cells:b.cells,explicitId:typeof o.id=="string"?o.id:null})}let T=j("record",n),E=[],h=[],p=[];for(let s of R){let o=s.explicitId;if(o===null&&x){let l=P(u,n).find(I=>x.every(g=>{let m=I.cells?.[g];return JSON.stringify(m??null)===JSON.stringify(s.cells[g]??null)}));o=l?String(l.id):null}if(o===null){let l=L("rec",`${u}:${T.size}:${JSON.stringify(s.cells)}`,T);T.add(l),await _("record",l,{recordId:l,baseId:t.baseId,tableId:u,cells:s.cells,createdTime:a},n,i),E.push(l),p.push(l);continue}let b=P(u,n).find(l=>l.id===o),w=r?s.cells:{...b.cells??{},...s.cells};await _("record",o,{baseId:t.baseId,tableId:u,cells:w,_replace:r},n,i),h.push(o),p.push(o)}let y=p.map(s=>K(t,P(u,n).find(o=>o.id===s),{byFieldId:A},n));return x?{status:200,body:{createdRecords:E,updatedRecords:h,records:y}}:{status:200,body:{records:y}}}import{serveHttp as ft}from"../../engine/v2/volter_world-core.mjs";import{createTwinFetchFromHandler as Ze,statefulTwinManifest as Xe}from"../../engine/v2/volter_world-core.mjs";function ge(t={}){let e=Ze(he,{...t,manifest:Xe({vendor:"airtable",twinOf:"the Airtable Web API (/v0)",stores:"bases, tables and their fields, records and record comments"})});return async function(n){try{return await e(n)}catch(a){return new Response(JSON.stringify({error:{type:"RETRIABLE_ERROR",message:`[twin] unhandled twin error: ${String(a)}`}}),{status:500,headers:{"content-type":"application/json"}})}}}import{assertBudgetGuardIntact as St,confirmAction as Rt,listActions as xt,pendingActions as _t,syncPull as Ot}from"../../engine/v2/volter_world-core.mjs";import{declareRateBudget as qe,rateBudgetPath as gt,rateBudgetWeight as yt,RateBudget as Et}from"../../engine/v2/volter_world-core.mjs";import{RateBudgetError as Pe}from"../../engine/v2/volter_world-core.mjs";var et="airtable",Ce=6e4,ee=150,tt=z*60,ve=300,te={batchWrite:3,createBase:5,other:1},ye={windowMs:Ce,ceiling:ee,defaultWeight:te.other,maxRetryAfterSeconds:ve,rules:[{match:"^POST /v0/meta/bases$",weight:te.createBase},{match:"^(POST|PATCH|PUT) /v0/[^/]+/[^/]+$",weight:te.batchWrite}],reason:`Airtable documents "5 requests per second per base" and "50 requests per second for all traffic using personal access tokens from a given user or service account" (airtable.com/developers/web/api/rate-limits, read 2026-08-31), and says an over-limit caller "will receive a 429 status code and will need to wait ${ce} seconds before subsequent requests will succeed". The TIGHTER per-base figure is the one that can bind a connector pulling one base, so the anchor is ${z} x 60 = ${z*60} requests/minute. ${ee} weighted units / 60s is ${ee} calls a minute \u2014 HALF that, so the 60s average stays under the vendor's own. It is deliberately more permissive than the kernel's undeclared fallback (30 calls/min) BECAUSE 300/min is documented; without that number it would not be. That page documents no response headers; the X-RateLimit-* names the guard reads are the conventional spelling, read if present and never assumed. Airtable's window is a SECOND, so this bounds the 60s AVERAGE and does not pace an intra-second burst; the 429 cooldown is the backstop for that. Batch record writes cost 3 (one request mutates many rows, fires the base's webhooks and re-runs its automations) and POST /v0/meta/bases costs 5 (it provisions a real base in the operator's workspace) \u2014 judgement calls, not published costs.`};qe(et,ye);import{bundleClient as Ct,fileResponse as vt,filePathOf as Pt}from"../../engine/v2/volter_world-core.mjs";import{serveHttp as Dt}from"../../engine/v2/volter_world-core.mjs";export{ge 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-algolia
2
+
3
+ Contains @volter/twin-algolia 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 Ot}from"node:crypto";import{applyTwinWrite as jt,projectResources as W,worldNow as Rt}from"../../engine/v2/volter_world-core.mjs";function Q(t){let e=t.indexOf(":");if(e<0)return;let n=t.slice(0,e).trim(),o=t.slice(e+1).trim(),i=!1;return o.startsWith("-")&&(i=!0,o=o.slice(1)),(o.startsWith('"')&&o.endsWith('"')||o.startsWith("'")&&o.endsWith("'"))&&(o=o.slice(1,-1)),{field:n,value:o,negate:i}}function J(t,e){return Array.isArray(t)?t.some(n=>String(n)===e):t==null?!1:String(t)===e}function F(t,e){if(!e||e.length===0)return!0;for(let n of e)if(!(Array.isArray(n)?n:[n]).some(a=>{let r=Q(a);if(!r)return!1;let l=J(t[r.field],r.value);return r.negate?!l:l}))return!1;return!0}var ht=/^(\S+)\s*(>=|<=|!=|>|<|=)\s*(-?\d+(?:\.\d+)?)$/;function mt(t){let e=t.trim();if(e.length===0)return;let n=e,o=!1;n.startsWith("NOT ")&&(o=!0,n=n.slice(4).trim());let i=ht.exec(n);if(i){let[,r,l,s]=i;return{kind:"compare",c:{field:r,op:o?bt(l):l,value:Number(s)}}}let a=Q(n);if(a)return{kind:"facet",c:{field:a.field,value:a.value,negate:o!==a.negate}}}function bt(t){return{">":"<=",">=":"<","<":">=","<=":">","=":"!=","!=":"="}[t]}function At(t,e){if(e.kind==="facet"){let o=J(t[e.c.field],e.c.value);return e.c.negate?!o:o}let n=t[e.c.field];if(typeof n!="number")return!1;switch(e.c.op){case">":return n>e.c.value;case">=":return n>=e.c.value;case"<":return n<e.c.value;case"<=":return n<=e.c.value;case"=":return n===e.c.value;case"!=":return n!==e.c.value}}function C(t,e){return!e||e.trim().length===0?!0:e.split(/\s+OR\s+/).some(o=>o.split(/\s+AND\s+/).map(i=>mt(i)).every(i=>i?At(t,i):!0))}function $(t,e){let n={};for(let o of e){let i={};for(let a of t){let r=a[o],l=Array.isArray(r)?r:r==null?[]:[r];for(let s of l){let u=String(s);i[u]=(i[u]??0)+1}}n[o]=i}return n}function S(t){return t.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[]}function Z(t,e){let n=t.length,o=e.length;if(n===0)return o;if(o===0)return n;let i=Array.from({length:n+1},()=>new Array(o+1).fill(0));for(let a=0;a<=n;a++)i[a][0]=a;for(let a=0;a<=o;a++)i[0][a]=a;for(let a=1;a<=n;a++)for(let r=1;r<=o;r++){let l=t[a-1]===e[r-1]?0:1,s=Math.min(i[a-1][r]+1,i[a][r-1]+1,i[a-1][r-1]+l);a>1&&r>1&&t[a-1]===e[r-2]&&t[a-2]===e[r-1]&&(s=Math.min(s,i[a-2][r-2]+l)),i[a][r]=s}return i[n][o]}var It=2;function B(t){let e=[];for(let n of t)n.type!=="synonym"||!Array.isArray(n.synonyms)||n.synonyms.length<2||e.push(n.synonyms.map(o=>o.toLowerCase()));return e}function xt(t,e,n){for(let o of n)if(o.includes(t)&&o.includes(e))return!0;return!1}function wt(t,e,n){if(t===e||xt(t,e,n))return 0;let o=Z(t,e);return o<=It?o:void 0}function q(t){return typeof t=="string"?S(t):typeof t=="number"||typeof t=="boolean"?S(String(t)):Array.isArray(t)?t.flatMap(e=>q(e)):[]}function Dt(t,e,n,o){if(t.length===0)return;let i=[],a=0,r=0;for(let s of e){let u;for(let c=0;c<t.length;c++){let d=wt(s,t[c],n);d!==void 0&&(!u||d<u.typos)&&(u={idx:c,typos:d})}if(!u)return;i.push(u.idx),a+=u.typos,u.typos===0&&r++}let l=i.length>0?Math.max(...i)-Math.min(...i):0;return{attributeIndex:o,typoTotal:a,exactCount:r,proximity:l}}function Tt(t){let e=new Set;for(let n of t)for(let o of Object.keys(n))o!=="objectID"&&e.add(o);return[...e].sort()}function Et(t,e,n){for(let o of n){let i=t[o.attribute],a=e[o.attribute],r=typeof i=="number"?i:Number.NEGATIVE_INFINITY,l=typeof a=="number"?a:Number.NEGATIVE_INFINITY;if(r!==l)return o.direction==="desc"?l-r:r-l}return 0}function N(t,e,n={}){let o=n.searchableAttributes&&n.searchableAttributes.length>0?n.searchableAttributes:Tt(t),i=n.customRanking??[],a=n.synonymGroups??[],r=S(e),l=[];for(let s of t){if(r.length===0){l.push({record:s,typoTotal:0,attributeIndex:0,proximity:0,exactCount:0});continue}let u;for(let c=0;c<o.length;c++){let d=q(s[o[c]]),f=Dt(d,r,a,c);f&&(!u||f.typoTotal<u.typoTotal||f.typoTotal===u.typoTotal&&f.attributeIndex<u.attributeIndex)&&(u=f)}u&&l.push({record:s,typoTotal:u.typoTotal,attributeIndex:u.attributeIndex,proximity:u.proximity,exactCount:u.exactCount})}return l.sort((s,u)=>{if(s.typoTotal!==u.typoTotal)return s.typoTotal-u.typoTotal;if(s.attributeIndex!==u.attributeIndex)return s.attributeIndex-u.attributeIndex;if(s.proximity!==u.proximity)return s.proximity-u.proximity;if(s.exactCount!==u.exactCount)return u.exactCount-s.exactCount;let c=Et(s.record,u.record,i);return c!==0?c:s.record.objectID<u.record.objectID?-1:s.record.objectID>u.record.objectID?1:0}),l}var v="algolia";function nt(t){return"api"}function g(t,e){return{status:t,body:{message:e,status:t}}}function I(){return{status:405,body:{message:"twin is read-only; omit readOnly to accept writes",status:405}}}function ot(t){if(t)try{return JSON.parse(t)}catch{return}}function E(t){let e=ot(t);return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function h(t){return t??Rt()}function R(t){return`index:${t}`}function j(t,e){return`record:${t}::${e}`}function _(t,e){return`synonym:${t}::${e}`}function rt(t){return`settings:${t}`}function st(t){let e=t.split("::");if(e.length===2)return{index:e[0],objectID:e[1]}}function St(t){let e=t.split("::");if(e.length===2)return{index:e[0],id:e[1]}}function M(t,e){let n=`${t}:`;return W(v,e).filter(o=>o.type===t&&o.id.startsWith(n)&&o._deleted!==!0)}function D(t,e,n){return W(v,n).find(o=>o.type===t&&o.id===e&&o._deleted!==!0)}function _t(t,e,n){return W(v,n).find(o=>o.type===t&&o.id===e)}var Lt=new Set(["type","id","updatedAt","_deleted"]);function P(t){let e={};for(let[n,o]of Object.entries(t))Lt.has(n)||o===null||(e[n]=o);return e}async function x(t,e,n,o,i){let{resource:a}=await jt(v,{operation:o,subjectType:t,subjectId:e,fields:n,...i.occurredAt?{occurredAt:i.occurredAt}:{},actor:{kind:"agent"}},i.root);return a}async function H(t,e){D("index",R(t),e.root)||await x("index",R(t),{name:t,createdAt:h(e.occurredAt)},"index.touch",e)}function O(t,e){let n=`record:${t}::`;return M("record",e).filter(o=>o.id.startsWith(n)).map(o=>{let i=st(o.id.slice(7));return{...P(o),objectID:i.objectID}})}function Gt(t){let{objectID:e,type:n,...o}=t;return{...o,...n!==void 0?{synonymType:n}:{}}}function it(t){let{synonymType:e,...n}=t;return{...n,...e!==void 0?{type:e}:{}}}function ct(t,e){let n=`synonym:${t}::`;return M("synonym",e).filter(o=>o.id.startsWith(n)).map(o=>{let i=St(o.id.slice(8));return{...it(P(o)),objectID:i.id}})}function U(t,e){let n=D("settings",rt(t),e);return{searchableAttributes:n?.searchableAttributes??[],attributesForFaceting:n?.attributesForFaceting??[],ranking:n?.ranking??["typo","geo","words","filters","proximity","attribute","exact","custom"],customRanking:n?.customRanking??[]}}function vt(t){let e=[];for(let n of t){let o=/^(asc|desc)\(([^)]+)\)$/.exec(n.trim());o&&e.push({direction:o[1],attribute:o[2]})}return e}function Pt(t){let e=st(t.id.slice(7));return{...P(t),objectID:e.objectID}}function tt(t,e,n){return Ot("sha256").update(`algolia-twin-objectid:${t}:${e}:${n}`).digest("hex").slice(0,12)}async function L(t,e,n,o){await H(t,o);let i=_t("record",j(t,e),o.root),{objectID:a,...r}=n,l={};if(i){let{type:s,id:u,_deleted:c,...d}=i;for(let f of Object.keys(d))f in r||(l[f]=null)}await x("record",j(t,e),{...l,...r,_deleted:!1},"record.add_replace",o)}async function et(t,e,n,o,i){if(!D("record",j(t,e),o.root)&&!i)return"not_found";await H(t,o);let{objectID:r,...l}=n;return await x("record",j(t,e),{...l,_deleted:!1},"record.partial_update",o),"ok"}async function G(t,e,n){await x("record",j(t,e),{_deleted:!0},"record.delete",n)}async function K(t){let e=t.method.toUpperCase(),[n,o]=t.path.split("?"),i=(n??"/").replace(/\/+$/,"")||"/",a=new URLSearchParams(o??""),r=i.replace(/^\/+/,"").split("/").filter(Boolean),l=c=>decodeURIComponent(r[c]??"");if(nt({host:t.host,path:i}),i==="/"||r.length===0)return{status:200,body:{service:"algolia",object:"twin"}};if(r[0]!=="1"||r[1]!=="indexes")return g(404,`Route not found: ${e} ${i}`);if(r.length===2&&e==="GET")return{status:200,body:{items:M("index",t.root).map(d=>({name:d.name??"",entries:O(d.name,t.root).length,createdAt:d.createdAt??h(t.occurredAt),updatedAt:d.createdAt??h(t.occurredAt)})),nbPages:1}};let s=l(2);if(r.length===3&&e==="DELETE"){if(t.readOnly)return I();for(let c of O(s,t.root))await G(s,c.objectID,t);for(let c of ct(s,t.root))await x("synonym",_(s,c.objectID),{_deleted:!0},"synonym.delete",t);return await x("index",R(s),{_deleted:!0},"index.delete",t),{status:200,body:{taskID:0,deletedAt:h(t.occurredAt)}}}if(r.length===3&&e==="POST"){if(t.readOnly)return I();let c=E(t.body),d=h(t.occurredAt),f=typeof c.objectID=="string"&&c.objectID.length>0?c.objectID:tt(s,d,O(s,t.root).length);return await L(s,f,{...c,objectID:f},t),{status:200,body:{objectID:f,taskID:0,createdAt:d}}}let u=r.length>=4?r[3]:void 0;if(r.length===4&&u==="clear"&&e==="POST"){if(t.readOnly)return I();if(!D("index",R(s),t.root))return g(404,`Index ${s} does not exist`);for(let c of O(s,t.root))await G(s,c.objectID,t);return{status:200,body:{taskID:0,updatedAt:h(t.occurredAt)}}}if(r.length===4&&u==="batch"&&e==="POST"){if(t.readOnly)return I();let c=E(t.body),d=Array.isArray(c.requests)?c.requests:[],f=h(t.occurredAt),b=[];for(let w=0;w<d.length;w++){let A=d[w].action,y=d[w].body??{};if(A==="addObject"){let p=typeof y.objectID=="string"&&y.objectID.length>0?y.objectID:tt(s,f,O(s,t.root).length+w);await L(s,p,{...y,objectID:p},t),b.push(p)}else if(A==="updateObject"){let p=typeof y.objectID=="string"?y.objectID:"";if(!p)return g(400,"updateObject requires an objectID in the request body");await L(s,p,y,t),b.push(p)}else if(A==="partialUpdateObject"||A==="partialUpdateObjectNoCreate"){let p=typeof y.objectID=="string"?y.objectID:"";if(!p)return g(400,`${A} requires an objectID in the request body`);if(await et(s,p,y,t,A==="partialUpdateObject")==="not_found")return g(404,`Object not found - Received createIfNotExist=false and object ${p} does not exist yet`);b.push(p)}else if(A==="deleteObject"){let p=typeof y.objectID=="string"?y.objectID:"";if(!p)return g(400,"deleteObject requires an objectID in the request body");await G(s,p,t),b.push(p)}else return g(400,`Invalid batch action: ${String(A)}`)}return{status:200,body:{objectIDs:b,taskID:0}}}if(r.length===4&&u==="query"&&e==="POST")return kt(s,E(t.body),t);if(r.length===4&&u==="settings"&&e==="GET")return{status:200,body:U(s,t.root)};if(r.length===4&&u==="settings"&&e==="PUT"){if(t.readOnly)return I();let c=E(t.body),d=U(s,t.root);return await x("settings",rt(s),{...d,...c},"settings.set",t),{status:200,body:{taskID:0,updatedAt:h(t.occurredAt)}}}if(u==="synonyms"){if(r.length===5&&r[4]==="batch"&&e==="POST"){if(t.readOnly)return I();let c=ot(t.body),d=Array.isArray(c)?c:[];for(let f of d){let b=typeof f.objectID=="string"?f.objectID:"";if(!b)return g(400,"each synonym requires an objectID");await H(s,t),await x("synonym",_(s,b),Gt(f),"synonym.save",t)}return{status:200,body:{updatedAt:h(t.occurredAt),taskID:0}}}if(r.length===5&&e==="GET"){let c=l(4),d=D("synonym",_(s,c),t.root);return d?{status:200,body:{...it(P(d)),objectID:c}}:g(404,"ObjectID does not exist")}if(r.length===5&&e==="DELETE"){if(t.readOnly)return I();let c=l(4);return await x("synonym",_(s,c),{_deleted:!0},"synonym.delete",t),{status:200,body:{deletedAt:h(t.occurredAt),taskID:0}}}return g(404,`Route not found: ${e} ${i}`)}if(r.length===4){let c=l(3);if(e==="GET"){let d=D("record",j(s,c),t.root);return d?{status:200,body:Pt(d)}:g(404,"ObjectID does not exist")}if(e==="PUT"){if(t.readOnly)return I();let d=E(t.body);return await L(s,c,{...d,objectID:c},t),{status:200,body:{objectID:c,taskID:0,updatedAt:h(t.occurredAt)}}}if(e==="DELETE")return t.readOnly?I():(await G(s,c,t),{status:200,body:{deletedAt:h(t.occurredAt),taskID:0}})}if(r.length===5&&r[4]==="partial"&&e==="POST"){if(t.readOnly)return I();let c=l(3),d=E(t.body),f=a.get("createIfNotExists")!=="false";return await et(s,c,d,t,f)==="not_found"?g(404,`Object not found - Received createIfNotExist=false and object ${c} does not exist yet`):{status:200,body:{objectID:c,taskID:0,updatedAt:h(t.occurredAt)}}}return g(404,`Route not found: ${e} ${i}`)}function kt(t,e,n){if(!D("index",R(t),n.root))return g(404,`Index ${t} does not exist`);let i=U(t,n.root),a=typeof e.query=="string"?e.query:"",r=typeof e.page=="number"?e.page:0,l=typeof e.hitsPerPage=="number"?e.hitsPerPage:20,s=typeof e.filters=="string"?e.filters:void 0,u=e.facetFilters??void 0,c=Array.isArray(e.attributesToRetrieve)?e.attributesToRetrieve:void 0,d=Array.isArray(e.facets)?e.facets:void 0,f=O(t,n.root),b=B(ct(t,n.root)),w=f.filter(m=>C(m,s)&&F(m,u)),A=vt(i.customRanking),y=N(w,a,{searchableAttributes:i.searchableAttributes,customRanking:A,synonymGroups:b}),p=y.length,T=Math.max(1,l),ft=Math.max(1,Math.ceil(p/T)),pt=y.slice(r*T,r*T+T),yt=m=>{if(!c||c.includes("*"))return{...m,objectID:m.objectID};let z={objectID:m.objectID};for(let k of c)k in m&&(z[k]=m[k]);return z},gt=i.attributesForFaceting.filter(m=>!d||d.includes("*")||d.includes(m)),X={hits:pt.map(m=>yt(m.record)),nbHits:p,page:r,nbPages:ft,hitsPerPage:T,processingTimeMS:0,query:a,params:""};return d&&d.length>0&&(X.facets=$(w,gt)),{status:200,body:X}}import{serveHttp as Qt}from"../../engine/v2/volter_world-core.mjs";import{createTwinFetchFromHandler as Ft,statefulTwinManifest as Ct}from"../../engine/v2/volter_world-core.mjs";function at(t={}){return Ft(K,{...t,manifest:Ct({vendor:"algolia",twinOf:"Algolia hosted search",stores:"indexes and their records (CRUD + batch), searched by a real local engine"}),extras:(e,n)=>({host:e.headers.get("x-algolia-target-host")||e.headers.get("host")||n.host})})}import{syncPull as ue}from"../../engine/v2/volter_world-core.mjs";import{declareRateBudget as $t,rateBudgetPath as ee,rateBudgetWeight as ne,RateBudget as oe,RateBudgetError as re}from"../../engine/v2/volter_world-core.mjs";import{RateBudgetError as Nt}from"../../engine/v2/volter_world-core.mjs";var Bt="algolia",ut=6e4,dt=60,lt=300,Y={browse:4,other:2};var V={windowMs:ut,ceiling:dt,defaultWeight:Y.other,maxRetryAfterSeconds:lt,rules:[{match:"(^|\\.)listRecords$",weight:Y.browse}],reason:`Algolia publishes NO scalar rate limit for the Search API, browse, or listIndices \u2014 the documented limits table covers only the Connectors (2000/min/IP push, 200/min/IP other), Analytics (100/min/app) and DocSearch (3 q/s) surfaces, per-plan max QPS is "contact Support", and browse is explicitly EXCLUDED from search-QPS accounting. With no published figure to aim at, this ceiling is pinned to the kernel's conservative fallback (60 units / 60s at weight 2 = 30 calls/min) rather than invented: it is no more permissive than an undeclared vendor already gets. listRecords costs 4 because it is the cross-index browse aggregation a pagination bug turns into hundreds of calls \u2014 a judgement call, not a published cost. Algolia does not document Retry-After; the 429/exhaustion cooldown is the backstop.`};$t(Bt,V);export{at as createTwinFetch};