@baique/pi-web-sky 0.1.9 → 0.1.11

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 (211) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +11 -8
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/react-loadable-manifest.json +8 -0
  5. package/.next/required-server-files.js +3 -2
  6. package/.next/required-server-files.json +3 -2
  7. package/.next/routes-manifest.json +22 -0
  8. package/.next/server/app/_global-error/page.js +2 -2
  9. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/_global-error.html +1 -1
  11. package/.next/server/app/_global-error.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page.js +1 -1
  16. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/_not-found.html +1 -1
  18. package/.next/server/app/_not-found.rsc +3 -3
  19. package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +3 -3
  21. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  22. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  23. package/.next/server/app/api/agent/[id]/events/route.js +1 -1
  24. package/.next/server/app/api/agent/[id]/route.js +1 -1
  25. package/.next/server/app/api/agent/new/route.js +1 -1
  26. package/.next/server/app/api/agent/running/events/route.js +1 -1
  27. package/.next/server/app/api/agent/running/route.js +1 -1
  28. package/.next/server/app/api/app-update/route.js +1 -1
  29. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  30. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  31. package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
  32. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  33. package/.next/server/app/api/auth/providers/route.js +1 -1
  34. package/.next/server/app/api/cwd/browse/route.js +1 -1
  35. package/.next/server/app/api/cwd/validate/route.js +1 -1
  36. package/.next/server/app/api/default-cwd/route.js +1 -1
  37. package/.next/server/app/api/file-index/route.js +1 -1
  38. package/.next/server/app/api/files/[...path]/route.js +1 -1
  39. package/.next/server/app/api/git/diff/route.js +1 -1
  40. package/.next/server/app/api/git/status/route.js +1 -1
  41. package/.next/server/app/api/home/route.js +1 -1
  42. package/.next/server/app/api/models/route.js +1 -1
  43. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  44. package/.next/server/app/api/models-config/discover/route.js +1 -1
  45. package/.next/server/app/api/models-config/route.js +1 -1
  46. package/.next/server/app/api/models-config/test/route.js +1 -1
  47. package/.next/server/app/api/plugins/route.js +1 -1
  48. package/.next/server/app/api/project-trust/route.js +1 -1
  49. package/.next/server/app/api/sessions/[id]/auto-name/route.js +2 -2
  50. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  51. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  52. package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
  53. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  54. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  55. package/.next/server/app/api/sessions/[id]/todos/route.js +1 -1
  56. package/.next/server/app/api/sessions/route.js +1 -1
  57. package/.next/server/app/api/skills/check/route.js +1 -1
  58. package/.next/server/app/api/skills/install/route.js +1 -1
  59. package/.next/server/app/api/skills/route.js +2 -2
  60. package/.next/server/app/api/skills/search/route.js +1 -1
  61. package/.next/server/app/api/skills/update/route.js +1 -1
  62. package/.next/server/app/api/terminal/[id]/events/route.js +6 -0
  63. package/.next/server/app/api/terminal/[id]/events/route.js.nft.json +1 -0
  64. package/.next/server/app/api/terminal/[id]/events/route_client-reference-manifest.js +1 -0
  65. package/.next/server/app/api/terminal/[id]/route.js +3 -0
  66. package/.next/server/app/api/terminal/[id]/route.js.nft.json +1 -0
  67. package/.next/server/app/api/terminal/[id]/route_client-reference-manifest.js +1 -0
  68. package/.next/server/app/api/terminal/route.js +3 -0
  69. package/.next/server/app/api/terminal/route.js.nft.json +1 -0
  70. package/.next/server/app/api/terminal/route_client-reference-manifest.js +1 -0
  71. package/.next/server/app/api/worktrees/route.js +1 -1
  72. package/.next/server/app/favicon.ico/route.js +1 -1
  73. package/.next/server/app/index.html +1 -1
  74. package/.next/server/app/index.rsc +5 -5
  75. package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -5
  76. package/.next/server/app/index.segments/_full.segment.rsc +5 -5
  77. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  78. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  79. package/.next/server/app/page.js +8 -8
  80. package/.next/server/app/page_client-reference-manifest.js +1 -1
  81. package/.next/server/app-paths-manifest.json +11 -8
  82. package/.next/server/middleware-build-manifest.js +1 -1
  83. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  84. package/.next/server/pages/404.html +1 -1
  85. package/.next/server/pages/500.html +1 -1
  86. package/.next/static/chunks/1074-6cfca65ac411b2b8.js +7 -0
  87. package/.next/static/chunks/3266.6d3cd40ecc314442.js +1 -0
  88. package/.next/static/chunks/app/_global-error/page-76cf4b5393676543.js +1 -0
  89. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-76cf4b5393676543.js +1 -0
  90. package/.next/static/chunks/app/api/agent/[id]/events/route-76cf4b5393676543.js +1 -0
  91. package/.next/static/chunks/app/api/agent/[id]/route-76cf4b5393676543.js +1 -0
  92. package/.next/static/chunks/app/api/agent/new/route-76cf4b5393676543.js +1 -0
  93. package/.next/static/chunks/app/api/agent/running/events/route-76cf4b5393676543.js +1 -0
  94. package/.next/static/chunks/app/api/agent/running/route-76cf4b5393676543.js +1 -0
  95. package/.next/static/chunks/app/api/app-update/route-76cf4b5393676543.js +1 -0
  96. package/.next/static/chunks/app/api/auth/all-providers/route-76cf4b5393676543.js +1 -0
  97. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-76cf4b5393676543.js +1 -0
  98. package/.next/static/chunks/app/api/auth/login/[provider]/route-76cf4b5393676543.js +1 -0
  99. package/.next/static/chunks/app/api/auth/logout/[provider]/route-76cf4b5393676543.js +1 -0
  100. package/.next/static/chunks/app/api/auth/providers/route-76cf4b5393676543.js +1 -0
  101. package/.next/static/chunks/app/api/cwd/browse/route-76cf4b5393676543.js +1 -0
  102. package/.next/static/chunks/app/api/cwd/validate/route-76cf4b5393676543.js +1 -0
  103. package/.next/static/chunks/app/api/default-cwd/route-76cf4b5393676543.js +1 -0
  104. package/.next/static/chunks/app/api/file-index/route-76cf4b5393676543.js +1 -0
  105. package/.next/static/chunks/app/api/files/[...path]/route-76cf4b5393676543.js +1 -0
  106. package/.next/static/chunks/app/api/git/diff/route-76cf4b5393676543.js +1 -0
  107. package/.next/static/chunks/app/api/git/status/route-76cf4b5393676543.js +1 -0
  108. package/.next/static/chunks/app/api/home/route-76cf4b5393676543.js +1 -0
  109. package/.next/static/chunks/app/api/models/route-76cf4b5393676543.js +1 -0
  110. package/.next/static/chunks/app/api/models-config/catalog/route-76cf4b5393676543.js +1 -0
  111. package/.next/static/chunks/app/api/models-config/discover/route-76cf4b5393676543.js +1 -0
  112. package/.next/static/chunks/app/api/models-config/route-76cf4b5393676543.js +1 -0
  113. package/.next/static/chunks/app/api/models-config/test/route-76cf4b5393676543.js +1 -0
  114. package/.next/static/chunks/app/api/plugins/route-76cf4b5393676543.js +1 -0
  115. package/.next/static/chunks/app/api/project-trust/route-76cf4b5393676543.js +1 -0
  116. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-76cf4b5393676543.js +1 -0
  117. package/.next/static/chunks/app/api/sessions/[id]/context/route-76cf4b5393676543.js +1 -0
  118. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-76cf4b5393676543.js +1 -0
  119. package/.next/static/chunks/app/api/sessions/[id]/export/route-76cf4b5393676543.js +1 -0
  120. package/.next/static/chunks/app/api/sessions/[id]/route-76cf4b5393676543.js +1 -0
  121. package/.next/static/chunks/app/api/sessions/[id]/state/route-76cf4b5393676543.js +1 -0
  122. package/.next/static/chunks/app/api/sessions/[id]/todos/route-76cf4b5393676543.js +1 -0
  123. package/.next/static/chunks/app/api/sessions/route-76cf4b5393676543.js +1 -0
  124. package/.next/static/chunks/app/api/skills/check/route-76cf4b5393676543.js +1 -0
  125. package/.next/static/chunks/app/api/skills/install/route-76cf4b5393676543.js +1 -0
  126. package/.next/static/chunks/app/api/skills/route-76cf4b5393676543.js +1 -0
  127. package/.next/static/chunks/app/api/skills/search/route-76cf4b5393676543.js +1 -0
  128. package/.next/static/chunks/app/api/skills/update/route-76cf4b5393676543.js +1 -0
  129. package/.next/static/chunks/app/api/terminal/[id]/events/route-76cf4b5393676543.js +1 -0
  130. package/.next/static/chunks/app/api/terminal/[id]/route-76cf4b5393676543.js +1 -0
  131. package/.next/static/chunks/app/api/terminal/route-76cf4b5393676543.js +1 -0
  132. package/.next/static/chunks/app/api/worktrees/route-76cf4b5393676543.js +1 -0
  133. package/.next/static/chunks/app/layout-24b765849755179d.js +1 -0
  134. package/.next/static/chunks/app/manifest.webmanifest/route-76cf4b5393676543.js +1 -0
  135. package/.next/static/chunks/app/page-3c3757ec944ae6c4.js +87 -0
  136. package/.next/static/chunks/e868780c.1584512c612787d7.js +18 -0
  137. package/.next/static/chunks/next/dist/client/components/builtin/app-error-76cf4b5393676543.js +1 -0
  138. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-76cf4b5393676543.js +1 -0
  139. package/.next/static/chunks/next/dist/client/components/builtin/not-found-76cf4b5393676543.js +1 -0
  140. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-76cf4b5393676543.js +1 -0
  141. package/.next/static/chunks/webpack-09499b33d3450792.js +1 -0
  142. package/.next/static/css/374e92f246b4e619.css +1 -0
  143. package/.next/static/css/659eccb5db697b76.css +1 -0
  144. package/.next/static/hFNHcfpD_byF58Zu9HRn6/_buildManifest.js +1 -0
  145. package/.next/trace +7 -6
  146. package/.next/trace-build +1 -1
  147. package/.next/types/app/api/terminal/[id]/events/route.ts +353 -0
  148. package/.next/types/app/api/terminal/[id]/route.ts +353 -0
  149. package/.next/types/app/api/terminal/route.ts +353 -0
  150. package/.next/types/routes.d.ts +4 -1
  151. package/.next/types/validator.ts +27 -0
  152. package/README.ja.md +14 -12
  153. package/README.md +15 -11
  154. package/README.ru.md +14 -12
  155. package/README.zh-CN.md +15 -11
  156. package/next.config.ts +3 -0
  157. package/package.json +4 -1
  158. package/.next/static/-XJIqiyMF8t1pltU-M3t9/_buildManifest.js +0 -1
  159. package/.next/static/chunks/3249-d891ccff87c62b6d.js +0 -7
  160. package/.next/static/chunks/app/_global-error/page-13f6e99c6fd8ad23.js +0 -1
  161. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-13f6e99c6fd8ad23.js +0 -1
  162. package/.next/static/chunks/app/api/agent/[id]/events/route-13f6e99c6fd8ad23.js +0 -1
  163. package/.next/static/chunks/app/api/agent/[id]/route-13f6e99c6fd8ad23.js +0 -1
  164. package/.next/static/chunks/app/api/agent/new/route-13f6e99c6fd8ad23.js +0 -1
  165. package/.next/static/chunks/app/api/agent/running/events/route-13f6e99c6fd8ad23.js +0 -1
  166. package/.next/static/chunks/app/api/agent/running/route-13f6e99c6fd8ad23.js +0 -1
  167. package/.next/static/chunks/app/api/app-update/route-13f6e99c6fd8ad23.js +0 -1
  168. package/.next/static/chunks/app/api/auth/all-providers/route-13f6e99c6fd8ad23.js +0 -1
  169. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-13f6e99c6fd8ad23.js +0 -1
  170. package/.next/static/chunks/app/api/auth/login/[provider]/route-13f6e99c6fd8ad23.js +0 -1
  171. package/.next/static/chunks/app/api/auth/logout/[provider]/route-13f6e99c6fd8ad23.js +0 -1
  172. package/.next/static/chunks/app/api/auth/providers/route-13f6e99c6fd8ad23.js +0 -1
  173. package/.next/static/chunks/app/api/cwd/browse/route-13f6e99c6fd8ad23.js +0 -1
  174. package/.next/static/chunks/app/api/cwd/validate/route-13f6e99c6fd8ad23.js +0 -1
  175. package/.next/static/chunks/app/api/default-cwd/route-13f6e99c6fd8ad23.js +0 -1
  176. package/.next/static/chunks/app/api/file-index/route-13f6e99c6fd8ad23.js +0 -1
  177. package/.next/static/chunks/app/api/files/[...path]/route-13f6e99c6fd8ad23.js +0 -1
  178. package/.next/static/chunks/app/api/git/diff/route-13f6e99c6fd8ad23.js +0 -1
  179. package/.next/static/chunks/app/api/git/status/route-13f6e99c6fd8ad23.js +0 -1
  180. package/.next/static/chunks/app/api/home/route-13f6e99c6fd8ad23.js +0 -1
  181. package/.next/static/chunks/app/api/models/route-13f6e99c6fd8ad23.js +0 -1
  182. package/.next/static/chunks/app/api/models-config/catalog/route-13f6e99c6fd8ad23.js +0 -1
  183. package/.next/static/chunks/app/api/models-config/discover/route-13f6e99c6fd8ad23.js +0 -1
  184. package/.next/static/chunks/app/api/models-config/route-13f6e99c6fd8ad23.js +0 -1
  185. package/.next/static/chunks/app/api/models-config/test/route-13f6e99c6fd8ad23.js +0 -1
  186. package/.next/static/chunks/app/api/plugins/route-13f6e99c6fd8ad23.js +0 -1
  187. package/.next/static/chunks/app/api/project-trust/route-13f6e99c6fd8ad23.js +0 -1
  188. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-13f6e99c6fd8ad23.js +0 -1
  189. package/.next/static/chunks/app/api/sessions/[id]/context/route-13f6e99c6fd8ad23.js +0 -1
  190. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-13f6e99c6fd8ad23.js +0 -1
  191. package/.next/static/chunks/app/api/sessions/[id]/export/route-13f6e99c6fd8ad23.js +0 -1
  192. package/.next/static/chunks/app/api/sessions/[id]/route-13f6e99c6fd8ad23.js +0 -1
  193. package/.next/static/chunks/app/api/sessions/[id]/state/route-13f6e99c6fd8ad23.js +0 -1
  194. package/.next/static/chunks/app/api/sessions/[id]/todos/route-13f6e99c6fd8ad23.js +0 -1
  195. package/.next/static/chunks/app/api/sessions/route-13f6e99c6fd8ad23.js +0 -1
  196. package/.next/static/chunks/app/api/skills/check/route-13f6e99c6fd8ad23.js +0 -1
  197. package/.next/static/chunks/app/api/skills/install/route-13f6e99c6fd8ad23.js +0 -1
  198. package/.next/static/chunks/app/api/skills/route-13f6e99c6fd8ad23.js +0 -1
  199. package/.next/static/chunks/app/api/skills/search/route-13f6e99c6fd8ad23.js +0 -1
  200. package/.next/static/chunks/app/api/skills/update/route-13f6e99c6fd8ad23.js +0 -1
  201. package/.next/static/chunks/app/api/worktrees/route-13f6e99c6fd8ad23.js +0 -1
  202. package/.next/static/chunks/app/layout-55f14b9eb59f2c06.js +0 -1
  203. package/.next/static/chunks/app/manifest.webmanifest/route-13f6e99c6fd8ad23.js +0 -1
  204. package/.next/static/chunks/app/page-fe90461fbee0db3f.js +0 -87
  205. package/.next/static/chunks/next/dist/client/components/builtin/app-error-13f6e99c6fd8ad23.js +0 -1
  206. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-13f6e99c6fd8ad23.js +0 -1
  207. package/.next/static/chunks/next/dist/client/components/builtin/not-found-13f6e99c6fd8ad23.js +0 -1
  208. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-13f6e99c6fd8ad23.js +0 -1
  209. package/.next/static/chunks/webpack-31d3b9ee7fdc5174.js +0 -1
  210. package/.next/static/css/c41a90be26df35a7.css +0 -1
  211. /package/.next/static/{-XJIqiyMF8t1pltU-M3t9 → hFNHcfpD_byF58Zu9HRn6}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=7067,a.ids=[7067],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},17393:(a,b,c)=>{function d(a){let b=0;for(let c=0;c<a.length;c++)"/"===a[c]&&b++;return b}function e(a){let b=new Set;for(let c of a){let a=c.indexOf("/");for(;-1!==a;)b.add(c.slice(0,a)),a=c.indexOf("/",a+1)}let c=[];for(let a of b)c.push({path:a,isDir:!0});for(let b of a)b&&c.push({path:b,isDir:!1});return c.sort((a,b)=>d(a.path)-d(b.path)||a.path.localeCompare(b.path)),c}function f(a,b){if(!a)return!0;let c=0;for(let d=0;d<b.length&&c<a.length;d++)b[d]===a[c]&&c++;return c===a.length}function g(a,b,c=20){let e=b.toLowerCase();if(!e)return a.slice(0,c);let h=[];for(let b of a){let a=function(a,b){let c=a.path.toLowerCase(),d=0;if(b.includes("/"))c===b?d=100:c.startsWith(b)?d=80:c.includes(b)?d=50:f(b,c)&&(d=10);else{let a=c.lastIndexOf("/"),e=-1===a?c:c.slice(a+1);e===b?d=100:e.startsWith(b)?d=80:e.includes(b)?d=50:c.includes(b)?d=30:f(b,c)&&(d=10)}return a.isDir&&d>0&&(d+=10),d}(b,e);a>0&&h.push({entry:b,score:a})}return h.sort((a,b)=>b.score-a.score||d(a.entry.path)-d(b.entry.path)||a.entry.path.localeCompare(b.entry.path)),h.slice(0,c).map(a=>a.entry)}c.d(b,{R7:()=>g,Yh:()=>e})},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},26918:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/file-index/route",pathname:"/api/file-index",filename:"route",bundlePath:"app/api/file-index/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/file-index/route.ts",nextConfigOutput:"",userland:()=>c(74974),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/file-index/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},74974:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>p});var e=c(23211),f=c(79646),g=c(28354),h=c(29021),i=c.n(h),j=c(33873),k=c.n(j),l=c(80547),m=c(17393),n=a([l]);l=(n.then?(await n)():n)[0];let q=(0,g.promisify)(f.execFile),r=new Set(["node_modules",".git",".next","dist","build","__pycache__",".turbo",".cache","coverage",".pytest_cache",".mypy_cache","target","vendor",".DS_Store"]),s=[".pyc"];async function o(a){try{let{stdout:b}=await q("git",["-C",a,"ls-files","--cached","--others","--exclude-standard","-z"],{timeout:1e4,maxBuffer:0x4000000,env:{...process.env,LC_ALL:"C"}}),c=b.split("\0").filter(Boolean);if(c.length>2e5)return{files:c.slice(0,2e5),hardTruncated:!0};return{files:c,hardTruncated:!1}}catch{return null}}async function p(a){try{let b,c=a.nextUrl.searchParams.get("cwd")?.trim()??"";if(!c||!c.startsWith("/")&&!(0,l.uK)(c))return e.NextResponse.json({error:"cwd must be an absolute path"},{status:400});let d=a.nextUrl.searchParams.get("q")?.slice(0,500)??"",f=await (0,l.mc)();if(!(0,l.A$)(c,f))return e.NextResponse.json({error:"Access denied"},{status:403});try{b=i().statSync(c)}catch{return e.NextResponse.json({error:"Directory not found"},{status:404})}if(!b.isDirectory())return e.NextResponse.json({error:"Not a directory"},{status:400});if(!(0,l.B7)(c,f))return e.NextResponse.json({error:"Access denied"},{status:403});let g=(globalThis.__piFileIndexCache||(globalThis.__piFileIndexCache=new Map),globalThis.__piFileIndexCache),h=Date.now(),j=g.get(c);if(!j||j.expiresAt<=h){let a=await o(c)??function(a){let b=[],c=[{abs:a,rel:"",depth:0}];for(;c.length>0;){let a,{abs:d,rel:e,depth:f}=c.shift();try{a=i().readdirSync(d,{withFileTypes:!0})}catch{continue}for(let g of a){if(r.has(g.name)||s.some(a=>g.name.endsWith(a)))continue;let a=e?`${e}/${g.name}`:g.name;if(g.isDirectory())f+1<=8&&c.push({abs:k().join(d,g.name),rel:a,depth:f+1});else if(g.isFile()){if(b.length>=5e4)return{files:b,hardTruncated:!0};b.push(a)}}}return{files:b,hardTruncated:!1}}(c);for(let[a,b]of g)b.expiresAt<=h&&g.delete(a);g.size>=20&&g.clear(),j={listing:a,expiresAt:h+1e4},g.set(c,j)}if(d)return j.entries??=(0,m.Yh)(j.listing.files),e.NextResponse.json({matches:(0,m.R7)(j.entries,d)});let{files:n,hardTruncated:p}=j.listing;return e.NextResponse.json({files:n.slice(0,5e3),truncated:p||n.length>5e3})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=26918));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=7067,a.ids=[7067],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},17393:(a,b,c)=>{function d(a){let b=0;for(let c=0;c<a.length;c++)"/"===a[c]&&b++;return b}function e(a){let b=new Set;for(let c of a){let a=c.indexOf("/");for(;-1!==a;)b.add(c.slice(0,a)),a=c.indexOf("/",a+1)}let c=[];for(let a of b)c.push({path:a,isDir:!0});for(let b of a)b&&c.push({path:b,isDir:!1});return c.sort((a,b)=>d(a.path)-d(b.path)||a.path.localeCompare(b.path)),c}function f(a,b){if(!a)return!0;let c=0;for(let d=0;d<b.length&&c<a.length;d++)b[d]===a[c]&&c++;return c===a.length}function g(a,b,c=20){let e=b.toLowerCase();if(!e)return a.slice(0,c);let h=[];for(let b of a){let a=function(a,b){let c=a.path.toLowerCase(),d=0;if(b.includes("/"))c===b?d=100:c.startsWith(b)?d=80:c.includes(b)?d=50:f(b,c)&&(d=10);else{let a=c.lastIndexOf("/"),e=-1===a?c:c.slice(a+1);e===b?d=100:e.startsWith(b)?d=80:e.includes(b)?d=50:c.includes(b)?d=30:f(b,c)&&(d=10)}return a.isDir&&d>0&&(d+=10),d}(b,e);a>0&&h.push({entry:b,score:a})}return h.sort((a,b)=>b.score-a.score||d(a.entry.path)-d(b.entry.path)||a.entry.path.localeCompare(b.entry.path)),h.slice(0,c).map(a=>a.entry)}c.d(b,{R7:()=>g,Yh:()=>e})},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},53586:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/file-index/route",pathname:"/api/file-index",filename:"route",bundlePath:"app/api/file-index/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/file-index/route.ts",nextConfigOutput:"",userland:()=>c(74974),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/file-index/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},74974:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>p});var e=c(23211),f=c(79646),g=c(28354),h=c(29021),i=c.n(h),j=c(33873),k=c.n(j),l=c(80547),m=c(17393),n=a([l]);l=(n.then?(await n)():n)[0];let q=(0,g.promisify)(f.execFile),r=new Set(["node_modules",".git",".next","dist","build","__pycache__",".turbo",".cache","coverage",".pytest_cache",".mypy_cache","target","vendor",".DS_Store"]),s=[".pyc"];async function o(a){try{let{stdout:b}=await q("git",["-C",a,"ls-files","--cached","--others","--exclude-standard","-z"],{timeout:1e4,maxBuffer:0x4000000,env:{...process.env,LC_ALL:"C"}}),c=b.split("\0").filter(Boolean);if(c.length>2e5)return{files:c.slice(0,2e5),hardTruncated:!0};return{files:c,hardTruncated:!1}}catch{return null}}async function p(a){try{let b,c=a.nextUrl.searchParams.get("cwd")?.trim()??"";if(!c||!c.startsWith("/")&&!(0,l.uK)(c))return e.NextResponse.json({error:"cwd must be an absolute path"},{status:400});let d=a.nextUrl.searchParams.get("q")?.slice(0,500)??"",f=await (0,l.mc)();if(!(0,l.A$)(c,f))return e.NextResponse.json({error:"Access denied"},{status:403});try{b=i().statSync(c)}catch{return e.NextResponse.json({error:"Directory not found"},{status:404})}if(!b.isDirectory())return e.NextResponse.json({error:"Not a directory"},{status:400});if(!(0,l.B7)(c,f))return e.NextResponse.json({error:"Access denied"},{status:403});let g=(globalThis.__piFileIndexCache||(globalThis.__piFileIndexCache=new Map),globalThis.__piFileIndexCache),h=Date.now(),j=g.get(c);if(!j||j.expiresAt<=h){let a=await o(c)??function(a){let b=[],c=[{abs:a,rel:"",depth:0}];for(;c.length>0;){let a,{abs:d,rel:e,depth:f}=c.shift();try{a=i().readdirSync(d,{withFileTypes:!0})}catch{continue}for(let g of a){if(r.has(g.name)||s.some(a=>g.name.endsWith(a)))continue;let a=e?`${e}/${g.name}`:g.name;if(g.isDirectory())f+1<=8&&c.push({abs:k().join(d,g.name),rel:a,depth:f+1});else if(g.isFile()){if(b.length>=5e4)return{files:b,hardTruncated:!0};b.push(a)}}}return{files:b,hardTruncated:!1}}(c);for(let[a,b]of g)b.expiresAt<=h&&g.delete(a);g.size>=20&&g.clear(),j={listing:a,expiresAt:h+1e4},g.set(c,j)}if(d)return j.entries??=(0,m.Yh)(j.listing.files),e.NextResponse.json({matches:(0,m.R7)(j.entries,d)});let{files:n,hardTruncated:p}=j.listing;return e.NextResponse.json({files:n.slice(0,5e3),truncated:p||n.length>5e3})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=53586));module.exports=c})();
