@henlii/pidance 0.2.7 → 0.2.9

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 (247) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +9 -6
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/required-server-files.json +1 -1
  6. package/.next/routes-manifest.json +20 -0
  7. package/.next/server/app/_global-error/page.js +3 -3
  8. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/.next/server/app/_not-found/page.js +2 -2
  18. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/.next/server/app/_not-found.html +1 -1
  20. package/.next/server/app/_not-found.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  22. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  24. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  26. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  27. package/.next/server/app/api/about/route.js +1 -1
  28. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  29. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  30. package/.next/server/app/api/agent/[id]/route.js +1 -1
  31. package/.next/server/app/api/agent/new/route.js +1 -1
  32. package/.next/server/app/api/agent/running/events/route.js +2 -2
  33. package/.next/server/app/api/agent/running/route.js +1 -1
  34. package/.next/server/app/api/agent-settings/route.js +2 -2
  35. package/.next/server/app/api/attachments/route.js +1 -1
  36. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  37. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  38. package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
  39. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  40. package/.next/server/app/api/auth/providers/route.js +1 -1
  41. package/.next/server/app/api/auth/ui-session/route.js +1 -1
  42. package/.next/server/app/api/auth/ui-sessions/[id]/route.js +1 -0
  43. package/.next/server/app/api/auth/ui-sessions/[id]/route_client-reference-manifest.js +1 -0
  44. package/.next/server/app/api/auth/ui-sessions/route.js +1 -0
  45. package/.next/server/app/api/auth/ui-sessions/route_client-reference-manifest.js +1 -0
  46. package/.next/server/app/api/cwd/browse/route.js +1 -1
  47. package/.next/server/app/api/cwd/validate/route.js +1 -1
  48. package/.next/server/app/api/default-cwd/route.js +1 -1
  49. package/.next/server/app/api/file-index/route.js +1 -1
  50. package/.next/server/app/api/files/[...path]/route.js +1 -1
  51. package/.next/server/app/api/git/diff/route.js +1 -1
  52. package/.next/server/app/api/git/status/route.js +1 -1
  53. package/.next/server/app/api/home/route.js +1 -1
  54. package/.next/server/app/api/models/route.js +1 -1
  55. package/.next/server/app/api/models-config/raw/route.js +1 -1
  56. package/.next/server/app/api/models-config/route.js +1 -1
  57. package/.next/server/app/api/models-config/test/route.js +1 -1
  58. package/.next/server/app/api/plugins/route.js +1 -1
  59. package/.next/server/app/api/plugins/search/route.js +1 -1
  60. package/.next/server/app/api/plugins/updates/route.js +1 -1
  61. package/.next/server/app/api/preferences/route.js +1 -1
  62. package/.next/server/app/api/project-assets/route.js +2 -2
  63. package/.next/server/app/api/prompts/route.js +1 -1
  64. package/.next/server/app/api/pty/route.js +2 -2
  65. package/.next/server/app/api/sessions/[id]/archive/route.js +1 -1
  66. package/.next/server/app/api/sessions/[id]/auto-name/route.js +3 -3
  67. package/.next/server/app/api/sessions/[id]/command-entry/route.js +1 -1
  68. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  69. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  70. package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
  71. package/.next/server/app/api/sessions/[id]/info/route.js +1 -1
  72. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  73. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  74. package/.next/server/app/api/sessions/[id]/tool-results/[toolCallId]/route.js +1 -1
  75. package/.next/server/app/api/sessions/route.js +1 -1
  76. package/.next/server/app/api/sessions/search/route.js +1 -1
  77. package/.next/server/app/api/settings/raw/route.js +2 -2
  78. package/.next/server/app/api/settings/remote/route.js +1 -0
  79. package/.next/server/app/api/settings/remote/route_client-reference-manifest.js +1 -0
  80. package/.next/server/app/api/skills/check/route.js +1 -1
  81. package/.next/server/app/api/skills/install/route.js +1 -1
  82. package/.next/server/app/api/skills/route.js +2 -2
  83. package/.next/server/app/api/skills/search/route.js +1 -1
  84. package/.next/server/app/api/skills/update/route.js +1 -1
  85. package/.next/server/app/api/subagent-runs/route.js +1 -1
  86. package/.next/server/app/api/update/apply/route.js +3 -3
  87. package/.next/server/app/api/update/check/route.js +2 -2
  88. package/.next/server/app/api/worktrees/route.js +1 -1
  89. package/.next/server/app/icon.png/route.js +1 -1
  90. package/.next/server/app/index.html +1 -1
  91. package/.next/server/app/index.rsc +4 -4
  92. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  93. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  94. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  95. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  96. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  97. package/.next/server/app/page.js +15 -15
  98. package/.next/server/app/page_client-reference-manifest.js +1 -1
  99. package/.next/server/app-paths-manifest.json +9 -6
  100. package/.next/server/chunks/188.js +1 -1
  101. package/.next/server/chunks/329.js +1 -0
  102. package/.next/server/chunks/7594.js +1 -1
  103. package/.next/server/functions-config-manifest.json +3 -0
  104. package/.next/server/instrumentation.js +1 -1
  105. package/.next/server/middleware-build-manifest.js +1 -1
  106. package/.next/server/middleware.js +3 -3
  107. package/.next/server/pages/404.html +1 -1
  108. package/.next/server/pages/500.html +1 -1
  109. package/.next/server/server-reference-manifest.json +1 -1
  110. package/.next/static/bR7RbvJMnnKuh-cKREZa4/_buildManifest.js +1 -0
  111. package/.next/static/chunks/9780-e3ccfd6965a6273f.js +1 -0
  112. package/.next/static/chunks/app/_global-error/page-81c6f790083aee21.js +1 -0
  113. package/.next/static/chunks/app/api/about/route-81c6f790083aee21.js +1 -0
  114. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-81c6f790083aee21.js +1 -0
  115. package/.next/static/chunks/app/api/agent/[id]/events/route-81c6f790083aee21.js +1 -0
  116. package/.next/static/chunks/app/api/agent/[id]/route-81c6f790083aee21.js +1 -0
  117. package/.next/static/chunks/app/api/agent/new/route-81c6f790083aee21.js +1 -0
  118. package/.next/static/chunks/app/api/agent/running/events/route-81c6f790083aee21.js +1 -0
  119. package/.next/static/chunks/app/api/agent/running/route-81c6f790083aee21.js +1 -0
  120. package/.next/static/chunks/app/api/agent-settings/route-81c6f790083aee21.js +1 -0
  121. package/.next/static/chunks/app/api/attachments/route-81c6f790083aee21.js +1 -0
  122. package/.next/static/chunks/app/api/auth/all-providers/route-81c6f790083aee21.js +1 -0
  123. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-81c6f790083aee21.js +1 -0
  124. package/.next/static/chunks/app/api/auth/login/[provider]/route-81c6f790083aee21.js +1 -0
  125. package/.next/static/chunks/app/api/auth/logout/[provider]/route-81c6f790083aee21.js +1 -0
  126. package/.next/static/chunks/app/api/auth/providers/route-81c6f790083aee21.js +1 -0
  127. package/.next/static/chunks/app/api/auth/ui-session/route-81c6f790083aee21.js +1 -0
  128. package/.next/static/chunks/app/api/auth/ui-sessions/[id]/route-81c6f790083aee21.js +1 -0
  129. package/.next/static/chunks/app/api/auth/ui-sessions/route-81c6f790083aee21.js +1 -0
  130. package/.next/static/chunks/app/api/cwd/browse/route-81c6f790083aee21.js +1 -0
  131. package/.next/static/chunks/app/api/cwd/validate/route-81c6f790083aee21.js +1 -0
  132. package/.next/static/chunks/app/api/default-cwd/route-81c6f790083aee21.js +1 -0
  133. package/.next/static/chunks/app/api/file-index/route-81c6f790083aee21.js +1 -0
  134. package/.next/static/chunks/app/api/files/[...path]/route-81c6f790083aee21.js +1 -0
  135. package/.next/static/chunks/app/api/git/diff/route-81c6f790083aee21.js +1 -0
  136. package/.next/static/chunks/app/api/git/status/route-81c6f790083aee21.js +1 -0
  137. package/.next/static/chunks/app/api/home/route-81c6f790083aee21.js +1 -0
  138. package/.next/static/chunks/app/api/models/route-81c6f790083aee21.js +1 -0
  139. package/.next/static/chunks/app/api/models-config/raw/route-81c6f790083aee21.js +1 -0
  140. package/.next/static/chunks/app/api/models-config/route-81c6f790083aee21.js +1 -0
  141. package/.next/static/chunks/app/api/models-config/test/route-81c6f790083aee21.js +1 -0
  142. package/.next/static/chunks/app/api/plugins/route-81c6f790083aee21.js +1 -0
  143. package/.next/static/chunks/app/api/plugins/search/route-81c6f790083aee21.js +1 -0
  144. package/.next/static/chunks/app/api/plugins/updates/route-81c6f790083aee21.js +1 -0
  145. package/.next/static/chunks/app/api/preferences/route-81c6f790083aee21.js +1 -0
  146. package/.next/static/chunks/app/api/project-assets/route-81c6f790083aee21.js +1 -0
  147. package/.next/static/chunks/app/api/prompts/route-81c6f790083aee21.js +1 -0
  148. package/.next/static/chunks/app/api/pty/route-81c6f790083aee21.js +1 -0
  149. package/.next/static/chunks/app/api/sessions/[id]/archive/route-81c6f790083aee21.js +1 -0
  150. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-81c6f790083aee21.js +1 -0
  151. package/.next/static/chunks/app/api/sessions/[id]/command-entry/route-81c6f790083aee21.js +1 -0
  152. package/.next/static/chunks/app/api/sessions/[id]/context/route-81c6f790083aee21.js +1 -0
  153. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-81c6f790083aee21.js +1 -0
  154. package/.next/static/chunks/app/api/sessions/[id]/export/route-81c6f790083aee21.js +1 -0
  155. package/.next/static/chunks/app/api/sessions/[id]/info/route-81c6f790083aee21.js +1 -0
  156. package/.next/static/chunks/app/api/sessions/[id]/route-81c6f790083aee21.js +1 -0
  157. package/.next/static/chunks/app/api/sessions/[id]/state/route-81c6f790083aee21.js +1 -0
  158. package/.next/static/chunks/app/api/sessions/[id]/tool-results/[toolCallId]/route-81c6f790083aee21.js +1 -0
  159. package/.next/static/chunks/app/api/sessions/route-81c6f790083aee21.js +1 -0
  160. package/.next/static/chunks/app/api/sessions/search/route-81c6f790083aee21.js +1 -0
  161. package/.next/static/chunks/app/api/settings/raw/route-81c6f790083aee21.js +1 -0
  162. package/.next/static/chunks/app/api/settings/remote/route-81c6f790083aee21.js +1 -0
  163. package/.next/static/chunks/app/api/skills/check/route-81c6f790083aee21.js +1 -0
  164. package/.next/static/chunks/app/api/skills/install/route-81c6f790083aee21.js +1 -0
  165. package/.next/static/chunks/app/api/skills/route-81c6f790083aee21.js +1 -0
  166. package/.next/static/chunks/app/api/skills/search/route-81c6f790083aee21.js +1 -0
  167. package/.next/static/chunks/app/api/skills/update/route-81c6f790083aee21.js +1 -0
  168. package/.next/static/chunks/app/api/subagent-runs/route-81c6f790083aee21.js +1 -0
  169. package/.next/static/chunks/app/api/update/apply/route-81c6f790083aee21.js +1 -0
  170. package/.next/static/chunks/app/api/update/check/route-81c6f790083aee21.js +1 -0
  171. package/.next/static/chunks/app/api/worktrees/route-81c6f790083aee21.js +1 -0
  172. package/.next/static/chunks/app/page-c9b79e882493c953.js +25 -0
  173. package/.next/static/chunks/next/dist/client/components/builtin/app-error-81c6f790083aee21.js +1 -0
  174. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-81c6f790083aee21.js +1 -0
  175. package/.next/static/chunks/next/dist/client/components/builtin/not-found-81c6f790083aee21.js +1 -0
  176. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-81c6f790083aee21.js +1 -0
  177. package/README.md +7 -4
  178. package/bin/pidance-auth-gate.js +10 -7
  179. package/bin/pidance-options.js +3 -2
  180. package/bin/pidance-server-config.js +46 -0
  181. package/bin/pidance.js +20 -6
  182. package/package.json +1 -1
  183. package/.next/static/01veEEO0MbroyjY72tWyr/_buildManifest.js +0 -1
  184. package/.next/static/chunks/9780-96bbb56af7ed70f1.js +0 -1
  185. package/.next/static/chunks/app/_global-error/page-212bed9d7023fb3f.js +0 -1
  186. package/.next/static/chunks/app/api/about/route-212bed9d7023fb3f.js +0 -1
  187. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-212bed9d7023fb3f.js +0 -1
  188. package/.next/static/chunks/app/api/agent/[id]/events/route-212bed9d7023fb3f.js +0 -1
  189. package/.next/static/chunks/app/api/agent/[id]/route-212bed9d7023fb3f.js +0 -1
  190. package/.next/static/chunks/app/api/agent/new/route-212bed9d7023fb3f.js +0 -1
  191. package/.next/static/chunks/app/api/agent/running/events/route-212bed9d7023fb3f.js +0 -1
  192. package/.next/static/chunks/app/api/agent/running/route-212bed9d7023fb3f.js +0 -1
  193. package/.next/static/chunks/app/api/agent-settings/route-212bed9d7023fb3f.js +0 -1
  194. package/.next/static/chunks/app/api/attachments/route-212bed9d7023fb3f.js +0 -1
  195. package/.next/static/chunks/app/api/auth/all-providers/route-212bed9d7023fb3f.js +0 -1
  196. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-212bed9d7023fb3f.js +0 -1
  197. package/.next/static/chunks/app/api/auth/login/[provider]/route-212bed9d7023fb3f.js +0 -1
  198. package/.next/static/chunks/app/api/auth/logout/[provider]/route-212bed9d7023fb3f.js +0 -1
  199. package/.next/static/chunks/app/api/auth/providers/route-212bed9d7023fb3f.js +0 -1
  200. package/.next/static/chunks/app/api/auth/ui-session/route-212bed9d7023fb3f.js +0 -1
  201. package/.next/static/chunks/app/api/cwd/browse/route-212bed9d7023fb3f.js +0 -1
  202. package/.next/static/chunks/app/api/cwd/validate/route-212bed9d7023fb3f.js +0 -1
  203. package/.next/static/chunks/app/api/default-cwd/route-212bed9d7023fb3f.js +0 -1
  204. package/.next/static/chunks/app/api/file-index/route-212bed9d7023fb3f.js +0 -1
  205. package/.next/static/chunks/app/api/files/[...path]/route-212bed9d7023fb3f.js +0 -1
  206. package/.next/static/chunks/app/api/git/diff/route-212bed9d7023fb3f.js +0 -1
  207. package/.next/static/chunks/app/api/git/status/route-212bed9d7023fb3f.js +0 -1
  208. package/.next/static/chunks/app/api/home/route-212bed9d7023fb3f.js +0 -1
  209. package/.next/static/chunks/app/api/models/route-212bed9d7023fb3f.js +0 -1
  210. package/.next/static/chunks/app/api/models-config/raw/route-212bed9d7023fb3f.js +0 -1
  211. package/.next/static/chunks/app/api/models-config/route-212bed9d7023fb3f.js +0 -1
  212. package/.next/static/chunks/app/api/models-config/test/route-212bed9d7023fb3f.js +0 -1
  213. package/.next/static/chunks/app/api/plugins/route-212bed9d7023fb3f.js +0 -1
  214. package/.next/static/chunks/app/api/plugins/search/route-212bed9d7023fb3f.js +0 -1
  215. package/.next/static/chunks/app/api/plugins/updates/route-212bed9d7023fb3f.js +0 -1
  216. package/.next/static/chunks/app/api/preferences/route-212bed9d7023fb3f.js +0 -1
  217. package/.next/static/chunks/app/api/project-assets/route-212bed9d7023fb3f.js +0 -1
  218. package/.next/static/chunks/app/api/prompts/route-212bed9d7023fb3f.js +0 -1
  219. package/.next/static/chunks/app/api/pty/route-212bed9d7023fb3f.js +0 -1
  220. package/.next/static/chunks/app/api/sessions/[id]/archive/route-212bed9d7023fb3f.js +0 -1
  221. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-212bed9d7023fb3f.js +0 -1
  222. package/.next/static/chunks/app/api/sessions/[id]/command-entry/route-212bed9d7023fb3f.js +0 -1
  223. package/.next/static/chunks/app/api/sessions/[id]/context/route-212bed9d7023fb3f.js +0 -1
  224. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-212bed9d7023fb3f.js +0 -1
  225. package/.next/static/chunks/app/api/sessions/[id]/export/route-212bed9d7023fb3f.js +0 -1
  226. package/.next/static/chunks/app/api/sessions/[id]/info/route-212bed9d7023fb3f.js +0 -1
  227. package/.next/static/chunks/app/api/sessions/[id]/route-212bed9d7023fb3f.js +0 -1
  228. package/.next/static/chunks/app/api/sessions/[id]/state/route-212bed9d7023fb3f.js +0 -1
  229. package/.next/static/chunks/app/api/sessions/[id]/tool-results/[toolCallId]/route-212bed9d7023fb3f.js +0 -1
  230. package/.next/static/chunks/app/api/sessions/route-212bed9d7023fb3f.js +0 -1
  231. package/.next/static/chunks/app/api/sessions/search/route-212bed9d7023fb3f.js +0 -1
  232. package/.next/static/chunks/app/api/settings/raw/route-212bed9d7023fb3f.js +0 -1
  233. package/.next/static/chunks/app/api/skills/check/route-212bed9d7023fb3f.js +0 -1
  234. package/.next/static/chunks/app/api/skills/install/route-212bed9d7023fb3f.js +0 -1
  235. package/.next/static/chunks/app/api/skills/route-212bed9d7023fb3f.js +0 -1
  236. package/.next/static/chunks/app/api/skills/search/route-212bed9d7023fb3f.js +0 -1
  237. package/.next/static/chunks/app/api/skills/update/route-212bed9d7023fb3f.js +0 -1
  238. package/.next/static/chunks/app/api/subagent-runs/route-212bed9d7023fb3f.js +0 -1
  239. package/.next/static/chunks/app/api/update/apply/route-212bed9d7023fb3f.js +0 -1
  240. package/.next/static/chunks/app/api/update/check/route-212bed9d7023fb3f.js +0 -1
  241. package/.next/static/chunks/app/api/worktrees/route-212bed9d7023fb3f.js +0 -1
  242. package/.next/static/chunks/app/page-c76a709acf636b23.js +0 -25
  243. package/.next/static/chunks/next/dist/client/components/builtin/app-error-212bed9d7023fb3f.js +0 -1
  244. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-212bed9d7023fb3f.js +0 -1
  245. package/.next/static/chunks/next/dist/client/components/builtin/not-found-212bed9d7023fb3f.js +0 -1
  246. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-212bed9d7023fb3f.js +0 -1
  247. /package/.next/static/{01veEEO0MbroyjY72tWyr → bR7RbvJMnnKuh-cKREZa4}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (()=>{var a={};a.id=4629,a.ids=[4629],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},60744:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>D,patchFetch:()=>C,routeModule:()=>y,serverHooks:()=>B,workAsyncStorage:()=>z,workUnitAsyncStorage:()=>A});var d={};c.r(d),c.d(d,{POST:()=>x,dynamic:()=>w});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211);let w="force-dynamic";async function x(a){try{let b=await a.json().catch(()=>({})),c="string"==typeof b.query?b.query.trim():"";if(!c||c.length>100)return v.NextResponse.json({error:"query is required (max 100 chars)"},{status:400});let d=encodeURIComponent(c),e=await fetch(`https://registry.npmjs.org/-/v1/search?text=${d}&size=15`,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(15e3)});if(!e.ok)return v.NextResponse.json({error:`npm search failed: HTTP ${e.status}`},{status:502});let f=((await e.json()).objects??[]).map(a=>a.package).filter(a=>!!(a&&"string"==typeof a.name)).map(a=>({name:a.name,version:"string"==typeof a.version?a.version:"",description:"string"==typeof a.description?a.description:"",publisher:a.publisher&&"string"==typeof a.publisher.username?a.publisher.username:void 0}));return v.NextResponse.json({results:f})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let y=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/plugins/search/route",pathname:"/api/plugins/search",filename:"route",bundlePath:"app/api/plugins/search/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/plugins/search/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:z,workUnitAsyncStorage:A,serverHooks:B}=y;function C(){return(0,g.patchFetch)({workAsyncStorage:z,workUnitAsyncStorage:A})}async function D(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),y.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/search/route";"/index"===d&&(d="/");let e=await y.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||y.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===y.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await y.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>y.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>y.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await y.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await y.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await y.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=60744));module.exports=c})();
