reflex-agent 0.2.4 → 0.3.1

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 (206) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +111 -98
  3. package/.next/app-path-routes-manifest.json +9 -9
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +4 -54
  6. package/.next/react-loadable-manifest.json +1 -1
  7. package/.next/server/app/_not-found/page.js +1 -1
  8. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  9. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/agents/[agentId]/page.js +3 -3
  11. package/.next/server/app/agents/[agentId]/page.js.nft.json +1 -1
  12. package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/agents/[agentId]/respond/route.js +2 -2
  14. package/.next/server/app/api/agents/[agentId]/respond/route.js.nft.json +1 -1
  15. package/.next/server/app/api/agents/[agentId]/respond/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/images/[rootId]/[file]/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/oauth/callback/route.js +3 -3
  18. package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/oauth/start/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/roots/[id]/attachments/route.js +0 -0
  21. package/.next/server/app/api/roots/[id]/attachments/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js +2 -2
  23. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js.nft.json +1 -1
  24. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js +2 -2
  26. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js.nft.json +1 -1
  27. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js +2 -2
  29. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js.nft.json +1 -1
  30. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/roots/[id]/dashboard/route.js +1 -1
  32. package/.next/server/app/api/roots/[id]/dashboard/route.js.nft.json +1 -1
  33. package/.next/server/app/api/roots/[id]/dashboard/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/roots/[id]/suggestions/route.js +1 -1
  35. package/.next/server/app/api/roots/[id]/suggestions/route.js.nft.json +1 -1
  36. package/.next/server/app/api/roots/[id]/suggestions/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/utilities/[scope]/[id]/bundle.js/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js +2 -2
  39. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js.nft.json +1 -1
  40. package/.next/server/app/api/utilities/[scope]/[id]/host/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/utilities/[scope]/[id]/host-api.mjs/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/utilities/[scope]/[id]/iframe/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/utilities/[scope]/[id]/style.css/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/audit/page.js +2 -2
  46. package/.next/server/app/audit/page.js.nft.json +1 -1
  47. package/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/onboarding/page.js +4 -4
  49. package/.next/server/app/onboarding/page.js.nft.json +1 -1
  50. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  51. package/.next/server/app/page.js +2 -2
  52. package/.next/server/app/page.js.nft.json +1 -1
  53. package/.next/server/app/page_client-reference-manifest.js +1 -1
  54. package/.next/server/app/roots/[id]/chat/[topicId]/page.js +2 -6
  55. package/.next/server/app/roots/[id]/chat/[topicId]/page.js.nft.json +1 -1
  56. package/.next/server/app/roots/[id]/chat/[topicId]/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/roots/[id]/kb/[...slug]/page.js +2 -6
  58. package/.next/server/app/roots/[id]/kb/[...slug]/page.js.nft.json +1 -1
  59. package/.next/server/app/roots/[id]/kb/[...slug]/page_client-reference-manifest.js +1 -1
  60. package/.next/server/app/roots/[id]/page.js +3 -3
  61. package/.next/server/app/roots/[id]/page.js.nft.json +1 -1
  62. package/.next/server/app/roots/[id]/page_client-reference-manifest.js +1 -1
  63. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js +2 -2
  64. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js.nft.json +1 -1
  65. package/.next/server/app/roots/[id]/workflows/[wfId]/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/roots/[id]/workflows/page.js +2 -2
  67. package/.next/server/app/roots/[id]/workflows/page.js.nft.json +1 -1
  68. package/.next/server/app/roots/[id]/workflows/page_client-reference-manifest.js +1 -1
  69. package/.next/server/app/roots/new/page.js +4 -2
  70. package/.next/server/app/roots/new/page.js.nft.json +1 -1
  71. package/.next/server/app/roots/new/page_client-reference-manifest.js +1 -1
  72. package/.next/server/app/settings/page.js +6 -6
  73. package/.next/server/app/settings/page.js.nft.json +1 -1
  74. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  75. package/.next/server/app/share/[id]/file/page.js +2 -2
  76. package/.next/server/app/share/[id]/file/page.js.nft.json +1 -1
  77. package/.next/server/app/share/[id]/file/page_client-reference-manifest.js +1 -1
  78. package/.next/server/app/share/[id]/page.js +2 -2
  79. package/.next/server/app/share/[id]/page.js.nft.json +1 -1
  80. package/.next/server/app/share/[id]/page_client-reference-manifest.js +1 -1
  81. package/.next/server/app/utilities/[scope]/[id]/page.js +2 -2
  82. package/.next/server/app/utilities/[scope]/[id]/page.js.nft.json +1 -1
  83. package/.next/server/app/utilities/[scope]/[id]/page_client-reference-manifest.js +1 -1
  84. package/.next/server/app/utilities/page.js +2 -17
  85. package/.next/server/app/utilities/page.js.nft.json +1 -1
  86. package/.next/server/app/utilities/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app-paths-manifest.json +9 -9
  88. package/.next/server/chunks/1223.js +1 -1
  89. package/.next/server/chunks/133.js +1 -490
  90. package/.next/server/chunks/1888.js +1 -1
  91. package/.next/server/chunks/{9739.js → 1988.js} +13 -9
  92. package/.next/server/chunks/2433.js +1 -1
  93. package/.next/server/chunks/2503.js +1 -1
  94. package/.next/server/chunks/285.js +471 -0
  95. package/.next/server/chunks/2959.js +1 -0
  96. package/.next/server/chunks/2995.js +1 -0
  97. package/.next/server/chunks/3240.js +1 -1
  98. package/.next/server/chunks/3332.js +1 -1
  99. package/.next/server/chunks/3657.js +1 -1
  100. package/.next/server/chunks/4066.js +1 -1
  101. package/.next/server/chunks/4438.js +1 -0
  102. package/.next/server/chunks/4514.js +3 -0
  103. package/.next/server/chunks/4553.js +1 -1
  104. package/.next/server/chunks/4812.js +179 -0
  105. package/.next/server/chunks/4925.js +1 -1
  106. package/.next/server/chunks/{3953.js → 5068.js} +2 -2
  107. package/.next/server/chunks/5319.js +1 -1
  108. package/.next/server/chunks/569.js +1 -1
  109. package/.next/server/chunks/6730.js +1 -1
  110. package/.next/server/chunks/6909.js +142 -161
  111. package/.next/server/chunks/8262.js +1 -1
  112. package/.next/server/chunks/9098.js +1 -1
  113. package/.next/server/chunks/94.js +1 -1
  114. package/.next/server/chunks/9427.js +1 -0
  115. package/.next/server/chunks/9538.js +1 -0
  116. package/.next/server/chunks/963.js +1 -0
  117. package/.next/server/chunks/9835.js +1 -1
  118. package/.next/server/middleware-build-manifest.js +1 -1
  119. package/.next/server/middleware-manifest.json +5 -5
  120. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  121. package/.next/server/pages/500.html +1 -1
  122. package/.next/server/pages-manifest.json +1 -2
  123. package/.next/server/server-reference-manifest.js +1 -1
  124. package/.next/server/server-reference-manifest.json +1 -1
  125. package/.next/static/chunks/2865-134f546f21ca4330.js +1 -0
  126. package/.next/static/chunks/4108.5abdb7812a13eafd.js +1 -0
  127. package/.next/static/chunks/5254-4196f25e56270de5.js +1 -0
  128. package/.next/static/chunks/5521-cbc665104c7e59d3.js +1 -0
  129. package/.next/static/chunks/6445-99824866a51b582a.js +1 -0
  130. package/.next/static/chunks/8855-9b941d2b78f398ce.js +1 -0
  131. package/.next/static/chunks/8871-2948840b33c0863d.js +1 -0
  132. package/.next/static/chunks/9411-af5f758c57741929.js +3 -0
  133. package/.next/static/chunks/app/agents/[agentId]/page-5d6f4cb16b42d02b.js +1 -0
  134. package/.next/static/chunks/app/layout-d4cf24375db6d793.js +1 -0
  135. package/.next/static/chunks/app/onboarding/page-7303664b62ccc24a.js +1 -0
  136. package/.next/static/chunks/app/page-97d312db91d569f7.js +1 -0
  137. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-123f60a544619a3c.js +1 -0
  138. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-e253597edb1b2440.js +1 -0
  139. package/.next/static/chunks/app/roots/[id]/page-91a8de6a1c79f8a3.js +1 -0
  140. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-4300a52e163883df.js +1 -0
  141. package/.next/static/chunks/app/roots/new/page-6b104aad46a38173.js +1 -0
  142. package/.next/static/chunks/app/settings/page-afe1b80f7f45c5eb.js +1 -0
  143. package/.next/static/chunks/app/share/[id]/page-a5fb565bd892d4df.js +1 -0
  144. package/.next/static/chunks/app/utilities/[scope]/[id]/page-eb713a2b5209942c.js +1 -0
  145. package/.next/static/chunks/app/utilities/page-b7f30c151c42a27c.js +1 -0
  146. package/.next/static/chunks/{webpack-5fca180586957874.js → webpack-bddc3babcbc30dd7.js} +1 -1
  147. package/.next/static/css/60e9b6cdf1283e83.css +1 -0
  148. package/.next/trace +47 -46
  149. package/dist/lib/reflex/agents/prompts.js +46 -46
  150. package/dist/lib/reflex/agents/prompts.js.map +1 -1
  151. package/dist/lib/reflex/prompts/defaults.js +102 -102
  152. package/next.config.ts +4 -1
  153. package/package.json +2 -2
  154. package/.next/server/app/_not-found.html +0 -1
  155. package/.next/server/app/_not-found.meta +0 -8
  156. package/.next/server/app/_not-found.rsc +0 -18
  157. package/.next/server/app/index.html +0 -1
  158. package/.next/server/app/index.meta +0 -9
  159. package/.next/server/app/index.rsc +0 -19
  160. package/.next/server/chunks/1410.js +0 -1
  161. package/.next/server/chunks/1986.js +0 -1
  162. package/.next/server/chunks/2448.js +0 -3
  163. package/.next/server/chunks/5754.js +0 -3
  164. package/.next/server/chunks/7097.js +0 -1
  165. package/.next/server/chunks/7782.js +0 -1
  166. package/.next/server/chunks/7987.js +0 -1
  167. package/.next/server/chunks/810.js +0 -1
  168. package/.next/server/chunks/8843.js +0 -1
  169. package/.next/server/chunks/9328.js +0 -179
  170. package/.next/server/pages/404.html +0 -1
  171. package/.next/static/chunks/2488-c9590facb4b9f184.js +0 -1
  172. package/.next/static/chunks/2684-257d38989ef53935.js +0 -1
  173. package/.next/static/chunks/4108.fb9f99a9c899ef54.js +0 -1
  174. package/.next/static/chunks/6231-d83c1544bbea8424.js +0 -1
  175. package/.next/static/chunks/9045-731ff0865352dd95.js +0 -1
  176. package/.next/static/chunks/9496-75ccd3fadb294fba.js +0 -1
  177. package/.next/static/chunks/992-4e7b7f722c629e21.js +0 -1
  178. package/.next/static/chunks/app/agents/[agentId]/page-0b5c2838354d0eba.js +0 -1
  179. package/.next/static/chunks/app/layout-9a59ed07c18cb786.js +0 -1
  180. package/.next/static/chunks/app/onboarding/page-79f07a813ea2abfe.js +0 -1
  181. package/.next/static/chunks/app/page-27f4b98b02ac4f79.js +0 -1
  182. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/page-8db2d0b75cd333c8.js +0 -1
  183. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-873b131eec3a2f30.js +0 -1
  184. package/.next/static/chunks/app/roots/[id]/page-270d0d49eb668784.js +0 -1
  185. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-7c1f10dbe0bcb9ad.js +0 -1
  186. package/.next/static/chunks/app/roots/new/page-ac1a9f6379710ca2.js +0 -1
  187. package/.next/static/chunks/app/settings/page-81cb1393e817dfc3.js +0 -1
  188. package/.next/static/chunks/app/share/[id]/page-2d123f0a99e1606f.js +0 -1
  189. package/.next/static/chunks/app/utilities/[scope]/[id]/page-0bbb8d17af80c1da.js +0 -1
  190. package/.next/static/chunks/app/utilities/page-e6ce673b9357bf1f.js +0 -1
  191. package/.next/static/css/87e01f779d555d04.css +0 -1
  192. package/packages/utilities/learn-anything/README.md +0 -41
  193. package/packages/utilities/learn-anything/actions/_json.ts +0 -191
  194. package/packages/utilities/learn-anything/actions/_store.ts +0 -248
  195. package/packages/utilities/learn-anything/actions/buildModule.ts +0 -487
  196. package/packages/utilities/learn-anything/actions/explainSelection.ts +0 -64
  197. package/packages/utilities/learn-anything/actions/generateOutline.ts +0 -170
  198. package/packages/utilities/learn-anything/actions/generateQuiz.ts +0 -72
  199. package/packages/utilities/learn-anything/actions/generateTrainer.ts +0 -106
  200. package/packages/utilities/learn-anything/actions/refreshCourseCard.ts +0 -76
  201. package/packages/utilities/learn-anything/actions/tutorAsk.ts +0 -93
  202. package/packages/utilities/learn-anything/article-view.tsx +0 -464
  203. package/packages/utilities/learn-anything/manifest.json +0 -42
  204. package/packages/utilities/learn-anything/ui.tsx +0 -1589
  205. /package/.next/static/{og_wC7UPkGtJDiapaTgBr → IGuuMcet1qtGZQCP2MEn4}/_buildManifest.js +0 -0
  206. /package/.next/static/{og_wC7UPkGtJDiapaTgBr → IGuuMcet1qtGZQCP2MEn4}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";exports.id=1888,exports.ids=[94,1223,1888],exports.modules={1223:(a,b,c)=>{c.d(b,{De:()=>u,Dt:()=>s,Sh:()=>r,cL:()=>p,getOAuthTokens:()=>t,gi:()=>v,tY:()=>q});var d=c(73024),e=c(76760),f=c.n(e),g=c(10094),h=c(73652);let i=f().join((0,h._)(),"oauth"),j=f().join(i,"clients"),k=f().join(i,"tokens");function l(a){return f().join(j,`${a}.json`)}function m(a){return f().join(k,`${a}.json`)}async function n(a,b){await d.promises.mkdir(f().dirname(a),{recursive:!0}),await d.promises.writeFile(a,JSON.stringify(b,null,2)+"\n",{encoding:"utf8",mode:384});try{await d.promises.chmod(a,384)}catch{}}async function o(a){try{let b=await d.promises.readFile(a,"utf8");return JSON.parse(b)}catch{return null}}async function p(a,b){let{getOAuthProvider:d}=await Promise.resolve().then(c.bind(c,10094));if(!await d(a))throw Error(`unknown provider: ${a}`);await n(l(a),{...b,updatedAt:new Date().toISOString()})}async function q(a){return o(l(a))}async function r(a){try{await d.promises.unlink(l(a))}catch{}}async function s(a,b){await n(m(a),{...b,updatedAt:new Date().toISOString()})}async function t(a){return o(m(a))}async function u(a){try{await d.promises.unlink(m(a))}catch{}}async function v(){let a=[];for(let b of(await (0,g.E4)())){let c=b.def,d=await q(c.id),e=await t(c.id);a.push({id:c.id,label:c.label,hasClient:!!d,hasTokens:!!e,...e?.expiresAt!==void 0?{expiresAt:e.expiresAt}:{},setupHint:c.setupHint,consoleUrl:c.consoleUrl,origin:b.origin,setupSteps:c.setupSteps})}return a}},10094:(a,b,c)=>{c.d(b,{Cs:()=>n,E4:()=>s,H:()=>w,To:()=>v,getOAuthProvider:()=>t,isOAuthProviderId:()=>u,lL:()=>k,uq:()=>x});var d=c(73024),e=c(48161),f=c.n(e),g=c(76760),h=c.n(g),i=c(56149);let j=i.Ik({title:i.Yj().min(1).max(200),body:i.Yj().max(2e3).optional(),field:i.Yj().max(200).optional(),copy:i.Yj().max(2e3).optional(),choice:i.Yj().max(200).optional()}),k=i.Ik({id:i.Yj().min(1).max(64).regex(/^[a-z][a-z0-9-]*$/,"provider id must be kebab-case (e.g. google, dropbox)"),label:i.Yj().min(1).max(120),authorizeUrl:i.Yj().url(),tokenUrl:i.Yj().url(),defaultScopes:i.YO(i.Yj()).default([]),supportsPKCE:i.zM().default(!0),refreshTokenSupported:i.zM().default(!0),extraAuthorizeParams:i.g1(i.Yj(),i.Yj()).default({}),needsClientSecret:i.zM().default(!0),setupHint:i.Yj().default(""),consoleUrl:i.Yj().url(),setupSteps:i.YO(j).default([])}),l={google:{id:"google",label:"Google",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",defaultScopes:["openid","email","https://www.googleapis.com/auth/calendar"],supportsPKCE:!0,refreshTokenSupported:!0,extraAuthorizeParams:{access_type:"offline",prompt:"consent"},needsClientSecret:!0,setupHint:"Если ещё не делал — сначала включи нужный API (Calendar/Gmail/Drive) во вкладке APIs & Services → Library.",consoleUrl:"https://console.cloud.google.com/apis/credentials",setupSteps:[{title:"Открой Google Cloud Console → APIs & Services → Credentials."},{title:"Нажми \xab+ CREATE CREDENTIALS\xbb → \xabOAuth client ID\xbb."},{title:"Application type",choice:"Web application",body:"Не \xabDesktop\xbb — Reflex использует фиксированный localhost-redirect."},{title:"Name — любое, например \xabReflex\xbb."},{title:"Authorized redirect URIs → ADD URI",field:"Authorized redirect URIs",copy:"http://localhost:3210/api/oauth/callback",body:"Точно как есть, без слэша в конце, http (не https)."},{title:"Жми CREATE → откроется попап с Client ID и Client Secret."},{title:"Скопируй сюда оба значения. (Если потерял — открой клиент в Credentials, \xabDownload JSON\xbb или \xabReset secret\xbb.)"},{title:"Перед первым Authorize убедись, что нужный API включён: APIs & Services → Library → Google Calendar API → Enable (для других сервисов — аналогично)."}]},github:{id:"github",label:"GitHub",authorizeUrl:"https://github.com/login/oauth/authorize",tokenUrl:"https://github.com/login/oauth/access_token",defaultScopes:["repo","read:user"],supportsPKCE:!1,refreshTokenSupported:!1,extraAuthorizeParams:{},needsClientSecret:!0,setupHint:"Личные OAuth Apps живут в Settings → Developer settings.",consoleUrl:"https://github.com/settings/developers",setupSteps:[{title:"Открой github.com/settings/developers → OAuth Apps."},{title:"Нажми \xabNew OAuth App\xbb."},{title:"Application name — что угодно, например \xabReflex\xbb."},{title:"Homepage URL",field:"Homepage URL",copy:"http://localhost:3210"},{title:"Authorization callback URL",field:"Authorization callback URL",copy:"http://localhost:3210/api/oauth/callback"},{title:"Жми \xabRegister application\xbb."},{title:"Скопируй \xabClient ID\xbb отсюда → в Reflex."},{title:"Нажми \xabGenerate a new client secret\xbb, скопируй значение сразу (показывается один раз) → в Reflex."}]},notion:{id:"notion",label:"Notion",authorizeUrl:"https://api.notion.com/v1/oauth/authorize",tokenUrl:"https://api.notion.com/v1/oauth/token",defaultScopes:[],supportsPKCE:!1,refreshTokenSupported:!1,extraAuthorizeParams:{owner:"user"},needsClientSecret:!0,setupHint:"Reflex использует Public integration (с OAuth flow), не Internal.",consoleUrl:"https://www.notion.so/profile/integrations",setupSteps:[{title:"Открой notion.so/profile/integrations → \xab+ New integration\xbb."},{title:"Name — \xabReflex\xbb."},{title:"Associated workspace — твой workspace."},{title:"Type",choice:"Public",body:"Internal не подходит — для OAuth flow нужна публичная integration."},{title:"Submit → integration создана. Перейди на её страницу."},{title:"В разделе \xabOAuth Domain & URIs\xbb → Redirect URIs → Add URI",field:"Redirect URIs",copy:"http://localhost:3210/api/oauth/callback"},{title:"Save."},{title:"В \xabSecrets\xbb скопируй OAuth client ID и OAuth client secret сюда."}]},slack:{id:"slack",label:"Slack",authorizeUrl:"https://slack.com/oauth/v2/authorize",tokenUrl:"https://slack.com/api/oauth.v2.access",defaultScopes:["chat:write","channels:read"],supportsPKCE:!1,refreshTokenSupported:!0,extraAuthorizeParams:{},needsClientSecret:!0,setupHint:"Scopes по умолчанию (chat:write, channels:read) можно расширить в OAuth & Permissions.",consoleUrl:"https://api.slack.com/apps",setupSteps:[{title:"Открой api.slack.com/apps → \xabCreate New App\xbb → \xabFrom scratch\xbb."},{title:"App Name — \xabReflex\xbb, выбери свой workspace → Create App."},{title:"В левой панели открой \xabOAuth & Permissions\xbb → Redirect URLs → \xabAdd New Redirect URL\xbb",field:"Redirect URLs",copy:"http://localhost:3210/api/oauth/callback"},{title:"Save URLs."},{title:"Под Scopes → User Token Scopes добавь нужные (chat:write, channels:read и т.д. — из defaults Reflex)."},{title:"Вверху страницы Install App → разреши доступ → получишь Client ID и Client Secret в \xabBasic Information\xbb."}]},linear:{id:"linear",label:"Linear",authorizeUrl:"https://linear.app/oauth/authorize",tokenUrl:"https://api.linear.app/oauth/token",defaultScopes:["read","write"],supportsPKCE:!1,refreshTokenSupported:!0,extraAuthorizeParams:{},needsClientSecret:!0,setupHint:"Личная OAuth-aplication привязывается к твоему workspace.",consoleUrl:"https://linear.app/settings/api/applications/new",setupSteps:[{title:"Открой linear.app/settings/api/applications/new (Settings → API → OAuth applications → Create new)."},{title:"Name — \xabReflex\xbb, описание любое."},{title:"Developer URL",field:"Developer URL",copy:"http://localhost:3210"},{title:"Callback URLs",field:"Callback URLs",copy:"http://localhost:3210/api/oauth/callback"},{title:"Scopes — отметь read + write (или те, что нужны: issues:create и т.п.)."},{title:"Submit → копируй Client ID + Client Secret сюда."}]}},m=Object.keys(l),n="http://localhost:3210/api/oauth/callback",o=h().join(f().homedir(),".reflex","oauth","providers.json"),p=i.Ik({version:i.eu(1),providers:i.YO(k)});async function q(){try{let a=await d.promises.readFile(o,"utf8"),b=p.safeParse(JSON.parse(a));if(!b.success)return{version:1,providers:[]};return b.data}catch{return{version:1,providers:[]}}}async function r(a){await d.promises.mkdir(h().dirname(o),{recursive:!0}),await d.promises.writeFile(o,JSON.stringify(a,null,2)+"\n",{encoding:"utf8",mode:384});try{await d.promises.chmod(o,384)}catch{}}async function s(){let a=await q(),b=new Set(a.providers.map(a=>a.id)),c=[];for(let a of m)b.has(a)||c.push({def:l[a],origin:"builtin"});for(let b of a.providers)c.push({def:b,origin:"user"});return c}async function t(a){let b=await s();return b.find(b=>b.def.id===a)?.def??null}async function u(a){return await t(a)!==null}async function v(a){let b=k.parse(a);if(void 0!==l[b.id])throw Error(`"${b.id}" is a built-in provider id — pick a different slug`);let c=await q();if(c.providers.some(a=>a.id===b.id))throw Error(`provider "${b.id}" already exists`);c.providers.push(b),await r(c)}async function w(a,b){if(void 0!==l[a])throw Error(`cannot edit built-in provider "${a}"`);let c=await q(),d=c.providers.findIndex(b=>b.id===a);if(d<0)throw Error(`provider "${a}" not found`);let e=k.parse({...c.providers[d],...b,id:a});c.providers[d]=e,await r(c)}async function x(a){if(void 0!==l[a])throw Error(`cannot remove built-in provider "${a}"`);let b=await q(),c=b.providers.filter(b=>b.id!==a);c.length!==b.providers.length&&(b.providers=c,await r(b))}},61888:(a,b,c)=>{c.d(b,{b:()=>i,getAccessToken:()=>j});var d=c(77598),e=c(10094),f=c(1223);let g=globalThis.__reflexOAuthPending??new Map;function h(a){return a.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function i(a,b){let c,i=Date.now()-9e5;for(let[a,b]of g)b.createdAt<i&&g.delete(a);let j=await (0,e.getOAuthProvider)(a);if(!j)throw Error(`unknown provider: ${a}`);let k=await (0,f.tY)(a);if(!k)throw Error(`OAuth client for "${a}" is not configured — set client_id/secret in Settings → OAuth first`);let l=h((0,d.randomBytes)(24)),m=b&&b.length>0?b:k.scopes&&k.scopes.length>0?k.scopes:j.defaultScopes,n=new URLSearchParams({client_id:k.clientId,redirect_uri:e.Cs,response_type:"code",state:l,...m.length>0?{scope:m.join(" ")}:{},...j.extraAuthorizeParams??{}});if(j.supportsPKCE){let{verifier:a,challenge:b}=function(){let a=h((0,d.randomBytes)(32)),b=h((0,d.createHash)("sha256").update(a).digest());return{verifier:a,challenge:b}}();c=a,n.set("code_challenge",b),n.set("code_challenge_method","S256")}g.set(l,{provider:a,...void 0!==c?{codeVerifier:c}:{},scopes:m,createdAt:Date.now()});let o=k.authorizeUrl??j.authorizeUrl;return{authorizeUrl:`${o}?${n.toString()}`,state:l}}async function j(a){let b=await (0,e.getOAuthProvider)(a);if(!b)throw Error(`unknown provider: ${a}`);let c=await (0,f.getOAuthTokens)(a);if(!c)throw Error(`provider "${a}" not authorized — open Settings → OAuth and click Authorize`);if(!(void 0!==c.expiresAt&&c.expiresAt-6e4<Date.now()))return c.accessToken;if(!c.refreshToken)throw Error(`access token for "${a}" expired and no refresh_token — re-authorize`);let d=await (0,f.tY)(a);if(!d)throw Error(`OAuth client for "${a}" is not configured`);let g=new URLSearchParams({grant_type:"refresh_token",refresh_token:c.refreshToken,client_id:d.clientId});b.needsClientSecret&&d.clientSecret&&g.set("client_secret",d.clientSecret);let h=await k(b,d,g),i={accessToken:h.accessToken,refreshToken:h.refreshToken??c.refreshToken,...void 0!==h.expiresAt?{expiresAt:h.expiresAt}:{},...h.scope?{scope:h.scope}:c.scope?{scope:c.scope}:{},...h.tokenType?{tokenType:h.tokenType}:c.tokenType?{tokenType:c.tokenType}:{}};return await (0,f.Dt)(a,i),i.accessToken}async function k(a,b,c){let d,e=b.tokenUrl??a.tokenUrl,f=await fetch(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:c.toString()}),g=await f.text();if(!f.ok)throw Error(`token endpoint HTTP ${f.status}: ${g.slice(0,500)}`);if(g.trim().startsWith("{"))d=JSON.parse(g);else for(let[a,b]of(d={},new URLSearchParams(g)))d[a]=b;if(d.error)throw Error(`OAuth error: ${d.error}${d.error_description?` — ${d.error_description}`:""}`);let h="string"==typeof d.access_token?d.access_token:null;if(!h)throw Error(`token endpoint returned no access_token (${g.slice(0,200)})`);let i="number"==typeof d.expires_in?d.expires_in:"string"==typeof d.expires_in?Number(d.expires_in):void 0;return{accessToken:h,..."string"==typeof d.refresh_token?{refreshToken:d.refresh_token}:{},...void 0!==i&&!Number.isNaN(i)?{expiresAt:Date.now()+1e3*i}:{},..."string"==typeof d.scope?{scope:d.scope}:{},..."string"==typeof d.token_type?{tokenType:d.token_type}:{}}}globalThis.__reflexOAuthPending=g}};
