@mcy2015/pi-web 0.15.4 → 0.15.5

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 (316) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +7 -6
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/required-server-files.js +1 -1
  6. package/.next/required-server-files.json +1 -1
  7. package/.next/routes-manifest.json +6 -0
  8. package/.next/server/app/_global-error/page.js +1 -1
  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 +2 -2
  24. package/.next/server/app/api/agent/[id]/lease/route.js +1 -1
  25. package/.next/server/app/api/agent/[id]/route.js +1 -1
  26. package/.next/server/app/api/agent/debug/route.js +2 -2
  27. package/.next/server/app/api/agent/new/route.js +1 -1
  28. package/.next/server/app/api/agent/running/route.js +1 -1
  29. package/.next/server/app/api/app-update/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/auto-title/route.js +2 -0
  35. package/.next/server/app/api/auto-title/route.js.nft.json +1 -0
  36. package/.next/server/app/api/auto-title/route_client-reference-manifest.js +1 -0
  37. package/.next/server/app/api/automations/route.js +4 -4
  38. package/.next/server/app/api/cache-miss-notices/route.js +1 -1
  39. package/.next/server/app/api/channels/route.js +7 -5
  40. package/.next/server/app/api/cwd/browse/route.js +1 -1
  41. package/.next/server/app/api/cwd/validate/route.js +1 -1
  42. package/.next/server/app/api/default-cwd/route.js +1 -1
  43. package/.next/server/app/api/file-index/route.js +1 -1
  44. package/.next/server/app/api/files/[...path]/route.js +1 -1
  45. package/.next/server/app/api/git/commit/route.js +2 -2
  46. package/.next/server/app/api/git/diff/route.js +2 -2
  47. package/.next/server/app/api/git/graph/route.js +1 -1
  48. package/.next/server/app/api/git/status/route.js +1 -1
  49. package/.next/server/app/api/home/route.js +1 -1
  50. package/.next/server/app/api/mcp/route.js +1 -1
  51. package/.next/server/app/api/mcp/sign-in/[flowId]/route.js +1 -1
  52. package/.next/server/app/api/mcp/sign-in/route.js +1 -1
  53. package/.next/server/app/api/mcp/test/route.js +1 -1
  54. package/.next/server/app/api/models/default/route.js +1 -1
  55. package/.next/server/app/api/models/enabled/route.js +1 -1
  56. package/.next/server/app/api/models/refresh/route.js +1 -1
  57. package/.next/server/app/api/models/route.js +1 -1
  58. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  59. package/.next/server/app/api/models-config/discover/route.js +1 -1
  60. package/.next/server/app/api/models-config/route.js +1 -1
  61. package/.next/server/app/api/models-config/test/route.js +1 -1
  62. package/.next/server/app/api/open-in-explorer/route.js +1 -1
  63. package/.next/server/app/api/plugins/check/route.js +1 -1
  64. package/.next/server/app/api/plugins/route.js +1 -1
  65. package/.next/server/app/api/project-trust/route.js +1 -1
  66. package/.next/server/app/api/provider-usage/query/route.js +1 -1
  67. package/.next/server/app/api/push/config/route.js +1 -1
  68. package/.next/server/app/api/push/subscribe/route.js +1 -1
  69. package/.next/server/app/api/sessions/[id]/auto-name/route.js +1 -11
  70. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  71. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  72. package/.next/server/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route.js +1 -1
  73. package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
  74. package/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  75. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  76. package/.next/server/app/api/sessions/[id]/share/route.js +1 -1
  77. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  78. package/.next/server/app/api/sessions/delete/route.js +1 -1
  79. package/.next/server/app/api/sessions/route.js +1 -1
  80. package/.next/server/app/api/sessions/search/route.js +1 -1
  81. package/.next/server/app/api/sessions/stats/route.js +1 -1
  82. package/.next/server/app/api/sessions/ui-state/route.js +1 -1
  83. package/.next/server/app/api/skills/check/route.js +1 -1
  84. package/.next/server/app/api/skills/content/route.js +1 -1
  85. package/.next/server/app/api/skills/install/route.js +1 -1
  86. package/.next/server/app/api/skills/route.js +1 -1
  87. package/.next/server/app/api/skills/search/route.js +1 -1
  88. package/.next/server/app/api/skills/update/route.js +1 -1
  89. package/.next/server/app/api/subagents/[id]/route.js +1 -1
  90. package/.next/server/app/api/subagents/profiles/route.js +1 -1
  91. package/.next/server/app/api/subagents/settings/route.js +1 -1
  92. package/.next/server/app/api/terminal/[id]/events/route.js +1 -1
  93. package/.next/server/app/api/terminal/[id]/route.js +1 -1
  94. package/.next/server/app/api/terminal/route.js +1 -1
  95. package/.next/server/app/api/tools/settings/route.js +1 -1
  96. package/.next/server/app/api/usage/route.js +1 -1
  97. package/.next/server/app/api/web-auth/route.js +1 -1
  98. package/.next/server/app/api/worktrees/route.js +1 -1
  99. package/.next/server/app/favicon.ico/route.js +1 -1
  100. package/.next/server/app/files/page.js +1 -1
  101. package/.next/server/app/files/page_client-reference-manifest.js +1 -1
  102. package/.next/server/app/files.html +1 -1
  103. package/.next/server/app/files.rsc +4 -4
  104. package/.next/server/app/files.segments/_full.segment.rsc +4 -4
  105. package/.next/server/app/files.segments/_tree.segment.rsc +2 -2
  106. package/.next/server/app/files.segments/files/__PAGE__.segment.rsc +4 -4
  107. package/.next/server/app/index.html +1 -1
  108. package/.next/server/app/index.rsc +8 -8
  109. package/.next/server/app/index.segments/__PAGE__.segment.rsc +8 -8
  110. package/.next/server/app/index.segments/_full.segment.rsc +8 -8
  111. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  112. package/.next/server/app/login/page.js +1 -1
  113. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  114. package/.next/server/app/login.html +1 -1
  115. package/.next/server/app/login.rsc +4 -4
  116. package/.next/server/app/login.segments/_full.segment.rsc +4 -4
  117. package/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  118. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +4 -4
  119. package/.next/server/app/manifest.webmanifest/route.js +1 -1
  120. package/.next/server/app/page.js +6 -6
  121. package/.next/server/app/page_client-reference-manifest.js +1 -1
  122. package/.next/server/app/share/[code]/page.js +1 -1
  123. package/.next/server/app/share/[code]/page_client-reference-manifest.js +1 -1
  124. package/.next/server/app-paths-manifest.json +7 -6
  125. package/.next/server/chunks/1795.js +1 -1
  126. package/.next/server/chunks/1975.js +1 -1
  127. package/.next/server/chunks/210.js +26 -14
  128. package/.next/server/chunks/2243.js +1 -1
  129. package/.next/server/chunks/6429.js +12 -1
  130. package/.next/server/chunks/7025.js +1 -1
  131. package/.next/server/chunks/9328.js +2 -2
  132. package/.next/server/middleware-build-manifest.js +1 -1
  133. package/.next/server/pages/404.html +1 -1
  134. package/.next/server/pages/500.html +1 -1
  135. package/.next/server/preview-props.json +3 -3
  136. package/.next/server/server-reference-manifest.json +1 -1
  137. package/.next/static/H-zMlFNln-mpSCCOKXR-e/_buildManifest.js +1 -0
  138. package/.next/static/chunks/1278-9faace365b604692.js +1 -0
  139. package/.next/static/chunks/7847-0190dc4ded5f19a4.js +1 -0
  140. package/.next/static/chunks/app/_global-error/page-88c7e2580138ec1c.js +1 -0
  141. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-88c7e2580138ec1c.js +1 -0
  142. package/.next/static/chunks/app/api/agent/[id]/events/route-88c7e2580138ec1c.js +1 -0
  143. package/.next/static/chunks/app/api/agent/[id]/lease/route-88c7e2580138ec1c.js +1 -0
  144. package/.next/static/chunks/app/api/agent/[id]/route-88c7e2580138ec1c.js +1 -0
  145. package/.next/static/chunks/app/api/agent/debug/route-88c7e2580138ec1c.js +1 -0
  146. package/.next/static/chunks/app/api/agent/new/route-88c7e2580138ec1c.js +1 -0
  147. package/.next/static/chunks/app/api/agent/running/route-88c7e2580138ec1c.js +1 -0
  148. package/.next/static/chunks/app/api/app-update/route-88c7e2580138ec1c.js +1 -0
  149. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-88c7e2580138ec1c.js +1 -0
  150. package/.next/static/chunks/app/api/auth/login/[provider]/route-88c7e2580138ec1c.js +1 -0
  151. package/.next/static/chunks/app/api/auth/logout/[provider]/route-88c7e2580138ec1c.js +1 -0
  152. package/.next/static/chunks/app/api/auth/providers/route-88c7e2580138ec1c.js +1 -0
  153. package/.next/static/chunks/app/api/auto-title/route-88c7e2580138ec1c.js +1 -0
  154. package/.next/static/chunks/app/api/automations/route-88c7e2580138ec1c.js +1 -0
  155. package/.next/static/chunks/app/api/cache-miss-notices/route-88c7e2580138ec1c.js +1 -0
  156. package/.next/static/chunks/app/api/channels/route-88c7e2580138ec1c.js +1 -0
  157. package/.next/static/chunks/app/api/cwd/browse/route-88c7e2580138ec1c.js +1 -0
  158. package/.next/static/chunks/app/api/cwd/validate/route-88c7e2580138ec1c.js +1 -0
  159. package/.next/static/chunks/app/api/default-cwd/route-88c7e2580138ec1c.js +1 -0
  160. package/.next/static/chunks/app/api/file-index/route-88c7e2580138ec1c.js +1 -0
  161. package/.next/static/chunks/app/api/files/[...path]/route-88c7e2580138ec1c.js +1 -0
  162. package/.next/static/chunks/app/api/git/commit/route-88c7e2580138ec1c.js +1 -0
  163. package/.next/static/chunks/app/api/git/diff/route-88c7e2580138ec1c.js +1 -0
  164. package/.next/static/chunks/app/api/git/graph/route-88c7e2580138ec1c.js +1 -0
  165. package/.next/static/chunks/app/api/git/status/route-88c7e2580138ec1c.js +1 -0
  166. package/.next/static/chunks/app/api/home/route-88c7e2580138ec1c.js +1 -0
  167. package/.next/static/chunks/app/api/mcp/route-88c7e2580138ec1c.js +1 -0
  168. package/.next/static/chunks/app/api/mcp/sign-in/[flowId]/route-88c7e2580138ec1c.js +1 -0
  169. package/.next/static/chunks/app/api/mcp/sign-in/route-88c7e2580138ec1c.js +1 -0
  170. package/.next/static/chunks/app/api/mcp/test/route-88c7e2580138ec1c.js +1 -0
  171. package/.next/static/chunks/app/api/models/default/route-88c7e2580138ec1c.js +1 -0
  172. package/.next/static/chunks/app/api/models/enabled/route-88c7e2580138ec1c.js +1 -0
  173. package/.next/static/chunks/app/api/models/refresh/route-88c7e2580138ec1c.js +1 -0
  174. package/.next/static/chunks/app/api/models/route-88c7e2580138ec1c.js +1 -0
  175. package/.next/static/chunks/app/api/models-config/catalog/route-88c7e2580138ec1c.js +1 -0
  176. package/.next/static/chunks/app/api/models-config/discover/route-88c7e2580138ec1c.js +1 -0
  177. package/.next/static/chunks/app/api/models-config/route-88c7e2580138ec1c.js +1 -0
  178. package/.next/static/chunks/app/api/models-config/test/route-88c7e2580138ec1c.js +1 -0
  179. package/.next/static/chunks/app/api/open-in-explorer/route-88c7e2580138ec1c.js +1 -0
  180. package/.next/static/chunks/app/api/plugins/check/route-88c7e2580138ec1c.js +1 -0
  181. package/.next/static/chunks/app/api/plugins/route-88c7e2580138ec1c.js +1 -0
  182. package/.next/static/chunks/app/api/project-trust/route-88c7e2580138ec1c.js +1 -0
  183. package/.next/static/chunks/app/api/provider-usage/query/route-88c7e2580138ec1c.js +1 -0
  184. package/.next/static/chunks/app/api/push/config/route-88c7e2580138ec1c.js +1 -0
  185. package/.next/static/chunks/app/api/push/subscribe/route-88c7e2580138ec1c.js +1 -0
  186. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-88c7e2580138ec1c.js +1 -0
  187. package/.next/static/chunks/app/api/sessions/[id]/context/route-88c7e2580138ec1c.js +1 -0
  188. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-88c7e2580138ec1c.js +1 -0
  189. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-88c7e2580138ec1c.js +1 -0
  190. package/.next/static/chunks/app/api/sessions/[id]/export/route-88c7e2580138ec1c.js +1 -0
  191. package/.next/static/chunks/app/api/sessions/[id]/fork/route-88c7e2580138ec1c.js +1 -0
  192. package/.next/static/chunks/app/api/sessions/[id]/route-88c7e2580138ec1c.js +1 -0
  193. package/.next/static/chunks/app/api/sessions/[id]/share/route-88c7e2580138ec1c.js +1 -0
  194. package/.next/static/chunks/app/api/sessions/[id]/state/route-88c7e2580138ec1c.js +1 -0
  195. package/.next/static/chunks/app/api/sessions/delete/route-88c7e2580138ec1c.js +1 -0
  196. package/.next/static/chunks/app/api/sessions/route-88c7e2580138ec1c.js +1 -0
  197. package/.next/static/chunks/app/api/sessions/search/route-88c7e2580138ec1c.js +1 -0
  198. package/.next/static/chunks/app/api/sessions/stats/route-88c7e2580138ec1c.js +1 -0
  199. package/.next/static/chunks/app/api/sessions/ui-state/route-88c7e2580138ec1c.js +1 -0
  200. package/.next/static/chunks/app/api/skills/check/route-88c7e2580138ec1c.js +1 -0
  201. package/.next/static/chunks/app/api/skills/content/route-88c7e2580138ec1c.js +1 -0
  202. package/.next/static/chunks/app/api/skills/install/route-88c7e2580138ec1c.js +1 -0
  203. package/.next/static/chunks/app/api/skills/route-88c7e2580138ec1c.js +1 -0
  204. package/.next/static/chunks/app/api/skills/search/route-88c7e2580138ec1c.js +1 -0
  205. package/.next/static/chunks/app/api/skills/update/route-88c7e2580138ec1c.js +1 -0
  206. package/.next/static/chunks/app/api/subagents/[id]/route-88c7e2580138ec1c.js +1 -0
  207. package/.next/static/chunks/app/api/subagents/profiles/route-88c7e2580138ec1c.js +1 -0
  208. package/.next/static/chunks/app/api/subagents/settings/route-88c7e2580138ec1c.js +1 -0
  209. package/.next/static/chunks/app/api/terminal/[id]/events/route-88c7e2580138ec1c.js +1 -0
  210. package/.next/static/chunks/app/api/terminal/[id]/route-88c7e2580138ec1c.js +1 -0
  211. package/.next/static/chunks/app/api/terminal/route-88c7e2580138ec1c.js +1 -0
  212. package/.next/static/chunks/app/api/tools/settings/route-88c7e2580138ec1c.js +1 -0
  213. package/.next/static/chunks/app/api/usage/route-88c7e2580138ec1c.js +1 -0
  214. package/.next/static/chunks/app/api/web-auth/route-88c7e2580138ec1c.js +1 -0
  215. package/.next/static/chunks/app/api/worktrees/route-88c7e2580138ec1c.js +1 -0
  216. package/.next/static/chunks/app/{layout-37a070d16cf06b89.js → layout-bcca9ad1f35b5fe9.js} +1 -1
  217. package/.next/static/chunks/app/manifest.webmanifest/route-88c7e2580138ec1c.js +1 -0
  218. package/.next/static/chunks/app/page-438dbfe8e32a65da.js +1456 -0
  219. package/.next/static/chunks/app/share/[code]/{page-c3eb4083c2ae623f.js → page-ba6c62568f24e009.js} +1 -1
  220. package/.next/static/chunks/next/dist/client/components/builtin/app-error-88c7e2580138ec1c.js +1 -0
  221. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-88c7e2580138ec1c.js +1 -0
  222. package/.next/static/chunks/next/dist/client/components/builtin/not-found-88c7e2580138ec1c.js +1 -0
  223. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-88c7e2580138ec1c.js +1 -0
  224. package/.next/static/css/70e5f0998966beb6.css +1 -0
  225. package/.next/trace +207 -207
  226. package/.next/trace-build +1 -1
  227. package/.next/types/app/api/auto-title/route.ts +355 -0
  228. package/.next/types/routes.d.ts +2 -1
  229. package/.next/types/validator.ts +10 -0
  230. package/package.json +1 -1
  231. package/.next/static/chunks/1278-04d8240232c24300.js +0 -1
  232. package/.next/static/chunks/8646-8131bc4913418a3d.js +0 -1
  233. package/.next/static/chunks/app/_global-error/page-5a1a5c08f6fa685c.js +0 -1
  234. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-5a1a5c08f6fa685c.js +0 -1
  235. package/.next/static/chunks/app/api/agent/[id]/events/route-5a1a5c08f6fa685c.js +0 -1
  236. package/.next/static/chunks/app/api/agent/[id]/lease/route-5a1a5c08f6fa685c.js +0 -1
  237. package/.next/static/chunks/app/api/agent/[id]/route-5a1a5c08f6fa685c.js +0 -1
  238. package/.next/static/chunks/app/api/agent/debug/route-5a1a5c08f6fa685c.js +0 -1
  239. package/.next/static/chunks/app/api/agent/new/route-5a1a5c08f6fa685c.js +0 -1
  240. package/.next/static/chunks/app/api/agent/running/route-5a1a5c08f6fa685c.js +0 -1
  241. package/.next/static/chunks/app/api/app-update/route-5a1a5c08f6fa685c.js +0 -1
  242. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-5a1a5c08f6fa685c.js +0 -1
  243. package/.next/static/chunks/app/api/auth/login/[provider]/route-5a1a5c08f6fa685c.js +0 -1
  244. package/.next/static/chunks/app/api/auth/logout/[provider]/route-5a1a5c08f6fa685c.js +0 -1
  245. package/.next/static/chunks/app/api/auth/providers/route-5a1a5c08f6fa685c.js +0 -1
  246. package/.next/static/chunks/app/api/automations/route-5a1a5c08f6fa685c.js +0 -1
  247. package/.next/static/chunks/app/api/cache-miss-notices/route-5a1a5c08f6fa685c.js +0 -1
  248. package/.next/static/chunks/app/api/channels/route-5a1a5c08f6fa685c.js +0 -1
  249. package/.next/static/chunks/app/api/cwd/browse/route-5a1a5c08f6fa685c.js +0 -1
  250. package/.next/static/chunks/app/api/cwd/validate/route-5a1a5c08f6fa685c.js +0 -1
  251. package/.next/static/chunks/app/api/default-cwd/route-5a1a5c08f6fa685c.js +0 -1
  252. package/.next/static/chunks/app/api/file-index/route-5a1a5c08f6fa685c.js +0 -1
  253. package/.next/static/chunks/app/api/files/[...path]/route-5a1a5c08f6fa685c.js +0 -1
  254. package/.next/static/chunks/app/api/git/commit/route-5a1a5c08f6fa685c.js +0 -1
  255. package/.next/static/chunks/app/api/git/diff/route-5a1a5c08f6fa685c.js +0 -1
  256. package/.next/static/chunks/app/api/git/graph/route-5a1a5c08f6fa685c.js +0 -1
  257. package/.next/static/chunks/app/api/git/status/route-5a1a5c08f6fa685c.js +0 -1
  258. package/.next/static/chunks/app/api/home/route-5a1a5c08f6fa685c.js +0 -1
  259. package/.next/static/chunks/app/api/mcp/route-5a1a5c08f6fa685c.js +0 -1
  260. package/.next/static/chunks/app/api/mcp/sign-in/[flowId]/route-5a1a5c08f6fa685c.js +0 -1
  261. package/.next/static/chunks/app/api/mcp/sign-in/route-5a1a5c08f6fa685c.js +0 -1
  262. package/.next/static/chunks/app/api/mcp/test/route-5a1a5c08f6fa685c.js +0 -1
  263. package/.next/static/chunks/app/api/models/default/route-5a1a5c08f6fa685c.js +0 -1
  264. package/.next/static/chunks/app/api/models/enabled/route-5a1a5c08f6fa685c.js +0 -1
  265. package/.next/static/chunks/app/api/models/refresh/route-5a1a5c08f6fa685c.js +0 -1
  266. package/.next/static/chunks/app/api/models/route-5a1a5c08f6fa685c.js +0 -1
  267. package/.next/static/chunks/app/api/models-config/catalog/route-5a1a5c08f6fa685c.js +0 -1
  268. package/.next/static/chunks/app/api/models-config/discover/route-5a1a5c08f6fa685c.js +0 -1
  269. package/.next/static/chunks/app/api/models-config/route-5a1a5c08f6fa685c.js +0 -1
  270. package/.next/static/chunks/app/api/models-config/test/route-5a1a5c08f6fa685c.js +0 -1
  271. package/.next/static/chunks/app/api/open-in-explorer/route-5a1a5c08f6fa685c.js +0 -1
  272. package/.next/static/chunks/app/api/plugins/check/route-5a1a5c08f6fa685c.js +0 -1
  273. package/.next/static/chunks/app/api/plugins/route-5a1a5c08f6fa685c.js +0 -1
  274. package/.next/static/chunks/app/api/project-trust/route-5a1a5c08f6fa685c.js +0 -1
  275. package/.next/static/chunks/app/api/provider-usage/query/route-5a1a5c08f6fa685c.js +0 -1
  276. package/.next/static/chunks/app/api/push/config/route-5a1a5c08f6fa685c.js +0 -1
  277. package/.next/static/chunks/app/api/push/subscribe/route-5a1a5c08f6fa685c.js +0 -1
  278. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-5a1a5c08f6fa685c.js +0 -1
  279. package/.next/static/chunks/app/api/sessions/[id]/context/route-5a1a5c08f6fa685c.js +0 -1
  280. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-5a1a5c08f6fa685c.js +0 -1
  281. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-5a1a5c08f6fa685c.js +0 -1
  282. package/.next/static/chunks/app/api/sessions/[id]/export/route-5a1a5c08f6fa685c.js +0 -1
  283. package/.next/static/chunks/app/api/sessions/[id]/fork/route-5a1a5c08f6fa685c.js +0 -1
  284. package/.next/static/chunks/app/api/sessions/[id]/route-5a1a5c08f6fa685c.js +0 -1
  285. package/.next/static/chunks/app/api/sessions/[id]/share/route-5a1a5c08f6fa685c.js +0 -1
  286. package/.next/static/chunks/app/api/sessions/[id]/state/route-5a1a5c08f6fa685c.js +0 -1
  287. package/.next/static/chunks/app/api/sessions/delete/route-5a1a5c08f6fa685c.js +0 -1
  288. package/.next/static/chunks/app/api/sessions/route-5a1a5c08f6fa685c.js +0 -1
  289. package/.next/static/chunks/app/api/sessions/search/route-5a1a5c08f6fa685c.js +0 -1
  290. package/.next/static/chunks/app/api/sessions/stats/route-5a1a5c08f6fa685c.js +0 -1
  291. package/.next/static/chunks/app/api/sessions/ui-state/route-5a1a5c08f6fa685c.js +0 -1
  292. package/.next/static/chunks/app/api/skills/check/route-5a1a5c08f6fa685c.js +0 -1
  293. package/.next/static/chunks/app/api/skills/content/route-5a1a5c08f6fa685c.js +0 -1
  294. package/.next/static/chunks/app/api/skills/install/route-5a1a5c08f6fa685c.js +0 -1
  295. package/.next/static/chunks/app/api/skills/route-5a1a5c08f6fa685c.js +0 -1
  296. package/.next/static/chunks/app/api/skills/search/route-5a1a5c08f6fa685c.js +0 -1
  297. package/.next/static/chunks/app/api/skills/update/route-5a1a5c08f6fa685c.js +0 -1
  298. package/.next/static/chunks/app/api/subagents/[id]/route-5a1a5c08f6fa685c.js +0 -1
  299. package/.next/static/chunks/app/api/subagents/profiles/route-5a1a5c08f6fa685c.js +0 -1
  300. package/.next/static/chunks/app/api/subagents/settings/route-5a1a5c08f6fa685c.js +0 -1
  301. package/.next/static/chunks/app/api/terminal/[id]/events/route-5a1a5c08f6fa685c.js +0 -1
  302. package/.next/static/chunks/app/api/terminal/[id]/route-5a1a5c08f6fa685c.js +0 -1
  303. package/.next/static/chunks/app/api/terminal/route-5a1a5c08f6fa685c.js +0 -1
  304. package/.next/static/chunks/app/api/tools/settings/route-5a1a5c08f6fa685c.js +0 -1
  305. package/.next/static/chunks/app/api/usage/route-5a1a5c08f6fa685c.js +0 -1
  306. package/.next/static/chunks/app/api/web-auth/route-5a1a5c08f6fa685c.js +0 -1
  307. package/.next/static/chunks/app/api/worktrees/route-5a1a5c08f6fa685c.js +0 -1
  308. package/.next/static/chunks/app/manifest.webmanifest/route-5a1a5c08f6fa685c.js +0 -1
  309. package/.next/static/chunks/app/page-d6046f92efff04ca.js +0 -1456
  310. package/.next/static/chunks/next/dist/client/components/builtin/app-error-5a1a5c08f6fa685c.js +0 -1
  311. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-5a1a5c08f6fa685c.js +0 -1
  312. package/.next/static/chunks/next/dist/client/components/builtin/not-found-5a1a5c08f6fa685c.js +0 -1
  313. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-5a1a5c08f6fa685c.js +0 -1
  314. package/.next/static/css/1c235f9240d931ae.css +0 -1
  315. package/.next/static/k7tBCkl9-JhoBnT7mYkQn/_buildManifest.js +0 -1
  316. /package/.next/static/{k7tBCkl9-JhoBnT7mYkQn → H-zMlFNln-mpSCCOKXR-e}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (()=>{var a={};a.id=6293,a.ids=[6293],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},305:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Up:()=>n,dp:()=>m,e5:()=>k,wQ:()=>i});var e=c(10674),f=a([e]);e=(f.then?(await f)():f)[0];let o=["read","bash","edit","write"],p=new Set(["bash","powershell"]);function g(a,b=process.platform){return"win32"===b&&a?.includes("powershell")===!0&&!a.includes("bash")}function h(a,b){let c=b?"powershell":"bash",d=[];for(let b of a){let a=p.has(b)?c:b;d.includes(a)||d.push(a)}return d}function i(a,b,c=process.platform){return h(a,g(b,c))}function j(a){return a.startsWith("+")||a.startsWith("-")}function k(a){let b=a.filter(a=>!j(a)),c=b.length>0||0===a.length?b:[...o];for(let b of a){if(!j(b))continue;let a=b.slice(1),d=c.indexOf(a);b.startsWith("+")&&-1===d&&a?c.push(a):b.startsWith("-")&&-1!==d&&c.splice(d,1)}return c}function l(a){let b=(0,e.cj)(a);return void 0===b?void 0:k(b)}async function m(a=(0,e.WD)(void 0),b=process.platform){return(0,e.lz)(a,a=>g(l(a),b))}async function n(a,b=(0,e.WD)(void 0),c=process.platform){if("win32"!==c)throw Error("PowerShell tool settings are only available on Windows");return await (0,e.AC)(b,b=>{let c=l(b)??o,d=h(c,a);c.some(a=>p.has(a))||d.push(a?"powershell":"bash"),b.defaultTools=d}),a}d()}catch(a){d(a)}})},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")},10674:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{AC:()=>o,WD:()=>k,cj:()=>m,lz:()=>n});var e=c(73024),f=c(76760),g=c(75430),h=c(80974),i=c.n(h),j=a([g]);function k(a=(0,g.getAgentDir)()){return(0,f.join)(a,"settings.json")}function l(a){var b;let c;if(!(0,e.existsSync)(a))return{};let d=(0,e.readFileSync)(a,"utf8");try{c=JSON.parse(d)}catch(c){let b=c instanceof Error?c.message:String(c);throw SyntaxError(`${a}: ${b}`)}if(!("object"==typeof(b=c)&&null!==b&&!Array.isArray(b)))throw Error("Invalid settings.json: expected an object");return c}function m(a){if(void 0!==a.defaultTools){if(!Array.isArray(a.defaultTools)||a.defaultTools.some(a=>"string"!=typeof a))throw Error("Invalid settings.json: defaultTools must be an array of strings");return[...a.defaultTools]}}async function n(a,b){if(!(0,e.existsSync)(a))return b({});let c=await i().lock(a,{realpath:!1,retries:10});try{return b(l(a))}finally{await c()}}async function o(a,b){(0,e.mkdirSync)((0,f.dirname)(a),{recursive:!0});try{(0,e.writeFileSync)(a,"{}",{flag:"wx",mode:384})}catch(a){if("EEXIST"!==a.code)throw a}let c=await i().lock(a,{realpath:!1,retries:10});try{let c=l(a),d=b(c);return(0,e.writeFileSync)(a,JSON.stringify(c,null,2),"utf8"),(0,e.chmodSync)(a,384),d}finally{await c()}}g=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},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")},32280:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>m,PUT:()=>n,dynamic:()=>o});var e=c(23211),f=c(41228),g=c(66544),h=c(305),i=a([f,h]);[f,h]=i.then?(await i)():i;let o="force-dynamic",p=["enabled","codemode","codemodeMode","codemodeInlineBudget"];function j(a,b,c){return e.NextResponse.json({error:c,reason:b},{status:a})}function k(a){return j(500,"internal",a instanceof Error?a.message:String(a))}async function l(){let a=await (0,h.dp)(),b=await (0,f.wS)(),{mode:c,inlineBudget:d}=await (0,f.yH)();return{isWindows:"win32"===process.platform,powerShellEnabled:a,codemode:b,codemodeMode:c,codemodeInlineBudget:d}}async function m(){try{return e.NextResponse.json(await l())}catch(a){return k(a)}}async function n(a){let b;if(!(0,g.EN)(a))return j(403,"request-denied","Untrusted API request");if(!(0,g.E2)(a))return j(415,"content-type","Content-Type must be application/json");try{b=await a.json()}catch{return j(400,"invalid-request","Invalid JSON body")}if("object"!=typeof b||null===b||Array.isArray(b))return j(400,"invalid-request","Expected a JSON object");let c=b;if(1!==p.filter(a=>a in c).length)return j(400,"invalid-request","Send one of enabled (PowerShell), codemode, codemodeMode or codemodeInlineBudget");if("codemodeMode"in c){if(!(0,f.yK)(c.codemodeMode))return j(400,"invalid-request",'codemodeMode must be "on" or "only"');try{return await (0,f.hy)(c.codemodeMode),e.NextResponse.json(await l())}catch(a){return k(a)}}if("codemodeInlineBudget"in c){let a=c.codemodeInlineBudget;if(null!==a&&!(0,f.Te)(a))return j(400,"invalid-request",`codemodeInlineBudget must be a whole number from 0 to ${f.mz}, or null`);try{return await (0,f.i7)(a??void 0),e.NextResponse.json(await l())}catch(a){return k(a)}}if("codemode"in c){if(!(0,f.cY)(c.codemode))return j(400,"invalid-request",'codemode must be "automatic" or "always"');try{return await (0,f.ZZ)(c.codemode),e.NextResponse.json(await l())}catch(a){return k(a)}}if("win32"!==process.platform)return j(404,"invalid-request","PowerShell tool settings are only available on Windows");if("boolean"!=typeof c.enabled)return j(400,"invalid-request","enabled must be a boolean");try{return await (0,h.Up)(c.enabled),e.NextResponse.json(await l())}catch(a){return k(a)}}d()}catch(a){d(a)}})},33873:a=>{"use strict";a.exports=require("path")},37431:(a,b,c)=>{"use strict";c.d(b,{T:()=>f,y:()=>g});var d=c(73024);let e=d.constants.O_RDONLY|(d.constants.O_NONBLOCK||0),f=1048576;function g(a,b){let c;try{c=(0,d.openSync)(a,e)}catch(b){let a;if("ENOENT"===(a=b?.code)||"ENOTDIR"===a)return;throw b}try{let e=(0,d.fstatSync)(c);if(!e.isFile())throw Error(`${a} is not a regular file`);if(void 0===b)return(0,d.readFileSync)(c,"utf8");if(e.size>b)throw Error(`${a} is larger than ${b} bytes`);let f=b+1,g=[],h=0;for(;h<f;){let a=Buffer.alloc(Math.min(f-h,65536)),b=(0,d.readSync)(c,a,0,a.length,null);if(0===b)break;g.push(a.subarray(0,b)),h+=b}if(h>b)throw Error(`${a} is larger than ${b} bytes`);return Buffer.concat(g,h).toString("utf8")}finally{(0,d.closeSync)(c)}}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86959:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});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(10246),u=c(37527);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/tools/settings/route",pathname:"/api/tools/settings",filename:"route",bundlePath:"app/api/tools/settings/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/Data Vault/PiSpace/pi-web/app/api/tools/settings/route.ts",nextConfigOutput:"",userland:()=>c(32280),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/tools/settings/route";"/index"===d&&(d="/");let{instrumentation:e}=await v.ensureInstrumentation(a,{deferSpans:!0});return v.traceRequest(a,{tracer:(0,h.getTracer)(),spanName:`${a.method||"GET"} ${d}`,httpTarget:a.url,instrumentation:e},(e,f)=>B(a,b,c,d,!1,e,f))}async function B(a,b,c,d,f,w,x){let y=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:f});if(!y)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:z,deploymentId:A,params:B,nextConfig:C,parsedUrl:D,isDraftMode:E,prerenderManifest:F,routerServerContext:G,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,resolvedPathname:J,clientReferenceManifest:K,serverActionsManifest:L,previewProps:M}=y,N=(0,j.normalizeAppPath)(d),O=!!F.routes[J]&&(v.isDev||(0,t.isRouteCacheOwner)(J,v.cacheOwner,F.routes[J])),P=!!(F.dynamicRoutes[N]||O),Q=async()=>((null==G?void 0:G.render404)?await G.render404(a,b,D,!1):b.end("This page could not be found"),null);if(P&&!E){let a=F.dynamicRoutes[N];if(a&&!1===a.fallback&&!O){if(C.adapterPath)return await Q();throw new s.NoFallbackError}}let R=null;!P||v.isDev||E||(R="/index"===(R=J)?"/":R),L&&K&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:K,serverActionsManifest:L});let S=a.method||"GET",T=(0,h.getTracer)(),U=!!(null==G?void 0:G.isWrappedByNextServer),V=!!(0,g.getRequestMeta)(a,"minimalMode"),W=(0,g.getRequestMeta)(a,"incrementalCache")||await v.getIncrementalCache(a,C,M,F,V);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let X={params:B,previewProps:M,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout,durableUseCacheEntries:!!C.experimental.durableUseCacheEntries},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,isDraftMode:E,incrementalCache:W,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0},sharedContext:{buildId:z,deploymentId:A}},Y=new k.NodeNextRequest(a),Z=new k.NodeNextResponse(b),$=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(b)),_=async({previousCacheEntry:e})=>{try{if(!V&&H&&I&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=null===R?await v.handle($,X):await v.prerender($,X);a.fetchMetrics=X.renderOpts.fetchMetrics;let f=X.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=X.renderOpts.collectedTags;if(!P)return await (0,o.I)(Y,Z,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!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,e=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?C.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:u.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 v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),b}},aa=async d=>{try{var f,g;let d=await v.handleResponse({req:a,nextConfig:C,cacheKey:R,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,previewProps:M,prerenderManifest:F,isRoutePPREnabled:!1,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,responseGenerator:_,waitUntil:c.waitUntil,isMinimalMode:V});if(null!==d&&"error"in d)throw d.error;if(!P)return;if((null==d||null==(f=d.value)?void 0:f.kind)!==u.CachedRouteKind.APP_ROUTE)throw Error(`Invariant: app-route received invalid cache entry ${null==d||null==(g=d.value)?void 0:g.kind}`);V||b.setHeader("x-nextjs-cache",H?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),E&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);V&&P||h.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(Y,Z,new Response(d.value.body,{headers:h,status:d.value.status||200}));return}catch(c){if(c instanceof s.NoFallbackError||await v.onRequestError(a,c,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),P)throw c;if(b.headersSent){if(d){let a=c instanceof Error?c:Error("Unknown app route error");d.recordException(a),d.setStatus({code:h.SpanStatusCode.ERROR,message:a.message}),d.setAttribute("error.type",a.name)}b.writableEnded||b.destroyed||b.end()}else await (0,o.I)(Y,Z,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=T.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")||N,f=`${S} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":f}),d.updateName(f),x&&x!==d&&(x.setAttribute("http.route",e),x.updateName(f))})()}};U||void 0===a.url||null==w||w.setAttribute("http.target",a.url),await aa(w)}},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2970,1813,974,1207],()=>b(b.s=86959));module.exports=c})();