1
+ (()=>{var a={};a.id=4629,a.ids=[4629],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},39503:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>D,patchFetch:()=>C,routeModule:()=>y,serverHooks:()=>B,workAsyncStorage:()=>z,workUnitAsyncStorage:()=>A});var d={};c.r(d),c.d(d,{POST:()=>x,dynamic:()=>w});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211);let w="force-dynamic";async function x(a){try{let b=await a.json().catch(()=>({})),c="string"==typeof b.query?b.query.trim():"";if(!c||c.length>100)return v.NextResponse.json({error:"query is required (max 100 chars)"},{status:400});let d=encodeURIComponent(c),e=await fetch(`https://registry.npmjs.org/-/v1/search?text=${d}&size=15`,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(15e3)});if(!e.ok)return v.NextResponse.json({error:`npm search failed: HTTP ${e.status}`},{status:502});let f=((await e.json()).objects??[]).map(a=>a.package).filter(a=>!!(a&&"string"==typeof a.name)).map(a=>({name:a.name,version:"string"==typeof a.version?a.version:"",description:"string"==typeof a.description?a.description:"",publisher:a.publisher&&"string"==typeof a.publisher.username?a.publisher.username:void 0}));return v.NextResponse.json({results:f})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let y=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/plugins/search/route",pathname:"/api/plugins/search",filename:"route",bundlePath:"app/api/plugins/search/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/plugins/search/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:z,workUnitAsyncStorage:A,serverHooks:B}=y;function C(){return(0,g.patchFetch)({workAsyncStorage:z,workUnitAsyncStorage:A})}async function D(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),y.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/search/route";"/index"===d&&(d="/");let e=await y.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||y.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===y.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await y.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>y.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>y.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await y.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await y.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await y.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=39503));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=6801,a.ids=[6801],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")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},15630:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>H,patchFetch:()=>G,routeModule:()=>C,serverHooks:()=>F,workAsyncStorage:()=>D,workUnitAsyncStorage:()=>E});var d={};c.r(d),c.d(d,{POST:()=>B,dynamic:()=>A});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211),w=c(95398),x=c(37827);async function y(a,b,c){let d=Array(a.length),e=0,f=Array.from({length:Math.min(b,a.length)},async()=>{for(;e<a.length;){let b=e;e+=1,d[b]=await c(a[b])}});return await Promise.all(f),d}async function z(a){let b=a.filter(a=>a.source.trim().startsWith("npm:"));return[...await y(b,4,async({source:a,installed:b})=>{let c=(0,x._n)(a.slice(4)).name,d=c?function(a){try{let b=(0,w.execFileSync)("npm",["view",a,"version","--json","--no-update-notifier"],{encoding:"utf8",timeout:3e4,stdio:["ignore","pipe","ignore"]}).trim(),c=JSON.parse(b);return"string"==typeof c&&c?c:null}catch{return null}}(c):null,e=null!==d&&null!==b&&d!==b&&function(a,b){let c=a.split(".").map(a=>parseInt(a,10)||0),d=b.split(".").map(a=>parseInt(a,10)||0);for(let a=0;a<Math.max(c.length,d.length);a++){let b=(c[a]??0)-(d[a]??0);if(0!==b)return b}return 0}(d,b)>0;return{source:a,installed:b,latest:d,hasUpdate:e}}),...a.filter(a=>!a.source.trim().startsWith("npm:")).map(a=>({source:a.source,installed:a.installed,latest:null,hasUpdate:!1}))]}let A="force-dynamic";async function B(a){try{let b=await a.json().catch(()=>({}));if(!Array.isArray(b.packages)||b.packages.length>200)return v.NextResponse.json({error:"packages must be an array (max 200)"},{status:400});let c=b.packages.filter(a=>"string"==typeof a?.source&&a.source).map(a=>({source:a.source.trim(),installed:"string"==typeof a.installed&&a.installed?a.installed:null})),d=await z(c);return v.NextResponse.json({updates:d})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let C=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/plugins/updates/route",pathname:"/api/plugins/updates",filename:"route",bundlePath:"app/api/plugins/updates/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/plugins/updates/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:D,workUnitAsyncStorage:E,serverHooks:F}=C;function G(){return(0,g.patchFetch)({workAsyncStorage:D,workUnitAsyncStorage:E})}async function H(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),C.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/updates/route";"/index"===d&&(d="/");let e=await C.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[F]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[F],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||C.isDev||z||(L="/index"===(L=F)?"/":L);let M=!0===C.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await C.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>C.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>C.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await C.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,B),b}},k=await C.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await C.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,B),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73127:a=>{a.exports=require("node:url")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")},95398:a=>{a.exports=require("node:child_process")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,8359],()=>b(b.s=15630));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=6801,a.ids=[6801],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")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},73127:a=>{a.exports=require("node:url")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},87161:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>H,patchFetch:()=>G,routeModule:()=>C,serverHooks:()=>F,workAsyncStorage:()=>D,workUnitAsyncStorage:()=>E});var d={};c.r(d),c.d(d,{POST:()=>B,dynamic:()=>A});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211),w=c(95398),x=c(37827);async function y(a,b,c){let d=Array(a.length),e=0,f=Array.from({length:Math.min(b,a.length)},async()=>{for(;e<a.length;){let b=e;e+=1,d[b]=await c(a[b])}});return await Promise.all(f),d}async function z(a){let b=a.filter(a=>a.source.trim().startsWith("npm:"));return[...await y(b,4,async({source:a,installed:b})=>{let c=(0,x._n)(a.slice(4)).name,d=c?function(a){try{let b=(0,w.execFileSync)("npm",["view",a,"version","--json","--no-update-notifier"],{encoding:"utf8",timeout:3e4,stdio:["ignore","pipe","ignore"]}).trim(),c=JSON.parse(b);return"string"==typeof c&&c?c:null}catch{return null}}(c):null,e=null!==d&&null!==b&&d!==b&&function(a,b){let c=a.split(".").map(a=>parseInt(a,10)||0),d=b.split(".").map(a=>parseInt(a,10)||0);for(let a=0;a<Math.max(c.length,d.length);a++){let b=(c[a]??0)-(d[a]??0);if(0!==b)return b}return 0}(d,b)>0;return{source:a,installed:b,latest:d,hasUpdate:e}}),...a.filter(a=>!a.source.trim().startsWith("npm:")).map(a=>({source:a.source,installed:a.installed,latest:null,hasUpdate:!1}))]}let A="force-dynamic";async function B(a){try{let b=await a.json().catch(()=>({}));if(!Array.isArray(b.packages)||b.packages.length>200)return v.NextResponse.json({error:"packages must be an array (max 200)"},{status:400});let c=b.packages.filter(a=>"string"==typeof a?.source&&a.source).map(a=>({source:a.source.trim(),installed:"string"==typeof a.installed&&a.installed?a.installed:null})),d=await z(c);return v.NextResponse.json({updates:d})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let C=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/plugins/updates/route",pathname:"/api/plugins/updates",filename:"route",bundlePath:"app/api/plugins/updates/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/plugins/updates/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:D,workUnitAsyncStorage:E,serverHooks:F}=C;function G(){return(0,g.patchFetch)({workAsyncStorage:D,workUnitAsyncStorage:E})}async function H(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),C.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/plugins/updates/route";"/index"===d&&(d="/");let e=await C.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[F]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[F],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||C.isDev||z||(L="/index"===(L=F)?"/":L);let M=!0===C.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await C.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>C.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>C.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await C.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,B),b}},k=await C.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await C.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,B),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},89477:a=>{a.exports=require("node:fs")},95398:a=>{a.exports=require("node:child_process")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,8359],()=>b(b.s=87161));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=9560,a.ids=[9560],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},60396:(a,b,c)=>{"use strict";c.d(b,{$M:()=>f,CZ:()=>h,Mc:()=>g,pA:()=>i});var d=c(62228),e=c(86697);function f(a=process.env){let b=a.PI_CODING_AGENT_DIR?.trim();if(b)return"~"===b?(0,d.homedir)():b.startsWith("~/")||b.startsWith("~\\")?(0,e.join)((0,d.homedir)(),b.slice(2)):b;return(0,e.join)((0,d.homedir)(),".pi","agent")}function g(a=process.env){return(0,e.join)(f(a),"models.json")}function h(a=process.env){return(0,e.join)(f(a),"auth.json")}function i(a=process.env){return(0,e.join)(f(a),"settings.json")}},62228:a=>{"use strict";a.exports=require("node:os")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},89477:a=>{"use strict";a.exports=require("node:fs")},90964:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>K,patchFetch:()=>J,routeModule:()=>F,serverHooks:()=>I,workAsyncStorage:()=>G,workUnitAsyncStorage:()=>H});var d={};c.r(d),c.d(d,{GET:()=>D,PUT:()=>E,dynamic:()=>z});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211),w=c(89477),x=c(86697),y=c(60396);let z="force-dynamic";function A(){return(0,x.join)((0,y.$M)(),"pidance-preferences.json")}function B(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function C(){let a=A();if(!(0,w.existsSync)(a))return{};try{let b=JSON.parse((0,w.readFileSync)(a,"utf8"));return B(b)?b:{}}catch{return{}}}async function D(){try{return v.NextResponse.json({prefs:C()},{headers:{"Cache-Control":"no-store"}})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function E(a){try{let b=await a.json().catch(()=>({}));if(!B(b.prefs))return v.NextResponse.json({error:"prefs must be a JSON object"},{status:400});let c=JSON.stringify(b.prefs);if(Buffer.byteLength(c,"utf8")>1e6)return v.NextResponse.json({error:"preferences exceed 1000000 bytes"},{status:413});let d=C();return!function(a){let b=A(),c=(0,x.dirname)(b);(0,w.existsSync)(c)||(0,w.mkdirSync)(c,{recursive:!0,mode:448});let d=`${b}.${process.pid}.${Date.now()}.tmp`;try{(0,w.writeFileSync)(d,JSON.stringify(a,null,2),{flag:"wx",mode:384}),(0,w.renameSync)(d,b)}catch(a){try{(0,w.unlinkSync)(d)}catch{}throw a}}(function(a,b){let c={...a};for(let[a,d]of Object.entries(b))B(d)&&B(c[a])?c[a]={...c[a],...d}:c[a]=d;return c}(d,b.prefs)),v.NextResponse.json({ok:!0})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let F=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/preferences/route",pathname:"/api/preferences",filename:"route",bundlePath:"app/api/preferences/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/preferences/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:G,workUnitAsyncStorage:H,serverHooks:I}=F;function J(){return(0,g.patchFetch)({workAsyncStorage:G,workUnitAsyncStorage:H})}async function K(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),F.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/preferences/route";"/index"===d&&(d="/");let e=await F.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[E]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||F.isDev||z||(L="/index"===(L=E)?"/":L);let M=!0===F.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await F.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>F.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>F.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await F.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await F.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await F.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=90964));module.exports=c})();
1
+ (()=>{var a={};a.id=9560,a.ids=[9560],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},60396:(a,b,c)=>{"use strict";c.d(b,{$M:()=>f,CZ:()=>h,Mc:()=>g,pA:()=>i});var d=c(62228),e=c(86697);function f(a=process.env){let b=a.PI_CODING_AGENT_DIR?.trim();if(b)return"~"===b?(0,d.homedir)():b.startsWith("~/")||b.startsWith("~\\")?(0,e.join)((0,d.homedir)(),b.slice(2)):b;return(0,e.join)((0,d.homedir)(),".pi","agent")}function g(a=process.env){return(0,e.join)(f(a),"models.json")}function h(a=process.env){return(0,e.join)(f(a),"auth.json")}function i(a=process.env){return(0,e.join)(f(a),"settings.json")}},62228:a=>{"use strict";a.exports=require("node:os")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},88586:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>K,patchFetch:()=>J,routeModule:()=>F,serverHooks:()=>I,workAsyncStorage:()=>G,workUnitAsyncStorage:()=>H});var d={};c.r(d),c.d(d,{GET:()=>D,PUT:()=>E,dynamic:()=>z});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211),w=c(89477),x=c(86697),y=c(60396);let z="force-dynamic";function A(){return(0,x.join)((0,y.$M)(),"pidance-preferences.json")}function B(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function C(){let a=A();if(!(0,w.existsSync)(a))return{};try{let b=JSON.parse((0,w.readFileSync)(a,"utf8"));return B(b)?b:{}}catch{return{}}}async function D(){try{return v.NextResponse.json({prefs:C()},{headers:{"Cache-Control":"no-store"}})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function E(a){try{let b=await a.json().catch(()=>({}));if(!B(b.prefs))return v.NextResponse.json({error:"prefs must be a JSON object"},{status:400});let c=JSON.stringify(b.prefs);if(Buffer.byteLength(c,"utf8")>1e6)return v.NextResponse.json({error:"preferences exceed 1000000 bytes"},{status:413});let d=C();return!function(a){let b=A(),c=(0,x.dirname)(b);(0,w.existsSync)(c)||(0,w.mkdirSync)(c,{recursive:!0,mode:448});let d=`${b}.${process.pid}.${Date.now()}.tmp`;try{(0,w.writeFileSync)(d,JSON.stringify(a,null,2),{flag:"wx",mode:384}),(0,w.renameSync)(d,b)}catch(a){try{(0,w.unlinkSync)(d)}catch{}throw a}}(function(a,b){let c={...a};for(let[a,d]of Object.entries(b))B(d)&&B(c[a])?c[a]={...c[a],...d}:c[a]=d;return c}(d,b.prefs)),v.NextResponse.json({ok:!0})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let F=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/preferences/route",pathname:"/api/preferences",filename:"route",bundlePath:"app/api/preferences/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/preferences/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:G,workUnitAsyncStorage:H,serverHooks:I}=F;function J(){return(0,g.patchFetch)({workAsyncStorage:G,workUnitAsyncStorage:H})}async function K(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),F.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/preferences/route";"/index"===d&&(d="/");let e=await F.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[E]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||F.isDev||z||(L="/index"===(L=E)?"/":L);let M=!0===F.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await F.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>F.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>F.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await F.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await F.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await F.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},89477:a=>{"use strict";a.exports=require("node:fs")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=88586));module.exports=c})();
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var a={};a.id=4133,a.ids=[4133],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31940:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(89516),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/project-assets/route",pathname:"/api/project-assets",filename:"route",bundlePath:"app/api/project-assets/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/project-assets/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/project-assets/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},69835:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Lj:()=>p,Md:()=>o,eq:()=>l,ki:()=>n,qo:()=>k,uF:()=>m});var e=c(29021),f=c(33873),g=c(55511),h=c(60396),i=c(80547),j=a([i]);i=(j.then?(await j)():j)[0];let o=0x1900000,p=0x6400000;function k(a=(0,h.$M)()){return(0,i.Nw)((0,f.join)(a,"pidance-attachments"))}function l(a=(0,h.$M)()){let b=k(a);return(0,e.existsSync)(b)||(0,e.mkdirSync)(b,{recursive:!0,mode:448}),(0,i.wz)(b),b}function m(a){let b=(a.replace(/\\/g,"/").split("/").pop()??"file").replace(/\0/g,"").replace(/^\.+/,"").trim()||"file";if(b.length<=180)return b;let c=b.lastIndexOf(".");if(c>0&&b.length-c<=20){let a=b.slice(c);return b.slice(0,180-a.length)+a}return b.slice(0,180)}function n(a,b,c=(0,h.$M)()){let d=l(c),j=function(a,b=Date.now()){let c=m(a),d=new Date(b).toISOString().replace(/[:.]/g,"-"),e=(0,g.randomUUID)().slice(0,8);return`${d}_${e}_${c}`}(a),k=(0,f.join)(d,j);return(0,e.writeFileSync)(k,b,{flag:"wx",mode:384}),{path:(0,i.Nw)(k),name:m(a),storedName:j,size:b.length}}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},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$:()=>q,Nw:()=>j.Nw,mc:()=>p,uK:()=>o,wz:()=>k.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(60396),j=c(50593),k=c(25252),l=c(69835),m=c(40402),n=a([l,m]);[l,m]=n.then?(await n)():n;let r=/^[a-zA-Z]:[\\/]/;function o(a){return r.test(a)||a.startsWith("\\\\")||a.startsWith("//")}async function p(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,m.dQ)(),d=function(a){let b=new Set;for(let c of a)!0!==c.readOnly&&c.cwd&&b.add((0,j.Nw)(c.cwd)),!0!==c.readOnly&&c.projectRoot&&b.add((0,j.Nw)(c.projectRoot));return b}(c);try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,j.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,k.HM)())d.add(a);try{d.add((0,l.qo)((0,i.$M)()))}catch{}return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function q(a,b){for(let c of b){let b=o(a)||o(c),d=b?h().win32:h(),e=b?"\\":h().sep,f=d.resolve(a),g=d.resolve(c),i=b?f.toLowerCase():f,j=b?g.toLowerCase():g,k=j.endsWith(e)?j:j+e;if(i===j||i.startsWith(k))return!0}return!1}d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")},89516:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>m,POST:()=>n,dynamic:()=>o});var e=c(23211),f=c(89477),g=c(86697),h=c(80547),i=a([h]);h=(i.then?(await i)():i)[0];let o="force-dynamic",p=/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/;function j(a){return(0,g.join)((0,g.resolve)(a),".agents","skills")}async function k(a){if("string"!=typeof a||!a)return"cwd is required";let b=await (0,h.mc)();return(0,h.A$)(a,b)?null:"cwd is not in allowed roots"}function l(a){try{return(0,f.readFileSync)(a,"utf8")}catch{return""}}async function m(a){try{let b=new URL(a.url).searchParams.get("cwd")??"",c=await k(b);if(c)return e.NextResponse.json({error:c},{status:403});let d=(0,g.join)((0,g.resolve)(b),"AGENTS.md"),h=(0,f.existsSync)(d)?l(d):"",i=function(a){let b,c=j(a);if(!(0,f.existsSync)(c))return[];try{b=(0,f.readdirSync)(c)}catch{return[]}let d=[];for(let a of b){let b=(0,g.join)(c,a);try{if(!(0,f.statSync)(b).isDirectory())continue}catch{continue}let e=(0,g.join)(b,"SKILL.md");if(!(0,f.existsSync)(e))continue;let h=l(e);d.push({name:a,enabled:!/^\s*disable-model-invocation:\s*true\s*$/m.test(h),content:h})}return d.sort((a,b)=>a.name.localeCompare(b.name))}(b);return e.NextResponse.json({rulesPath:d,rulesExists:(0,f.existsSync)(d),rulesContent:h,skills:i},{headers:{"Cache-Control":"no-store"}})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function n(a){try{let b=await a.json().catch(()=>({})),c="string"==typeof b.cwd?b.cwd:"",d=await k(c);if(d)return e.NextResponse.json({error:d},{status:403});let h=b.kind;if("rules"===h){let a=b.content;if("string"!=typeof a)return e.NextResponse.json({error:"content must be a string"},{status:400});if(Buffer.byteLength(a,"utf8")>524288)return e.NextResponse.json({error:"content too large"},{status:413});let d=(0,g.join)((0,g.resolve)(c),"AGENTS.md");(0,f.mkdirSync)((0,g.dirname)(d),{recursive:!0});let h=`${d}.${process.pid}.${Date.now()}.tmp`;try{(0,f.writeFileSync)(h,a,{flag:"wx",mode:420}),(0,f.renameSync)(h,d)}catch(a){try{(0,f.unlinkSync)(h)}catch{}throw a}return e.NextResponse.json({ok:!0})}if("skill"===h){let a,d,h=b.action,i="string"==typeof b.name?b.name.trim():"";if(!i||!p.test(i))return e.NextResponse.json({error:"invalid skill name"},{status:400});let k=(0,g.join)(j(c),i),m=(0,g.join)(k,"SKILL.md");if(a=(0,g.resolve)(c),d=(0,g.relative)(a,(0,g.resolve)(m)),""===d||d.startsWith("..")||(0,g.resolve)(m).startsWith(`${a}${g.sep}`))return e.NextResponse.json({error:"skill path escapes project"},{status:403});if("create"===h){if((0,f.existsSync)(m))return e.NextResponse.json({error:"skill already exists"},{status:409});(0,f.mkdirSync)(k,{recursive:!0});let a=`---
1
+ "use strict";(()=>{var a={};a.id=4133,a.ids=[4133],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},43168:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(89516),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/project-assets/route",pathname:"/api/project-assets",filename:"route",bundlePath:"app/api/project-assets/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/project-assets/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/project-assets/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},69835:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Lj:()=>p,Md:()=>o,eq:()=>l,ki:()=>n,qo:()=>k,uF:()=>m});var e=c(29021),f=c(33873),g=c(55511),h=c(60396),i=c(80547),j=a([i]);i=(j.then?(await j)():j)[0];let o=0x1900000,p=0x6400000;function k(a=(0,h.$M)()){return(0,i.Nw)((0,f.join)(a,"pidance-attachments"))}function l(a=(0,h.$M)()){let b=k(a);return(0,e.existsSync)(b)||(0,e.mkdirSync)(b,{recursive:!0,mode:448}),(0,i.wz)(b),b}function m(a){let b=(a.replace(/\\/g,"/").split("/").pop()??"file").replace(/\0/g,"").replace(/^\.+/,"").trim()||"file";if(b.length<=180)return b;let c=b.lastIndexOf(".");if(c>0&&b.length-c<=20){let a=b.slice(c);return b.slice(0,180-a.length)+a}return b.slice(0,180)}function n(a,b,c=(0,h.$M)()){let d=l(c),j=function(a,b=Date.now()){let c=m(a),d=new Date(b).toISOString().replace(/[:.]/g,"-"),e=(0,g.randomUUID)().slice(0,8);return`${d}_${e}_${c}`}(a),k=(0,f.join)(d,j);return(0,e.writeFileSync)(k,b,{flag:"wx",mode:384}),{path:(0,i.Nw)(k),name:m(a),storedName:j,size:b.length}}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},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$:()=>q,Nw:()=>j.Nw,mc:()=>p,uK:()=>o,wz:()=>k.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(60396),j=c(50593),k=c(25252),l=c(69835),m=c(40402),n=a([l,m]);[l,m]=n.then?(await n)():n;let r=/^[a-zA-Z]:[\\/]/;function o(a){return r.test(a)||a.startsWith("\\\\")||a.startsWith("//")}async function p(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,m.dQ)(),d=function(a){let b=new Set;for(let c of a)!0!==c.readOnly&&c.cwd&&b.add((0,j.Nw)(c.cwd)),!0!==c.readOnly&&c.projectRoot&&b.add((0,j.Nw)(c.projectRoot));return b}(c);try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,j.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,k.HM)())d.add(a);try{d.add((0,l.qo)((0,i.$M)()))}catch{}return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function q(a,b){for(let c of b){let b=o(a)||o(c),d=b?h().win32:h(),e=b?"\\":h().sep,f=d.resolve(a),g=d.resolve(c),i=b?f.toLowerCase():f,j=b?g.toLowerCase():g,k=j.endsWith(e)?j:j+e;if(i===j||i.startsWith(k))return!0}return!1}d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")},89516:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>m,POST:()=>n,dynamic:()=>o});var e=c(23211),f=c(89477),g=c(86697),h=c(80547),i=a([h]);h=(i.then?(await i)():i)[0];let o="force-dynamic",p=/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/;function j(a){return(0,g.join)((0,g.resolve)(a),".agents","skills")}async function k(a){if("string"!=typeof a||!a)return"cwd is required";let b=await (0,h.mc)();return(0,h.A$)(a,b)?null:"cwd is not in allowed roots"}function l(a){try{return(0,f.readFileSync)(a,"utf8")}catch{return""}}async function m(a){try{let b=new URL(a.url).searchParams.get("cwd")??"",c=await k(b);if(c)return e.NextResponse.json({error:c},{status:403});let d=(0,g.join)((0,g.resolve)(b),"AGENTS.md"),h=(0,f.existsSync)(d)?l(d):"",i=function(a){let b,c=j(a);if(!(0,f.existsSync)(c))return[];try{b=(0,f.readdirSync)(c)}catch{return[]}let d=[];for(let a of b){let b=(0,g.join)(c,a);try{if(!(0,f.statSync)(b).isDirectory())continue}catch{continue}let e=(0,g.join)(b,"SKILL.md");if(!(0,f.existsSync)(e))continue;let h=l(e);d.push({name:a,enabled:!/^\s*disable-model-invocation:\s*true\s*$/m.test(h),content:h})}return d.sort((a,b)=>a.name.localeCompare(b.name))}(b);return e.NextResponse.json({rulesPath:d,rulesExists:(0,f.existsSync)(d),rulesContent:h,skills:i},{headers:{"Cache-Control":"no-store"}})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function n(a){try{let b=await a.json().catch(()=>({})),c="string"==typeof b.cwd?b.cwd:"",d=await k(c);if(d)return e.NextResponse.json({error:d},{status:403});let h=b.kind;if("rules"===h){let a=b.content;if("string"!=typeof a)return e.NextResponse.json({error:"content must be a string"},{status:400});if(Buffer.byteLength(a,"utf8")>524288)return e.NextResponse.json({error:"content too large"},{status:413});let d=(0,g.join)((0,g.resolve)(c),"AGENTS.md");(0,f.mkdirSync)((0,g.dirname)(d),{recursive:!0});let h=`${d}.${process.pid}.${Date.now()}.tmp`;try{(0,f.writeFileSync)(h,a,{flag:"wx",mode:420}),(0,f.renameSync)(h,d)}catch(a){try{(0,f.unlinkSync)(h)}catch{}throw a}return e.NextResponse.json({ok:!0})}if("skill"===h){let a,d,h=b.action,i="string"==typeof b.name?b.name.trim():"";if(!i||!p.test(i))return e.NextResponse.json({error:"invalid skill name"},{status:400});let k=(0,g.join)(j(c),i),m=(0,g.join)(k,"SKILL.md");if(a=(0,g.resolve)(c),d=(0,g.relative)(a,(0,g.resolve)(m)),""===d||d.startsWith("..")||(0,g.resolve)(m).startsWith(`${a}${g.sep}`))return e.NextResponse.json({error:"skill path escapes project"},{status:403});if("create"===h){if((0,f.existsSync)(m))return e.NextResponse.json({error:"skill already exists"},{status:409});(0,f.mkdirSync)(k,{recursive:!0});let a=`---
2
2
  name: ${i}