@@ -46,4 +46,4 @@ ${f}
46
46
  </html>`);return new Response(b,{headers:{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-cache","Content-Security-Policy":"default-src 'none'; img-src data:; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'","Referrer-Policy":"no-referrer","X-Content-Type-Options":"nosniff"}})}if("watch"===r){if(n&&!n.isFile())return e.NextResponse.json({error:"Not a file"},{status:400});let a=null,b=n?.mtimeMs??0,c=n?.ctimeMs??0,d=n?.ino??0,f=n?.size??0,h=void 0!==n,j=new ReadableStream({start(e){let j=(a,b)=>{let c=`event: ${a}
47
47
  data: ${JSON.stringify(b)}
48
48
 
49
- `;try{e.enqueue(new TextEncoder().encode(c))}catch{}};try{let k=i().dirname(p);(a=g().watch(k,(a,e)=>{if(null==e||(0,q.Eb)(i().join(k,e.toString()),p))try{let a=g().statSync(p);if(h&&a.mtimeMs===b&&a.ctimeMs===c&&a.ino===d&&a.size===f)return;h=!0,b=a.mtimeMs,c=a.ctimeMs,d=a.ino,f=a.size,j("change",{mtime:a.mtime.toISOString(),size:a.size})}catch{if(!h)return;h=!1,j("change",{mtime:new Date().toISOString(),size:0})}})).on("error",()=>{try{a?.close()}catch{}a=null;try{e.close()}catch{}}),j("connected",{filePath:p})}catch{j("error",{message:"Failed to watch file"}),e.close()}},cancel(){try{a?.close()}catch{}}});return new Response(j,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})}if(!n?.isDirectory())return e.NextResponse.json({error:"Not a directory"},{status:400});let D=g().readdirSync(p,{withFileTypes:!0}).filter(a=>!z.has(a.name)&&!A.some(b=>a.name.endsWith(b))).flatMap(a=>{let b=(0,l.w)(a,i().join(p,a.name));return null===b?[]:[{name:a.name,isDir:b,size:0,modified:""}]}).sort((a,b)=>a.isDir!==b.isDir?a.isDir?-1:1:a.name.localeCompare(b.name));return e.NextResponse.json({entries:D,path:p})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},1932:a=>{a.exports=require("url")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},20700:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/files/[...path]/route",pathname:"/api/files/[...path]",filename:"route",bundlePath:"app/api/files/[...path]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/files/[...path]/route.ts",nextConfigOutput:"",userland:()=>c(1304),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/files/[...path]/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},21820:a=>{a.exports=require("os")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49180:(a,b,c)=>{c.d(b,{ah:()=>e,iX:()=>h,j1:()=>i});let d=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function e(a){return!!a&&d.test(a)}function f(a){return a.replace(/\\/g,"/")}function g(a){return/[A-Za-z0-9._~+%@/\\:-]/.test(a)}function h(a,b){for(let c of b){let b=[];if(!function a(b,c){if("string"==typeof b)return void c.push(b);if(b&&"object"==typeof b){if(Array.isArray(b)){for(let d of b)a(d,c);return}for(let d of Object.values(b))a(d,c)}}(c,b),b.some(b=>(function(a,b){let c=f(b),d=c.startsWith("/")?[c,`file://${c}`]:[c];for(let b of new Set([f(a),f(function(a){try{return decodeURIComponent(a)}catch{return a}}(a))]))for(let a of d){let c=b.indexOf(a);for(;-1!==c;){let d=0===c?"":b[c-1],e=c+a.length;if((0===c||!g(d))&&function(a,b){if(b>=a.length)return!0;let c=a[b];return":"===c?/\d/.test(a[b+1]??""):!g(c)}(b,e))return!0;c=b.indexOf(a,c+1)}}return!1})(b,a)))return!0}return!1}function i(a,b){return b.some(b=>"message"===b.type&&"bashExecution"===b.message.role&&b.message.fullOutputPath===a)}},55484:(a,b,c)=>{c.d(b,{Ey:()=>i,Gu:()=>k,SI:()=>j});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f);let h=new Set(["error","overwrite","skip"]);function i(a){let b=a??"error";return h.has(b)?b:null}function j(a){if(0===a.length)return"No files selected";let b=new Set;for(let c of a){if(!c||"."===c||".."===c||c.includes("\0"))return`Invalid file name: ${c||"(empty)"}`;if(c.includes("/")||c.includes("\\")||g().basename(c)!==c)return`File names must not contain a path: ${c}`;if(b.has(c))return`Duplicate file name in upload: ${c}`;b.add(c)}return null}function k(a,b){let c=[],d=[];for(let f of b){let b,h=g().join(a,f);try{b=e().lstatSync(h)}catch(a){if("ENOENT"===a.code)continue;throw a}c.push(f),(!b.isFile()||b.isSymbolicLink())&&d.push(f)}return{conflicts:c,nonReplaceable:d}}},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},65630:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Iq:()=>h,jV:()=>i});var e=c(40402),f=c(49180),g=a([e]);async function h(a,b){if(!(0,f.ah)(b))return!1;try{let c=await (0,e.os)(b);if(!c)return!1;return(0,f.iX)(a,(0,e.DK)(c))}catch{return!1}}async function i(a,b){if(!(0,f.ah)(b))return!1;try{let c=await (0,e.os)(b);if(!c)return!1;return(0,f.j1)(a,(0,e.DK)(c))}catch{return!1}}e=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},66544:(a,b,c)=>{c.d(b,{E2:()=>j,EN:()=>i});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}function i(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a))}function j(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},66829:(a,b,c)=>{c.d(b,{H:()=>d,s:()=>e});class d extends Error{constructor(){super("Request body exceeds the allowed size")}}async function e(a,b){let c=function(a){let b=a.headers.get("content-length");if(!b||!/^\d+$/.test(b))return null;let c=Number(b);return Number.isSafeInteger(c)?c:null}(a);if(null!==c&&c>b)throw new d;let e=a.body?.getReader();if(!e)return a.formData();let f=[],g=0;try{for(;;){let{done:a,value:c}=await e.read();if(a)break;if(g+c.byteLength>b)throw await e.cancel().catch(()=>{}),new d;g+=c.byteLength;let h=new Uint8Array(c.byteLength);h.set(c),f.push(h)}}finally{e.releaseLock()}let h=a.headers.get("content-type");return new Response(new Blob(f),{headers:h?{"content-type":h}:void 0}).formData()}},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},79428:a=>{a.exports=require("buffer")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88473:(a,b,c)=>{c.d(b,{w:()=>f});var d=c(29021),e=c.n(d);function f(a,b){if(a.isDirectory())return!0;if(a.isFile())return!1;try{return e().statSync(b).isDirectory()}catch{return null}}},94735:a=>{a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=20700));module.exports=c})();
49
+ `;try{e.enqueue(new TextEncoder().encode(c))}catch{}};try{let k=i().dirname(p);(a=g().watch(k,(a,e)=>{if(null==e||(0,q.Eb)(i().join(k,e.toString()),p))try{let a=g().statSync(p);if(h&&a.mtimeMs===b&&a.ctimeMs===c&&a.ino===d&&a.size===f)return;h=!0,b=a.mtimeMs,c=a.ctimeMs,d=a.ino,f=a.size,j("change",{mtime:a.mtime.toISOString(),size:a.size})}catch{if(!h)return;h=!1,j("change",{mtime:new Date().toISOString(),size:0})}})).on("error",()=>{try{a?.close()}catch{}a=null;try{e.close()}catch{}}),j("connected",{filePath:p})}catch{j("error",{message:"Failed to watch file"}),e.close()}},cancel(){try{a?.close()}catch{}}});return new Response(j,{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"}})}if(!n?.isDirectory())return e.NextResponse.json({error:"Not a directory"},{status:400});let D=g().readdirSync(p,{withFileTypes:!0}).filter(a=>!z.has(a.name)&&!A.some(b=>a.name.endsWith(b))).flatMap(a=>{let b=(0,l.w)(a,i().join(p,a.name));return null===b?[]:[{name:a.name,isDir:b,size:0,modified:""}]}).sort((a,b)=>a.isDir!==b.isDir?a.isDir?-1:1:a.name.localeCompare(b.name));return e.NextResponse.json({entries:D,path:p})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},1932:a=>{a.exports=require("url")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},32160:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/files/[...path]/route",pathname:"/api/files/[...path]",filename:"route",bundlePath:"app/api/files/[...path]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/files/[...path]/route.ts",nextConfigOutput:"",userland:()=>c(1304),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/files/[...path]/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},49180:(a,b,c)=>{c.d(b,{ah:()=>e,iX:()=>h,j1:()=>i});let d=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function e(a){return!!a&&d.test(a)}function f(a){return a.replace(/\\/g,"/")}function g(a){return/[A-Za-z0-9._~+%@/\\:-]/.test(a)}function h(a,b){for(let c of b){let b=[];if(!function a(b,c){if("string"==typeof b)return void c.push(b);if(b&&"object"==typeof b){if(Array.isArray(b)){for(let d of b)a(d,c);return}for(let d of Object.values(b))a(d,c)}}(c,b),b.some(b=>(function(a,b){let c=f(b),d=c.startsWith("/")?[c,`file://${c}`]:[c];for(let b of new Set([f(a),f(function(a){try{return decodeURIComponent(a)}catch{return a}}(a))]))for(let a of d){let c=b.indexOf(a);for(;-1!==c;){let d=0===c?"":b[c-1],e=c+a.length;if((0===c||!g(d))&&function(a,b){if(b>=a.length)return!0;let c=a[b];return":"===c?/\d/.test(a[b+1]??""):!g(c)}(b,e))return!0;c=b.indexOf(a,c+1)}}return!1})(b,a)))return!0}return!1}function i(a,b){return b.some(b=>"message"===b.type&&"bashExecution"===b.message.role&&b.message.fullOutputPath===a)}},55484:(a,b,c)=>{c.d(b,{Ey:()=>i,Gu:()=>k,SI:()=>j});var d=c(29021),e=c.n(d),f=c(33873),g=c.n(f);let h=new Set(["error","overwrite","skip"]);function i(a){let b=a??"error";return h.has(b)?b:null}function j(a){if(0===a.length)return"No files selected";let b=new Set;for(let c of a){if(!c||"."===c||".."===c||c.includes("\0"))return`Invalid file name: ${c||"(empty)"}`;if(c.includes("/")||c.includes("\\")||g().basename(c)!==c)return`File names must not contain a path: ${c}`;if(b.has(c))return`Duplicate file name in upload: ${c}`;b.add(c)}return null}function k(a,b){let c=[],d=[];for(let f of b){let b,h=g().join(a,f);try{b=e().lstatSync(h)}catch(a){if("ENOENT"===a.code)continue;throw a}c.push(f),(!b.isFile()||b.isSymbolicLink())&&d.push(f)}return{conflicts:c,nonReplaceable:d}}},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},65630:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Iq:()=>h,jV:()=>i});var e=c(40402),f=c(49180),g=a([e]);async function h(a,b){if(!(0,f.ah)(b))return!1;try{let c=await (0,e.os)(b);if(!c)return!1;return(0,f.iX)(a,(0,e.DK)(c))}catch{return!1}}async function i(a,b){if(!(0,f.ah)(b))return!1;try{let c=await (0,e.os)(b);if(!c)return!1;return(0,f.j1)(a,(0,e.DK)(c))}catch{return!1}}e=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},66544:(a,b,c)=>{c.d(b,{E2:()=>j,EN:()=>i});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}function i(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a))}function j(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},66829:(a,b,c)=>{c.d(b,{H:()=>d,s:()=>e});class d extends Error{constructor(){super("Request body exceeds the allowed size")}}async function e(a,b){let c=function(a){let b=a.headers.get("content-length");if(!b||!/^\d+$/.test(b))return null;let c=Number(b);return Number.isSafeInteger(c)?c:null}(a);if(null!==c&&c>b)throw new d;let e=a.body?.getReader();if(!e)return a.formData();let f=[],g=0;try{for(;;){let{done:a,value:c}=await e.read();if(a)break;if(g+c.byteLength>b)throw await e.cancel().catch(()=>{}),new d;g+=c.byteLength;let h=new Uint8Array(c.byteLength);h.set(c),f.push(h)}}finally{e.releaseLock()}let h=a.headers.get("content-type");return new Response(new Blob(f),{headers:h?{"content-type":h}:void 0}).formData()}},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},79428:a=>{a.exports=require("buffer")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},88473:(a,b,c)=>{c.d(b,{w:()=>f});var d=c(29021),e=c.n(d);function f(a,b){if(a.isDirectory())return!0;if(a.isFile())return!1;try{return e().statSync(b).isDirectory()}catch{return null}}},94735:a=>{a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=32160));module.exports=c})();
@@ -3,4 +3,4 @@ new file mode 100644
3
3
  --- /dev/null