1
+ (()=>{var a={};a.id=6293,a.ids=[6293],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},305:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Up:()=>n,dp:()=>m,e5:()=>k,wQ:()=>i});var e=c(10674),f=a([e]);e=(f.then?(await f)():f)[0];let o=["read","bash","edit","write"],p=new Set(["bash","powershell"]);function g(a,b=process.platform){return"win32"===b&&a?.includes("powershell")===!0&&!a.includes("bash")}function h(a,b){let c=b?"powershell":"bash",d=[];for(let b of a){let a=p.has(b)?c:b;d.includes(a)||d.push(a)}return d}function i(a,b,c=process.platform){return h(a,g(b,c))}function j(a){return a.startsWith("+")||a.startsWith("-")}function k(a){let b=a.filter(a=>!j(a)),c=b.length>0||0===a.length?b:[...o];for(let b of a){if(!j(b))continue;let a=b.slice(1),d=c.indexOf(a);b.startsWith("+")&&-1===d&&a?c.push(a):b.startsWith("-")&&-1!==d&&c.splice(d,1)}return c}function l(a){let b=(0,e.cj)(a);return void 0===b?void 0:k(b)}async function m(a=(0,e.WD)(void 0),b=process.platform){return(0,e.lz)(a,a=>g(l(a),b))}async function n(a,b=(0,e.WD)(void 0),c=process.platform){if("win32"!==c)throw Error("PowerShell tool settings are only available on Windows");return await (0,e.AC)(b,b=>{let c=l(b)??o,d=h(c,a);c.some(a=>p.has(a))||d.push(a?"powershell":"bash"),b.defaultTools=d}),a}d()}catch(a){d(a)}})},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")},10674:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{AC:()=>o,WD:()=>k,cj:()=>m,lz:()=>n});var e=c(73024),f=c(76760),g=c(75430),h=c(80974),i=c.n(h),j=a([g]);function k(a=(0,g.getAgentDir)()){return(0,f.join)(a,"settings.json")}function l(a){var b;let c;if(!(0,e.existsSync)(a))return{};let d=(0,e.readFileSync)(a,"utf8");try{c=JSON.parse(d)}catch(c){let b=c instanceof Error?c.message:String(c);throw SyntaxError(`${a}: ${b}`)}if(!("object"==typeof(b=c)&&null!==b&&!Array.isArray(b)))throw Error("Invalid settings.json: expected an object");return c}function m(a){if(void 0!==a.defaultTools){if(!Array.isArray(a.defaultTools)||a.defaultTools.some(a=>"string"!=typeof a))throw Error("Invalid settings.json: defaultTools must be an array of strings");return[...a.defaultTools]}}async function n(a,b){if(!(0,e.existsSync)(a))return b({});let c=await i().lock(a,{realpath:!1,retries:10});try{return b(l(a))}finally{await c()}}async function o(a,b){(0,e.mkdirSync)((0,f.dirname)(a),{recursive:!0});try{(0,e.writeFileSync)(a,"{}",{flag:"wx",mode:384})}catch(a){if("EEXIST"!==a.code)throw a}let c=await i().lock(a,{realpath:!1,retries:10});try{let c=l(a),d=b(c);return(0,e.writeFileSync)(a,JSON.stringify(c,null,2),"utf8"),(0,e.chmodSync)(a,384),d}finally{await c()}}g=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{"use strict";a.exports=require("assert")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},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")},32280:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>m,PUT:()=>n,dynamic:()=>o});var e=c(23211),f=c(41228),g=c(66544),h=c(305),i=a([f,h]);[f,h]=i.then?(await i)():i;let o="force-dynamic",p=["enabled","codemode","codemodeMode","codemodeInlineBudget"];function j(a,b,c){return e.NextResponse.json({error:c,reason:b},{status:a})}function k(a){return j(500,"internal",a instanceof Error?a.message:String(a))}async function l(){let a=await (0,h.dp)(),b=await (0,f.wS)(),{mode:c,inlineBudget:d}=await (0,f.yH)();return{isWindows:"win32"===process.platform,powerShellEnabled:a,codemode:b,codemodeMode:c,codemodeInlineBudget:d}}async function m(){try{return e.NextResponse.json(await l())}catch(a){return k(a)}}async function n(a){let b;if(!(0,g.EN)(a))return j(403,"request-denied","Untrusted API request");if(!(0,g.E2)(a))return j(415,"content-type","Content-Type must be application/json");try{b=await a.json()}catch{return j(400,"invalid-request","Invalid JSON body")}if("object"!=typeof b||null===b||Array.isArray(b))return j(400,"invalid-request","Expected a JSON object");let c=b;if(1!==p.filter(a=>a in c).length)return j(400,"invalid-request","Send one of enabled (PowerShell), codemode, codemodeMode or codemodeInlineBudget");if("codemodeMode"in c){if(!(0,f.yK)(c.codemodeMode))return j(400,"invalid-request",'codemodeMode must be "on" or "only"');try{return await (0,f.hy)(c.codemodeMode),e.NextResponse.json(await l())}catch(a){return k(a)}}if("codemodeInlineBudget"in c){let a=c.codemodeInlineBudget;if(null!==a&&!(0,f.Te)(a))return j(400,"invalid-request",`codemodeInlineBudget must be a whole number from 0 to ${f.mz}, or null`);try{return await (0,f.i7)(a??void 0),e.NextResponse.json(await l())}catch(a){return k(a)}}if("codemode"in c){if(!(0,f.cY)(c.codemode))return j(400,"invalid-request",'codemode must be "automatic" or "always"');try{return await (0,f.ZZ)(c.codemode),e.NextResponse.json(await l())}catch(a){return k(a)}}if("win32"!==process.platform)return j(404,"invalid-request","PowerShell tool settings are only available on Windows");if("boolean"!=typeof c.enabled)return j(400,"invalid-request","enabled must be a boolean");try{return await (0,h.Up)(c.enabled),e.NextResponse.json(await l())}catch(a){return k(a)}}d()}catch(a){d(a)}})},33873:a=>{"use strict";a.exports=require("path")},37431:(a,b,c)=>{"use strict";c.d(b,{T:()=>f,y:()=>g});var d=c(73024);let e=d.constants.O_RDONLY|(d.constants.O_NONBLOCK||0),f=1048576;function g(a,b){let c;try{c=(0,d.openSync)(a,e)}catch(b){let a;if("ENOENT"===(a=b?.code)||"ENOTDIR"===a)return;throw b}try{let e=(0,d.fstatSync)(c);if(!e.isFile())throw Error(`${a} is not a regular file`);if(void 0===b)return(0,d.readFileSync)(c,"utf8");if(e.size>b)throw Error(`${a} is larger than ${b} bytes`);let f=b+1,g=[],h=0;for(;h<f;){let a=Buffer.alloc(Math.min(f-h,65536)),b=(0,d.readSync)(c,a,0,a.length,null);if(0===b)break;g.push(a.subarray(0,b)),h+=b}if(h>b)throw Error(`${a} is larger than ${b} bytes`);return Buffer.concat(g,h).toString("utf8")}finally{(0,d.closeSync)(c)}}},43671:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});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(10246),u=c(37527);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/tools/settings/route",pathname:"/api/tools/settings",filename:"route",bundlePath:"app/api/tools/settings/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/Data Vault/PiSpace/pi-web/app/api/tools/settings/route.ts",nextConfigOutput:"",userland:()=>c(32280),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/tools/settings/route";"/index"===d&&(d="/");let{instrumentation:e}=await v.ensureInstrumentation(a,{deferSpans:!0});return v.traceRequest(a,{tracer:(0,h.getTracer)(),spanName:`${a.method||"GET"} ${d}`,httpTarget:a.url,instrumentation:e},(e,f)=>B(a,b,c,d,!1,e,f))}async function B(a,b,c,d,f,w,x){let y=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:f});if(!y)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:z,deploymentId:A,params:B,nextConfig:C,parsedUrl:D,isDraftMode:E,prerenderManifest:F,routerServerContext:G,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,resolvedPathname:J,clientReferenceManifest:K,serverActionsManifest:L,previewProps:M}=y,N=(0,j.normalizeAppPath)(d),O=!!F.routes[J]&&(v.isDev||(0,t.isRouteCacheOwner)(J,v.cacheOwner,F.routes[J])),P=!!(F.dynamicRoutes[N]||O),Q=async()=>((null==G?void 0:G.render404)?await G.render404(a,b,D,!1):b.end("This page could not be found"),null);if(P&&!E){let a=F.dynamicRoutes[N];if(a&&!1===a.fallback&&!O){if(C.adapterPath)return await Q();throw new s.NoFallbackError}}let R=null;!P||v.isDev||E||(R="/index"===(R=J)?"/":R),L&&K&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:K,serverActionsManifest:L});let S=a.method||"GET",T=(0,h.getTracer)(),U=!!(null==G?void 0:G.isWrappedByNextServer),V=!!(0,g.getRequestMeta)(a,"minimalMode"),W=(0,g.getRequestMeta)(a,"incrementalCache")||await v.getIncrementalCache(a,C,M,F,V);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let X={params:B,previewProps:M,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout,durableUseCacheEntries:!!C.experimental.durableUseCacheEntries},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,isDraftMode:E,incrementalCache:W,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0},sharedContext:{buildId:z,deploymentId:A}},Y=new k.NodeNextRequest(a),Z=new k.NodeNextResponse(b),$=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(b)),_=async({previousCacheEntry:e})=>{try{if(!V&&H&&I&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=null===R?await v.handle($,X):await v.prerender($,X);a.fetchMetrics=X.renderOpts.fetchMetrics;let f=X.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=X.renderOpts.collectedTags;if(!P)return await (0,o.I)(Y,Z,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!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,e=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?C.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:u.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 v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),b}},aa=async d=>{try{var f,g;let d=await v.handleResponse({req:a,nextConfig:C,cacheKey:R,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,previewProps:M,prerenderManifest:F,isRoutePPREnabled:!1,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,responseGenerator:_,waitUntil:c.waitUntil,isMinimalMode:V});if(null!==d&&"error"in d)throw d.error;if(!P)return;if((null==d||null==(f=d.value)?void 0:f.kind)!==u.CachedRouteKind.APP_ROUTE)throw Error(`Invariant: app-route received invalid cache entry ${null==d||null==(g=d.value)?void 0:g.kind}`);V||b.setHeader("x-nextjs-cache",H?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),E&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);V&&P||h.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(Y,Z,new Response(d.value.body,{headers:h,status:d.value.status||200}));return}catch(c){if(c instanceof s.NoFallbackError||await v.onRequestError(a,c,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),P)throw c;if(b.headersSent){if(d){let a=c instanceof Error?c:Error("Unknown app route error");d.recordException(a),d.setStatus({code:h.SpanStatusCode.ERROR,message:a.message}),d.setAttribute("error.type",a.name)}b.writableEnded||b.destroyed||b.end()}else await (0,o.I)(Y,Z,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=T.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")||N,f=`${S} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":f}),d.updateName(f),x&&x!==d&&(x.setAttribute("http.route",e),x.updateName(f))})()}};U||void 0===a.url||null==w||w.setAttribute("http.target",a.url),await aa(w)}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2970,1813,974,1207],()=>b(b.s=43671));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=7347,a.ids=[7347],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")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},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")},40829:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{uh:()=>t});var e=c(51455),f=c(40402),g=c(63563),h=a([f]);function i(){return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0,cost:0,messages:0,toolCalls:0,activeMs:0,hours:Array(24).fill(0),models:new Map,tools:new Map}}function j(){return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0,cost:0}}function k(a){return a<10?`0${a}`:String(a)}function l(a){let b=new Date(a);return`${b.getFullYear()}-${k(b.getMonth()+1)}-${k(b.getDate())}`}function m(a){let[b,c,d]=a.split("-").map(Number);return l(new Date(b,c-1,d+1).getTime())}function n(a){let[b,c,d]=a.split("-").map(Number);return l(new Date(b,c-1,d-1).getTime())}function o(a){return"number"==typeof a&&Number.isFinite(a)?a:0}function p(a,b){return"string"==typeof a&&a&&"string"==typeof b&&b?`${a}/${b}`:null}async function q(a){try{let b=await (0,e.stat)(a);return`${b.size}:${b.mtimeMs}`}catch{return null}}async function r(a){let b,c,d=await q(a.path);if(null===d)return null;try{b=await (0,e.readFile)(a.path,"utf8")}catch{return null}let f=await q(a.path),g=b.indexOf("\n"),h=-1===g?b:b.slice(0,g);try{c=JSON.parse(h)}catch{return null}let k=function(a,b){let c;if("object"!=typeof a||null===a||"session"!==a.type||"string"!=typeof a.timestamp)return null;let d=a.timestamp,e=new Map,f=null,g=function(a){for(let b of a)if(b)try{let a=JSON.parse(b);if("object"==typeof a&&null!==a&&"model_change"===a.type)return p(a.provider,a.modelId)}catch{continue}return null}(b);for(let a of b){var h;let b,k;if(!a)continue;try{let c=JSON.parse(a);if("object"!=typeof c||null===c)continue;b=c}catch{continue}let m=b.timestamp;if("string"!=typeof m)continue;let n=Date.parse(m);if(!Number.isFinite(n)||m<d)continue;if("model_change"===b.type){f=p(b.provider,b.modelId);continue}let q="message"===b.type&&"object"==typeof b.message&&null!==b.message?b.message:void 0;k="usage"===b.type?p(b.provider,b.model)??f??g??"unknown":q?.role==="assistant"?p(q.provider,q.model)??f??g??"unknown":f??g??"unknown";let r=function(a){let b="message"===a.type?a.message?.usage:a.usage;return"object"==typeof b&&null!==b?b:void 0}(b),s=l(n);if(r){let a=e.get(s)??(e.set(s,i()),e.get(s));!function(a,b){let c=o(b.input),d=o(b.output),e=o(b.cacheRead),f=o(b.cacheWrite),g=o(b.cost?.total);a.input+=c,a.output+=d,a.cacheRead+=e,a.cacheWrite+=f,a.total+=c+d+e+f,a.cost+=g}(a,r),a.hours[new Date(n).getHours()]+=o(r.input)+o(r.output)+o(r.cacheRead)+o(r.cacheWrite),function(a,b,c){let d=a.get(b)??j();d.input+=o(c.input),d.output+=o(c.output),d.cacheRead+=o(c.cacheRead),d.cacheWrite+=o(c.cacheWrite),d.total+=o(c.input)+o(c.output)+o(c.cacheRead)+o(c.cacheWrite),d.cost+=o(c.cost?.total),a.set(b,d)}(a.models,k,r)}if("message"===b.type&&q){let a=e.get(s)??(e.set(s,i()),e.get(s));if(a.messages+=1,"assistant"===q.role&&Array.isArray(q.content))for(let b of q.content){if("object"!=typeof b||null===b||"toolCall"!==b.type)continue;a.toolCalls+=1;let c="string"==typeof b.toolName&&b.toolName?b.toolName:"string"==typeof b.name?b.name:"";c&&a.tools.set(c,(a.tools.get(c)??0)+1)}}if("message"===(h=b.type)||"compaction"===h||"branch_summary"===h||"custom_message"===h){let a="message"===b.type?q?.role:void 0;if("user"===a||"bashExecution"===a)c=n;else{if(void 0!==c&&n>c){let a=e.get(s)??(e.set(s,i()),e.get(s));a.activeMs+=n-c}c=n}}}return{sessionId:"string"==typeof a.id?a.id:"",cwd:"string"==typeof a.cwd?a.cwd:null,isSubagent:"string"==typeof a.parentSession&&""!==a.parentSession,sessionActiveMs:[...e.values()].reduce((a,b)=>a+b.activeMs,0),days:e}}(c,(-1===g?"":b.slice(g+1)).split("\n"));return k?{fingerprint:null!==f&&f===d?d:`${d}:unstable`,sessionId:k.sessionId||a.id,cwd:k.cwd??a.cwd,sessionActiveMs:k.sessionActiveMs,days:k.days}:null}async function s(a){let b=globalThis.__piUsageFileCache??=new Map,c=await (0,f.dQ)({force:a}),d=new Set,e=[],g=0;for(let a of c){d.add(a.path);let c=b.get(a.path);if(c){let d=await q(a.path);if(null!==d&&d===c.fingerprint){g+=1;continue}b.delete(a.path)}e.push(a)}for(let a of[...b.keys()])d.has(a)||b.delete(a);let h=0;for(let a of e){let c=await r(a);c&&(h+=1,b.set(a.path,c))}return{cache:b,meta:{files:c.length,skipped:c.length-g-h}}}async function t(a={}){let b,c=(0,g.Y)(a.range)?a.range:"all",d=!0===a.force,e={files:0,skipped:0};if(!d&&globalThis.__piUsageFilesPromise){let a=await globalThis.__piUsageFilesPromise;b=a.cache,e=a.meta}else{let a=s(d);globalThis.__piUsageFilesPromise=a;let c=()=>{globalThis.__piUsageFilesPromise===a&&(globalThis.__piUsageFilesPromise=void 0)};a.then(c,c);try{let c=await a;b=c.cache,e=c.meta}finally{c()}}return function(a,b,c,d=new Date){let e=l(d.getTime()),f=null;if("all"!==b){let[a,c,d]=e.split("-").map(Number);f=l(new Date(a,c-1,d-(b-1)).getTime())}let g=new Map,h=new Set,k=new Set,o=new Map,p=new Map,q=new Map;for(let b of a)for(let[a,c]of b.days){if(null!==f&&a<f)continue;let d=g.get(a)??(g.set(a,i()),g.get(a));d.input+=c.input,d.output+=c.output,d.cacheRead+=c.cacheRead,d.cacheWrite+=c.cacheWrite,d.total+=c.total,d.cost+=c.cost,d.messages+=c.messages,d.toolCalls+=c.toolCalls,d.activeMs+=c.activeMs;for(let a=0;a<24;a++)d.hours[a]+=c.hours[a];for(let[a,b]of c.models){let c=d.models.get(a)??j();c.input+=b.input,c.output+=b.output,c.cacheRead+=b.cacheRead,c.cacheWrite+=b.cacheWrite,c.total+=b.total,c.cost+=b.cost,d.models.set(a,c);let e=p.get(a)??{model:a,input:0,output:0,cacheRead:0,cacheWrite:0,total:0,cost:0,share:0};e.input+=b.input,e.output+=b.output,e.cacheRead+=b.cacheRead,e.cacheWrite+=b.cacheWrite,e.total+=b.total,e.cost+=b.cost,p.set(a,e)}for(let[a,b]of c.tools)q.set(a,(q.get(a)??0)+b);if((c.messages>0||c.total>0)&&(h.add(a),k.add(b.sessionId),null!==b.cwd)){let a=o.get(b.cwd)??{total:0,cost:0,sessions:new Set};a.total+=c.total,a.cost+=c.cost,a.sessions.add(b.sessionId),o.set(b.cwd,a)}}let r={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},s=0,t=0,u=0,v=Array(24).fill(0);for(let a of g.values()){r.input+=a.input,r.output+=a.output,r.cacheRead+=a.cacheRead,r.cacheWrite+=a.cacheWrite,r.total+=a.total,s+=a.cost,t+=a.messages,u+=a.activeMs;for(let b=0;b<24;b++)v[b]+=a.hours[b]}r.total=r.input+r.output+r.cacheRead+r.cacheWrite;let w=[...p.values()].sort((a,b)=>b.total-a.total||a.model.localeCompare(b.model));for(let a of w)a.share=r.total>0?a.total/r.total:0;let x=new Set(w.slice(0,6).map(a=>a.model)),y=[...q.entries()].map(([a,b])=>({name:a,count:b})).sort((a,b)=>b.count-a.count||a.name.localeCompare(b.name)),z=[...o.entries()].map(([a,b])=>({cwd:a,total:b.total,cost:b.cost,sessions:b.sessions.size})).sort((a,b)=>b.total-a.total||a.cwd.localeCompare(b.cwd)),A=[...g.keys()].sort(),B=f??A[0]??e,C=[];for(let a=B;a<=e;a=m(a)){let b=g.get(a),c={};if(b)for(let[a,d]of b.models)x.has(a)&&(c[a]=(c[a]??0)+d.total);C.push({date:a,input:b?.input??0,output:b?.output??0,cacheRead:b?.cacheRead??0,cacheWrite:b?.cacheWrite??0,total:b?.total??0,cost:b?.cost??0,messages:b?.messages??0,models:c})}let D=C.reduce((a,b)=>Math.max(a,b.total),0),E=a.reduce((a,b)=>Math.max(a,b.sessionActiveMs??0),0),F=r.cacheRead+r.input,G=null,H=0;for(let a=0;a<24;a++)v[a]>H&&(H=v[a],G=a);let{current:I,longest:J}=function(a,b){if(0===a.size)return{current:0,longest:0};let c=[...a].sort(),d=1,e=1;for(let a=1;a<c.length;a++)(e=m(c[a-1])===c[a]?e+1:1)>d&&(d=e);let f=b;a.has(f)||(f=n(f));let g=0;for(;a.has(f);)g+=1,f=n(f);return{current:g,longest:d}}(h,e);return{generatedAt:d.toISOString(),range:{days:"all"===b?null:b,from:A.length>0?B:null,to:e},meta:c,overview:{tokens:r,cost:s,sessions:k.size,messages:t,activeDays:h.size,peakDayTokens:D,longestSessionActiveMs:E,topModel:w[0]?{model:w[0].model,share:w[0].share}:null,totalActiveMs:u},activity:{currentStreakDays:I,longestStreakDays:J,cacheHitRate:F>0?r.cacheRead/F:null,peakHour:G},daily:C,models:w.slice(0,10),tools:y.slice(0,10),projects:z.slice(0,8)}}([...b.values()].map(a=>({sessionId:a.sessionId,cwd:a.cwd,sessionActiveMs:a.sessionActiveMs,days:a.days})),c,e,new Date)}f=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},50842:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>j,dynamic:()=>k});var e=c(23211),f=c(66544),g=c(40829),h=c(63563),i=a([g]);g=(i.then?(await i)():i)[0];let k="force-dynamic",l={"Cache-Control":"no-store"};async function j(a){if(!(0,f.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403,headers:l});let b=new URL(a.url).searchParams,c=b.get("range")??"all",d="7"===c?7:"30"===c?30:"90"===c?90:"all"===c?"all":void 0;if(void 0===d||!(0,h.Y)(d))return e.NextResponse.json({error:"range must be 7, 30, 90 or all"},{status:400,headers:l});let i="1"===b.get("force");try{let a=await (0,g.uh)({range:d,force:i});return e.NextResponse.json(a,{headers:l})}catch{return e.NextResponse.json({error:"Failed to aggregate usage"},{status:500,headers:l})}}d()}catch(a){d(a)}})},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63563:(a,b,c)=>{c.d(b,{Y:()=>d});function d(a){return 7===a||30===a||90===a||"all"===a}},66544:(a,b,c)=>{c.d(b,{E2:()=>k,EN:()=>j});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(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;let c=e(b.hostname);return b.port?`${c}:${b.port}`:c}catch{return null}}function h(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function i(a){try{return new URL(a).origin}catch{return null}}function j(a,b=h()){return!!function(a,b=h()){let c=a.headers.get("host"),g=c?f(c):null;return!!g&&(!!("localhost"===g||g.endsWith(".localhost")||(0,d.isIP)(g))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===g}))}(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{let b=new URL(a.url);return/^\/api\/sessions\/[^/]+\/export$/.test(b.pathname)||function(a){if(!a.pathname.startsWith("/api/files/")||"read"!==a.searchParams.get("type"))return!1;let b=a.pathname.slice(a.pathname.lastIndexOf("/")+1);try{return decodeURIComponent(b).toLowerCase().endsWith(".pdf")}catch{return!1}}(b)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d,e=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!e)return!0;let f=(b=new URL(a.url),(c=a.headers.get("host"))?i(`${b.protocol}//${c}`):null);if(null!==f&&i(e)===f)return!0;if("same-origin"!==a.headers.get("sec-fetch-site")||!a.headers.get("x-forwarded-proto"))return!1;let h=a.headers.get("host");if(!h)return!1;try{d=new URL(e).host}catch{return!1}let j=g(d);return null!==j&&j===g(h)}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},67727:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});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(10246),u=c(37527);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/usage/route",pathname:"/api/usage",filename:"route",bundlePath:"app/api/usage/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/Data Vault/PiSpace/pi-web/app/api/usage/route.ts",nextConfigOutput:"",userland:()=>c(50842),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/usage/route";"/index"===d&&(d="/");let{instrumentation:e}=await v.ensureInstrumentation(a,{deferSpans:!0});return v.traceRequest(a,{tracer:(0,h.getTracer)(),spanName:`${a.method||"GET"} ${d}`,httpTarget:a.url,instrumentation:e},(e,f)=>B(a,b,c,d,!1,e,f))}async function B(a,b,c,d,f,w,x){let y=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:f});if(!y)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:z,deploymentId:A,params:B,nextConfig:C,parsedUrl:D,isDraftMode:E,prerenderManifest:F,routerServerContext:G,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,resolvedPathname:J,clientReferenceManifest:K,serverActionsManifest:L,previewProps:M}=y,N=(0,j.normalizeAppPath)(d),O=!!F.routes[J]&&(v.isDev||(0,t.isRouteCacheOwner)(J,v.cacheOwner,F.routes[J])),P=!!(F.dynamicRoutes[N]||O),Q=async()=>((null==G?void 0:G.render404)?await G.render404(a,b,D,!1):b.end("This page could not be found"),null);if(P&&!E){let a=F.dynamicRoutes[N];if(a&&!1===a.fallback&&!O){if(C.adapterPath)return await Q();throw new s.NoFallbackError}}let R=null;!P||v.isDev||E||(R="/index"===(R=J)?"/":R),L&&K&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:K,serverActionsManifest:L});let S=a.method||"GET",T=(0,h.getTracer)(),U=!!(null==G?void 0:G.isWrappedByNextServer),V=!!(0,g.getRequestMeta)(a,"minimalMode"),W=(0,g.getRequestMeta)(a,"incrementalCache")||await v.getIncrementalCache(a,C,M,F,V);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let X={params:B,previewProps:M,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout,durableUseCacheEntries:!!C.experimental.durableUseCacheEntries},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,isDraftMode:E,incrementalCache:W,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0},sharedContext:{buildId:z,deploymentId:A}},Y=new k.NodeNextRequest(a),Z=new k.NodeNextResponse(b),$=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(b)),_=async({previousCacheEntry:e})=>{try{if(!V&&H&&I&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=null===R?await v.handle($,X):await v.prerender($,X);a.fetchMetrics=X.renderOpts.fetchMetrics;let f=X.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=X.renderOpts.collectedTags;if(!P)return await (0,o.I)(Y,Z,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!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,e=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?C.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:u.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 v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),b}},aa=async d=>{try{var f,g;let d=await v.handleResponse({req:a,nextConfig:C,cacheKey:R,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,previewProps:M,prerenderManifest:F,isRoutePPREnabled:!1,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,responseGenerator:_,waitUntil:c.waitUntil,isMinimalMode:V});if(null!==d&&"error"in d)throw d.error;if(!P)return;if((null==d||null==(f=d.value)?void 0:f.kind)!==u.CachedRouteKind.APP_ROUTE)throw Error(`Invariant: app-route received invalid cache entry ${null==d||null==(g=d.value)?void 0:g.kind}`);V||b.setHeader("x-nextjs-cache",H?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),E&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);V&&P||h.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(Y,Z,new Response(d.value.body,{headers:h,status:d.value.status||200}));return}catch(c){if(c instanceof s.NoFallbackError||await v.onRequestError(a,c,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),P)throw c;if(b.headersSent){if(d){let a=c instanceof Error?c:Error("Unknown app route error");d.recordException(a),d.setStatus({code:h.SpanStatusCode.ERROR,message:a.message}),d.setAttribute("error.type",a.name)}b.writableEnded||b.destroyed||b.end()}else await (0,o.I)(Y,Z,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=T.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")||N,f=`${S} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":f}),d.updateName(f),x&&x!==d&&(x.setAttribute("http.route",e),x.updateName(f))})()}};U||void 0===a.url||null==w||w.setAttribute("http.target",a.url),await aa(w)}},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},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,[2970,1813,426,5582],()=>b(b.s=67727));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=7347,a.ids=[7347],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")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},27319:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});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(10246),u=c(37527);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/usage/route",pathname:"/api/usage",filename:"route",bundlePath:"app/api/usage/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/Data Vault/PiSpace/pi-web/app/api/usage/route.ts",nextConfigOutput:"",userland:()=>c(50842),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/usage/route";"/index"===d&&(d="/");let{instrumentation:e}=await v.ensureInstrumentation(a,{deferSpans:!0});return v.traceRequest(a,{tracer:(0,h.getTracer)(),spanName:`${a.method||"GET"} ${d}`,httpTarget:a.url,instrumentation:e},(e,f)=>B(a,b,c,d,!1,e,f))}async function B(a,b,c,d,f,w,x){let y=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:f});if(!y)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:z,deploymentId:A,params:B,nextConfig:C,parsedUrl:D,isDraftMode:E,prerenderManifest:F,routerServerContext:G,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,resolvedPathname:J,clientReferenceManifest:K,serverActionsManifest:L,previewProps:M}=y,N=(0,j.normalizeAppPath)(d),O=!!F.routes[J]&&(v.isDev||(0,t.isRouteCacheOwner)(J,v.cacheOwner,F.routes[J])),P=!!(F.dynamicRoutes[N]||O),Q=async()=>((null==G?void 0:G.render404)?await G.render404(a,b,D,!1):b.end("This page could not be found"),null);if(P&&!E){let a=F.dynamicRoutes[N];if(a&&!1===a.fallback&&!O){if(C.adapterPath)return await Q();throw new s.NoFallbackError}}let R=null;!P||v.isDev||E||(R="/index"===(R=J)?"/":R),L&&K&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:K,serverActionsManifest:L});let S=a.method||"GET",T=(0,h.getTracer)(),U=!!(null==G?void 0:G.isWrappedByNextServer),V=!!(0,g.getRequestMeta)(a,"minimalMode"),W=(0,g.getRequestMeta)(a,"incrementalCache")||await v.getIncrementalCache(a,C,M,F,V);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let X={params:B,previewProps:M,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout,durableUseCacheEntries:!!C.experimental.durableUseCacheEntries},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,isDraftMode:E,incrementalCache:W,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0},sharedContext:{buildId:z,deploymentId:A}},Y=new k.NodeNextRequest(a),Z=new k.NodeNextResponse(b),$=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(b)),_=async({previousCacheEntry:e})=>{try{if(!V&&H&&I&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=null===R?await v.handle($,X):await v.prerender($,X);a.fetchMetrics=X.renderOpts.fetchMetrics;let f=X.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=X.renderOpts.collectedTags;if(!P)return await (0,o.I)(Y,Z,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!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,e=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?C.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:u.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 v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),b}},aa=async d=>{try{var f,g;let d=await v.handleResponse({req:a,nextConfig:C,cacheKey:R,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,previewProps:M,prerenderManifest:F,isRoutePPREnabled:!1,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,responseGenerator:_,waitUntil:c.waitUntil,isMinimalMode:V});if(null!==d&&"error"in d)throw d.error;if(!P)return;if((null==d||null==(f=d.value)?void 0:f.kind)!==u.CachedRouteKind.APP_ROUTE)throw Error(`Invariant: app-route received invalid cache entry ${null==d||null==(g=d.value)?void 0:g.kind}`);V||b.setHeader("x-nextjs-cache",H?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),E&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);V&&P||h.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(Y,Z,new Response(d.value.body,{headers:h,status:d.value.status||200}));return}catch(c){if(c instanceof s.NoFallbackError||await v.onRequestError(a,c,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),P)throw c;if(b.headersSent){if(d){let a=c instanceof Error?c:Error("Unknown app route error");d.recordException(a),d.setStatus({code:h.SpanStatusCode.ERROR,message:a.message}),d.setAttribute("error.type",a.name)}b.writableEnded||b.destroyed||b.end()}else await (0,o.I)(Y,Z,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=T.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")||N,f=`${S} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":f}),d.updateName(f),x&&x!==d&&(x.setAttribute("http.route",e),x.updateName(f))})()}};U||void 0===a.url||null==w||w.setAttribute("http.target",a.url),await aa(w)}},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},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")},40829:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{uh:()=>t});var e=c(51455),f=c(40402),g=c(63563),h=a([f]);function i(){return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0,cost:0,messages:0,toolCalls:0,activeMs:0,hours:Array(24).fill(0),models:new Map,tools:new Map}}function j(){return{input:0,output:0,cacheRead:0,cacheWrite:0,total:0,cost:0}}function k(a){return a<10?`0${a}`:String(a)}function l(a){let b=new Date(a);return`${b.getFullYear()}-${k(b.getMonth()+1)}-${k(b.getDate())}`}function m(a){let[b,c,d]=a.split("-").map(Number);return l(new Date(b,c-1,d+1).getTime())}function n(a){let[b,c,d]=a.split("-").map(Number);return l(new Date(b,c-1,d-1).getTime())}function o(a){return"number"==typeof a&&Number.isFinite(a)?a:0}function p(a,b){return"string"==typeof a&&a&&"string"==typeof b&&b?`${a}/${b}`:null}async function q(a){try{let b=await (0,e.stat)(a);return`${b.size}:${b.mtimeMs}`}catch{return null}}async function r(a){let b,c,d=await q(a.path);if(null===d)return null;try{b=await (0,e.readFile)(a.path,"utf8")}catch{return null}let f=await q(a.path),g=b.indexOf("\n"),h=-1===g?b:b.slice(0,g);try{c=JSON.parse(h)}catch{return null}let k=function(a,b){let c;if("object"!=typeof a||null===a||"session"!==a.type||"string"!=typeof a.timestamp)return null;let d=a.timestamp,e=new Map,f=null,g=function(a){for(let b of a)if(b)try{let a=JSON.parse(b);if("object"==typeof a&&null!==a&&"model_change"===a.type)return p(a.provider,a.modelId)}catch{continue}return null}(b);for(let a of b){var h;let b,k;if(!a)continue;try{let c=JSON.parse(a);if("object"!=typeof c||null===c)continue;b=c}catch{continue}let m=b.timestamp;if("string"!=typeof m)continue;let n=Date.parse(m);if(!Number.isFinite(n)||m<d)continue;if("model_change"===b.type){f=p(b.provider,b.modelId);continue}let q="message"===b.type&&"object"==typeof b.message&&null!==b.message?b.message:void 0;k="usage"===b.type?p(b.provider,b.model)??f??g??"unknown":q?.role==="assistant"?p(q.provider,q.model)??f??g??"unknown":f??g??"unknown";let r=function(a){let b="message"===a.type?a.message?.usage:a.usage;return"object"==typeof b&&null!==b?b:void 0}(b),s=l(n);if(r){let a=e.get(s)??(e.set(s,i()),e.get(s));!function(a,b){let c=o(b.input),d=o(b.output),e=o(b.cacheRead),f=o(b.cacheWrite),g=o(b.cost?.total);a.input+=c,a.output+=d,a.cacheRead+=e,a.cacheWrite+=f,a.total+=c+d+e+f,a.cost+=g}(a,r),a.hours[new Date(n).getHours()]+=o(r.input)+o(r.output)+o(r.cacheRead)+o(r.cacheWrite),function(a,b,c){let d=a.get(b)??j();d.input+=o(c.input),d.output+=o(c.output),d.cacheRead+=o(c.cacheRead),d.cacheWrite+=o(c.cacheWrite),d.total+=o(c.input)+o(c.output)+o(c.cacheRead)+o(c.cacheWrite),d.cost+=o(c.cost?.total),a.set(b,d)}(a.models,k,r)}if("message"===b.type&&q){let a=e.get(s)??(e.set(s,i()),e.get(s));if(a.messages+=1,"assistant"===q.role&&Array.isArray(q.content))for(let b of q.content){if("object"!=typeof b||null===b||"toolCall"!==b.type)continue;a.toolCalls+=1;let c="string"==typeof b.toolName&&b.toolName?b.toolName:"string"==typeof b.name?b.name:"";c&&a.tools.set(c,(a.tools.get(c)??0)+1)}}if("message"===(h=b.type)||"compaction"===h||"branch_summary"===h||"custom_message"===h){let a="message"===b.type?q?.role:void 0;if("user"===a||"bashExecution"===a)c=n;else{if(void 0!==c&&n>c){let a=e.get(s)??(e.set(s,i()),e.get(s));a.activeMs+=n-c}c=n}}}return{sessionId:"string"==typeof a.id?a.id:"",cwd:"string"==typeof a.cwd?a.cwd:null,isSubagent:"string"==typeof a.parentSession&&""!==a.parentSession,sessionActiveMs:[...e.values()].reduce((a,b)=>a+b.activeMs,0),days:e}}(c,(-1===g?"":b.slice(g+1)).split("\n"));return k?{fingerprint:null!==f&&f===d?d:`${d}:unstable`,sessionId:k.sessionId||a.id,cwd:k.cwd??a.cwd,sessionActiveMs:k.sessionActiveMs,days:k.days}:null}async function s(a){let b=globalThis.__piUsageFileCache??=new Map,c=await (0,f.dQ)({force:a}),d=new Set,e=[],g=0;for(let a of c){d.add(a.path);let c=b.get(a.path);if(c){let d=await q(a.path);if(null!==d&&d===c.fingerprint){g+=1;continue}b.delete(a.path)}e.push(a)}for(let a of[...b.keys()])d.has(a)||b.delete(a);let h=0;for(let a of e){let c=await r(a);c&&(h+=1,b.set(a.path,c))}return{cache:b,meta:{files:c.length,skipped:c.length-g-h}}}async function t(a={}){let b,c=(0,g.Y)(a.range)?a.range:"all",d=!0===a.force,e={files:0,skipped:0};if(!d&&globalThis.__piUsageFilesPromise){let a=await globalThis.__piUsageFilesPromise;b=a.cache,e=a.meta}else{let a=s(d);globalThis.__piUsageFilesPromise=a;let c=()=>{globalThis.__piUsageFilesPromise===a&&(globalThis.__piUsageFilesPromise=void 0)};a.then(c,c);try{let c=await a;b=c.cache,e=c.meta}finally{c()}}return function(a,b,c,d=new Date){let e=l(d.getTime()),f=null;if("all"!==b){let[a,c,d]=e.split("-").map(Number);f=l(new Date(a,c-1,d-(b-1)).getTime())}let g=new Map,h=new Set,k=new Set,o=new Map,p=new Map,q=new Map;for(let b of a)for(let[a,c]of b.days){if(null!==f&&a<f)continue;let d=g.get(a)??(g.set(a,i()),g.get(a));d.input+=c.input,d.output+=c.output,d.cacheRead+=c.cacheRead,d.cacheWrite+=c.cacheWrite,d.total+=c.total,d.cost+=c.cost,d.messages+=c.messages,d.toolCalls+=c.toolCalls,d.activeMs+=c.activeMs;for(let a=0;a<24;a++)d.hours[a]+=c.hours[a];for(let[a,b]of c.models){let c=d.models.get(a)??j();c.input+=b.input,c.output+=b.output,c.cacheRead+=b.cacheRead,c.cacheWrite+=b.cacheWrite,c.total+=b.total,c.cost+=b.cost,d.models.set(a,c);let e=p.get(a)??{model:a,input:0,output:0,cacheRead:0,cacheWrite:0,total:0,cost:0,share:0};e.input+=b.input,e.output+=b.output,e.cacheRead+=b.cacheRead,e.cacheWrite+=b.cacheWrite,e.total+=b.total,e.cost+=b.cost,p.set(a,e)}for(let[a,b]of c.tools)q.set(a,(q.get(a)??0)+b);if((c.messages>0||c.total>0)&&(h.add(a),k.add(b.sessionId),null!==b.cwd)){let a=o.get(b.cwd)??{total:0,cost:0,sessions:new Set};a.total+=c.total,a.cost+=c.cost,a.sessions.add(b.sessionId),o.set(b.cwd,a)}}let r={input:0,output:0,cacheRead:0,cacheWrite:0,total:0},s=0,t=0,u=0,v=Array(24).fill(0);for(let a of g.values()){r.input+=a.input,r.output+=a.output,r.cacheRead+=a.cacheRead,r.cacheWrite+=a.cacheWrite,r.total+=a.total,s+=a.cost,t+=a.messages,u+=a.activeMs;for(let b=0;b<24;b++)v[b]+=a.hours[b]}r.total=r.input+r.output+r.cacheRead+r.cacheWrite;let w=[...p.values()].sort((a,b)=>b.total-a.total||a.model.localeCompare(b.model));for(let a of w)a.share=r.total>0?a.total/r.total:0;let x=new Set(w.slice(0,6).map(a=>a.model)),y=[...q.entries()].map(([a,b])=>({name:a,count:b})).sort((a,b)=>b.count-a.count||a.name.localeCompare(b.name)),z=[...o.entries()].map(([a,b])=>({cwd:a,total:b.total,cost:b.cost,sessions:b.sessions.size})).sort((a,b)=>b.total-a.total||a.cwd.localeCompare(b.cwd)),A=[...g.keys()].sort(),B=f??A[0]??e,C=[];for(let a=B;a<=e;a=m(a)){let b=g.get(a),c={};if(b)for(let[a,d]of b.models)x.has(a)&&(c[a]=(c[a]??0)+d.total);C.push({date:a,input:b?.input??0,output:b?.output??0,cacheRead:b?.cacheRead??0,cacheWrite:b?.cacheWrite??0,total:b?.total??0,cost:b?.cost??0,messages:b?.messages??0,models:c})}let D=C.reduce((a,b)=>Math.max(a,b.total),0),E=a.reduce((a,b)=>Math.max(a,b.sessionActiveMs??0),0),F=r.cacheRead+r.input,G=null,H=0;for(let a=0;a<24;a++)v[a]>H&&(H=v[a],G=a);let{current:I,longest:J}=function(a,b){if(0===a.size)return{current:0,longest:0};let c=[...a].sort(),d=1,e=1;for(let a=1;a<c.length;a++)(e=m(c[a-1])===c[a]?e+1:1)>d&&(d=e);let f=b;a.has(f)||(f=n(f));let g=0;for(;a.has(f);)g+=1,f=n(f);return{current:g,longest:d}}(h,e);return{generatedAt:d.toISOString(),range:{days:"all"===b?null:b,from:A.length>0?B:null,to:e},meta:c,overview:{tokens:r,cost:s,sessions:k.size,messages:t,activeDays:h.size,peakDayTokens:D,longestSessionActiveMs:E,topModel:w[0]?{model:w[0].model,share:w[0].share}:null,totalActiveMs:u},activity:{currentStreakDays:I,longestStreakDays:J,cacheHitRate:F>0?r.cacheRead/F:null,peakHour:G},daily:C,models:w.slice(0,10),tools:y.slice(0,10),projects:z.slice(0,8)}}([...b.values()].map(a=>({sessionId:a.sessionId,cwd:a.cwd,sessionActiveMs:a.sessionActiveMs,days:a.days})),c,e,new Date)}f=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},50842:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>j,dynamic:()=>k});var e=c(23211),f=c(66544),g=c(40829),h=c(63563),i=a([g]);g=(i.then?(await i)():i)[0];let k="force-dynamic",l={"Cache-Control":"no-store"};async function j(a){if(!(0,f.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403,headers:l});let b=new URL(a.url).searchParams,c=b.get("range")??"all",d="7"===c?7:"30"===c?30:"90"===c?90:"all"===c?"all":void 0;if(void 0===d||!(0,h.Y)(d))return e.NextResponse.json({error:"range must be 7, 30, 90 or all"},{status:400,headers:l});let i="1"===b.get("force");try{let a=await (0,g.uh)({range:d,force:i});return e.NextResponse.json(a,{headers:l})}catch{return e.NextResponse.json({error:"Failed to aggregate usage"},{status:500,headers:l})}}d()}catch(a){d(a)}})},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63563:(a,b,c)=>{c.d(b,{Y:()=>d});function d(a){return 7===a||30===a||90===a||"all"===a}},66544:(a,b,c)=>{c.d(b,{E2:()=>k,EN:()=>j});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(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;let c=e(b.hostname);return b.port?`${c}:${b.port}`:c}catch{return null}}function h(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function i(a){try{return new URL(a).origin}catch{return null}}function j(a,b=h()){return!!function(a,b=h()){let c=a.headers.get("host"),g=c?f(c):null;return!!g&&(!!("localhost"===g||g.endsWith(".localhost")||(0,d.isIP)(g))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===g}))}(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{let b=new URL(a.url);return/^\/api\/sessions\/[^/]+\/export$/.test(b.pathname)||function(a){if(!a.pathname.startsWith("/api/files/")||"read"!==a.searchParams.get("type"))return!1;let b=a.pathname.slice(a.pathname.lastIndexOf("/")+1);try{return decodeURIComponent(b).toLowerCase().endsWith(".pdf")}catch{return!1}}(b)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d,e=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!e)return!0;let f=(b=new URL(a.url),(c=a.headers.get("host"))?i(`${b.protocol}//${c}`):null);if(null!==f&&i(e)===f)return!0;if("same-origin"!==a.headers.get("sec-fetch-site")||!a.headers.get("x-forwarded-proto"))return!1;let h=a.headers.get("host");if(!h)return!1;try{d=new URL(e).host}catch{return!1}let j=g(d);return null!==j&&j===g(h)}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},77598:a=>{a.exports=require("node:crypto")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},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,[2970,1813,426,5582],()=>b(b.s=27319));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=6031,a.ids=[6031],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")},10446:(a,b,c)=>{"use strict";c.r(b),c.d(b,{DELETE:()=>u,GET:()=>s,POST:()=>t,dynamic:()=>q});var d=c(23211);function e(){return{failures:0,lastFailureAt:0,blockedUntil:0}}function f(){var a;let b=globalThis,c=Symbol.for("pi-web:auth-throttle"),d=b[c];if("object"==typeof(a=d)&&null!==a&&"number"==typeof a.failures&&"number"==typeof a.lastFailureAt&&"number"==typeof a.blockedUntil)return d;let f=e();return b[c]=f,f}function g(a,b){a.failures>0&&b-a.lastFailureAt>=3e5&&Object.assign(a,e())}function h(a){return Math.max(1,Math.ceil(a/1e3))}var i=c(66544),j=c(77598);let k="pi_web_session";function l(a){return(0,j.createHash)("sha256").update(a,"utf8").digest()}function m(a,b){return(0,j.timingSafeEqual)(l(a),l(b))}function n(a=process.env.PI_WEB_PASSWORD){return"string"==typeof a&&a.length>0}function o(a,b=process.env.PI_WEB_PASSWORD){return n(b)&&m(a,b)}function p(a,b){return(0,j.createHmac)("sha256",b).update(`pi-web-session:${a}`,"utf8").digest("hex")}let q="force-dynamic";function r(a){return"https:"===new URL(a.url).protocol||a.headers.get("x-forwarded-proto")?.split(",",1)[0]?.trim()==="https"}async function s(a){if(!(0,i.EN)(a))return d.NextResponse.json({error:"Untrusted API request"},{status:403});let b=process.env.PI_WEB_PASSWORD,c=n(b),e=!c||function(a,b=process.env.PI_WEB_PASSWORD){let c;if(!n(b)||!a)return!1;let d=/^Basic\s+(\S+)$/i.exec(a);if(!d)return!1;try{let a=Buffer.from(d[1],"base64");if(a.toString("base64")!==d[1])return!1;c=new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{return!1}let e=c.indexOf(":");if(-1===e)return!1;let f=c.slice(0,e),g=c.slice(e+1),h=m(f,"pi"),i=o(g,b);return h&&i}(a.headers.get("authorization"),b)||function(a,b=process.env.PI_WEB_PASSWORD,c=Date.now()){if(!a||!n(b))return!1;let d=/^(v1\.(\d+)\.[a-f0-9]{32})\.([a-f0-9]{64})$/.exec(a);if(!d)return!1;let e=Number(d[2]);return!(!Number.isSafeInteger(e)||e<=Math.floor(c/1e3))&&m(d[3],p(d[1],b))}(a.cookies.get(k)?.value,b);return d.NextResponse.json({enabled:c,authenticated:e},{headers:{"Cache-Control":"no-store"}})}async function t(a){if(!(0,i.EN)(a))return d.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,i.E2)(a))return d.NextResponse.json({error:"Content-Type must be application/json"},{status:415});let b=process.env.PI_WEB_PASSWORD;if(!n(b))return d.NextResponse.json({error:"Password authentication is disabled"},{status:404});let c=function(a=Date.now(),b=f()){return g(b,a),Math.max(0,b.blockedUntil-a)}();if(c>0)return d.NextResponse.json({error:"Too many failed attempts",retryAfterMs:c},{status:429,headers:{"Cache-Control":"no-store","Retry-After":String(h(c))}});let l=await a.json().catch(()=>null);if(!l||"string"!=typeof l.password||!o(l.password,b)){let a=function(a=Date.now(),b=f()){g(b,a),b.failures+=1,b.lastFailureAt=a;let c=function(a){if(a<=0)return 0;let b=Math.min(a-1,31);return Math.min(1e3*2**b,6e4)}(b.failures);return b.blockedUntil=a+c,c}();return console.warn(`[web-auth] Password authentication failed; next attempt blocked for ${a}ms`),d.NextResponse.json({error:"Invalid password",retryAfterMs:a},{status:401,headers:{"Retry-After":String(h(a))}})}!function(a=f()){Object.assign(a,e())}();let m=d.NextResponse.json({ok:!0});return m.cookies.set({name:k,value:function(a,b=Date.now(),c=(0,j.randomBytes)(16).toString("hex")){let d=`v1.${Math.floor(b/1e3)+2592e3}.${c}`;return`${d}.${p(d,a)}`}(b),httpOnly:!0,sameSite:"lax",secure:r(a),path:"/",maxAge:2592e3}),m}async function u(a){if(!(0,i.EN)(a))return d.NextResponse.json({error:"Untrusted API request"},{status:403});let b=d.NextResponse.json({ok:!0});return b.cookies.set({name:k,value:"",httpOnly:!0,sameSite:"lax",secure:r(a),path:"/",maxAge:0}),b}},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")},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")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});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(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;let c=e(b.hostname);return b.port?`${c}:${b.port}`:c}catch{return null}}function h(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function i(a){try{return new URL(a).origin}catch{return null}}function j(a,b=h()){return!!function(a,b=h()){let c=a.headers.get("host"),g=c?f(c):null;return!!g&&(!!("localhost"===g||g.endsWith(".localhost")||(0,d.isIP)(g))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===g}))}(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{let b=new URL(a.url);return/^\/api\/sessions\/[^/]+\/export$/.test(b.pathname)||function(a){if(!a.pathname.startsWith("/api/files/")||"read"!==a.searchParams.get("type"))return!1;let b=a.pathname.slice(a.pathname.lastIndexOf("/")+1);try{return decodeURIComponent(b).toLowerCase().endsWith(".pdf")}catch{return!1}}(b)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d,e=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!e)return!0;let f=(b=new URL(a.url),(c=a.headers.get("host"))?i(`${b.protocol}//${c}`):null);if(null!==f&&i(e)===f)return!0;if("same-origin"!==a.headers.get("sec-fetch-site")||!a.headers.get("x-forwarded-proto"))return!1;let h=a.headers.get("host");if(!h)return!1;try{d=new URL(e).host}catch{return!1}let j=g(d);return null!==j&&j===g(h)}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78335:()=>{},80791:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});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(10246),u=c(37527);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/web-auth/route",pathname:"/api/web-auth",filename:"route",bundlePath:"app/api/web-auth/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/Data Vault/PiSpace/pi-web/app/api/web-auth/route.ts",nextConfigOutput:"",userland:()=>c(10446),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/web-auth/route";"/index"===d&&(d="/");let{instrumentation:e}=await v.ensureInstrumentation(a,{deferSpans:!0});return v.traceRequest(a,{tracer:(0,h.getTracer)(),spanName:`${a.method||"GET"} ${d}`,httpTarget:a.url,instrumentation:e},(e,f)=>B(a,b,c,d,!1,e,f))}async function B(a,b,c,d,f,w,x){let y=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:f});if(!y)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:z,deploymentId:A,params:B,nextConfig:C,parsedUrl:D,isDraftMode:E,prerenderManifest:F,routerServerContext:G,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,resolvedPathname:J,clientReferenceManifest:K,serverActionsManifest:L,previewProps:M}=y,N=(0,j.normalizeAppPath)(d),O=!!F.routes[J]&&(v.isDev||(0,t.isRouteCacheOwner)(J,v.cacheOwner,F.routes[J])),P=!!(F.dynamicRoutes[N]||O),Q=async()=>((null==G?void 0:G.render404)?await G.render404(a,b,D,!1):b.end("This page could not be found"),null);if(P&&!E){let a=F.dynamicRoutes[N];if(a&&!1===a.fallback&&!O){if(C.adapterPath)return await Q();throw new s.NoFallbackError}}let R=null;!P||v.isDev||E||(R="/index"===(R=J)?"/":R),L&&K&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:K,serverActionsManifest:L});let S=a.method||"GET",T=(0,h.getTracer)(),U=!!(null==G?void 0:G.isWrappedByNextServer),V=!!(0,g.getRequestMeta)(a,"minimalMode"),W=(0,g.getRequestMeta)(a,"incrementalCache")||await v.getIncrementalCache(a,C,M,F,V);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let X={params:B,previewProps:M,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout,durableUseCacheEntries:!!C.experimental.durableUseCacheEntries},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,isDraftMode:E,incrementalCache:W,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0},sharedContext:{buildId:z,deploymentId:A}},Y=new k.NodeNextRequest(a),Z=new k.NodeNextResponse(b),$=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(b)),_=async({previousCacheEntry:e})=>{try{if(!V&&H&&I&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=null===R?await v.handle($,X):await v.prerender($,X);a.fetchMetrics=X.renderOpts.fetchMetrics;let f=X.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=X.renderOpts.collectedTags;if(!P)return await (0,o.I)(Y,Z,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!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,e=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?C.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:u.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 v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),b}},aa=async d=>{try{var f,g;let d=await v.handleResponse({req:a,nextConfig:C,cacheKey:R,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,previewProps:M,prerenderManifest:F,isRoutePPREnabled:!1,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,responseGenerator:_,waitUntil:c.waitUntil,isMinimalMode:V});if(null!==d&&"error"in d)throw d.error;if(!P)return;if((null==d||null==(f=d.value)?void 0:f.kind)!==u.CachedRouteKind.APP_ROUTE)throw Error(`Invariant: app-route received invalid cache entry ${null==d||null==(g=d.value)?void 0:g.kind}`);V||b.setHeader("x-nextjs-cache",H?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),E&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);V&&P||h.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(Y,Z,new Response(d.value.body,{headers:h,status:d.value.status||200}));return}catch(c){if(c instanceof s.NoFallbackError||await v.onRequestError(a,c,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),P)throw c;if(b.headersSent){if(d){let a=c instanceof Error?c:Error("Unknown app route error");d.recordException(a),d.setStatus({code:h.SpanStatusCode.ERROR,message:a.message}),d.setAttribute("error.type",a.name)}b.writableEnded||b.destroyed||b.end()}else await (0,o.I)(Y,Z,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=T.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")||N,f=`${S} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":f}),d.updateName(f),x&&x!==d&&(x.setAttribute("http.route",e),x.updateName(f))})()}};U||void 0===a.url||null==w||w.setAttribute("http.target",a.url),await aa(w)}},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,[2970,1813],()=>b(b.s=80791));module.exports=c})();
1
+ (()=>{var a={};a.id=6031,a.ids=[6031],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")},10446:(a,b,c)=>{"use strict";c.r(b),c.d(b,{DELETE:()=>u,GET:()=>s,POST:()=>t,dynamic:()=>q});var d=c(23211);function e(){return{failures:0,lastFailureAt:0,blockedUntil:0}}function f(){var a;let b=globalThis,c=Symbol.for("pi-web:auth-throttle"),d=b[c];if("object"==typeof(a=d)&&null!==a&&"number"==typeof a.failures&&"number"==typeof a.lastFailureAt&&"number"==typeof a.blockedUntil)return d;let f=e();return b[c]=f,f}function g(a,b){a.failures>0&&b-a.lastFailureAt>=3e5&&Object.assign(a,e())}function h(a){return Math.max(1,Math.ceil(a/1e3))}var i=c(66544),j=c(77598);let k="pi_web_session";function l(a){return(0,j.createHash)("sha256").update(a,"utf8").digest()}function m(a,b){return(0,j.timingSafeEqual)(l(a),l(b))}function n(a=process.env.PI_WEB_PASSWORD){return"string"==typeof a&&a.length>0}function o(a,b=process.env.PI_WEB_PASSWORD){return n(b)&&m(a,b)}function p(a,b){return(0,j.createHmac)("sha256",b).update(`pi-web-session:${a}`,"utf8").digest("hex")}let q="force-dynamic";function r(a){return"https:"===new URL(a.url).protocol||a.headers.get("x-forwarded-proto")?.split(",",1)[0]?.trim()==="https"}async function s(a){if(!(0,i.EN)(a))return d.NextResponse.json({error:"Untrusted API request"},{status:403});let b=process.env.PI_WEB_PASSWORD,c=n(b),e=!c||function(a,b=process.env.PI_WEB_PASSWORD){let c;if(!n(b)||!a)return!1;let d=/^Basic\s+(\S+)$/i.exec(a);if(!d)return!1;try{let a=Buffer.from(d[1],"base64");if(a.toString("base64")!==d[1])return!1;c=new TextDecoder("utf-8",{fatal:!0}).decode(a)}catch{return!1}let e=c.indexOf(":");if(-1===e)return!1;let f=c.slice(0,e),g=c.slice(e+1),h=m(f,"pi"),i=o(g,b);return h&&i}(a.headers.get("authorization"),b)||function(a,b=process.env.PI_WEB_PASSWORD,c=Date.now()){if(!a||!n(b))return!1;let d=/^(v1\.(\d+)\.[a-f0-9]{32})\.([a-f0-9]{64})$/.exec(a);if(!d)return!1;let e=Number(d[2]);return!(!Number.isSafeInteger(e)||e<=Math.floor(c/1e3))&&m(d[3],p(d[1],b))}(a.cookies.get(k)?.value,b);return d.NextResponse.json({enabled:c,authenticated:e},{headers:{"Cache-Control":"no-store"}})}async function t(a){if(!(0,i.EN)(a))return d.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,i.E2)(a))return d.NextResponse.json({error:"Content-Type must be application/json"},{status:415});let b=process.env.PI_WEB_PASSWORD;if(!n(b))return d.NextResponse.json({error:"Password authentication is disabled"},{status:404});let c=function(a=Date.now(),b=f()){return g(b,a),Math.max(0,b.blockedUntil-a)}();if(c>0)return d.NextResponse.json({error:"Too many failed attempts",retryAfterMs:c},{status:429,headers:{"Cache-Control":"no-store","Retry-After":String(h(c))}});let l=await a.json().catch(()=>null);if(!l||"string"!=typeof l.password||!o(l.password,b)){let a=function(a=Date.now(),b=f()){g(b,a),b.failures+=1,b.lastFailureAt=a;let c=function(a){if(a<=0)return 0;let b=Math.min(a-1,31);return Math.min(1e3*2**b,6e4)}(b.failures);return b.blockedUntil=a+c,c}();return console.warn(`[web-auth] Password authentication failed; next attempt blocked for ${a}ms`),d.NextResponse.json({error:"Invalid password",retryAfterMs:a},{status:401,headers:{"Retry-After":String(h(a))}})}!function(a=f()){Object.assign(a,e())}();let m=d.NextResponse.json({ok:!0});return m.cookies.set({name:k,value:function(a,b=Date.now(),c=(0,j.randomBytes)(16).toString("hex")){let d=`v1.${Math.floor(b/1e3)+2592e3}.${c}`;return`${d}.${p(d,a)}`}(b),httpOnly:!0,sameSite:"lax",secure:r(a),path:"/",maxAge:2592e3}),m}async function u(a){if(!(0,i.EN)(a))return d.NextResponse.json({error:"Untrusted API request"},{status:403});let b=d.NextResponse.json({ok:!0});return b.cookies.set({name:k,value:"",httpOnly:!0,sameSite:"lax",secure:r(a),path:"/",maxAge:0}),b}},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")},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")},55511:a=>{"use strict";a.exports=require("crypto")},56431:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});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(10246),u=c(37527);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/web-auth/route",pathname:"/api/web-auth",filename:"route",bundlePath:"app/api/web-auth/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/Data Vault/PiSpace/pi-web/app/api/web-auth/route.ts",nextConfigOutput:"",userland:()=>c(10446),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/web-auth/route";"/index"===d&&(d="/");let{instrumentation:e}=await v.ensureInstrumentation(a,{deferSpans:!0});return v.traceRequest(a,{tracer:(0,h.getTracer)(),spanName:`${a.method||"GET"} ${d}`,httpTarget:a.url,instrumentation:e},(e,f)=>B(a,b,c,d,!1,e,f))}async function B(a,b,c,d,f,w,x){let y=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:f});if(!y)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:z,deploymentId:A,params:B,nextConfig:C,parsedUrl:D,isDraftMode:E,prerenderManifest:F,routerServerContext:G,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,resolvedPathname:J,clientReferenceManifest:K,serverActionsManifest:L,previewProps:M}=y,N=(0,j.normalizeAppPath)(d),O=!!F.routes[J]&&(v.isDev||(0,t.isRouteCacheOwner)(J,v.cacheOwner,F.routes[J])),P=!!(F.dynamicRoutes[N]||O),Q=async()=>((null==G?void 0:G.render404)?await G.render404(a,b,D,!1):b.end("This page could not be found"),null);if(P&&!E){let a=F.dynamicRoutes[N];if(a&&!1===a.fallback&&!O){if(C.adapterPath)return await Q();throw new s.NoFallbackError}}let R=null;!P||v.isDev||E||(R="/index"===(R=J)?"/":R),L&&K&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:K,serverActionsManifest:L});let S=a.method||"GET",T=(0,h.getTracer)(),U=!!(null==G?void 0:G.isWrappedByNextServer),V=!!(0,g.getRequestMeta)(a,"minimalMode"),W=(0,g.getRequestMeta)(a,"incrementalCache")||await v.getIncrementalCache(a,C,M,F,V);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let X={params:B,previewProps:M,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout,durableUseCacheEntries:!!C.experimental.durableUseCacheEntries},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,isDraftMode:E,incrementalCache:W,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0},sharedContext:{buildId:z,deploymentId:A}},Y=new k.NodeNextRequest(a),Z=new k.NodeNextResponse(b),$=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(b)),_=async({previousCacheEntry:e})=>{try{if(!V&&H&&I&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=null===R?await v.handle($,X):await v.prerender($,X);a.fetchMetrics=X.renderOpts.fetchMetrics;let f=X.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=X.renderOpts.collectedTags;if(!P)return await (0,o.I)(Y,Z,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!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,e=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?C.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:u.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 v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),b}},aa=async d=>{try{var f,g;let d=await v.handleResponse({req:a,nextConfig:C,cacheKey:R,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,previewProps:M,prerenderManifest:F,isRoutePPREnabled:!1,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,responseGenerator:_,waitUntil:c.waitUntil,isMinimalMode:V});if(null!==d&&"error"in d)throw d.error;if(!P)return;if((null==d||null==(f=d.value)?void 0:f.kind)!==u.CachedRouteKind.APP_ROUTE)throw Error(`Invariant: app-route received invalid cache entry ${null==d||null==(g=d.value)?void 0:g.kind}`);V||b.setHeader("x-nextjs-cache",H?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),E&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);V&&P||h.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(Y,Z,new Response(d.value.body,{headers:h,status:d.value.status||200}));return}catch(c){if(c instanceof s.NoFallbackError||await v.onRequestError(a,c,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),P)throw c;if(b.headersSent){if(d){let a=c instanceof Error?c:Error("Unknown app route error");d.recordException(a),d.setStatus({code:h.SpanStatusCode.ERROR,message:a.message}),d.setAttribute("error.type",a.name)}b.writableEnded||b.destroyed||b.end()}else await (0,o.I)(Y,Z,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=T.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")||N,f=`${S} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":f}),d.updateName(f),x&&x!==d&&(x.setAttribute("http.route",e),x.updateName(f))})()}};U||void 0===a.url||null==w||w.setAttribute("http.target",a.url),await aa(w)}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});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(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;let c=e(b.hostname);return b.port?`${c}:${b.port}`:c}catch{return null}}function h(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function i(a){try{return new URL(a).origin}catch{return null}}function j(a,b=h()){return!!function(a,b=h()){let c=a.headers.get("host"),g=c?f(c):null;return!!g&&(!!("localhost"===g||g.endsWith(".localhost")||(0,d.isIP)(g))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===g}))}(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{let b=new URL(a.url);return/^\/api\/sessions\/[^/]+\/export$/.test(b.pathname)||function(a){if(!a.pathname.startsWith("/api/files/")||"read"!==a.searchParams.get("type"))return!1;let b=a.pathname.slice(a.pathname.lastIndexOf("/")+1);try{return decodeURIComponent(b).toLowerCase().endsWith(".pdf")}catch{return!1}}(b)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c,d,e=a.headers.get("origin");if("cross-site"===a.headers.get("sec-fetch-site"))return!1;if(!e)return!0;let f=(b=new URL(a.url),(c=a.headers.get("host"))?i(`${b.protocol}//${c}`):null);if(null!==f&&i(e)===f)return!0;if("same-origin"!==a.headers.get("sec-fetch-site")||!a.headers.get("x-forwarded-proto"))return!1;let h=a.headers.get("host");if(!h)return!1;try{d=new URL(e).host}catch{return!1}let j=g(d);return null!==j&&j===g(h)}(a))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},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,[2970,1813],()=>b(b.s=56431));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=4016,a.ids=[4016],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")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},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")},42819:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>n,GET:()=>l,POST:()=>m});var e=c(23211),f=c(29021),g=c(24923),h=c(80547),i=c(74244),j=a([h]);async function k(a){let b=await (0,h.mc)();return(0,h.A$)(a,b)&&(0,h.B7)(a,b)?null:e.NextResponse.json({error:"Access denied"},{status:403})}async function l(a){try{let b=new URL(a.url).searchParams.get("cwd");if(!b)return e.NextResponse.json({error:"cwd is required"},{status:400});let c=await k(b);if(c)return c;let d=await (0,g.KI)(b),j=[],l=null,m=!0;try{j=await (0,g.P9)((0,f.existsSync)(b)?b:d.projectRoot),l=(0,g.xw)(j,b)}catch{m=!1}for(let a of j)(0,h.wz)(a.path);return e.NextResponse.json({projectRoot:d.projectRoot,projectKey:(0,i.z)(d.projectRoot),isGit:m,isTopLevel:d.isTopLevel,currentWorktreePath:l,worktrees:j})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function m(a){try{let b=await a.json();if(!b.cwd||"string"!=typeof b.cwd)return e.NextResponse.json({error:"cwd is required"},{status:400});if(!b.branch||"string"!=typeof b.branch)return e.NextResponse.json({error:"branch is required"},{status:400});let c=await k(b.cwd);if(c)return c;if(!(0,f.existsSync)(b.cwd))return e.NextResponse.json({error:`Directory does not exist: ${b.cwd}`},{status:400});let d=await (0,g.l)(b.cwd,b.branch);return e.NextResponse.json(d)}catch(b){let a=b instanceof Error?b.message:String(b);if(b instanceof g.GC)return e.NextResponse.json({error:a,code:b.missing?"branch_worktree_missing":"branch_in_use",branch:b.branch,worktreePath:b.worktreePath},{status:409});return e.NextResponse.json({error:a},{status:400})}}async function n(a){try{let b=await a.json();if(!b.cwd||"string"!=typeof b.cwd)return e.NextResponse.json({error:"cwd is required"},{status:400});if(!b.path||"string"!=typeof b.path)return e.NextResponse.json({error:"path is required"},{status:400});let c=await k(b.cwd);if(c)return c;return await (0,g.IL)(b.cwd,b.path,!0===b.force),e.NextResponse.json({success:!0})}catch(c){let a=c instanceof Error?c.message:String(c),b=(0,g.HI)(a);return e.NextResponse.json({error:a,dirty:b},{status:b?409:400})}}h=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},75147:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});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(10246),u=c(37527);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/worktrees/route",pathname:"/api/worktrees",filename:"route",bundlePath:"app/api/worktrees/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/Data Vault/PiSpace/pi-web/app/api/worktrees/route.ts",nextConfigOutput:"",userland:()=>c(42819),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/worktrees/route";"/index"===d&&(d="/");let{instrumentation:e}=await v.ensureInstrumentation(a,{deferSpans:!0});return v.traceRequest(a,{tracer:(0,h.getTracer)(),spanName:`${a.method||"GET"} ${d}`,httpTarget:a.url,instrumentation:e},(e,f)=>B(a,b,c,d,!1,e,f))}async function B(a,b,c,d,f,w,x){let y=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:f});if(!y)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:z,deploymentId:A,params:B,nextConfig:C,parsedUrl:D,isDraftMode:E,prerenderManifest:F,routerServerContext:G,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,resolvedPathname:J,clientReferenceManifest:K,serverActionsManifest:L,previewProps:M}=y,N=(0,j.normalizeAppPath)(d),O=!!F.routes[J]&&(v.isDev||(0,t.isRouteCacheOwner)(J,v.cacheOwner,F.routes[J])),P=!!(F.dynamicRoutes[N]||O),Q=async()=>((null==G?void 0:G.render404)?await G.render404(a,b,D,!1):b.end("This page could not be found"),null);if(P&&!E){let a=F.dynamicRoutes[N];if(a&&!1===a.fallback&&!O){if(C.adapterPath)return await Q();throw new s.NoFallbackError}}let R=null;!P||v.isDev||E||(R="/index"===(R=J)?"/":R),L&&K&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:K,serverActionsManifest:L});let S=a.method||"GET",T=(0,h.getTracer)(),U=!!(null==G?void 0:G.isWrappedByNextServer),V=!!(0,g.getRequestMeta)(a,"minimalMode"),W=(0,g.getRequestMeta)(a,"incrementalCache")||await v.getIncrementalCache(a,C,M,F,V);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let X={params:B,previewProps:M,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout,durableUseCacheEntries:!!C.experimental.durableUseCacheEntries},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,isDraftMode:E,incrementalCache:W,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0},sharedContext:{buildId:z,deploymentId:A}},Y=new k.NodeNextRequest(a),Z=new k.NodeNextResponse(b),$=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(b)),_=async({previousCacheEntry:e})=>{try{if(!V&&H&&I&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=null===R?await v.handle($,X):await v.prerender($,X);a.fetchMetrics=X.renderOpts.fetchMetrics;let f=X.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=X.renderOpts.collectedTags;if(!P)return await (0,o.I)(Y,Z,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!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,e=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?C.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:u.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 v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),b}},aa=async d=>{try{var f,g;let d=await v.handleResponse({req:a,nextConfig:C,cacheKey:R,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,previewProps:M,prerenderManifest:F,isRoutePPREnabled:!1,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,responseGenerator:_,waitUntil:c.waitUntil,isMinimalMode:V});if(null!==d&&"error"in d)throw d.error;if(!P)return;if((null==d||null==(f=d.value)?void 0:f.kind)!==u.CachedRouteKind.APP_ROUTE)throw Error(`Invariant: app-route received invalid cache entry ${null==d||null==(g=d.value)?void 0:g.kind}`);V||b.setHeader("x-nextjs-cache",H?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),E&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);V&&P||h.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(Y,Z,new Response(d.value.body,{headers:h,status:d.value.status||200}));return}catch(c){if(c instanceof s.NoFallbackError||await v.onRequestError(a,c,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),P)throw c;if(b.headersSent){if(d){let a=c instanceof Error?c:Error("Unknown app route error");d.recordException(a),d.setStatus({code:h.SpanStatusCode.ERROR,message:a.message}),d.setAttribute("error.type",a.name)}b.writableEnded||b.destroyed||b.end()}else await (0,o.I)(Y,Z,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=T.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")||N,f=`${S} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":f}),d.updateName(f),x&&x!==d&&(x.setAttribute("http.route",e),x.updateName(f))})()}};U||void 0===a.url||null==w||w.setAttribute("http.target",a.url),await aa(w)}},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},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$:()=>k,B7:()=>l,mc:()=>j,uK:()=>h.uK,wz:()=>e.wz});var e=c(25252),f=c(82536),g=c(40402),h=c(58864),i=a([g]);async function j(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,g.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,e.Nw)(a.cwd)),a.projectRoot&&d.add((0,e.Nw)(a.projectRoot));for(let a of(0,e.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function k(a,b){return(0,f.o4)(a,b)}function l(a,b){return(0,f.xk)(a,b)}g=(i.then?(await i)():i)[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,[2970,1813,426,5582],()=>b(b.s=75147));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=4016,a.ids=[4016],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")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},28354:a=>{a.exports=require("util")},28802:a=>{a.exports=import("@earendil-works/pi-ai")},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")},42819:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>n,GET:()=>l,POST:()=>m});var e=c(23211),f=c(29021),g=c(24923),h=c(80547),i=c(74244),j=a([h]);async function k(a){let b=await (0,h.mc)();return(0,h.A$)(a,b)&&(0,h.B7)(a,b)?null:e.NextResponse.json({error:"Access denied"},{status:403})}async function l(a){try{let b=new URL(a.url).searchParams.get("cwd");if(!b)return e.NextResponse.json({error:"cwd is required"},{status:400});let c=await k(b);if(c)return c;let d=await (0,g.KI)(b),j=[],l=null,m=!0;try{j=await (0,g.P9)((0,f.existsSync)(b)?b:d.projectRoot),l=(0,g.xw)(j,b)}catch{m=!1}for(let a of j)(0,h.wz)(a.path);return e.NextResponse.json({projectRoot:d.projectRoot,projectKey:(0,i.z)(d.projectRoot),isGit:m,isTopLevel:d.isTopLevel,currentWorktreePath:l,worktrees:j})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function m(a){try{let b=await a.json();if(!b.cwd||"string"!=typeof b.cwd)return e.NextResponse.json({error:"cwd is required"},{status:400});if(!b.branch||"string"!=typeof b.branch)return e.NextResponse.json({error:"branch is required"},{status:400});let c=await k(b.cwd);if(c)return c;if(!(0,f.existsSync)(b.cwd))return e.NextResponse.json({error:`Directory does not exist: ${b.cwd}`},{status:400});let d=await (0,g.l)(b.cwd,b.branch);return e.NextResponse.json(d)}catch(b){let a=b instanceof Error?b.message:String(b);if(b instanceof g.GC)return e.NextResponse.json({error:a,code:b.missing?"branch_worktree_missing":"branch_in_use",branch:b.branch,worktreePath:b.worktreePath},{status:409});return e.NextResponse.json({error:a},{status:400})}}async function n(a){try{let b=await a.json();if(!b.cwd||"string"!=typeof b.cwd)return e.NextResponse.json({error:"cwd is required"},{status:400});if(!b.path||"string"!=typeof b.path)return e.NextResponse.json({error:"path is required"},{status:400});let c=await k(b.cwd);if(c)return c;return await (0,g.IL)(b.cwd,b.path,!0===b.force),e.NextResponse.json({success:!0})}catch(c){let a=c instanceof Error?c.message:String(c),b=(0,g.HI)(a);return e.NextResponse.json({error:a,dirty:b},{status:b?409:400})}}h=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51455:a=>{a.exports=require("node:fs/promises")},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{a.exports=require("node:path")},77598:a=>{a.exports=require("node:crypto")},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$:()=>k,B7:()=>l,mc:()=>j,uK:()=>h.uK,wz:()=>e.wz});var e=c(25252),f=c(82536),g=c(40402),h=c(58864),i=a([g]);async function j(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,g.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,e.Nw)(a.cwd)),a.projectRoot&&d.add((0,e.Nw)(a.projectRoot));for(let a of(0,e.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function k(a,b){return(0,f.o4)(a,b)}function l(a,b){return(0,f.xk)(a,b)}g=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},90187:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>A,patchFetch:()=>z,routeModule:()=>v,serverHooks:()=>y,workAsyncStorage:()=>w,workUnitAsyncStorage:()=>x});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(10246),u=c(37527);let v=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/worktrees/route",pathname:"/api/worktrees",filename:"route",bundlePath:"app/api/worktrees/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/Data Vault/PiSpace/pi-web/app/api/worktrees/route.ts",nextConfigOutput:"",userland:()=>c(42819),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:y}=v;function z(){return(0,f.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})}async function A(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),v.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/worktrees/route";"/index"===d&&(d="/");let{instrumentation:e}=await v.ensureInstrumentation(a,{deferSpans:!0});return v.traceRequest(a,{tracer:(0,h.getTracer)(),spanName:`${a.method||"GET"} ${d}`,httpTarget:a.url,instrumentation:e},(e,f)=>B(a,b,c,d,!1,e,f))}async function B(a,b,c,d,f,w,x){let y=await v.prepare(a,b,{srcPage:d,multiZoneDraftMode:f});if(!y)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:z,deploymentId:A,params:B,nextConfig:C,parsedUrl:D,isDraftMode:E,prerenderManifest:F,routerServerContext:G,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,resolvedPathname:J,clientReferenceManifest:K,serverActionsManifest:L,previewProps:M}=y,N=(0,j.normalizeAppPath)(d),O=!!F.routes[J]&&(v.isDev||(0,t.isRouteCacheOwner)(J,v.cacheOwner,F.routes[J])),P=!!(F.dynamicRoutes[N]||O),Q=async()=>((null==G?void 0:G.render404)?await G.render404(a,b,D,!1):b.end("This page could not be found"),null);if(P&&!E){let a=F.dynamicRoutes[N];if(a&&!1===a.fallback&&!O){if(C.adapterPath)return await Q();throw new s.NoFallbackError}}let R=null;!P||v.isDev||E||(R="/index"===(R=J)?"/":R),L&&K&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:K,serverActionsManifest:L});let S=a.method||"GET",T=(0,h.getTracer)(),U=!!(null==G?void 0:G.isWrappedByNextServer),V=!!(0,g.getRequestMeta)(a,"minimalMode"),W=(0,g.getRequestMeta)(a,"incrementalCache")||await v.getIncrementalCache(a,C,M,F,V);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let X={params:B,previewProps:M,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout,durableUseCacheEntries:!!C.experimental.durableUseCacheEntries},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,isDraftMode:E,incrementalCache:W,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0},sharedContext:{buildId:z,deploymentId:A}},Y=new k.NodeNextRequest(a),Z=new k.NodeNextResponse(b),$=l.NextRequestAdapter.fromNodeNextRequest(Y,(0,l.signalFromNodeResponse)(b)),_=async({previousCacheEntry:e})=>{try{if(!V&&H&&I&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=null===R?await v.handle($,X):await v.prerender($,X);a.fetchMetrics=X.renderOpts.fetchMetrics;let f=X.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=X.renderOpts.collectedTags;if(!P)return await (0,o.I)(Y,Z,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!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,e=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?C.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:u.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 v.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),b}},aa=async d=>{try{var f,g;let d=await v.handleResponse({req:a,nextConfig:C,cacheKey:R,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,previewProps:M,prerenderManifest:F,isRoutePPREnabled:!1,isOnDemandRevalidate:H,revalidateOnlyGenerated:I,responseGenerator:_,waitUntil:c.waitUntil,isMinimalMode:V});if(null!==d&&"error"in d)throw d.error;if(!P)return;if((null==d||null==(f=d.value)?void 0:f.kind)!==u.CachedRouteKind.APP_ROUTE)throw Error(`Invariant: app-route received invalid cache entry ${null==d||null==(g=d.value)?void 0:g.kind}`);V||b.setHeader("x-nextjs-cache",H?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),E&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let h=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);V&&P||h.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||h.get("Cache-Control")||h.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(Y,Z,new Response(d.value.body,{headers:h,status:d.value.status||200}));return}catch(c){if(c instanceof s.NoFallbackError||await v.onRequestError(a,c,{routerKind:"App Router",routePath:N,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:null!==R,isOnDemandRevalidate:H})},!1,G),P)throw c;if(b.headersSent){if(d){let a=c instanceof Error?c:Error("Unknown app route error");d.recordException(a),d.setStatus({code:h.SpanStatusCode.ERROR,message:a.message}),d.setAttribute("error.type",a.name)}b.writableEnded||b.destroyed||b.end()}else await (0,o.I)(Y,Z,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=T.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")||N,f=`${S} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":f}),d.updateName(f),x&&x!==d&&(x.setAttribute("http.route",e),x.updateName(f))})()}};U||void 0===a.url||null==w||w.setAttribute("http.target",a.url),await aa(w)}}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2970,1813,426,5582],()=>b(b.s=90187));module.exports=c})();