3
3
  description: ${i} skill
4
4
  ---
@@ -10,4 +10,4 @@ description: ${i} skill
10
10
  disable-model-invocation: true
11
11
  ---
12
12
 
13
- ${c}`;let d=`${m}.${process.pid}.${Date.now()}.tmp`;try{(0,f.writeFileSync)(d,c,{flag:"wx",mode:420}),(0,f.renameSync)(d,m)}catch(a){try{(0,f.unlinkSync)(d)}catch{}throw a}return e.NextResponse.json({ok:!0})}if("delete"===h){if(!(0,f.existsSync)(m))return e.NextResponse.json({error:"skill not found"},{status:404});(0,f.unlinkSync)(m);try{(0,f.readdirSync)(k),function(a){try{0===(0,f.readdirSync)(a).length&&(0,f.rmdirSync)(a)}catch{}}(k)}catch{}return e.NextResponse.json({ok:!0})}return e.NextResponse.json({error:"unknown skill action"},{status:400})}return e.NextResponse.json({error:"kind must be rules | skill"},{status:400})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=31940));module.exports=c})();
13
+ ${c}`;let d=`${m}.${process.pid}.${Date.now()}.tmp`;try{(0,f.writeFileSync)(d,c,{flag:"wx",mode:420}),(0,f.renameSync)(d,m)}catch(a){try{(0,f.unlinkSync)(d)}catch{}throw a}return e.NextResponse.json({ok:!0})}if("delete"===h){if(!(0,f.existsSync)(m))return e.NextResponse.json({error:"skill not found"},{status:404});(0,f.unlinkSync)(m);try{(0,f.readdirSync)(k),function(a){try{0===(0,f.readdirSync)(a).length&&(0,f.rmdirSync)(a)}catch{}}(k)}catch{}return e.NextResponse.json({ok:!0})}return e.NextResponse.json({error:"unknown skill action"},{status:400})}return e.NextResponse.json({error:"kind must be rules | skill"},{status:400})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582],()=>b(b.s=43168));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=4459,a.ids=[4459],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},60396:(a,b,c)=>{"use strict";c.d(b,{$M:()=>f,CZ:()=>h,Mc:()=>g,pA:()=>i});var d=c(62228),e=c(86697);function f(a=process.env){let b=a.PI_CODING_AGENT_DIR?.trim();if(b)return"~"===b?(0,d.homedir)():b.startsWith("~/")||b.startsWith("~\\")?(0,e.join)((0,d.homedir)(),b.slice(2)):b;return(0,e.join)((0,d.homedir)(),".pi","agent")}function g(a=process.env){return(0,e.join)(f(a),"models.json")}function h(a=process.env){return(0,e.join)(f(a),"auth.json")}function i(a=process.env){return(0,e.join)(f(a),"settings.json")}},62228:a=>{"use strict";a.exports=require("node:os")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},74222:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>K,patchFetch:()=>J,routeModule:()=>F,serverHooks:()=>I,workAsyncStorage:()=>G,workUnitAsyncStorage:()=>H});var d={};c.r(d),c.d(d,{GET:()=>D,PUT:()=>E,dynamic:()=>A});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211),w=c(89477),x=c(86697),y=c(60396);let z={system:"SYSTEM.md",systemAppend:"APPEND_SYSTEM.md",agents:"AGENTS.md"},A="force-dynamic";function B(){return(0,x.join)((0,y.$M)(),"pidance-prompt-drafts.json")}function C(){let a=B();if(!(0,w.existsSync)(a))return{};try{let b=JSON.parse((0,w.readFileSync)(a,"utf8"));if("object"==typeof b&&null!==b&&!Array.isArray(b))return b}catch{}return{}}async function D(){try{let a=(0,y.$M)(),b=C(),c=Object.keys(z).map(c=>{let d=(0,x.join)(a,z[c]),e=(0,w.existsSync)(d),f=e?(()=>{try{return(0,w.readFileSync)(d,"utf8")}catch{return b[c]??""}})():b[c]??"";return{key:c,enabled:e,content:f}});return v.NextResponse.json({entries:c},{headers:{"Cache-Control":"no-store"}})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function E(a){try{var b;let c=await a.json().catch(()=>({}));if(b=c.key,"string"!=typeof b||"system"!==b&&"systemAppend"!==b&&"agents"!==b)return v.NextResponse.json({error:"key must be system | systemAppend | agents"},{status:400});if(void 0!==c.enabled&&"boolean"!=typeof c.enabled)return v.NextResponse.json({error:"enabled must be a boolean"},{status:400});if(void 0!==c.content&&"string"!=typeof c.content)return v.NextResponse.json({error:"content must be a string"},{status:400});if(c.content&&Buffer.byteLength(c.content,"utf8")>524288)return v.NextResponse.json({error:"content exceeds 524288 bytes"},{status:413});let d=c.key,e=(0,y.$M)(),f=(0,x.join)(e,z[d]),g=C(),h=c.enabled??(0,w.existsSync)(f);void 0!==c.content&&(c.content?g[d]=c.content:delete g[d]);let i=B(),j=(0,x.dirname)(i);(0,w.existsSync)(j)||(0,w.mkdirSync)(j,{recursive:!0,mode:448});let k=`${i}.${process.pid}.${Date.now()}.tmp`;try{(0,w.writeFileSync)(k,JSON.stringify(g,null,2),{flag:"wx",mode:384}),(0,w.renameSync)(k,i)}catch(a){try{(0,w.unlinkSync)(k)}catch{}throw a}if(h){let a=c.content??g[d];null!=a?((0,w.mkdirSync)((0,x.dirname)(f),{recursive:!0}),(0,w.writeFileSync)(f,a,"utf8")):(0,w.existsSync)(f)||(0,w.writeFileSync)(f,"","utf8")}else(0,w.existsSync)(f)&&(0,w.unlinkSync)(f);return v.NextResponse.json({ok:!0})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let F=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/prompts/route",pathname:"/api/prompts",filename:"route",bundlePath:"app/api/prompts/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/prompts/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:G,workUnitAsyncStorage:H,serverHooks:I}=F;function J(){return(0,g.patchFetch)({workAsyncStorage:G,workUnitAsyncStorage:H})}async function K(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),F.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/prompts/route";"/index"===d&&(d="/");let e=await F.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[E]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||F.isDev||z||(L="/index"===(L=E)?"/":L);let M=!0===F.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await F.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>F.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>F.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await F.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await F.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await F.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},89477:a=>{"use strict";a.exports=require("node:fs")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=74222));module.exports=c})();
1
+ (()=>{var a={};a.id=4459,a.ids=[4459],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},60396:(a,b,c)=>{"use strict";c.d(b,{$M:()=>f,CZ:()=>h,Mc:()=>g,pA:()=>i});var d=c(62228),e=c(86697);function f(a=process.env){let b=a.PI_CODING_AGENT_DIR?.trim();if(b)return"~"===b?(0,d.homedir)():b.startsWith("~/")||b.startsWith("~\\")?(0,e.join)((0,d.homedir)(),b.slice(2)):b;return(0,e.join)((0,d.homedir)(),".pi","agent")}function g(a=process.env){return(0,e.join)(f(a),"models.json")}function h(a=process.env){return(0,e.join)(f(a),"auth.json")}function i(a=process.env){return(0,e.join)(f(a),"settings.json")}},62228:a=>{"use strict";a.exports=require("node:os")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},76574:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>K,patchFetch:()=>J,routeModule:()=>F,serverHooks:()=>I,workAsyncStorage:()=>G,workUnitAsyncStorage:()=>H});var d={};c.r(d),c.d(d,{GET:()=>D,PUT:()=>E,dynamic:()=>A});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211),w=c(89477),x=c(86697),y=c(60396);let z={system:"SYSTEM.md",systemAppend:"APPEND_SYSTEM.md",agents:"AGENTS.md"},A="force-dynamic";function B(){return(0,x.join)((0,y.$M)(),"pidance-prompt-drafts.json")}function C(){let a=B();if(!(0,w.existsSync)(a))return{};try{let b=JSON.parse((0,w.readFileSync)(a,"utf8"));if("object"==typeof b&&null!==b&&!Array.isArray(b))return b}catch{}return{}}async function D(){try{let a=(0,y.$M)(),b=C(),c=Object.keys(z).map(c=>{let d=(0,x.join)(a,z[c]),e=(0,w.existsSync)(d),f=e?(()=>{try{return(0,w.readFileSync)(d,"utf8")}catch{return b[c]??""}})():b[c]??"";return{key:c,enabled:e,content:f}});return v.NextResponse.json({entries:c},{headers:{"Cache-Control":"no-store"}})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function E(a){try{var b;let c=await a.json().catch(()=>({}));if(b=c.key,"string"!=typeof b||"system"!==b&&"systemAppend"!==b&&"agents"!==b)return v.NextResponse.json({error:"key must be system | systemAppend | agents"},{status:400});if(void 0!==c.enabled&&"boolean"!=typeof c.enabled)return v.NextResponse.json({error:"enabled must be a boolean"},{status:400});if(void 0!==c.content&&"string"!=typeof c.content)return v.NextResponse.json({error:"content must be a string"},{status:400});if(c.content&&Buffer.byteLength(c.content,"utf8")>524288)return v.NextResponse.json({error:"content exceeds 524288 bytes"},{status:413});let d=c.key,e=(0,y.$M)(),f=(0,x.join)(e,z[d]),g=C(),h=c.enabled??(0,w.existsSync)(f);void 0!==c.content&&(c.content?g[d]=c.content:delete g[d]);let i=B(),j=(0,x.dirname)(i);(0,w.existsSync)(j)||(0,w.mkdirSync)(j,{recursive:!0,mode:448});let k=`${i}.${process.pid}.${Date.now()}.tmp`;try{(0,w.writeFileSync)(k,JSON.stringify(g,null,2),{flag:"wx",mode:384}),(0,w.renameSync)(k,i)}catch(a){try{(0,w.unlinkSync)(k)}catch{}throw a}if(h){let a=c.content??g[d];null!=a?((0,w.mkdirSync)((0,x.dirname)(f),{recursive:!0}),(0,w.writeFileSync)(f,a,"utf8")):(0,w.existsSync)(f)||(0,w.writeFileSync)(f,"","utf8")}else(0,w.existsSync)(f)&&(0,w.unlinkSync)(f);return v.NextResponse.json({ok:!0})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let F=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/prompts/route",pathname:"/api/prompts",filename:"route",bundlePath:"app/api/prompts/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/prompts/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:G,workUnitAsyncStorage:H,serverHooks:I}=F;function J(){return(0,g.patchFetch)({workAsyncStorage:G,workUnitAsyncStorage:H})}async function K(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),F.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/prompts/route";"/index"===d&&(d="/");let e=await F.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:z,prerenderManifest:A,routerServerContext:B,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,resolvedPathname:E,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[E]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[E],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||F.isDev||z||(L="/index"===(L=E)?"/":L);let M=!0===F.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==B?void 0:B.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await F.getIncrementalCache(a,x,A,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>F.onRequestError(a,b,d,e,B)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>F.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&C&&D&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await F.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await F.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:D,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",C?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),z&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await F.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},89477:a=>{"use strict";a.exports=require("node:fs")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=76574));module.exports=c})();
@@ -1,3 +1,3 @@
1
- (()=>{var a={};a.id=5403,a.ids=[5403],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14566:a=>{"use strict";a.exports=require("node-pty")},15086:a=>{"use strict";a.exports=require("ws")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63678:(a,b,c)=>{"use strict";let{existsSync:d,realpathSync:e}=c(29021),{WebSocketServer:f}=c(15086),g=new f({noServer:!0});function h(){try{let a=c(14566);if("function"!=typeof a.spawn)return null;return a}catch{return null}}function i(a){if(!d(a))throw Error("PTY cwd 不存在");return e(a)}function j(a,b){let{spawn:d}=c(79646),e=c(33873).join(__dirname,"pty-worker.js"),f=d(process.execPath,[e,b,"80","24"],{stdio:["pipe","pipe","pipe"],env:process.env});f.stderr.setEncoding("utf8"),f.stderr.on("data",a=>console.warn("[pidance] pty-worker stderr",a)),f.on("error",a=>console.warn("[pidance] pty-worker spawn",a.message));let g={pid:f.pid,write:a=>f.stdin.write(`${JSON.stringify({type:"in",d:a})}
1
+ (()=>{var a={};a.id=5403,a.ids=[5403],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")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14566:a=>{"use strict";a.exports=require("node-pty")},15086:a=>{"use strict";a.exports=require("ws")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},59281:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{GET:()=>y,dynamic:()=>x});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211);let{tryLoadNodePty:w}=c(63678),x="force-dynamic";async function y(){return v.NextResponse.json({available:null!==w()})}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/pty/route",pathname:"/api/pty",filename:"route",bundlePath:"app/api/pty/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/pty/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/pty/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},63678:(a,b,c)=>{"use strict";let{existsSync:d,realpathSync:e}=c(29021),{WebSocketServer:f}=c(15086),g=new f({noServer:!0});function h(){try{let a=c(14566);if("function"!=typeof a.spawn)return null;return a}catch{return null}}function i(a){if(!d(a))throw Error("PTY cwd 不存在");return e(a)}function j(a,b){let{spawn:d}=c(79646),e=c(33873).join(__dirname,"pty-worker.js"),f=d(process.execPath,[e,b,"80","24"],{stdio:["pipe","pipe","pipe"],env:process.env});f.stderr.setEncoding("utf8"),f.stderr.on("data",a=>console.warn("[pidance] pty-worker stderr",a)),f.on("error",a=>console.warn("[pidance] pty-worker spawn",a.message));let g={pid:f.pid,write:a=>f.stdin.write(`${JSON.stringify({type:"in",d:a})}
2
2
  `),resize:(a,b)=>f.stdin.write(`${JSON.stringify({type:"rs",cols:a,rows:b})}
3
- `),dispose:()=>{try{f.kill("SIGTERM")}catch{}}};f.stdout.setEncoding("utf8");let h="";f.stdout.on("data",b=>{let c;for(h+="string"==typeof b?b:Buffer.from(b).toString("utf8");(c=h.indexOf("\n"))>=0;){let b=h.slice(0,c);if(h=h.slice(c+1),b)try{let c=JSON.parse(b);c&&"out"===c.type&&"string"==typeof c.d&&a.send(JSON.stringify({type:"out",d:c.d}))}catch{try{a.send(b)}catch{}}}}),f.on("exit",b=>{try{1===a.readyState&&(a.send(JSON.stringify({type:"exit",code:b??0})),a.close())}catch{}}),a.on("message",a=>{let b,c="string"==typeof a?a:a.toString();try{b=JSON.parse(c)}catch{return}b&&"in"===b.type&&"string"==typeof b.d&&g.write(b.d),b&&"rs"===b.type&&b.cols>0&&b.rows>0&&g.resize(b.cols,b.rows)}),a.on("close",()=>g.dispose()),a.on("error",()=>g.dispose());try{a.send(JSON.stringify({type:"out",d:"\r\n[pidance] terminal ready\r\n"}))}catch{}return g}a.exports={startPtySession:function(a){let b,c=void 0===a.pty?h():a.pty;if(!c)throw Error("node-pty 不可用");let d=i(a.cwd),e=a.cols&&a.cols>0?a.cols:80,f=a.rows&&a.rows>0?a.rows:24,g=process.env.SHELL&&process.env.SHELL.length>0?process.env.SHELL:"/bin/bash",j=c.spawn(g,[],{name:"xterm-256color",cols:e,rows:f,cwd:d,env:(b={...a.env??process.env},delete b.PI_WEB_PASSWORD,delete b.PIDANCE_PASSWORD,b)}),k=!1,l=b=>{if(!k){let c="string"==typeof b?b:b.toString();a.onData(c)}};"function"==typeof j.on?j.on("data",l):"function"==typeof j.onData&&j.onData(l);let m=b=>{k||a.onExit("object"==typeof b&&b?b.exitCode:0)};return"function"==typeof j.on?j.on("exit",m):"function"==typeof j.onExit&&j.onExit(m),{pid:j.pid,write:a=>{k||j.write(a)},resize:(a,b)=>{!k&&a>0&&b>0&&j.resize(a,b)},dispose:()=>{if(!k){k=!0;try{j.pid>0&&process.kill(-j.pid,"SIGTERM")}catch{}try{j.kill("SIGTERM")}catch{}}}}},tryLoadNodePty:h,resolvePtyCwd:i,attachPtyToWebSocket:j,completePtyUpgrade:function(a,b,c,d){g.handleUpgrade(a,b,c,b=>{g.emit("connection",b,a),j(b,d)})}}},66637:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>E,patchFetch:()=>D,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var d={};c.r(d),c.d(d,{GET:()=>y,dynamic:()=>x});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(23211);let{tryLoadNodePty:w}=c(63678),x="force-dynamic";async function y(){return v.NextResponse.json({available:null!==w()})}let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/pty/route",pathname:"/api/pty",filename:"route",bundlePath:"app/api/pty/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/pty/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function D(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function E(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/pty/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=66637));module.exports=c})();
3
+ `),dispose:()=>{try{f.kill("SIGTERM")}catch{}}};f.stdout.setEncoding("utf8");let h="";f.stdout.on("data",b=>{let c;for(h+="string"==typeof b?b:Buffer.from(b).toString("utf8");(c=h.indexOf("\n"))>=0;){let b=h.slice(0,c);if(h=h.slice(c+1),b)try{let c=JSON.parse(b);c&&"out"===c.type&&"string"==typeof c.d&&a.send(JSON.stringify({type:"out",d:c.d}))}catch{try{a.send(b)}catch{}}}}),f.on("exit",b=>{try{1===a.readyState&&(a.send(JSON.stringify({type:"exit",code:b??0})),a.close())}catch{}}),a.on("message",a=>{let b,c="string"==typeof a?a:a.toString();try{b=JSON.parse(c)}catch{return}b&&"in"===b.type&&"string"==typeof b.d&&g.write(b.d),b&&"rs"===b.type&&b.cols>0&&b.rows>0&&g.resize(b.cols,b.rows)}),a.on("close",()=>g.dispose()),a.on("error",()=>g.dispose());try{a.send(JSON.stringify({type:"out",d:"\r\n[pidance] terminal ready\r\n"}))}catch{}return g}a.exports={startPtySession:function(a){let b,c=void 0===a.pty?h():a.pty;if(!c)throw Error("node-pty 不可用");let d=i(a.cwd),e=a.cols&&a.cols>0?a.cols:80,f=a.rows&&a.rows>0?a.rows:24,g=process.env.SHELL&&process.env.SHELL.length>0?process.env.SHELL:"/bin/bash",j=c.spawn(g,[],{name:"xterm-256color",cols:e,rows:f,cwd:d,env:(b={...a.env??process.env},delete b.PI_WEB_PASSWORD,delete b.PIDANCE_PASSWORD,b)}),k=!1,l=b=>{if(!k){let c="string"==typeof b?b:b.toString();a.onData(c)}};"function"==typeof j.on?j.on("data",l):"function"==typeof j.onData&&j.onData(l);let m=b=>{k||a.onExit("object"==typeof b&&b?b.exitCode:0)};return"function"==typeof j.on?j.on("exit",m):"function"==typeof j.onExit&&j.onExit(m),{pid:j.pid,write:a=>{k||j.write(a)},resize:(a,b)=>{!k&&a>0&&b>0&&j.resize(a,b)},dispose:()=>{if(!k){k=!0;try{j.pid>0&&process.kill(-j.pid,"SIGTERM")}catch{}try{j.kill("SIGTERM")}catch{}}}}},tryLoadNodePty:h,resolvePtyCwd:i,attachPtyToWebSocket:j,completePtyUpgrade:function(a,b,c,d){g.handleUpgrade(a,b,c,b=>{g.emit("connection",b,a),j(b,d)})}}},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=59281));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=7074,a.ids=[7074],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14274:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(82181),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/archive/route",pathname:"/api/sessions/[id]/archive",filename:"route",bundlePath:"app/api/sessions/[id]/archive/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/sessions/[id]/archive/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/archive/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},82181:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>k,POST:()=>j,dynamic:()=>l});var e=c(23211),f=c(37594),g=c(40239),h=a([f]);f=(h.then?(await h)():h)[0];let l="force-dynamic";async function i(a){let{id:b}=await a;return b}async function j(a,{params:b}){let c=await i(b);try{let a=await f.mB.archiveSession(c);return e.NextResponse.json({sessionId:c,archivedAt:a})}catch(a){if(a instanceof g.J3)return e.NextResponse.json({error:a.message},{status:409});if(String(a)===f.DQ)return e.NextResponse.json({error:f.DQ},{status:403});if(String(a).includes("Session not found"))return e.NextResponse.json({error:String(a)},{status:404});return e.NextResponse.json({error:String(a)},{status:500})}}async function k(a,{params:b}){let c=await i(b);try{let a=await f.mB.restoreSession(c);if(!a)return e.NextResponse.json({error:"Session not found"},{status:404});return e.NextResponse.json({session:a})}catch(a){if(String(a).includes("Session is not archived")||String(a).includes("Session not found"))return e.NextResponse.json({error:String(a)},{status:404});return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582,7594],()=>b(b.s=14274));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=7074,a.ids=[7074],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},2786:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(82181),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/archive/route",pathname:"/api/sessions/[id]/archive",filename:"route",bundlePath:"app/api/sessions/[id]/archive/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/sessions/[id]/archive/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/archive/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},82181:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>k,POST:()=>j,dynamic:()=>l});var e=c(23211),f=c(37594),g=c(40239),h=a([f]);f=(h.then?(await h)():h)[0];let l="force-dynamic";async function i(a){let{id:b}=await a;return b}async function j(a,{params:b}){let c=await i(b);try{let a=await f.mB.archiveSession(c);return e.NextResponse.json({sessionId:c,archivedAt:a})}catch(a){if(a instanceof g.J3)return e.NextResponse.json({error:a.message},{status:409});if(String(a)===f.DQ)return e.NextResponse.json({error:f.DQ},{status:403});if(String(a).includes("Session not found"))return e.NextResponse.json({error:String(a)},{status:404});return e.NextResponse.json({error:String(a)},{status:500})}}async function k(a,{params:b}){let c=await i(b);try{let a=await f.mB.restoreSession(c);if(!a)return e.NextResponse.json({error:"Session not found"},{status:404});return e.NextResponse.json({session:a})}catch(a){if(String(a).includes("Session is not archived")||String(a).includes("Session not found"))return e.NextResponse.json({error:String(a)},{status:404});return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582,7594],()=>b(b.s=2786));module.exports=c})();
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var a={};a.id=2835,a.ids=[2835],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},16970:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(25846),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/auto-name/route",pathname:"/api/sessions/[id]/auto-name",filename:"route",bundlePath:"app/api/sessions/[id]/auto-name/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/sessions/[id]/auto-name/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/auto-name/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},21820:a=>{a.exports=require("os")},25846:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>k});var e=c(23211),f=c(79495),g=c(40402),h=c(37594),i=c(95237),j=a([g,h,i]);async function k(a,{params:b}){let{id:c}=await b;try{let a=await h.mB.ensureLive(c);await a.waitUntilReady?.();let b=await (0,g.os)(c);if(!b)throw Error("Session not found");let{messages:d}=(0,i.kW)(b).buildSessionContext(),j=(0,f.CL)(),k=await (0,f.K)({messages:d,provider:j.provider,modelId:j.modelId,baseUrl:j.baseUrl,api:j.api,apiKey:j.apiKey,headers:j.headers});if(!a.isAlive())return e.NextResponse.json({error:"The session was closed while its title was being generated. Please try again."},{status:409});try{await a.send({type:"set_session_name",name:k.title})}catch{let b=a.sessionFile;if(!b)throw Error("Session file is missing");a.isAlive()&&h.mB.destroy(c),(0,i.kW)(b).appendSessionInfo(k.title)}return(0,g.mD)(),e.NextResponse.json({title:k.title,usage:k.usage??null})}catch(b){if(String(b)===h.DQ)return e.NextResponse.json({error:h.DQ},{status:403});let a=b instanceof Error?b.message:String(b);if(a.includes("Session not found"))return e.NextResponse.json({error:"Session not found"},{status:404});return e.NextResponse.json({error:a},{status:500})}}[g,h,i]=j.then?(await j)():j,d()}catch(a){d(a)}})},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79495:(a,b,c)=>{c.d(b,{CL:()=>n,K:()=>k});var d=c(89477),e=c(60396),f=c(92395);let g=`Create a concise title for this session based on the conversation above.
1
+ "use strict";(()=>{var a={};a.id=2835,a.ids=[2835],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},25846:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>k});var e=c(23211),f=c(79495),g=c(40402),h=c(37594),i=c(95237),j=a([g,h,i]);async function k(a,{params:b}){let{id:c}=await b;try{let a=await h.mB.ensureLive(c);await a.waitUntilReady?.();let b=await (0,g.os)(c);if(!b)throw Error("Session not found");let{messages:d}=(0,i.kW)(b).buildSessionContext(),j=(0,f.CL)(),k=await (0,f.K)({messages:d,provider:j.provider,modelId:j.modelId,baseUrl:j.baseUrl,api:j.api,apiKey:j.apiKey,headers:j.headers});if(!a.isAlive())return e.NextResponse.json({error:"The session was closed while its title was being generated. Please try again."},{status:409});try{await a.send({type:"set_session_name",name:k.title})}catch{let b=a.sessionFile;if(!b)throw Error("Session file is missing");a.isAlive()&&h.mB.destroy(c),(0,i.kW)(b).appendSessionInfo(k.title)}return(0,g.mD)(),e.NextResponse.json({title:k.title,usage:k.usage??null})}catch(b){if(String(b)===h.DQ)return e.NextResponse.json({error:h.DQ},{status:403});let a=b instanceof Error?b.message:String(b);if(a.includes("Session not found"))return e.NextResponse.json({error:"Session not found"},{status:404});return e.NextResponse.json({error:a},{status:500})}}[g,h,i]=j.then?(await j)():j,d()}catch(a){d(a)}})},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},79495:(a,b,c)=>{c.d(b,{CL:()=>n,K:()=>k});var d=c(89477),e=c(60396),f=c(92395);let g=`Create a concise title for this session based on the conversation above.
2
2
 
3
3
  Requirements:
4
4
  - Match the primary language used by the user.
@@ -7,5 +7,5 @@ Requirements:
7
7
  - Do not call any tools.
8
8
  - Return only the title as plain text, with no quotes, label, markdown, or explanation.`;function h(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function i(a){return"string"==typeof a?a.trim():""}function j(a){return"number"==typeof a&&Number.isFinite(a)?a:0}async function k(a){let{messages:b,modelId:c,baseUrl:d,apiKey:e,headers:f,signal:i}=a;if(!b.some(a=>"user"===a.role))throw Error("The session has no user messages to name");let k=b.filter(a=>"user"===a.role||"assistant"===a.role).slice(-12).map(a=>{var b;return{role:a.role,content:"string"==typeof(b=a.content)?b.trim():Array.isArray(b)?b.filter(a=>h(a)&&"text"===a.type&&"string"==typeof a.text).map(a=>a.text).join("\n").trim():""}}).filter(a=>"user"===a.role||"string"==typeof a.content&&a.content.length>0),l=function(a){let b=a.at(-1);if(!b||"user"!==b.role)return a;let c="string"==typeof b.content?`${b.content}
9
9
 
10
- ${g}`:[...Array.isArray(b.content)?b.content:[],{type:"text",text:g}];return[...a.slice(0,-1),{...b,content:c}]}(k);l===k&&k.push({role:"user",content:g});let m=l.map(a=>({role:"assistant"===a.role?"assistant":"user",content:a.content})),n=new AbortController,o=setTimeout(()=>n.abort(),9e4),p=()=>n.abort();i?.addEventListener("abort",p,{once:!0});try{var q;let a,b,g=d.replace(/\/+$/,""),i=await fetch(`${g}/chat/completions`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e}`,...f},body:JSON.stringify({model:c,messages:m,max_tokens:64}),signal:n.signal}),k=await i.text();if(!i.ok)throw Error(k.slice(0,500)||`HTTP ${i.status}`);try{a=JSON.parse(k)}catch{throw Error("The model did not return a usable session title")}let l=function(a){if(!h(a))return"";let b=a.choices;if(Array.isArray(b)){let a=b[0];if(h(a)){let b=a.message;if(h(b)&&"string"==typeof b.content)return b.content;if("string"==typeof a.text)return a.text}}return"string"==typeof a.output_text?a.output_text:""}(a);if(!l)throw Error("The model did not return a session title");return{title:function(a){let b=a.trim(),c=b.match(/^```(?:json|text)?\s*([\s\S]*?)\s*```$/i);if(c&&(b=c[1].trim()),b.startsWith("{"))try{let a=JSON.parse(b);"string"==typeof a.title&&(b=a.title.trim())}catch{}if(b=(b=(function(a){for(let[b,c]of[['"','"'],["'","'"],["`","`"],["“","”"],["「","」"],["『","』"]])if(a.startsWith(b)&&a.endsWith(c)&&a.length>b.length+c.length)return a.slice(b.length,-c.length).trim();return a})(b=(b=b.split(/\r?\n/,1)[0]??"").replace(/^(?:session\s+title|title|标题)\s*[::-]\s*/i,"")).replace(/\s+/g," ").trim()).replace(/[。.!]+$/u,"").trim(),!/[\p{L}\p{N}]/u.test(b))throw Error("The model did not return a usable session title");let d=Array.from(b);return d.length>80&&(b=d.slice(0,80).join("").trim()),b}(l),...h(a)&&h(a.usage)?{usage:(q=a.usage,b=h(q.prompt_tokens_details)?q.prompt_tokens_details:{},{input:j(q.prompt_tokens),output:j(q.completion_tokens),cacheRead:j(b.cached_tokens),cacheWrite:j(b.cache_creation_input_tokens),total:j(q.total_tokens)})}:{}}}finally{clearTimeout(o),i?.removeEventListener("abort",p)}}function l(a){if(!a)return;let b=a.match(/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/);if(b){let a=process.env[b[1]];return a&&a.length>0?a:void 0}return a}function m(a){if(!h(a))return{};let b={};for(let[c,d]of Object.entries(a))"string"==typeof d&&(b[c]=d);return b}function n(a){let b,c=a?.settingsPath??(0,e.pA)(),g=a?.modelsPath??(0,e.Mc)(),j=(0,f.wq)(c),k=i(j.defaultProvider),n=i(j.defaultModel);if(!k||!n)throw Error("No default model configured: set defaultProvider/defaultModel in settings.json");try{if(!(0,d.existsSync)(g))throw Error("missing");b=JSON.parse((0,d.readFileSync)(g,"utf8"))}catch{throw Error(`models.json not found or unreadable: ${g}`)}if(!h(b))throw Error(`models.json is not an object: ${g}`);let o=h(b.providers)?b.providers:{},p=h(o[k])?o[k]:void 0;if(!p)throw Error(`Model provider not found in models.json: ${k}`);let q=Array.isArray(p.models)?p.models:[],r=h(p.modelOverrides)?p.modelOverrides:{},s=q.find(a=>h(a)&&i(a.id)===n)??r[n],t=h(s)?s:void 0;if(!t)throw Error(`Model not found in models.json: ${k}/${n}`);let u=l(i(t.apiKey))??l(i(p.apiKey));if(!u)throw Error(`No API key found for "${k}"`);let v=i(t.baseUrl)||i(p.baseUrl);if(!v)throw Error(`baseUrl is required for "${k}"`);return{provider:k,modelId:n,baseUrl:v,api:i(t.api)||i(p.api)||"openai-completions",apiKey:u,headers:{...m(p.headers),...m(t.headers)}}}},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")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")},92395:(a,b,c)=>{c.d(b,{Ej:()=>q,FN:()=>j,J7:()=>s,Tj:()=>r,oT:()=>m,wq:()=>i,xH:()=>t});var d=c(89477),e=c(86697),f=c(60396);function g(a){return(0,e.join)((0,e.resolve)(a),".pi","settings.json")}function h(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function i(a){if(!(0,d.existsSync)(a))return{};try{let b=JSON.parse((0,d.readFileSync)(a,"utf8"));return h(b)?{...b}:{}}catch{return{}}}function j(a,b){let c=(0,e.dirname)(a);(0,d.mkdirSync)(c,{recursive:!0});let f=`${a}.${process.pid}.${Date.now()}.tmp`,g=`${JSON.stringify(b,null,2)}
11
- `;try{(0,d.writeFileSync)(f,g,{flag:"wx",mode:384}),(0,d.renameSync)(f,a)}catch(a){try{(0,d.unlinkSync)(f)}catch{}throw a}}function k(a){return"string"==typeof a&&a.length>0?a:void 0}function l(a,b){return"all"===a||"one-at-a-time"===a?a:b}class m{constructor(a={}){this.dirty=!1;const b=a.agentDir??(0,f.$M)();this.globalPath=(0,e.join)((0,e.resolve)(b),"settings.json"),this.global=i(this.globalPath)}static create(a,b){return new m({agentDir:b})}view(){return this.global}getDefaultProvider(){return k(this.view().defaultProvider)}getDefaultModel(){return k(this.view().defaultModel)}getDefaultThinkingLevel(){return k(this.view().defaultThinkingLevel)}getSteeringMode(){return l(this.view().steeringMode,"one-at-a-time")}getFollowUpMode(){return l(this.view().followUpMode,"one-at-a-time")}getCompactionSettings(){let a=h(this.view().compaction)?this.view().compaction:{};return{enabled:"boolean"!=typeof a.enabled||a.enabled,reserveTokens:"number"==typeof a.reserveTokens?a.reserveTokens:16384,keepRecentTokens:"number"==typeof a.keepRecentTokens?a.keepRecentTokens:2e4}}getRetrySettings(){let a=h(this.view().retry)?this.view().retry:{};return{enabled:"boolean"!=typeof a.enabled||a.enabled,maxRetries:"number"==typeof a.maxRetries?a.maxRetries:3,baseDelayMs:"number"==typeof a.baseDelayMs?a.baseDelayMs:2e3}}getPackages(){return this.global.packages}setDefaultProvider(a){this.global.defaultProvider=a,this.dirty=!0}setDefaultModel(a){this.global.defaultModel=a,this.dirty=!0}setDefaultModelAndProvider(a,b){this.global.defaultProvider=a,this.global.defaultModel=b,this.dirty=!0}setDefaultThinkingLevel(a){this.global.defaultThinkingLevel=a,this.dirty=!0}setSteeringMode(a){this.global.steeringMode=a,this.dirty=!0}setFollowUpMode(a){this.global.followUpMode=a,this.dirty=!0}setCompactionEnabled(a){let b=h(this.global.compaction)?{...this.global.compaction}:{};b.enabled=a,this.global.compaction=b,this.dirty=!0}setRetryEnabled(a){let b=h(this.global.retry)?{...this.global.retry}:{};b.enabled=a,this.global.retry=b,this.dirty=!0}setPackages(a){this.global.packages=a,this.dirty=!0}async flush(){this.dirty&&(j(this.globalPath,this.global),this.dirty=!1)}flushSync(){this.dirty&&(j(this.globalPath,this.global),this.dirty=!1)}}function n(a){return Array.isArray(a)?a:[]}function o(a){return"string"==typeof a?a:a.source}function p(a){return"string"!=typeof a&&Array.isArray(a.extensions)&&0===a.extensions.length&&Array.isArray(a.skills)&&0===a.skills.length&&Array.isArray(a.prompts)&&0===a.prompts.length&&Array.isArray(a.themes)&&0===a.themes.length}function q(a,b={}){return"global"===a?n(i(b.agentDir?(0,e.join)((0,e.resolve)(b.agentDir),"settings.json"):(0,f.pA)()).packages):b.cwd?n(i(g(b.cwd)).packages):[]}function r(a,b,c={}){if("global"===a){let a=c.agentDir?(0,e.join)((0,e.resolve)(c.agentDir),"settings.json"):(0,f.pA)(),d=i(a);d.packages=b,j(a,d);return}if(!c.cwd)throw Error("project packages 需要 cwd");let d=g(c.cwd),h=i(d);h.packages=b,j(d,h)}function s(a,b,c,d={}){let e=q(b,d),f=!1,g=e.map(b=>o(b)!==a?b:(f=!0,c)?{..."string"==typeof b?{source:b}:b,extensions:[],skills:[],prompts:[],themes:[]}:o(b));return!!f&&(r(b,g,d),!0)}function t(a){let b=new Map;for(let c of q("global",a))b.set(`global\0${o(c)}`,p(c));if(a.cwd)for(let c of q("project",a))b.set(`project\0${o(c)}`,p(c));return b}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582,7594],()=>b(b.s=16970));module.exports=c})();
10
+ ${g}`:[...Array.isArray(b.content)?b.content:[],{type:"text",text:g}];return[...a.slice(0,-1),{...b,content:c}]}(k);l===k&&k.push({role:"user",content:g});let m=l.map(a=>({role:"assistant"===a.role?"assistant":"user",content:a.content})),n=new AbortController,o=setTimeout(()=>n.abort(),9e4),p=()=>n.abort();i?.addEventListener("abort",p,{once:!0});try{var q;let a,b,g=d.replace(/\/+$/,""),i=await fetch(`${g}/chat/completions`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e}`,...f},body:JSON.stringify({model:c,messages:m,max_tokens:64}),signal:n.signal}),k=await i.text();if(!i.ok)throw Error(k.slice(0,500)||`HTTP ${i.status}`);try{a=JSON.parse(k)}catch{throw Error("The model did not return a usable session title")}let l=function(a){if(!h(a))return"";let b=a.choices;if(Array.isArray(b)){let a=b[0];if(h(a)){let b=a.message;if(h(b)&&"string"==typeof b.content)return b.content;if("string"==typeof a.text)return a.text}}return"string"==typeof a.output_text?a.output_text:""}(a);if(!l)throw Error("The model did not return a session title");return{title:function(a){let b=a.trim(),c=b.match(/^```(?:json|text)?\s*([\s\S]*?)\s*```$/i);if(c&&(b=c[1].trim()),b.startsWith("{"))try{let a=JSON.parse(b);"string"==typeof a.title&&(b=a.title.trim())}catch{}if(b=(b=(function(a){for(let[b,c]of[['"','"'],["'","'"],["`","`"],["“","”"],["「","」"],["『","』"]])if(a.startsWith(b)&&a.endsWith(c)&&a.length>b.length+c.length)return a.slice(b.length,-c.length).trim();return a})(b=(b=b.split(/\r?\n/,1)[0]??"").replace(/^(?:session\s+title|title|标题)\s*[::-]\s*/i,"")).replace(/\s+/g," ").trim()).replace(/[。.!]+$/u,"").trim(),!/[\p{L}\p{N}]/u.test(b))throw Error("The model did not return a usable session title");let d=Array.from(b);return d.length>80&&(b=d.slice(0,80).join("").trim()),b}(l),...h(a)&&h(a.usage)?{usage:(q=a.usage,b=h(q.prompt_tokens_details)?q.prompt_tokens_details:{},{input:j(q.prompt_tokens),output:j(q.completion_tokens),cacheRead:j(b.cached_tokens),cacheWrite:j(b.cache_creation_input_tokens),total:j(q.total_tokens)})}:{}}}finally{clearTimeout(o),i?.removeEventListener("abort",p)}}function l(a){if(!a)return;let b=a.match(/^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$/);if(b){let a=process.env[b[1]];return a&&a.length>0?a:void 0}return a}function m(a){if(!h(a))return{};let b={};for(let[c,d]of Object.entries(a))"string"==typeof d&&(b[c]=d);return b}function n(a){let b,c=a?.settingsPath??(0,e.pA)(),g=a?.modelsPath??(0,e.Mc)(),j=(0,f.wq)(c),k=i(j.defaultProvider),n=i(j.defaultModel);if(!k||!n)throw Error("No default model configured: set defaultProvider/defaultModel in settings.json");try{if(!(0,d.existsSync)(g))throw Error("missing");b=JSON.parse((0,d.readFileSync)(g,"utf8"))}catch{throw Error(`models.json not found or unreadable: ${g}`)}if(!h(b))throw Error(`models.json is not an object: ${g}`);let o=h(b.providers)?b.providers:{},p=h(o[k])?o[k]:void 0;if(!p)throw Error(`Model provider not found in models.json: ${k}`);let q=Array.isArray(p.models)?p.models:[],r=h(p.modelOverrides)?p.modelOverrides:{},s=q.find(a=>h(a)&&i(a.id)===n)??r[n],t=h(s)?s:void 0;if(!t)throw Error(`Model not found in models.json: ${k}/${n}`);let u=l(i(t.apiKey))??l(i(p.apiKey));if(!u)throw Error(`No API key found for "${k}"`);let v=i(t.baseUrl)||i(p.baseUrl);if(!v)throw Error(`baseUrl is required for "${k}"`);return{provider:k,modelId:n,baseUrl:v,api:i(t.api)||i(p.api)||"openai-completions",apiKey:u,headers:{...m(p.headers),...m(t.headers)}}}},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")},86697:a=>{a.exports=require("node:path")},87274:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(25846),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/auto-name/route",pathname:"/api/sessions/[id]/auto-name",filename:"route",bundlePath:"app/api/sessions/[id]/auto-name/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/sessions/[id]/auto-name/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/auto-name/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},89477:a=>{a.exports=require("node:fs")},92395:(a,b,c)=>{c.d(b,{Ej:()=>q,FN:()=>j,J7:()=>s,Tj:()=>r,oT:()=>m,wq:()=>i,xH:()=>t});var d=c(89477),e=c(86697),f=c(60396);function g(a){return(0,e.join)((0,e.resolve)(a),".pi","settings.json")}function h(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function i(a){if(!(0,d.existsSync)(a))return{};try{let b=JSON.parse((0,d.readFileSync)(a,"utf8"));return h(b)?{...b}:{}}catch{return{}}}function j(a,b){let c=(0,e.dirname)(a);(0,d.mkdirSync)(c,{recursive:!0});let f=`${a}.${process.pid}.${Date.now()}.tmp`,g=`${JSON.stringify(b,null,2)}
11
+ `;try{(0,d.writeFileSync)(f,g,{flag:"wx",mode:384}),(0,d.renameSync)(f,a)}catch(a){try{(0,d.unlinkSync)(f)}catch{}throw a}}function k(a){return"string"==typeof a&&a.length>0?a:void 0}function l(a,b){return"all"===a||"one-at-a-time"===a?a:b}class m{constructor(a={}){this.dirty=!1;const b=a.agentDir??(0,f.$M)();this.globalPath=(0,e.join)((0,e.resolve)(b),"settings.json"),this.global=i(this.globalPath)}static create(a,b){return new m({agentDir:b})}view(){return this.global}getDefaultProvider(){return k(this.view().defaultProvider)}getDefaultModel(){return k(this.view().defaultModel)}getDefaultThinkingLevel(){return k(this.view().defaultThinkingLevel)}getSteeringMode(){return l(this.view().steeringMode,"one-at-a-time")}getFollowUpMode(){return l(this.view().followUpMode,"one-at-a-time")}getCompactionSettings(){let a=h(this.view().compaction)?this.view().compaction:{};return{enabled:"boolean"!=typeof a.enabled||a.enabled,reserveTokens:"number"==typeof a.reserveTokens?a.reserveTokens:16384,keepRecentTokens:"number"==typeof a.keepRecentTokens?a.keepRecentTokens:2e4}}getRetrySettings(){let a=h(this.view().retry)?this.view().retry:{};return{enabled:"boolean"!=typeof a.enabled||a.enabled,maxRetries:"number"==typeof a.maxRetries?a.maxRetries:3,baseDelayMs:"number"==typeof a.baseDelayMs?a.baseDelayMs:2e3}}getPackages(){return this.global.packages}setDefaultProvider(a){this.global.defaultProvider=a,this.dirty=!0}setDefaultModel(a){this.global.defaultModel=a,this.dirty=!0}setDefaultModelAndProvider(a,b){this.global.defaultProvider=a,this.global.defaultModel=b,this.dirty=!0}setDefaultThinkingLevel(a){this.global.defaultThinkingLevel=a,this.dirty=!0}setSteeringMode(a){this.global.steeringMode=a,this.dirty=!0}setFollowUpMode(a){this.global.followUpMode=a,this.dirty=!0}setCompactionEnabled(a){let b=h(this.global.compaction)?{...this.global.compaction}:{};b.enabled=a,this.global.compaction=b,this.dirty=!0}setRetryEnabled(a){let b=h(this.global.retry)?{...this.global.retry}:{};b.enabled=a,this.global.retry=b,this.dirty=!0}setPackages(a){this.global.packages=a,this.dirty=!0}async flush(){this.dirty&&(j(this.globalPath,this.global),this.dirty=!1)}flushSync(){this.dirty&&(j(this.globalPath,this.global),this.dirty=!1)}}function n(a){return Array.isArray(a)?a:[]}function o(a){return"string"==typeof a?a:a.source}function p(a){return"string"!=typeof a&&Array.isArray(a.extensions)&&0===a.extensions.length&&Array.isArray(a.skills)&&0===a.skills.length&&Array.isArray(a.prompts)&&0===a.prompts.length&&Array.isArray(a.themes)&&0===a.themes.length}function q(a,b={}){return"global"===a?n(i(b.agentDir?(0,e.join)((0,e.resolve)(b.agentDir),"settings.json"):(0,f.pA)()).packages):b.cwd?n(i(g(b.cwd)).packages):[]}function r(a,b,c={}){if("global"===a){let a=c.agentDir?(0,e.join)((0,e.resolve)(c.agentDir),"settings.json"):(0,f.pA)(),d=i(a);d.packages=b,j(a,d);return}if(!c.cwd)throw Error("project packages 需要 cwd");let d=g(c.cwd),h=i(d);h.packages=b,j(d,h)}function s(a,b,c,d={}){let e=q(b,d),f=!1,g=e.map(b=>o(b)!==a?b:(f=!0,c)?{..."string"==typeof b?{source:b}:b,extensions:[],skills:[],prompts:[],themes:[]}:o(b));return!!f&&(r(b,g,d),!0)}function t(a){let b=new Map;for(let c of q("global",a))b.set(`global\0${o(c)}`,p(c));if(a.cwd)for(let c of q("project",a))b.set(`project\0${o(c)}`,p(c));return b}}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582,7594],()=>b(b.s=87274));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=796,a.ids=[796],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21554:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(70343),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/command-entry/route",pathname:"/api/sessions/[id]/command-entry",filename:"route",bundlePath:"app/api/sessions/[id]/command-entry/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/sessions/[id]/command-entry/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/command-entry/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},70343:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h,dynamic:()=>i});var e=c(23211),f=c(37594),g=a([f]);f=(g.then?(await g)():g)[0];let i="force-dynamic";async function h(a,{params:b}){let c,{id:d}=await b;try{c=await a.json()}catch{return e.NextResponse.json({error:"invalid json body"},{status:400})}if(!c||"object"!=typeof c)return e.NextResponse.json({error:"body required"},{status:400});let g=c;if("string"!=typeof g.command||""===g.command.trim())return e.NextResponse.json({error:"command required"},{status:400});if(void 0!==g.ok&&"boolean"!=typeof g.ok)return e.NextResponse.json({error:"ok must be boolean"},{status:400});if(void 0!==g.result&&"string"!=typeof g.result)return e.NextResponse.json({error:"result must be string"},{status:400});try{let a=await f.mB.appendCommandEntry(d,{command:g.command,ok:g.ok,result:g.result});return e.NextResponse.json(a)}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},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")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582,7594],()=>b(b.s=21554));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=796,a.ids=[796],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},716:a=>{a.exports=require("node:crypto")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{a.exports=require("os")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},62228:a=>{a.exports=require("node:os")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64754:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{handler:()=>y,patchFetch:()=>x,routeModule:()=>z,serverHooks:()=>C,workAsyncStorage:()=>A,workUnitAsyncStorage:()=>B});var e=c(19225),f=c(84006),g=c(8317),h=c(99373),i=c(34775),j=c(24235),k=c(261),l=c(54365),m=c(90771),n=c(73461),o=c(67798),p=c(92280),q=c(62018),r=c(45696),s=c(47929),t=c(86439),u=c(37527),v=c(70343),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/command-entry/route",pathname:"/api/sessions/[id]/command-entry",filename:"route",bundlePath:"app/api/sessions/[id]/command-entry/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/sessions/[id]/command-entry/route.ts",nextConfigOutput:"",userland:v,...{}}),{workAsyncStorage:A,workUnitAsyncStorage:B,serverHooks:C}=z;function x(){return(0,g.patchFetch)({workAsyncStorage:A,workUnitAsyncStorage:B})}async function y(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),z.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/command-entry/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.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==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},70343:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h,dynamic:()=>i});var e=c(23211),f=c(37594),g=a([f]);f=(g.then?(await g)():g)[0];let i="force-dynamic";async function h(a,{params:b}){let c,{id:d}=await b;try{c=await a.json()}catch{return e.NextResponse.json({error:"invalid json body"},{status:400})}if(!c||"object"!=typeof c)return e.NextResponse.json({error:"body required"},{status:400});let g=c;if("string"!=typeof g.command||""===g.command.trim())return e.NextResponse.json({error:"command required"},{status:400});if(void 0!==g.ok&&"boolean"!=typeof g.ok)return e.NextResponse.json({error:"ok must be boolean"},{status:400});if(void 0!==g.result&&"string"!=typeof g.result)return e.NextResponse.json({error:"result must be string"},{status:400});try{let a=await f.mB.appendCommandEntry(d,{command:g.command,ok:g.ok,result:g.result});return e.NextResponse.json(a)}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},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")},86697:a=>{a.exports=require("node:path")},89477:a=>{a.exports=require("node:fs")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5582,7594],()=>b(b.s=64754));module.exports=c})();