4
4
  +++ b/${a}
5
5
  @@ -0,0 +1,${d.length} @@
6
- ${e}${f}`}async function w(a,b,c){try{return await n(a,["diff","--no-color","--no-ext-diff","--unified=3","HEAD","--",...c&&c!==b?[c,b]:[b]],4*j._4)}catch{return null}}async function x(a,b){let c,d,e=await o(a);if(!e||!p(e,b))return{supported:!1};let g=h().resolve(b),i=q(h().relative(e,g)),k=(await r(e)).find(a=>a.path===i);if(!k)return{supported:!1};let{status:m}=l(k);if("deleted"===m){let a=await w(e,i,k.originalPath);return a?.includes("\n@@ ")?{supported:!0,status:m,patch:a}:{supported:!1}}try{c=f().lstatSync(g)}catch{return{supported:!1}}if(!c.isFile()||c.size>j._4)return{supported:!1};let n=f().readFileSync(g);if(u(n))return{supported:!1};let s=n.toString("utf8");if("untracked"===m)d=v(i,s);else{let a=await w(e,i,k.originalPath);if(null===a){if("added"!==m)return{supported:!1};d=v(i,s)}else d=a}return d.includes("\n@@ ")?{supported:!0,status:m,patch:d}:{supported:!1}}},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},74784:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/git/diff/route",pathname:"/api/git/diff",filename:"route",bundlePath:"app/api/git/diff/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/git/diff/route.ts",nextConfigOutput:"",userland:()=>c(94551),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/git/diff/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94551:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i});var e=c(23211),f=c(80547),g=c(33012),h=a([f]);async function i(a){try{let b=a.nextUrl.searchParams.get("cwd")?.trim()??"",c=a.nextUrl.searchParams.get("path")?.trim()??"";if(!b||!b.startsWith("/")&&!(0,f.uK)(b))return e.NextResponse.json({error:"cwd must be an absolute path"},{status:400});if(!c||!c.startsWith("/")&&!(0,f.uK)(c))return e.NextResponse.json({error:"path must be an absolute path"},{status:400});let d=await (0,f.mc)();if(!(0,f.A$)(b,d)||!(0,f.A$)(c,d)||!(0,f.B7)(b,d))return e.NextResponse.json({error:"Access denied"},{status:403});return e.NextResponse.json(await (0,g.S)(b,c))}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}f=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=74784));module.exports=c})();
6
+ ${e}${f}`}async function w(a,b,c){try{return await n(a,["diff","--no-color","--no-ext-diff","--unified=3","HEAD","--",...c&&c!==b?[c,b]:[b]],4*j._4)}catch{return null}}async function x(a,b){let c,d,e=await o(a);if(!e||!p(e,b))return{supported:!1};let g=h().resolve(b),i=q(h().relative(e,g)),k=(await r(e)).find(a=>a.path===i);if(!k)return{supported:!1};let{status:m}=l(k);if("deleted"===m){let a=await w(e,i,k.originalPath);return a?.includes("\n@@ ")?{supported:!0,status:m,patch:a}:{supported:!1}}try{c=f().lstatSync(g)}catch{return{supported:!1}}if(!c.isFile()||c.size>j._4)return{supported:!1};let n=f().readFileSync(g);if(u(n))return{supported:!1};let s=n.toString("utf8");if("untracked"===m)d=v(i,s);else{let a=await w(e,i,k.originalPath);if(null===a){if("added"!==m)return{supported:!1};d=v(i,s)}else d=a}return d.includes("\n@@ ")?{supported:!0,status:m,patch:d}:{supported:!1}}},33873:a=>{a.exports=require("path")},44244:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/git/diff/route",pathname:"/api/git/diff",filename:"route",bundlePath:"app/api/git/diff/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/git/diff/route.ts",nextConfigOutput:"",userland:()=>c(94551),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/git/diff/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94551:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i});var e=c(23211),f=c(80547),g=c(33012),h=a([f]);async function i(a){try{let b=a.nextUrl.searchParams.get("cwd")?.trim()??"",c=a.nextUrl.searchParams.get("path")?.trim()??"";if(!b||!b.startsWith("/")&&!(0,f.uK)(b))return e.NextResponse.json({error:"cwd must be an absolute path"},{status:400});if(!c||!c.startsWith("/")&&!(0,f.uK)(c))return e.NextResponse.json({error:"path must be an absolute path"},{status:400});let d=await (0,f.mc)();if(!(0,f.A$)(b,d)||!(0,f.A$)(c,d)||!(0,f.B7)(b,d))return e.NextResponse.json({error:"Access denied"},{status:403});return e.NextResponse.json(await (0,g.S)(b,c))}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}f=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=44244));module.exports=c})();
@@ -3,4 +3,4 @@ new file mode 100644
3
3
  --- /dev/null