1
+ "use strict";exports.id=1888,exports.ids=[94,1223,1888],exports.modules={1223:(a,b,c)=>{c.d(b,{De:()=>u,Dt:()=>s,Sh:()=>r,cL:()=>p,getOAuthTokens:()=>t,gi:()=>v,tY:()=>q});var d=c(73024),e=c(76760),f=c.n(e),g=c(10094),h=c(73652);let i=f().join((0,h._)(),"oauth"),j=f().join(i,"clients"),k=f().join(i,"tokens");function l(a){return f().join(j,`${a}.json`)}function m(a){return f().join(k,`${a}.json`)}async function n(a,b){await d.promises.mkdir(f().dirname(a),{recursive:!0}),await d.promises.writeFile(a,JSON.stringify(b,null,2)+"\n",{encoding:"utf8",mode:384});try{await d.promises.chmod(a,384)}catch{}}async function o(a){try{let b=await d.promises.readFile(a,"utf8");return JSON.parse(b)}catch{return null}}async function p(a,b){let{getOAuthProvider:d}=await Promise.resolve().then(c.bind(c,10094));if(!await d(a))throw Error(`unknown provider: ${a}`);await n(l(a),{...b,updatedAt:new Date().toISOString()})}async function q(a){return o(l(a))}async function r(a){try{await d.promises.unlink(l(a))}catch{}}async function s(a,b){await n(m(a),{...b,updatedAt:new Date().toISOString()})}async function t(a){return o(m(a))}async function u(a){try{await d.promises.unlink(m(a))}catch{}}async function v(){let a=[];for(let b of(await (0,g.E4)())){let c=b.def,d=await q(c.id),e=await t(c.id);a.push({id:c.id,label:c.label,hasClient:!!d,hasTokens:!!e,...e?.expiresAt!==void 0?{expiresAt:e.expiresAt}:{},setupHint:c.setupHint,consoleUrl:c.consoleUrl,origin:b.origin,setupSteps:c.setupSteps})}return a}},10094:(a,b,c)=>{c.d(b,{Cs:()=>n,E4:()=>s,H:()=>w,To:()=>v,getOAuthProvider:()=>t,isOAuthProviderId:()=>u,lL:()=>k,uq:()=>x});var d=c(73024),e=c(48161),f=c.n(e),g=c(76760),h=c.n(g),i=c(56149);let j=i.Ik({title:i.Yj().min(1).max(200),body:i.Yj().max(2e3).optional(),field:i.Yj().max(200).optional(),copy:i.Yj().max(2e3).optional(),choice:i.Yj().max(200).optional()}),k=i.Ik({id:i.Yj().min(1).max(64).regex(/^[a-z][a-z0-9-]*$/,"provider id must be kebab-case (e.g. google, dropbox)"),label:i.Yj().min(1).max(120),authorizeUrl:i.Yj().url(),tokenUrl:i.Yj().url(),defaultScopes:i.YO(i.Yj()).default([]),supportsPKCE:i.zM().default(!0),refreshTokenSupported:i.zM().default(!0),extraAuthorizeParams:i.g1(i.Yj(),i.Yj()).default({}),needsClientSecret:i.zM().default(!0),setupHint:i.Yj().default(""),consoleUrl:i.Yj().url(),setupSteps:i.YO(j).default([])}),l={google:{id:"google",label:"Google",authorizeUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",defaultScopes:["openid","email","https://www.googleapis.com/auth/calendar"],supportsPKCE:!0,refreshTokenSupported:!0,extraAuthorizeParams:{access_type:"offline",prompt:"consent"},needsClientSecret:!0,setupHint:"If you haven't already — first enable the required API (Calendar/Gmail/Drive) under APIs & Services → Library.",consoleUrl:"https://console.cloud.google.com/apis/credentials",setupSteps:[{title:"Open Google Cloud Console → APIs & Services → Credentials."},{title:'Click "+ CREATE CREDENTIALS" → "OAuth client ID".'},{title:"Application type",choice:"Web application",body:'Not "Desktop" — Reflex uses a fixed localhost redirect.'},{title:'Name — anything, e.g. "Reflex".'},{title:"Authorized redirect URIs → ADD URI",field:"Authorized redirect URIs",copy:"http://localhost:3210/api/oauth/callback",body:"Exactly as shown, no trailing slash, http (not https)."},{title:"Hit CREATE → a popup will show the Client ID and Client Secret."},{title:'Copy both values here. (If lost — open the client in Credentials, use "Download JSON" or "Reset secret".)'},{title:"Before the first Authorize, make sure the required API is enabled: APIs & Services → Library → Google Calendar API → Enable (similarly for other services)."}]},github:{id:"github",label:"GitHub",authorizeUrl:"https://github.com/login/oauth/authorize",tokenUrl:"https://github.com/login/oauth/access_token",defaultScopes:["repo","read:user"],supportsPKCE:!1,refreshTokenSupported:!1,extraAuthorizeParams:{},needsClientSecret:!0,setupHint:"Personal OAuth Apps live in Settings → Developer settings.",consoleUrl:"https://github.com/settings/developers",setupSteps:[{title:"Open github.com/settings/developers → OAuth Apps."},{title:'Click "New OAuth App".'},{title:'Application name — anything, e.g. "Reflex".'},{title:"Homepage URL",field:"Homepage URL",copy:"http://localhost:3210"},{title:"Authorization callback URL",field:"Authorization callback URL",copy:"http://localhost:3210/api/oauth/callback"},{title:'Click "Register application".'},{title:'Copy "Client ID" from here → into Reflex.'},{title:'Click "Generate a new client secret", copy the value immediately (shown only once) → into Reflex.'}]},notion:{id:"notion",label:"Notion",authorizeUrl:"https://api.notion.com/v1/oauth/authorize",tokenUrl:"https://api.notion.com/v1/oauth/token",defaultScopes:[],supportsPKCE:!1,refreshTokenSupported:!1,extraAuthorizeParams:{owner:"user"},needsClientSecret:!0,setupHint:"Reflex uses a Public integration (with OAuth flow), not Internal.",consoleUrl:"https://www.notion.so/profile/integrations",setupSteps:[{title:'Open notion.so/profile/integrations → "+ New integration".'},{title:'Name — "Reflex".'},{title:"Associated workspace — your workspace."},{title:"Type",choice:"Public",body:"Internal doesn't fit — the OAuth flow needs a public integration."},{title:"Submit → integration is created. Go to its page."},{title:'Under "OAuth Domain & URIs" → Redirect URIs → Add URI',field:"Redirect URIs",copy:"http://localhost:3210/api/oauth/callback"},{title:"Save."},{title:'Under "Secrets", copy the OAuth client ID and OAuth client secret here.'}]},slack:{id:"slack",label:"Slack",authorizeUrl:"https://slack.com/oauth/v2/authorize",tokenUrl:"https://slack.com/api/oauth.v2.access",defaultScopes:["chat:write","channels:read"],supportsPKCE:!1,refreshTokenSupported:!0,extraAuthorizeParams:{},needsClientSecret:!0,setupHint:"Default scopes (chat:write, channels:read) can be extended in OAuth & Permissions.",consoleUrl:"https://api.slack.com/apps",setupSteps:[{title:'Open api.slack.com/apps → "Create New App" → "From scratch".'},{title:'App Name — "Reflex", pick your workspace → Create App.'},{title:'In the left panel open "OAuth & Permissions" → Redirect URLs → "Add New Redirect URL"',field:"Redirect URLs",copy:"http://localhost:3210/api/oauth/callback"},{title:"Save URLs."},{title:"Under Scopes → User Token Scopes add the required ones (chat:write, channels:read, etc. — from Reflex defaults)."},{title:'At the top of the page click Install App → grant access → you\'ll get Client ID and Client Secret under "Basic Information".'}]},linear:{id:"linear",label:"Linear",authorizeUrl:"https://linear.app/oauth/authorize",tokenUrl:"https://api.linear.app/oauth/token",defaultScopes:["read","write"],supportsPKCE:!1,refreshTokenSupported:!0,extraAuthorizeParams:{},needsClientSecret:!0,setupHint:"A personal OAuth application is tied to your workspace.",consoleUrl:"https://linear.app/settings/api/applications/new",setupSteps:[{title:"Open linear.app/settings/api/applications/new (Settings → API → OAuth applications → Create new)."},{title:'Name — "Reflex", description anything.'},{title:"Developer URL",field:"Developer URL",copy:"http://localhost:3210"},{title:"Callback URLs",field:"Callback URLs",copy:"http://localhost:3210/api/oauth/callback"},{title:"Scopes — check read + write (or whichever you need: issues:create, etc.)."},{title:"Submit → copy Client ID + Client Secret here."}]}},m=Object.keys(l),n="http://localhost:3210/api/oauth/callback",o=h().join(f().homedir(),".reflex","oauth","providers.json"),p=i.Ik({version:i.eu(1),providers:i.YO(k)});async function q(){try{let a=await d.promises.readFile(o,"utf8"),b=p.safeParse(JSON.parse(a));if(!b.success)return{version:1,providers:[]};return b.data}catch{return{version:1,providers:[]}}}async function r(a){await d.promises.mkdir(h().dirname(o),{recursive:!0}),await d.promises.writeFile(o,JSON.stringify(a,null,2)+"\n",{encoding:"utf8",mode:384});try{await d.promises.chmod(o,384)}catch{}}async function s(){let a=await q(),b=new Set(a.providers.map(a=>a.id)),c=[];for(let a of m)b.has(a)||c.push({def:l[a],origin:"builtin"});for(let b of a.providers)c.push({def:b,origin:"user"});return c}async function t(a){let b=await s();return b.find(b=>b.def.id===a)?.def??null}async function u(a){return await t(a)!==null}async function v(a){let b=k.parse(a);if(void 0!==l[b.id])throw Error(`"${b.id}" is a built-in provider id — pick a different slug`);let c=await q();if(c.providers.some(a=>a.id===b.id))throw Error(`provider "${b.id}" already exists`);c.providers.push(b),await r(c)}async function w(a,b){if(void 0!==l[a])throw Error(`cannot edit built-in provider "${a}"`);let c=await q(),d=c.providers.findIndex(b=>b.id===a);if(d<0)throw Error(`provider "${a}" not found`);let e=k.parse({...c.providers[d],...b,id:a});c.providers[d]=e,await r(c)}async function x(a){if(void 0!==l[a])throw Error(`cannot remove built-in provider "${a}"`);let b=await q(),c=b.providers.filter(b=>b.id!==a);c.length!==b.providers.length&&(b.providers=c,await r(b))}},61888:(a,b,c)=>{c.d(b,{b:()=>i,getAccessToken:()=>j});var d=c(77598),e=c(10094),f=c(1223);let g=globalThis.__reflexOAuthPending??new Map;function h(a){return a.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function i(a,b){let c,i=Date.now()-9e5;for(let[a,b]of g)b.createdAt<i&&g.delete(a);let j=await (0,e.getOAuthProvider)(a);if(!j)throw Error(`unknown provider: ${a}`);let k=await (0,f.tY)(a);if(!k)throw Error(`OAuth client for "${a}" is not configured — set client_id/secret in Settings → OAuth first`);let l=h((0,d.randomBytes)(24)),m=b&&b.length>0?b:k.scopes&&k.scopes.length>0?k.scopes:j.defaultScopes,n=new URLSearchParams({client_id:k.clientId,redirect_uri:e.Cs,response_type:"code",state:l,...m.length>0?{scope:m.join(" ")}:{},...j.extraAuthorizeParams??{}});if(j.supportsPKCE){let{verifier:a,challenge:b}=function(){let a=h((0,d.randomBytes)(32)),b=h((0,d.createHash)("sha256").update(a).digest());return{verifier:a,challenge:b}}();c=a,n.set("code_challenge",b),n.set("code_challenge_method","S256")}g.set(l,{provider:a,...void 0!==c?{codeVerifier:c}:{},scopes:m,createdAt:Date.now()});let o=k.authorizeUrl??j.authorizeUrl;return{authorizeUrl:`${o}?${n.toString()}`,state:l}}async function j(a){let b=await (0,e.getOAuthProvider)(a);if(!b)throw Error(`unknown provider: ${a}`);let c=await (0,f.getOAuthTokens)(a);if(!c)throw Error(`provider "${a}" not authorized — open Settings → OAuth and click Authorize`);if(!(void 0!==c.expiresAt&&c.expiresAt-6e4<Date.now()))return c.accessToken;if(!c.refreshToken)throw Error(`access token for "${a}" expired and no refresh_token — re-authorize`);let d=await (0,f.tY)(a);if(!d)throw Error(`OAuth client for "${a}" is not configured`);let g=new URLSearchParams({grant_type:"refresh_token",refresh_token:c.refreshToken,client_id:d.clientId});b.needsClientSecret&&d.clientSecret&&g.set("client_secret",d.clientSecret);let h=await k(b,d,g),i={accessToken:h.accessToken,refreshToken:h.refreshToken??c.refreshToken,...void 0!==h.expiresAt?{expiresAt:h.expiresAt}:{},...h.scope?{scope:h.scope}:c.scope?{scope:c.scope}:{},...h.tokenType?{tokenType:h.tokenType}:c.tokenType?{tokenType:c.tokenType}:{}};return await (0,f.Dt)(a,i),i.accessToken}async function k(a,b,c){let d,e=b.tokenUrl??a.tokenUrl,f=await fetch(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:c.toString()}),g=await f.text();if(!f.ok)throw Error(`token endpoint HTTP ${f.status}: ${g.slice(0,500)}`);if(g.trim().startsWith("{"))d=JSON.parse(g);else for(let[a,b]of(d={},new URLSearchParams(g)))d[a]=b;if(d.error)throw Error(`OAuth error: ${d.error}${d.error_description?` — ${d.error_description}`:""}`);let h="string"==typeof d.access_token?d.access_token:null;if(!h)throw Error(`token endpoint returned no access_token (${g.slice(0,200)})`);let i="number"==typeof d.expires_in?d.expires_in:"string"==typeof d.expires_in?Number(d.expires_in):void 0;return{accessToken:h,..."string"==typeof d.refresh_token?{refreshToken:d.refresh_token}:{},...void 0!==i&&!Number.isNaN(i)?{expiresAt:Date.now()+1e3*i}:{},..."string"==typeof d.scope?{scope:d.scope}:{},..."string"==typeof d.token_type?{tokenType:d.token_type}:{}}}globalThis.__reflexOAuthPending=g}};