4
4
  +++ b/${a}
5
5
  @@ -0,0 +1,${d.length} @@
6
- ${e}${f}`}async function w(a,b,c){try{return await n(a,["diff","--no-color","--no-ext-diff","--unified=3","HEAD","--",...c&&c!==b?[c,b]:[b]],4*j._4)}catch{return null}}async function x(a,b){let c,d,e=await o(a);if(!e||!p(e,b))return{supported:!1};let g=h().resolve(b),i=q(h().relative(e,g)),k=(await r(e)).find(a=>a.path===i);if(!k)return{supported:!1};let{status:m}=l(k);if("deleted"===m){let a=await w(e,i,k.originalPath);return a?.includes("\n@@ ")?{supported:!0,status:m,patch:a}:{supported:!1}}try{c=f().lstatSync(g)}catch{return{supported:!1}}if(!c.isFile()||c.size>j._4)return{supported:!1};let n=f().readFileSync(g);if(u(n))return{supported:!1};let s=n.toString("utf8");if("untracked"===m)d=v(i,s);else{let a=await w(e,i,k.originalPath);if(null===a){if("added"!==m)return{supported:!1};d=v(i,s)}else d=a}return d.includes("\n@@ ")?{supported:!0,status:m,patch:d}:{supported:!1}}},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},83518:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>k});var e=c(29021),f=c.n(e),g=c(23211),h=c(80547),i=c(33012),j=a([h]);async function k(a){try{let b,c=a.nextUrl.searchParams.get("cwd")?.trim()??"";if(!c||!c.startsWith("/")&&!(0,h.uK)(c))return g.NextResponse.json({error:"cwd must be an absolute path"},{status:400});let d=await (0,h.mc)();if(!(0,h.A$)(c,d))return g.NextResponse.json({error:"Access denied"},{status:403});try{b=f().statSync(c)}catch{return g.NextResponse.json({error:"Directory not found"},{status:404})}if(!b.isDirectory())return g.NextResponse.json({error:"Not a directory"},{status:400});if(!(0,h.B7)(c,d))return g.NextResponse.json({error:"Access denied"},{status:403});return g.NextResponse.json(await (0,i.$)(c))}catch(a){return g.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}h=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},91578:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/git/status/route",pathname:"/api/git/status",filename:"route",bundlePath:"app/api/git/status/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/git/status/route.ts",nextConfigOutput:"",userland:()=>c(83518),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/git/status/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=91578));module.exports=c})();
6
+ ${e}${f}`}async function w(a,b,c){try{return await n(a,["diff","--no-color","--no-ext-diff","--unified=3","HEAD","--",...c&&c!==b?[c,b]:[b]],4*j._4)}catch{return null}}async function x(a,b){let c,d,e=await o(a);if(!e||!p(e,b))return{supported:!1};let g=h().resolve(b),i=q(h().relative(e,g)),k=(await r(e)).find(a=>a.path===i);if(!k)return{supported:!1};let{status:m}=l(k);if("deleted"===m){let a=await w(e,i,k.originalPath);return a?.includes("\n@@ ")?{supported:!0,status:m,patch:a}:{supported:!1}}try{c=f().lstatSync(g)}catch{return{supported:!1}}if(!c.isFile()||c.size>j._4)return{supported:!1};let n=f().readFileSync(g);if(u(n))return{supported:!1};let s=n.toString("utf8");if("untracked"===m)d=v(i,s);else{let a=await w(e,i,k.originalPath);if(null===a){if("added"!==m)return{supported:!1};d=v(i,s)}else d=a}return d.includes("\n@@ ")?{supported:!0,status:m,patch:d}:{supported:!1}}},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55606:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/git/status/route",pathname:"/api/git/status",filename:"route",bundlePath:"app/api/git/status/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/git/status/route.ts",nextConfigOutput:"",userland:()=>c(83518),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/git/status/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},83518:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>k});var e=c(29021),f=c.n(e),g=c(23211),h=c(80547),i=c(33012),j=a([h]);async function k(a){try{let b,c=a.nextUrl.searchParams.get("cwd")?.trim()??"";if(!c||!c.startsWith("/")&&!(0,h.uK)(c))return g.NextResponse.json({error:"cwd must be an absolute path"},{status:400});let d=await (0,h.mc)();if(!(0,h.A$)(c,d))return g.NextResponse.json({error:"Access denied"},{status:403});try{b=f().statSync(c)}catch{return g.NextResponse.json({error:"Directory not found"},{status:404})}if(!b.isDirectory())return g.NextResponse.json({error:"Not a directory"},{status:400});if(!(0,h.B7)(c,d))return g.NextResponse.json({error:"Access denied"},{status:403});return g.NextResponse.json(await (0,i.$)(c))}catch(a){return g.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}h=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=55606));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=3851,a.ids=[3851],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},6106:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>f});var d=c(23211),e=c(21820);async function f(){return d.NextResponse.json({home:(0,e.homedir)()})}},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},60238:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/home/route",pathname:"/api/home",filename:"route",bundlePath:"app/api/home/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/home/route.ts",nextConfigOutput:"",userland:()=>c(6106),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/home/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=60238));module.exports=c})();
1
+ (()=>{var a={};a.id=3851,a.ids=[3851],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},6106:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>f});var d=c(23211),e=c(21820);async function f(){return d.NextResponse.json({home:(0,e.homedir)()})}},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},38122:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/home/route",pathname:"/api/home",filename:"route",bundlePath:"app/api/home/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/home/route.ts",nextConfigOutput:"",userland:()=>c(6106),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/home/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=38122));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=552,a.ids=[552],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},7135:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>p,dynamic:()=>q});var e=c(79748),f=c(33873),g=c(75430),h=c(28802),i=c(28967),j=c(18904),k=c(80547),l=c(72498),m=a([g,h,j,k,l]);[g,h,j,k,l]=m.then?(await m)():m;let q="force-dynamic",r=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function n(a,b){return r.compare(a.name||a.id,b.name||b.id)||r.compare(a.provider,b.provider)||r.compare(a.id,b.id)}async function o(a){let b=new Map,c=[],d=null,e={},f={},k=(0,g.getAgentDir)(),m=(0,l.Fk)(a,k),o=await (0,g.createAgentSessionServices)({cwd:a,agentDir:k,...m?{resourceLoaderReloadOptions:m}:{}}),p=o.modelRuntime.getError(),q=o.settingsManager,r=await (0,j.p)(o.modelRuntime,q.getEnabledModels()),{visible:s,thinkingLevelPins:t,warnings:u}=r;for(let a of(c=s.map(a=>({id:a.id,name:a.name,provider:a.provider})).sort(n),s)){let c=`${a.provider}:${a.id}`;b.set(c,a.name),e[c]=(0,h.getSupportedThinkingLevels)(a),a.thinkingLevelMap&&(f[c]=a.thinkingLevelMap)}let v=q.getDefaultProvider(),w=q.getDefaultModel(),x=(0,j.I)(r,{...v&&w?{defaultModel:{provider:v,modelId:w}}:{}});return x.model&&(d={provider:x.model.provider,modelId:x.model.id}),(0,i.Mx)({models:Object.fromEntries(b),modelList:c,defaultModel:d,thinkingLevels:e,thinkingLevelMaps:f,thinkingLevelPins:t,...u.length>0?{modelScopeWarnings:u}:{}},p)}let s={models:{},modelList:[],defaultModel:null,thinkingLevels:{},thinkingLevelMaps:{},thinkingLevelPins:{}};async function p(a){let b,c=new URL(a.url).searchParams.get("cwd")||process.cwd(),d=(0,f.resolve)(c);try{b=await (0,e.stat)(d)}catch{return Response.json({error:`Directory does not exist: ${d}`},{status:400})}if(!b.isDirectory())return Response.json({error:`Not a directory: ${d}`},{status:400});let g=await (0,k.mc)();if(!(0,k.B7)(d,g))return Response.json({error:"Access denied"},{status:403});try{return Response.json(await (0,i.rC)(d,()=>o(d)))}catch{return Response.json((0,i.Fw)(s))}}d()}catch(a){d(a)}})},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},18904:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{I:()=>j,p:()=>i});var e=c(75430),f=a([e]);e=(f.then?(await f)():f)[0];let k=new Set(["off","minimal","low","medium","high","xhigh","max"]);function g(a,b){return a.provider===b.provider&&a.id===b.modelId}function h(a,b){let c=a.toLowerCase(),d=b.filter(a=>`${a.provider}/${a.id}`.toLowerCase()===c);return d.length>0?d:b.filter(a=>a.id.toLowerCase()===c)}async function i(a,b){let c=(b??[]).map(a=>a.trim()).filter(Boolean);if(0===c.length)return{visible:await a.getAvailable(),scopedModels:[],thinkingLevelPins:{},warnings:[]};let d=await a.getAvailable();!function(a,b){for(let c of a){if(c.includes("*")||c.includes("?")||c.includes("["))continue;let a=h(c,b);if(0===a.length){let d=c.lastIndexOf(":"),e=d>=0?c.slice(d+1):"";k.has(e)&&(a=h(c.slice(0,d),b))}if(a.length>1){let b=a.map(a=>`${a.provider}/${a.id}`).sort().join(", ");throw Error(`Ambiguous enabledModels entry "${c}" matches multiple models: ${b}. Use provider/modelId.`)}}}(c,d);let{scopedModels:f,diagnostics:g}=await (0,e.resolveModelScopeWithDiagnostics)(c,{getAvailable:async()=>d}),i=g.map(a=>a.message);if(0===f.length)return{visible:d,scopedModels:[],thinkingLevelPins:{},warnings:i};let j={};for(let a of f)a.thinkingLevel&&(j[`${a.model.provider}/${a.model.id}`]=a.thinkingLevel);return{visible:f.map(a=>a.model),scopedModels:f,thinkingLevelPins:j,warnings:i}}function j(a,b={}){let c=b.requestedModel,d=b.defaultModel,e=c?a.visible.find(a=>g(a,c)):void 0;if(c&&!e)throw Error(`Model is not available in the enabled scope: ${c.provider}/${c.modelId}`);let f=e?a.scopedModels.find(a=>a.model===e||g(a.model,{provider:e.provider,modelId:e.id})):void 0,h=!e&&d?a.scopedModels.find(a=>g(a.model,d)):void 0,i=e?void 0:h??a.scopedModels[0],k=e||i||!d?void 0:a.visible.find(a=>g(a,d)),l=e??i?.model??k,m=f??i,n=b.thinkingLevel??m?.thinkingLevel;return{...l?{model:l}:{},...n?{thinkingLevel:n}:{},scopedModels:[...a.scopedModels]}}d()}catch(a){d(a)}})},19225:(a,b,c)=>{a.exports=c(44870)},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},28967:(a,b,c)=>{function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear()}function f(a,b){return b?{...a,modelError:b}:a}function g(a){return{...a,modelError:"Model list is temporarily unavailable. Check your configuration and try again."}}function h(a,b){let c=d(),e=c.entries.get(a);if(e){if(e.expiresAt>Date.now())return Promise.resolve(e.data);c.entries.delete(a)}let f=c.inFlight.get(a);if(f)return f;let g=c.generation,h=Promise.resolve().then(b).then(b=>{if(c.generation===g&&c.inFlight.get(a)===h){let d=Date.now();for(let[a,b]of c.entries)b.expiresAt<=d&&c.entries.delete(a);for(;c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(a,{data:b,expiresAt:d+6e4})}return b}).finally(()=>{c.inFlight.get(a)===h&&c.inFlight.delete(a)});return c.inFlight.set(a,h),h}c.d(b,{Fw:()=>g,Mx:()=>f,kn:()=>e,rC:()=>h})},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},39760:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models/route",pathname:"/api/models",filename:"route",bundlePath:"app/api/models/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/models/route.ts",nextConfigOutput:"",userland:()=>c(7135),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},72498:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,5582],()=>b(b.s=39760));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=552,a.ids=[552],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},7135:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>p,dynamic:()=>q});var e=c(79748),f=c(33873),g=c(75430),h=c(28802),i=c(28967),j=c(18904),k=c(80547),l=c(72498),m=a([g,h,j,k,l]);[g,h,j,k,l]=m.then?(await m)():m;let q="force-dynamic",r=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function n(a,b){return r.compare(a.name||a.id,b.name||b.id)||r.compare(a.provider,b.provider)||r.compare(a.id,b.id)}async function o(a){let b=new Map,c=[],d=null,e={},f={},k=(0,g.getAgentDir)(),m=(0,l.Fk)(a,k),o=await (0,g.createAgentSessionServices)({cwd:a,agentDir:k,...m?{resourceLoaderReloadOptions:m}:{}}),p=o.modelRuntime.getError(),q=o.settingsManager,r=await (0,j.p)(o.modelRuntime,q.getEnabledModels()),{visible:s,thinkingLevelPins:t,warnings:u}=r;for(let a of(c=s.map(a=>({id:a.id,name:a.name,provider:a.provider})).sort(n),s)){let c=`${a.provider}:${a.id}`;b.set(c,a.name),e[c]=(0,h.getSupportedThinkingLevels)(a),a.thinkingLevelMap&&(f[c]=a.thinkingLevelMap)}let v=q.getDefaultProvider(),w=q.getDefaultModel(),x=(0,j.I)(r,{...v&&w?{defaultModel:{provider:v,modelId:w}}:{}});return x.model&&(d={provider:x.model.provider,modelId:x.model.id}),(0,i.Mx)({models:Object.fromEntries(b),modelList:c,defaultModel:d,thinkingLevels:e,thinkingLevelMaps:f,thinkingLevelPins:t,...u.length>0?{modelScopeWarnings:u}:{}},p)}let s={models:{},modelList:[],defaultModel:null,thinkingLevels:{},thinkingLevelMaps:{},thinkingLevelPins:{}};async function p(a){let b,c=new URL(a.url).searchParams.get("cwd")||process.cwd(),d=(0,f.resolve)(c);try{b=await (0,e.stat)(d)}catch{return Response.json({error:`Directory does not exist: ${d}`},{status:400})}if(!b.isDirectory())return Response.json({error:`Not a directory: ${d}`},{status:400});let g=await (0,k.mc)();if(!(0,k.B7)(d,g))return Response.json({error:"Access denied"},{status:403});try{return Response.json(await (0,i.rC)(d,()=>o(d)))}catch{return Response.json((0,i.Fw)(s))}}d()}catch(a){d(a)}})},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},18904:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{I:()=>j,p:()=>i});var e=c(75430),f=a([e]);e=(f.then?(await f)():f)[0];let k=new Set(["off","minimal","low","medium","high","xhigh","max"]);function g(a,b){return a.provider===b.provider&&a.id===b.modelId}function h(a,b){let c=a.toLowerCase(),d=b.filter(a=>`${a.provider}/${a.id}`.toLowerCase()===c);return d.length>0?d:b.filter(a=>a.id.toLowerCase()===c)}async function i(a,b){let c=(b??[]).map(a=>a.trim()).filter(Boolean);if(0===c.length)return{visible:await a.getAvailable(),scopedModels:[],thinkingLevelPins:{},warnings:[]};let d=await a.getAvailable();!function(a,b){for(let c of a){if(c.includes("*")||c.includes("?")||c.includes("["))continue;let a=h(c,b);if(0===a.length){let d=c.lastIndexOf(":"),e=d>=0?c.slice(d+1):"";k.has(e)&&(a=h(c.slice(0,d),b))}if(a.length>1){let b=a.map(a=>`${a.provider}/${a.id}`).sort().join(", ");throw Error(`Ambiguous enabledModels entry "${c}" matches multiple models: ${b}. Use provider/modelId.`)}}}(c,d);let{scopedModels:f,diagnostics:g}=await (0,e.resolveModelScopeWithDiagnostics)(c,{getAvailable:async()=>d}),i=g.map(a=>a.message);if(0===f.length)return{visible:d,scopedModels:[],thinkingLevelPins:{},warnings:i};let j={};for(let a of f)a.thinkingLevel&&(j[`${a.model.provider}/${a.model.id}`]=a.thinkingLevel);return{visible:f.map(a=>a.model),scopedModels:f,thinkingLevelPins:j,warnings:i}}function j(a,b={}){let c=b.requestedModel,d=b.defaultModel,e=c?a.visible.find(a=>g(a,c)):void 0;if(c&&!e)throw Error(`Model is not available in the enabled scope: ${c.provider}/${c.modelId}`);let f=e?a.scopedModels.find(a=>a.model===e||g(a.model,{provider:e.provider,modelId:e.id})):void 0,h=!e&&d?a.scopedModels.find(a=>g(a.model,d)):void 0,i=e?void 0:h??a.scopedModels[0],k=e||i||!d?void 0:a.visible.find(a=>g(a,d)),l=e??i?.model??k,m=f??i,n=b.thinkingLevel??m?.thinkingLevel;return{...l?{model:l}:{},...n?{thinkingLevel:n}:{},scopedModels:[...a.scopedModels]}}d()}catch(a){d(a)}})},19225:(a,b,c)=>{a.exports=c(44870)},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},28967:(a,b,c)=>{function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear()}function f(a,b){return b?{...a,modelError:b}:a}function g(a){return{...a,modelError:"Model list is temporarily unavailable. Check your configuration and try again."}}function h(a,b){let c=d(),e=c.entries.get(a);if(e){if(e.expiresAt>Date.now())return Promise.resolve(e.data);c.entries.delete(a)}let f=c.inFlight.get(a);if(f)return f;let g=c.generation,h=Promise.resolve().then(b).then(b=>{if(c.generation===g&&c.inFlight.get(a)===h){let d=Date.now();for(let[a,b]of c.entries)b.expiresAt<=d&&c.entries.delete(a);for(;c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(a,{data:b,expiresAt:d+6e4})}return b}).finally(()=>{c.inFlight.get(a)===h&&c.inFlight.delete(a)});return c.inFlight.set(a,h),h}c.d(b,{Fw:()=>g,Mx:()=>f,kn:()=>e,rC:()=>h})},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},72498:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){if(!(a&&(0,e.hasTrustRequiringProjectResources)(a)))return{requiresTrust:!1,trusted:!0};let c=new e.ProjectTrustStore(b);return{requiresTrust:!0,trusted:!0===c.get(a)}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73572:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models/route",pathname:"/api/models",filename:"route",bundlePath:"app/api/models/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/models/route.ts",nextConfigOutput:"",userland:()=>c(7135),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>o,B7:()=>p,Nw:()=>i.Nw,mc:()=>n,uK:()=>l.uK,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(82536),k=c(40402),l=c(58864),m=a([k]);async function n(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,k.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function o(a,b){return(0,j.o)(a,b)}function p(a,b){return(0,j.x)(a,b)}k=(m.then?(await m)():m)[0],d()}catch(a){d(a)}})},82536:(a,b,c)=>{c.d(b,{o:()=>h,x:()=>i});var d=c(29021),e=c(33873),f=c.n(e),g=c(58864);function h(a,b){for(let c of b){let b=(0,g.uK)(a)||(0,g.uK)(c),d=b?f().win32:f(),e=b?"\\":f().sep,h=d.resolve(a),i=d.resolve(c),j=b?h.toLowerCase():h,k=b?i.toLowerCase():i,l=k.endsWith(e)?k:k+e;if(j===k||j.startsWith(l))return!0}return!1}function i(a,b){let c;try{c=(0,d.realpathSync)(a)}catch{return!1}let e=new Set;for(let a of b)try{e.add((0,d.realpathSync)(a))}catch{}return h(c,e)}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,5582],()=>b(b.s=73572));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=9747,a.ids=[9747],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},54240:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models-config/catalog/route",pathname:"/api/models-config/catalog",filename:"route",bundlePath:"app/api/models-config/catalog/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/models-config/catalog/route.ts",nextConfigOutput:"",userland:()=>c(78246),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models-config/catalog/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78246:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>v,dynamic:()=>r});var d=c(23211);let e={anthropic:["api.anthropic.com"],google:["generativelanguage.googleapis.com"],openai:["api.openai.com"],openrouter:["openrouter.ai"]},f=new Set(["text","image"]);function g(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function h(a){return"string"==typeof a&&a.trim()?a.trim():void 0}function i(a){return"number"==typeof a&&Number.isFinite(a)&&a>=0?a:void 0}function j(a){return"number"==typeof a&&Number.isFinite(a)&&a>0?a:void 0}function k(a){return a.trim().toLocaleLowerCase().replace(/[^a-z0-9]/g,"")}function l(a){return a.trim().toLocaleLowerCase().replace(/^models\//,"")}function m(a){if(a)try{return new URL(a).hostname.toLocaleLowerCase().replace(/\.$/,"")}catch{return}}function n(a){return void 0!==a.cost.input&&void 0!==a.cost.output}function o(a,b,c){if(0===a.length||b<=0)return;let d=new Map;for(let b of a){let a=c(b),e=d.get(a);e?e.count+=1:d.set(a,{value:b,count:1})}let e=[...d.values()].sort((a,b)=>b.count-a.count),f=e[0];if(f&&!(f.count/b<.6)&&e[1]?.count!==f.count)return f.value}function p(a){if(0===a.length)return;let b=new Map;for(let c of a)b.set(c,(b.get(c)??0)+1);let c=[...b.entries()].sort((a,b)=>b[1]-a[1]);if(c[0]&&c[1]?.[1]!==c[0][1])return c[0][0]}function q(a,b){return{status:"reliable",method:b,cost:{input:a.cost.input,output:a.cost.output,cacheRead:a.cost.cacheRead??0,cacheWrite:a.cost.cacheWrite??0},providerId:a.providerId,providerName:a.providerName,support:1,total:1}}let r="force-dynamic",s="https://models.dev/api.json";async function t(){let a=await fetch(s,{cache:"no-store",headers:{Accept:"application/json"},signal:AbortSignal.timeout(15e3)});if(!a.ok)throw Error(`models.dev returned HTTP ${a.status}`);let b=function(a){if(!g(a))return[];let b=[];for(let[d,e]of Object.entries(a)){if(!g(e)||!g(e.models))continue;let a=h(e.name)??d,k=h(e.api);for(let[l,m]of Object.entries(e.models)){var c;if(!g(m))continue;let e=h(m.id)??l;if(!e)continue;let n=h(m.name)??e,o={key:`${d}/${e}`,providerId:d,providerName:a,id:e,name:n,cost:g(c=m.cost)?{input:i(c.input),output:i(c.output),cacheRead:i(c.cache_read),cacheWrite:i(c.cache_write)}:{}};k&&(o.providerBaseUrl=k),"boolean"==typeof m.reasoning&&(o.reasoning=m.reasoning);let p=function(a){if(!g(a)||!Array.isArray(a.input))return;let b=Array.from(new Set(a.input.filter(a=>"string"==typeof a).map(a=>a.trim().toLocaleLowerCase()).filter(a=>f.has(a))));return b.length?b:void 0}(m.modalities);if(p&&(o.input=p),g(m.limit)){let a=j(m.limit.context),b=j(m.limit.output);void 0!==a&&(o.contextWindow=a),void 0!==b&&(o.maxTokens=b)}b.push(o)}}return b}(await a.json());if(0===b.length)throw Error("models.dev returned an empty catalog");return b}async function u(){let a=globalThis.__piModelsDevCatalogCache??={entries:[],expiresAt:0};if(a.entries.length>0&&a.expiresAt>Date.now())return a.entries;a.inFlight||(a.inFlight=t().then(b=>(a.entries=b,a.expiresAt=Date.now()+36e5,b)).finally(()=>{a.inFlight=void 0}));try{return await a.inFlight}catch(b){if(a.entries.length>0)return a.entries;throw b}}async function v(a){let{searchParams:b}=new URL(a.url),c=(b.get("q")??"").slice(0,120),f=(b.get("provider")??"").slice(0,120),g=(b.get("baseUrl")??"").slice(0,500),h=Number.parseInt(b.get("limit")??"50",10),i=Number.isFinite(h)?h:50;try{let a=await u(),b=function(a,b,c="",d=50){let e=b.trim().toLocaleLowerCase(),f=c.trim().toLocaleLowerCase(),g=Math.max(1,Math.min(100,Math.floor(d)||50));return a.map(a=>{let b,c,d,g,h,i;return{entry:a,rank:(b=a.id.toLocaleLowerCase(),c=a.name.toLocaleLowerCase(),d=a.providerId.toLocaleLowerCase(),g=a.providerName.toLocaleLowerCase(),h=`${d}/${b}`,i=20,e?b===e||h===e?i=0:c===e?i=1:b.startsWith(e)||c.startsWith(e)?i=2:h.startsWith(e)||d===e||g===e?i=3:b.includes(e)||c.includes(e)?i=4:(h.includes(e)||g.includes(e))&&(i=5):i=10,i<20&&f&&(d===f||g===f)&&(i-=.5),i)}}).filter(({rank:a})=>!e||a<20).sort((a,b)=>a.rank-b.rank||a.entry.providerName.localeCompare(b.entry.providerName,void 0,{sensitivity:"base"})||a.entry.name.localeCompare(b.entry.name,void 0,{numeric:!0,sensitivity:"base"})||a.entry.id.localeCompare(b.entry.id,void 0,{numeric:!0,sensitivity:"base"})).slice(0,g).map(({entry:a})=>a)}(a,c,f,i),h=function(a,b,c="",d=""){let f,g=a.filter(a=>(function(a,b){let c=l(b);if(!c)return!1;let d=l(a.id),e=`${a.providerId.toLocaleLowerCase()}/${d}`;return d===c||e===c})(a,b));if(0===g.length)return{exactMatches:0,metadataMethod:"none",preset:{},price:{status:"unreliable",reason:"no-exact-match",support:0,total:0}};let h=g.filter(a=>{let b;return!!(b=k(c))&&(k(a.providerId)===b||k(a.providerName)===b)}),i=g.filter(a=>(function(a,b){let c=m(b);if(!c)return!1;let d=e[k(a.providerId)]??[],f=m(a.providerBaseUrl);return[...d,...f?[f]:[]].some(a=>c===a||c.endsWith(`.${a}`))})(a,d)),j=h[0]??i[0],r=h.length?"provider":i.length?"base-url":"consensus",s=j?{name:j.name,reasoning:j.reasoning,input:j.input,contextWindow:j.contextWindow,maxTokens:j.maxTokens}:(f=g.length,{name:o(g.map(a=>a.name),f,a=>a.toLocaleLowerCase()),reasoning:o(g.flatMap(a=>void 0===a.reasoning?[]:[a.reasoning]),f,String),input:o(g.flatMap(a=>a.input?[a.input]:[]),f,a=>[...a].sort().join(",")),contextWindow:o(g.flatMap(a=>void 0===a.contextWindow?[]:[a.contextWindow]),f,String),maxTokens:o(g.flatMap(a=>void 0===a.maxTokens?[]:[a.maxTokens]),f,String)}),t=h.find(n),u=i.find(n),v=t?q(t,"provider"):u?q(u,"base-url"):function(a){let b=a.filter(n);if(0===b.length)return{status:"unreliable",reason:"no-valid-price",support:0,total:0};if(1===b.length)return{status:"unreliable",reason:"insufficient-support",support:1,total:1};let c=new Map;for(let a of b){let b=JSON.stringify([a.cost.input,a.cost.output]),d=c.get(b);d?d.push(a):c.set(b,[a])}let d=[...c.values()].sort((a,b)=>b.length-a.length),e=d[0];if(!e)return{status:"unreliable",reason:"no-valid-price",support:0,total:b.length};let f=e.length/b.length>=.6||e.length>=5;if(d[1]?.length===e.length||!f)return{status:"unreliable",reason:"conflict",support:e.length,total:b.length};let g=p(e.map(a=>a.cost.cacheRead??0))??0,h=p(e.map(a=>a.cost.cacheWrite??0))??0;return{status:"reliable",method:"consensus",cost:{input:e[0].cost.input,output:e[0].cost.output,cacheRead:g,cacheWrite:h},support:e.length,total:b.length}}(g);return"reliable"===v.status&&(s.cost=v.cost),{exactMatches:g.length,metadataMethod:r,matchedProviderId:j?.providerId,matchedProviderName:j?.providerName,preset:s,price:v}}(a,c,f,g);return d.NextResponse.json({models:b,recommendation:h,source:s})}catch(a){return d.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:502})}}},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=54240));module.exports=c})();
1
+ (()=>{var a={};a.id=9747,a.ids=[9747],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},69684:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models-config/catalog/route",pathname:"/api/models-config/catalog",filename:"route",bundlePath:"app/api/models-config/catalog/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/models-config/catalog/route.ts",nextConfigOutput:"",userland:()=>c(78246),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models-config/catalog/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},78246:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>v,dynamic:()=>r});var d=c(23211);let e={anthropic:["api.anthropic.com"],google:["generativelanguage.googleapis.com"],openai:["api.openai.com"],openrouter:["openrouter.ai"]},f=new Set(["text","image"]);function g(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function h(a){return"string"==typeof a&&a.trim()?a.trim():void 0}function i(a){return"number"==typeof a&&Number.isFinite(a)&&a>=0?a:void 0}function j(a){return"number"==typeof a&&Number.isFinite(a)&&a>0?a:void 0}function k(a){return a.trim().toLocaleLowerCase().replace(/[^a-z0-9]/g,"")}function l(a){return a.trim().toLocaleLowerCase().replace(/^models\//,"")}function m(a){if(a)try{return new URL(a).hostname.toLocaleLowerCase().replace(/\.$/,"")}catch{return}}function n(a){return void 0!==a.cost.input&&void 0!==a.cost.output}function o(a,b,c){if(0===a.length||b<=0)return;let d=new Map;for(let b of a){let a=c(b),e=d.get(a);e?e.count+=1:d.set(a,{value:b,count:1})}let e=[...d.values()].sort((a,b)=>b.count-a.count),f=e[0];if(f&&!(f.count/b<.6)&&e[1]?.count!==f.count)return f.value}function p(a){if(0===a.length)return;let b=new Map;for(let c of a)b.set(c,(b.get(c)??0)+1);let c=[...b.entries()].sort((a,b)=>b[1]-a[1]);if(c[0]&&c[1]?.[1]!==c[0][1])return c[0][0]}function q(a,b){return{status:"reliable",method:b,cost:{input:a.cost.input,output:a.cost.output,cacheRead:a.cost.cacheRead??0,cacheWrite:a.cost.cacheWrite??0},providerId:a.providerId,providerName:a.providerName,support:1,total:1}}let r="force-dynamic",s="https://models.dev/api.json";async function t(){let a=await fetch(s,{cache:"no-store",headers:{Accept:"application/json"},signal:AbortSignal.timeout(15e3)});if(!a.ok)throw Error(`models.dev returned HTTP ${a.status}`);let b=function(a){if(!g(a))return[];let b=[];for(let[d,e]of Object.entries(a)){if(!g(e)||!g(e.models))continue;let a=h(e.name)??d,k=h(e.api);for(let[l,m]of Object.entries(e.models)){var c;if(!g(m))continue;let e=h(m.id)??l;if(!e)continue;let n=h(m.name)??e,o={key:`${d}/${e}`,providerId:d,providerName:a,id:e,name:n,cost:g(c=m.cost)?{input:i(c.input),output:i(c.output),cacheRead:i(c.cache_read),cacheWrite:i(c.cache_write)}:{}};k&&(o.providerBaseUrl=k),"boolean"==typeof m.reasoning&&(o.reasoning=m.reasoning);let p=function(a){if(!g(a)||!Array.isArray(a.input))return;let b=Array.from(new Set(a.input.filter(a=>"string"==typeof a).map(a=>a.trim().toLocaleLowerCase()).filter(a=>f.has(a))));return b.length?b:void 0}(m.modalities);if(p&&(o.input=p),g(m.limit)){let a=j(m.limit.context),b=j(m.limit.output);void 0!==a&&(o.contextWindow=a),void 0!==b&&(o.maxTokens=b)}b.push(o)}}return b}(await a.json());if(0===b.length)throw Error("models.dev returned an empty catalog");return b}async function u(){let a=globalThis.__piModelsDevCatalogCache??={entries:[],expiresAt:0};if(a.entries.length>0&&a.expiresAt>Date.now())return a.entries;a.inFlight||(a.inFlight=t().then(b=>(a.entries=b,a.expiresAt=Date.now()+36e5,b)).finally(()=>{a.inFlight=void 0}));try{return await a.inFlight}catch(b){if(a.entries.length>0)return a.entries;throw b}}async function v(a){let{searchParams:b}=new URL(a.url),c=(b.get("q")??"").slice(0,120),f=(b.get("provider")??"").slice(0,120),g=(b.get("baseUrl")??"").slice(0,500),h=Number.parseInt(b.get("limit")??"50",10),i=Number.isFinite(h)?h:50;try{let a=await u(),b=function(a,b,c="",d=50){let e=b.trim().toLocaleLowerCase(),f=c.trim().toLocaleLowerCase(),g=Math.max(1,Math.min(100,Math.floor(d)||50));return a.map(a=>{let b,c,d,g,h,i;return{entry:a,rank:(b=a.id.toLocaleLowerCase(),c=a.name.toLocaleLowerCase(),d=a.providerId.toLocaleLowerCase(),g=a.providerName.toLocaleLowerCase(),h=`${d}/${b}`,i=20,e?b===e||h===e?i=0:c===e?i=1:b.startsWith(e)||c.startsWith(e)?i=2:h.startsWith(e)||d===e||g===e?i=3:b.includes(e)||c.includes(e)?i=4:(h.includes(e)||g.includes(e))&&(i=5):i=10,i<20&&f&&(d===f||g===f)&&(i-=.5),i)}}).filter(({rank:a})=>!e||a<20).sort((a,b)=>a.rank-b.rank||a.entry.providerName.localeCompare(b.entry.providerName,void 0,{sensitivity:"base"})||a.entry.name.localeCompare(b.entry.name,void 0,{numeric:!0,sensitivity:"base"})||a.entry.id.localeCompare(b.entry.id,void 0,{numeric:!0,sensitivity:"base"})).slice(0,g).map(({entry:a})=>a)}(a,c,f,i),h=function(a,b,c="",d=""){let f,g=a.filter(a=>(function(a,b){let c=l(b);if(!c)return!1;let d=l(a.id),e=`${a.providerId.toLocaleLowerCase()}/${d}`;return d===c||e===c})(a,b));if(0===g.length)return{exactMatches:0,metadataMethod:"none",preset:{},price:{status:"unreliable",reason:"no-exact-match",support:0,total:0}};let h=g.filter(a=>{let b;return!!(b=k(c))&&(k(a.providerId)===b||k(a.providerName)===b)}),i=g.filter(a=>(function(a,b){let c=m(b);if(!c)return!1;let d=e[k(a.providerId)]??[],f=m(a.providerBaseUrl);return[...d,...f?[f]:[]].some(a=>c===a||c.endsWith(`.${a}`))})(a,d)),j=h[0]??i[0],r=h.length?"provider":i.length?"base-url":"consensus",s=j?{name:j.name,reasoning:j.reasoning,input:j.input,contextWindow:j.contextWindow,maxTokens:j.maxTokens}:(f=g.length,{name:o(g.map(a=>a.name),f,a=>a.toLocaleLowerCase()),reasoning:o(g.flatMap(a=>void 0===a.reasoning?[]:[a.reasoning]),f,String),input:o(g.flatMap(a=>a.input?[a.input]:[]),f,a=>[...a].sort().join(",")),contextWindow:o(g.flatMap(a=>void 0===a.contextWindow?[]:[a.contextWindow]),f,String),maxTokens:o(g.flatMap(a=>void 0===a.maxTokens?[]:[a.maxTokens]),f,String)}),t=h.find(n),u=i.find(n),v=t?q(t,"provider"):u?q(u,"base-url"):function(a){let b=a.filter(n);if(0===b.length)return{status:"unreliable",reason:"no-valid-price",support:0,total:0};if(1===b.length)return{status:"unreliable",reason:"insufficient-support",support:1,total:1};let c=new Map;for(let a of b){let b=JSON.stringify([a.cost.input,a.cost.output]),d=c.get(b);d?d.push(a):c.set(b,[a])}let d=[...c.values()].sort((a,b)=>b.length-a.length),e=d[0];if(!e)return{status:"unreliable",reason:"no-valid-price",support:0,total:b.length};let f=e.length/b.length>=.6||e.length>=5;if(d[1]?.length===e.length||!f)return{status:"unreliable",reason:"conflict",support:e.length,total:b.length};let g=p(e.map(a=>a.cost.cacheRead??0))??0,h=p(e.map(a=>a.cost.cacheWrite??0))??0;return{status:"reliable",method:"consensus",cost:{input:e[0].cost.input,output:e[0].cost.output,cacheRead:g,cacheWrite:h},support:e.length,total:b.length}}(g);return"reliable"===v.status&&(s.cost=v.cost),{exactMatches:g.length,metadataMethod:r,matchedProviderId:j?.providerId,matchedProviderName:j?.providerName,preset:s,price:v}}(a,c,f,g);return d.NextResponse.json({models:b,recommendation:h,source:s})}catch(a){return d.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:502})}}},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=69684));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=9787,a.ids=[9787],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},26777:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{u:()=>k});var e=c(29021),f=c(21820),g=c(33873),h=c(75430),i=a([h]);function j(a){return"object"!=typeof a||null===a||Array.isArray(a)?{}:Object.fromEntries(Object.entries(a).filter(a=>"string"==typeof a[1]))}async function k(a,b){let c;try{c=(0,e.mkdtempSync)((0,g.join)((0,f.tmpdir)(),"pi-web-model-discovery-"));let d=(0,g.join)(c,"models.json"),i="__pi_web_model_discovery__";(0,e.writeFileSync)(d,JSON.stringify({providers:{[a]:{...b,models:[{id:i}]}}},null,2),"utf8");let k=await h.ModelRuntime.create({modelsPath:d}),l=k.getError();if(l)throw Error(l);let m=k.getModel(a,i);if(!m)throw Error(`Unable to load provider "${a}"`);let n=await k.getAuth(m);if(n)return{apiKey:n.auth.apiKey,headers:j(n.auth.headers)};return{headers:j(k.getCompatibilityRequestConfig(m).headers)}}finally{c&&(0,e.rmSync)(c,{recursive:!0,force:!0})}}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},38278:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models-config/discover/route",pathname:"/api/models-config/discover",filename:"route",bundlePath:"app/api/models-config/discover/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/models-config/discover/route.ts",nextConfigOutput:"",userland:()=>c(51874),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models-config/discover/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51874:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i,dynamic:()=>j});var e=c(23211),f=c(26777),g=c(93598),h=a([f]);f=(h.then?(await h)():h)[0];let j="force-dynamic";async function i(a){try{var b;let c,d,h=await a.json(),i="string"==typeof h.providerName?h.providerName.trim():"";if(!i)return e.NextResponse.json({error:"providerName is required"},{status:400});if(b=h.provider,"object"!=typeof b||null===b||Array.isArray(b))return e.NextResponse.json({error:"provider is required"},{status:400});let j="string"==typeof h.provider.baseUrl?h.provider.baseUrl.trim():"";if(!j)return e.NextResponse.json({error:"Base URL is required"},{status:400});let k="string"==typeof h.provider.api&&h.provider.api?h.provider.api:"openai-completions";try{c=(0,g.y)(j,k)}catch{return e.NextResponse.json({error:"Base URL is invalid"},{status:400})}let l=await (0,f.u)(i,h.provider);if("string"==typeof h.provider.apiKey&&h.provider.apiKey.trim()&&!l.apiKey)return e.NextResponse.json({error:`No API key found for "${i}"`},{status:400});let m=await fetch(c,{cache:"no-store",headers:function(a,b,c){let d=new Headers(c);return(d.has("accept")||d.set("Accept","application/json"),b)?("anthropic-messages"===a?(d.has("x-api-key")||d.set("x-api-key",b),d.has("anthropic-version")||d.set("anthropic-version","2023-06-01")):"google-generative-ai"===a?d.has("x-goog-api-key")||d.set("x-goog-api-key",b):d.has("authorization")||d.set("Authorization",`Bearer ${b}`),d):d}(k,l.apiKey,l.headers),signal:AbortSignal.timeout(2e4)}),n=await m.text();if(!m.ok)return e.NextResponse.json({error:n.slice(0,500)||`Upstream returned HTTP ${m.status}`,status:m.status},{status:502});try{d=JSON.parse(n)}catch{return e.NextResponse.json({error:"Upstream model list was not valid JSON"},{status:502})}let o=(0,g.f)(d);if(0===o.length)return e.NextResponse.json({error:"No models found in the upstream response"},{status:502});return e.NextResponse.json({models:o,endpoint:c.toString()})}catch(c){let a=c instanceof Error?c.message:String(c),b=c instanceof DOMException&&"TimeoutError"===c.name?504:500;return e.NextResponse.json({error:a},{status:b})}}d()}catch(a){d(a)}})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93598:(a,b,c)=>{"use strict";function d(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function e(a){return"string"==typeof a&&a.trim()?a.trim():void 0}function f(a){let b=new Set,c=[];for(let f of function(a){if(Array.isArray(a))return a;if(!d(a))return[];for(let b of["data","models","results","items"]){let c=a[b];if(Array.isArray(c))return c;if(d(c))return Object.values(c)}return[]}(a)){let a=function(a){if("string"==typeof a){let b=a.trim();return b?{id:b}:null}if(!d(a))return null;let b=e(a.id)??e(a.model)??e(a.name);if(!b)return null;let c=b.startsWith("models/")?b.slice(7):b;if(!c)return null;let f=e(a.display_name)??e(a.displayName)??(e(a.id)||e(a.model)?e(a.name):void 0);return f&&f!==c?{id:c,name:f}:{id:c}}(f);!a||b.has(a.id)||(b.add(a.id),c.push(a))}return c.sort((a,b)=>(a.name??a.id).localeCompare(b.name??b.id,void 0,{numeric:!0,sensitivity:"base"}))}function g(a,b){let c=new URL(a.trim()),d=c.pathname.replace(/\/+$/,"");if(!/\/models$/i.test(d)){let a=d;"anthropic-messages"!==b||/\/v\d+(?:beta)?$/i.test(a)||(a+="/v1"),"google-generative-ai"!==b||/\/v\d+(?:beta)?$/i.test(a)||(a+="/v1beta"),c.pathname=`${a}/models`.replace(/\/+/g,"/")}return"anthropic-messages"!==b||c.searchParams.has("limit")||c.searchParams.set("limit","1000"),"google-generative-ai"!==b||c.searchParams.has("pageSize")||c.searchParams.set("pageSize","1000"),c}c.d(b,{f:()=>f,y:()=>g})},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=38278));module.exports=c})();
1
+ (()=>{var a={};a.id=9787,a.ids=[9787],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},26777:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{u:()=>k});var e=c(29021),f=c(21820),g=c(33873),h=c(75430),i=a([h]);function j(a){return"object"!=typeof a||null===a||Array.isArray(a)?{}:Object.fromEntries(Object.entries(a).filter(a=>"string"==typeof a[1]))}async function k(a,b){let c;try{c=(0,e.mkdtempSync)((0,g.join)((0,f.tmpdir)(),"pi-web-model-discovery-"));let d=(0,g.join)(c,"models.json"),i="__pi_web_model_discovery__";(0,e.writeFileSync)(d,JSON.stringify({providers:{[a]:{...b,models:[{id:i}]}}},null,2),"utf8");let k=await h.ModelRuntime.create({modelsPath:d}),l=k.getError();if(l)throw Error(l);let m=k.getModel(a,i);if(!m)throw Error(`Unable to load provider "${a}"`);let n=await k.getAuth(m);if(n)return{apiKey:n.auth.apiKey,headers:j(n.auth.headers)};return{headers:j(k.getCompatibilityRequestConfig(m).headers)}}finally{c&&(0,e.rmSync)(c,{recursive:!0,force:!0})}}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51874:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>i,dynamic:()=>j});var e=c(23211),f=c(26777),g=c(93598),h=a([f]);f=(h.then?(await h)():h)[0];let j="force-dynamic";async function i(a){try{var b;let c,d,h=await a.json(),i="string"==typeof h.providerName?h.providerName.trim():"";if(!i)return e.NextResponse.json({error:"providerName is required"},{status:400});if(b=h.provider,"object"!=typeof b||null===b||Array.isArray(b))return e.NextResponse.json({error:"provider is required"},{status:400});let j="string"==typeof h.provider.baseUrl?h.provider.baseUrl.trim():"";if(!j)return e.NextResponse.json({error:"Base URL is required"},{status:400});let k="string"==typeof h.provider.api&&h.provider.api?h.provider.api:"openai-completions";try{c=(0,g.y)(j,k)}catch{return e.NextResponse.json({error:"Base URL is invalid"},{status:400})}let l=await (0,f.u)(i,h.provider);if("string"==typeof h.provider.apiKey&&h.provider.apiKey.trim()&&!l.apiKey)return e.NextResponse.json({error:`No API key found for "${i}"`},{status:400});let m=await fetch(c,{cache:"no-store",headers:function(a,b,c){let d=new Headers(c);return(d.has("accept")||d.set("Accept","application/json"),b)?("anthropic-messages"===a?(d.has("x-api-key")||d.set("x-api-key",b),d.has("anthropic-version")||d.set("anthropic-version","2023-06-01")):"google-generative-ai"===a?d.has("x-goog-api-key")||d.set("x-goog-api-key",b):d.has("authorization")||d.set("Authorization",`Bearer ${b}`),d):d}(k,l.apiKey,l.headers),signal:AbortSignal.timeout(2e4)}),n=await m.text();if(!m.ok)return e.NextResponse.json({error:n.slice(0,500)||`Upstream returned HTTP ${m.status}`,status:m.status},{status:502});try{d=JSON.parse(n)}catch{return e.NextResponse.json({error:"Upstream model list was not valid JSON"},{status:502})}let o=(0,g.f)(d);if(0===o.length)return e.NextResponse.json({error:"No models found in the upstream response"},{status:502});return e.NextResponse.json({models:o,endpoint:c.toString()})}catch(c){let a=c instanceof Error?c.message:String(c),b=c instanceof DOMException&&"TimeoutError"===c.name?504:500;return e.NextResponse.json({error:a},{status:b})}}d()}catch(a){d(a)}})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86962:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/models-config/discover/route",pathname:"/api/models-config/discover",filename:"route",bundlePath:"app/api/models-config/discover/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/home/wa/project/pi-web-sky/app/api/models-config/discover/route.ts",nextConfigOutput:"",userland:()=>c(51874),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/models-config/discover/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},93598:(a,b,c)=>{"use strict";function d(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function e(a){return"string"==typeof a&&a.trim()?a.trim():void 0}function f(a){let b=new Set,c=[];for(let f of function(a){if(Array.isArray(a))return a;if(!d(a))return[];for(let b of["data","models","results","items"]){let c=a[b];if(Array.isArray(c))return c;if(d(c))return Object.values(c)}return[]}(a)){let a=function(a){if("string"==typeof a){let b=a.trim();return b?{id:b}:null}if(!d(a))return null;let b=e(a.id)??e(a.model)??e(a.name);if(!b)return null;let c=b.startsWith("models/")?b.slice(7):b;if(!c)return null;let f=e(a.display_name)??e(a.displayName)??(e(a.id)||e(a.model)?e(a.name):void 0);return f&&f!==c?{id:c,name:f}:{id:c}}(f);!a||b.has(a.id)||(b.add(a.id),c.push(a))}return c.sort((a,b)=>(a.name??a.id).localeCompare(b.name??b.id,void 0,{numeric:!0,sensitivity:"base"}))}function g(a,b){let c=new URL(a.trim()),d=c.pathname.replace(/\/+$/,"");if(!/\/models$/i.test(d)){let a=d;"anthropic-messages"!==b||/\/v\d+(?:beta)?$/i.test(a)||(a+="/v1"),"google-generative-ai"!==b||/\/v\d+(?:beta)?$/i.test(a)||(a+="/v1beta"),c.pathname=`${a}/models`.replace(/\/+/g,"/")}return"anthropic-messages"!==b||c.searchParams.has("limit")||c.searchParams.set("limit","1000"),"google-generative-ai"!==b||c.searchParams.has("pageSize")||c.searchParams.set("pageSize","1000"),c}c.d(b,{f:()=>f,y:()=>g})},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=86962));module.exports=c})();