@henlii/pidance 0.2.37 → 0.2.40

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 (334) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +12 -9
  3. package/.next/build-manifest.json +6 -6
  4. package/.next/prerender-manifest.json +18 -3
  5. package/.next/required-server-files.json +29 -9
  6. package/.next/routes-manifest.json +20 -0
  7. package/.next/server/app/_global-error/page.js +2 -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.meta +16 -5
  11. package/.next/server/app/_global-error.rsc +3 -3
  12. package/.next/server/app/_global-error.segments/_full.segment.rsc +3 -3
  13. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +16 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page.js +1 -2
  16. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/_not-found.html +1 -1
  18. package/.next/server/app/_not-found.meta +16 -5
  19. package/.next/server/app/_not-found.rsc +7 -7
  20. package/.next/server/app/_not-found.segments/_full.segment.rsc +7 -7
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +20 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/.next/server/app/api/about/route.js +1 -1
  24. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  25. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  26. package/.next/server/app/api/agent/[id]/route.js +1 -1
  27. package/.next/server/app/api/agent/new/route.js +1 -1
  28. package/.next/server/app/api/agent/running/events/route.js +2 -2
  29. package/.next/server/app/api/agent/running/route.js +1 -1
  30. package/.next/server/app/api/agent/submissions/[submissionId]/route.js +1 -1
  31. package/.next/server/app/api/agent-settings/route.js +2 -2
  32. package/.next/server/app/api/attachments/route.js +1 -1
  33. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  34. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  35. package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
  36. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  37. package/.next/server/app/api/auth/providers/route.js +1 -1
  38. package/.next/server/app/api/auth/ui-session/route.js +1 -1
  39. package/.next/server/app/api/auth/ui-sessions/[id]/route.js +1 -1
  40. package/.next/server/app/api/auth/ui-sessions/route.js +1 -1
  41. package/.next/server/app/api/cwd/browse/route.js +1 -1
  42. package/.next/server/app/api/cwd/create/route.js +1 -1
  43. package/.next/server/app/api/cwd/validate/route.js +1 -1
  44. package/.next/server/app/api/default-cwd/route.js +1 -1
  45. package/.next/server/app/api/file-index/route.js +1 -1
  46. package/.next/server/app/api/files/[...path]/route.js +3 -3
  47. package/.next/server/app/api/files/save-as/route.js +1 -1
  48. package/.next/server/app/api/git/diff/route.js +1 -1
  49. package/.next/server/app/api/git/status/route.js +1 -1
  50. package/.next/server/app/api/home/route.js +1 -1
  51. package/.next/server/app/api/message-media/route.js +1 -1
  52. package/.next/server/app/api/models/enabled/route.js +1 -0
  53. package/.next/server/app/api/models/enabled/route_client-reference-manifest.js +1 -0
  54. package/.next/server/app/api/models/refresh/route.js +1 -0
  55. package/.next/server/app/api/models/refresh/route_client-reference-manifest.js +1 -0
  56. package/.next/server/app/api/models/route.js +1 -1
  57. package/.next/server/app/api/models-config/raw/route.js +1 -1
  58. package/.next/server/app/api/models-config/route.js +1 -1
  59. package/.next/server/app/api/models-config/test/route.js +1 -1
  60. package/.next/server/app/api/plugins/route.js +1 -1
  61. package/.next/server/app/api/plugins/search/route.js +1 -1
  62. package/.next/server/app/api/plugins/updates/route.js +2 -1
  63. package/.next/server/app/api/preferences/route.js +1 -1
  64. package/.next/server/app/api/project-assets/route.js +2 -2
  65. package/.next/server/app/api/prompts/route.js +1 -1
  66. package/.next/server/app/api/pty/route.js +4 -3
  67. package/.next/server/app/api/sessions/[id]/archive/route.js +1 -1
  68. package/.next/server/app/api/sessions/[id]/auto-name/route.js +1 -1
  69. package/.next/server/app/api/sessions/[id]/command-entry/route.js +1 -1
  70. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  71. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  72. package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
  73. package/.next/server/app/api/sessions/[id]/info/route.js +1 -1
  74. package/.next/server/app/api/sessions/[id]/lock/route.js +1 -0
  75. package/.next/server/app/api/sessions/[id]/lock/route_client-reference-manifest.js +1 -0
  76. package/.next/server/app/api/sessions/[id]/outline/route.js +1 -1
  77. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  78. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  79. package/.next/server/app/api/sessions/[id]/tool-results/[toolCallId]/route.js +1 -1
  80. package/.next/server/app/api/sessions/route.js +1 -1
  81. package/.next/server/app/api/sessions/search/route.js +1 -1
  82. package/.next/server/app/api/settings/raw/route.js +2 -2
  83. package/.next/server/app/api/settings/remote/route.js +1 -1
  84. package/.next/server/app/api/skills/check/route.js +1 -1
  85. package/.next/server/app/api/skills/install/route.js +1 -1
  86. package/.next/server/app/api/skills/route.js +2 -2
  87. package/.next/server/app/api/skills/search/route.js +1 -1
  88. package/.next/server/app/api/skills/update/route.js +1 -1
  89. package/.next/server/app/api/subagent-runs/route.js +1 -1
  90. package/.next/server/app/api/update/apply/route.js +2 -2
  91. package/.next/server/app/api/update/check/route.js +1 -1
  92. package/.next/server/app/icon.png/route.js +1 -1
  93. package/.next/server/app/index.html +1 -1
  94. package/.next/server/app/index.meta +11 -4
  95. package/.next/server/app/index.rsc +5 -5
  96. package/.next/server/app/index.segments/__PAGE__.segment.rsc +19 -3
  97. package/.next/server/app/index.segments/_full.segment.rsc +5 -5
  98. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  99. package/.next/server/app/page.js +13 -14
  100. package/.next/server/app/page_client-reference-manifest.js +1 -1
  101. package/.next/server/app-paths-manifest.json +12 -9
  102. package/.next/server/chunks/1069.js +1 -1
  103. package/.next/server/chunks/1207.js +2 -2
  104. package/.next/server/chunks/1813.js +1 -1
  105. package/.next/server/chunks/2325.js +2 -2
  106. package/.next/server/chunks/2430.js +193 -0
  107. package/.next/server/chunks/329.js +1 -1
  108. package/.next/server/chunks/3379.js +1 -1
  109. package/.next/server/chunks/3557.js +1 -1
  110. package/.next/server/chunks/3908.js +1 -0
  111. package/.next/server/chunks/3960.js +1 -1
  112. package/.next/server/chunks/4127.js +1 -1
  113. package/.next/server/chunks/42.js +1 -0
  114. package/.next/server/chunks/4367.js +1 -1
  115. package/.next/server/chunks/4511.js +1 -0
  116. package/.next/server/chunks/4674.js +1 -1
  117. package/.next/server/chunks/4741.js +152 -7
  118. package/.next/server/chunks/4980.js +1 -1
  119. package/.next/server/chunks/5274.js +1 -1
  120. package/.next/server/chunks/5277.js +1 -1
  121. package/.next/server/chunks/5304.js +2 -2
  122. package/.next/server/chunks/5318.js +1 -1
  123. package/.next/server/chunks/5420.js +1 -0
  124. package/.next/server/chunks/5726.js +1 -1
  125. package/.next/server/chunks/7307.js +1 -1
  126. package/.next/server/chunks/7594.js +11 -11
  127. package/.next/server/chunks/7818.js +1 -0
  128. package/.next/server/chunks/8443.js +1 -0
  129. package/.next/server/chunks/8645.js +1 -1
  130. package/.next/server/chunks/9032.js +1 -0
  131. package/.next/server/chunks/9280.js +3 -3
  132. package/.next/server/chunks/940.js +1 -1
  133. package/.next/server/chunks/9460.js +2 -0
  134. package/.next/server/chunks/981.js +1 -1
  135. package/.next/server/instrumentation.js +1 -1
  136. package/.next/server/middleware-build-manifest.js +1 -1
  137. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  138. package/.next/server/middleware.js +151 -6
  139. package/.next/server/pages/404.html +1 -1
  140. package/.next/server/pages/500.html +1 -1
  141. package/.next/server/prefetch-hints.json +39 -1
  142. package/.next/server/server-reference-manifest.json +1 -1
  143. package/.next/static/chunks/{1377.e883e13864574c26.js → 1377.540f9477711dcf8f.js} +1 -1
  144. package/.next/static/chunks/{3308.23eadd1744bb967c.js → 3308.c0a1a01bfd826d65.js} +2 -2
  145. package/.next/static/chunks/{370.57cfa27da8567918.js → 370.8e8f3cf8eb0e29dd.js} +1 -1
  146. package/.next/static/chunks/3794-0a1186eb85c3950f.js +52 -0
  147. package/.next/static/chunks/4bd1b696-8a4ab4fdf0ae305a.js +1 -0
  148. package/.next/static/chunks/6121.eb9023b1cbc78ee2.js +1 -0
  149. package/.next/static/chunks/{5519-9fb47277a49697d8.js → 7444-80a846a8795bf6f4.js} +1 -1
  150. package/.next/static/chunks/{776.fe8e64ab3669a915.js → 776.4d418d68f76336c7.js} +1 -1
  151. package/.next/static/chunks/{8233.a465d18b04719c6d.js → 8233.e3b47a59bd72a3b3.js} +1 -1
  152. package/.next/static/chunks/{90542734.b75ad0df50bf68f5.js → 90542734.ae439f2382f58c51.js} +1 -1
  153. package/.next/static/chunks/9780-3879ff424362f71a.js +1 -0
  154. package/.next/static/chunks/app/_global-error/page-8f70dda1817cd20c.js +1 -0
  155. package/.next/static/chunks/app/api/about/route-8f70dda1817cd20c.js +1 -0
  156. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-8f70dda1817cd20c.js +1 -0
  157. package/.next/static/chunks/app/api/agent/[id]/events/route-8f70dda1817cd20c.js +1 -0
  158. package/.next/static/chunks/app/api/agent/[id]/route-8f70dda1817cd20c.js +1 -0
  159. package/.next/static/chunks/app/api/agent/new/route-8f70dda1817cd20c.js +1 -0
  160. package/.next/static/chunks/app/api/agent/running/events/route-8f70dda1817cd20c.js +1 -0
  161. package/.next/static/chunks/app/api/agent/running/route-8f70dda1817cd20c.js +1 -0
  162. package/.next/static/chunks/app/api/agent/submissions/[submissionId]/route-8f70dda1817cd20c.js +1 -0
  163. package/.next/static/chunks/app/api/agent-settings/route-8f70dda1817cd20c.js +1 -0
  164. package/.next/static/chunks/app/api/attachments/route-8f70dda1817cd20c.js +1 -0
  165. package/.next/static/chunks/app/api/auth/all-providers/route-8f70dda1817cd20c.js +1 -0
  166. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-8f70dda1817cd20c.js +1 -0
  167. package/.next/static/chunks/app/api/auth/login/[provider]/route-8f70dda1817cd20c.js +1 -0
  168. package/.next/static/chunks/app/api/auth/logout/[provider]/route-8f70dda1817cd20c.js +1 -0
  169. package/.next/static/chunks/app/api/auth/providers/route-8f70dda1817cd20c.js +1 -0
  170. package/.next/static/chunks/app/api/auth/ui-session/route-8f70dda1817cd20c.js +1 -0
  171. package/.next/static/chunks/app/api/auth/ui-sessions/[id]/route-8f70dda1817cd20c.js +1 -0
  172. package/.next/static/chunks/app/api/auth/ui-sessions/route-8f70dda1817cd20c.js +1 -0
  173. package/.next/static/chunks/app/api/cwd/browse/route-8f70dda1817cd20c.js +1 -0
  174. package/.next/static/chunks/app/api/cwd/create/route-8f70dda1817cd20c.js +1 -0
  175. package/.next/static/chunks/app/api/cwd/validate/route-8f70dda1817cd20c.js +1 -0
  176. package/.next/static/chunks/app/api/default-cwd/route-8f70dda1817cd20c.js +1 -0
  177. package/.next/static/chunks/app/api/file-index/route-8f70dda1817cd20c.js +1 -0
  178. package/.next/static/chunks/app/api/files/[...path]/route-8f70dda1817cd20c.js +1 -0
  179. package/.next/static/chunks/app/api/files/save-as/route-8f70dda1817cd20c.js +1 -0
  180. package/.next/static/chunks/app/api/git/diff/route-8f70dda1817cd20c.js +1 -0
  181. package/.next/static/chunks/app/api/git/status/route-8f70dda1817cd20c.js +1 -0
  182. package/.next/static/chunks/app/api/home/route-8f70dda1817cd20c.js +1 -0
  183. package/.next/static/chunks/app/api/message-media/route-8f70dda1817cd20c.js +1 -0
  184. package/.next/static/chunks/app/api/models/enabled/route-8f70dda1817cd20c.js +1 -0
  185. package/.next/static/chunks/app/api/models/refresh/route-8f70dda1817cd20c.js +1 -0
  186. package/.next/static/chunks/app/api/models/route-8f70dda1817cd20c.js +1 -0
  187. package/.next/static/chunks/app/api/models-config/raw/route-8f70dda1817cd20c.js +1 -0
  188. package/.next/static/chunks/app/api/models-config/route-8f70dda1817cd20c.js +1 -0
  189. package/.next/static/chunks/app/api/models-config/test/route-8f70dda1817cd20c.js +1 -0
  190. package/.next/static/chunks/app/api/plugins/route-8f70dda1817cd20c.js +1 -0
  191. package/.next/static/chunks/app/api/plugins/search/route-8f70dda1817cd20c.js +1 -0
  192. package/.next/static/chunks/app/api/plugins/updates/route-8f70dda1817cd20c.js +1 -0
  193. package/.next/static/chunks/app/api/preferences/route-8f70dda1817cd20c.js +1 -0
  194. package/.next/static/chunks/app/api/project-assets/route-8f70dda1817cd20c.js +1 -0
  195. package/.next/static/chunks/app/api/prompts/route-8f70dda1817cd20c.js +1 -0
  196. package/.next/static/chunks/app/api/pty/route-8f70dda1817cd20c.js +1 -0
  197. package/.next/static/chunks/app/api/sessions/[id]/archive/route-8f70dda1817cd20c.js +1 -0
  198. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-8f70dda1817cd20c.js +1 -0
  199. package/.next/static/chunks/app/api/sessions/[id]/command-entry/route-8f70dda1817cd20c.js +1 -0
  200. package/.next/static/chunks/app/api/sessions/[id]/context/route-8f70dda1817cd20c.js +1 -0
  201. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-8f70dda1817cd20c.js +1 -0
  202. package/.next/static/chunks/app/api/sessions/[id]/export/route-8f70dda1817cd20c.js +1 -0
  203. package/.next/static/chunks/app/api/sessions/[id]/info/route-8f70dda1817cd20c.js +1 -0
  204. package/.next/static/chunks/app/api/sessions/[id]/lock/route-8f70dda1817cd20c.js +1 -0
  205. package/.next/static/chunks/app/api/sessions/[id]/outline/route-8f70dda1817cd20c.js +1 -0
  206. package/.next/static/chunks/app/api/sessions/[id]/route-8f70dda1817cd20c.js +1 -0
  207. package/.next/static/chunks/app/api/sessions/[id]/state/route-8f70dda1817cd20c.js +1 -0
  208. package/.next/static/chunks/app/api/sessions/[id]/tool-results/[toolCallId]/route-8f70dda1817cd20c.js +1 -0
  209. package/.next/static/chunks/app/api/sessions/route-8f70dda1817cd20c.js +1 -0
  210. package/.next/static/chunks/app/api/sessions/search/route-8f70dda1817cd20c.js +1 -0
  211. package/.next/static/chunks/app/api/settings/raw/route-8f70dda1817cd20c.js +1 -0
  212. package/.next/static/chunks/app/api/settings/remote/route-8f70dda1817cd20c.js +1 -0
  213. package/.next/static/chunks/app/api/skills/check/route-8f70dda1817cd20c.js +1 -0
  214. package/.next/static/chunks/app/api/skills/install/route-8f70dda1817cd20c.js +1 -0
  215. package/.next/static/chunks/app/api/skills/route-8f70dda1817cd20c.js +1 -0
  216. package/.next/static/chunks/app/api/skills/search/route-8f70dda1817cd20c.js +1 -0
  217. package/.next/static/chunks/app/api/skills/update/route-8f70dda1817cd20c.js +1 -0
  218. package/.next/static/chunks/app/api/subagent-runs/route-8f70dda1817cd20c.js +1 -0
  219. package/.next/static/chunks/app/api/update/apply/route-8f70dda1817cd20c.js +1 -0
  220. package/.next/static/chunks/app/api/update/check/route-8f70dda1817cd20c.js +1 -0
  221. package/.next/static/chunks/app/page-03ce7a25f33f4d70.js +24 -0
  222. package/.next/static/chunks/{da12927c.00775c0e4542fd3e.js → da12927c.476aa688a637649c.js} +2 -2
  223. package/.next/static/chunks/{e868780c-16e43c5968ccf2bf.js → e868780c-1584512c612787d7.js} +1 -1
  224. package/.next/static/chunks/framework-b33a8f5d57cd8d87.js +1 -0
  225. package/.next/static/chunks/main-1b407bf74905d84a.js +5 -0
  226. package/.next/static/chunks/{main-app-06b2b50b226e40d1.js → main-app-d353053e6467499a.js} +1 -1
  227. package/.next/static/chunks/next/dist/client/components/builtin/app-error-8f70dda1817cd20c.js +1 -0
  228. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-8f70dda1817cd20c.js +1 -0
  229. package/.next/static/chunks/next/dist/client/components/builtin/not-found-8f70dda1817cd20c.js +1 -0
  230. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-8f70dda1817cd20c.js +1 -0
  231. package/.next/static/chunks/{webpack-d2379fd13c5c78c6.js → webpack-2423c4442766d244.js} +1 -1
  232. package/.next/static/css/1ad5c09cc7ca816b.css +1 -0
  233. package/.next/static/qrH41YQOkbPr0RvEZs8IZ/_buildManifest.js +1 -0
  234. package/README.en.md +10 -1
  235. package/README.md +10 -1
  236. package/bin/pidance-auth-gate.js +41 -11
  237. package/bin/pidance-http-server.js +7 -0
  238. package/bin/pidance.js +5 -1
  239. package/bin/pty-manager.cjs +65 -12
  240. package/bin/pty-process.cjs +135 -0
  241. package/bin/pty-worker.js +17 -3
  242. package/bin/pty-ws.js +126 -3
  243. package/package.json +6 -4
  244. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +0 -5
  245. package/.next/server/app/_global-error.segments/_head.segment.rsc +0 -5
  246. package/.next/server/app/_global-error.segments/_index.segment.rsc +0 -5
  247. package/.next/server/app/_not-found.segments/_head.segment.rsc +0 -6
  248. package/.next/server/app/_not-found.segments/_index.segment.rsc +0 -7
  249. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +0 -5
  250. package/.next/server/app/index.segments/_head.segment.rsc +0 -6
  251. package/.next/server/app/index.segments/_index.segment.rsc +0 -7
  252. package/.next/server/chunks/188.js +0 -1
  253. package/.next/server/chunks/319.js +0 -45
  254. package/.next/server/chunks/6953.js +0 -1
  255. package/.next/server/chunks/8359.js +0 -2
  256. package/.next/server/chunks/9935.js +0 -1
  257. package/.next/static/WyhxhOSSU4IaU7cnCvJTt/_buildManifest.js +0 -1
  258. package/.next/static/chunks/3794-907785a527d8128b.js +0 -32
  259. package/.next/static/chunks/4bd1b696-e356ca5ba0218e27.js +0 -1
  260. package/.next/static/chunks/6121.5b8cb3199531d194.js +0 -1
  261. package/.next/static/chunks/9780-190981a7d5f4799b.js +0 -1
  262. package/.next/static/chunks/app/_global-error/page-7c63ab7d3880fba7.js +0 -1
  263. package/.next/static/chunks/app/api/about/route-7c63ab7d3880fba7.js +0 -1
  264. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-7c63ab7d3880fba7.js +0 -1
  265. package/.next/static/chunks/app/api/agent/[id]/events/route-7c63ab7d3880fba7.js +0 -1
  266. package/.next/static/chunks/app/api/agent/[id]/route-7c63ab7d3880fba7.js +0 -1
  267. package/.next/static/chunks/app/api/agent/new/route-7c63ab7d3880fba7.js +0 -1
  268. package/.next/static/chunks/app/api/agent/running/events/route-7c63ab7d3880fba7.js +0 -1
  269. package/.next/static/chunks/app/api/agent/running/route-7c63ab7d3880fba7.js +0 -1
  270. package/.next/static/chunks/app/api/agent/submissions/[submissionId]/route-7c63ab7d3880fba7.js +0 -1
  271. package/.next/static/chunks/app/api/agent-settings/route-7c63ab7d3880fba7.js +0 -1
  272. package/.next/static/chunks/app/api/attachments/route-7c63ab7d3880fba7.js +0 -1
  273. package/.next/static/chunks/app/api/auth/all-providers/route-7c63ab7d3880fba7.js +0 -1
  274. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-7c63ab7d3880fba7.js +0 -1
  275. package/.next/static/chunks/app/api/auth/login/[provider]/route-7c63ab7d3880fba7.js +0 -1
  276. package/.next/static/chunks/app/api/auth/logout/[provider]/route-7c63ab7d3880fba7.js +0 -1
  277. package/.next/static/chunks/app/api/auth/providers/route-7c63ab7d3880fba7.js +0 -1
  278. package/.next/static/chunks/app/api/auth/ui-session/route-7c63ab7d3880fba7.js +0 -1
  279. package/.next/static/chunks/app/api/auth/ui-sessions/[id]/route-7c63ab7d3880fba7.js +0 -1
  280. package/.next/static/chunks/app/api/auth/ui-sessions/route-7c63ab7d3880fba7.js +0 -1
  281. package/.next/static/chunks/app/api/cwd/browse/route-7c63ab7d3880fba7.js +0 -1
  282. package/.next/static/chunks/app/api/cwd/create/route-7c63ab7d3880fba7.js +0 -1
  283. package/.next/static/chunks/app/api/cwd/validate/route-7c63ab7d3880fba7.js +0 -1
  284. package/.next/static/chunks/app/api/default-cwd/route-7c63ab7d3880fba7.js +0 -1
  285. package/.next/static/chunks/app/api/file-index/route-7c63ab7d3880fba7.js +0 -1
  286. package/.next/static/chunks/app/api/files/[...path]/route-7c63ab7d3880fba7.js +0 -1
  287. package/.next/static/chunks/app/api/files/save-as/route-7c63ab7d3880fba7.js +0 -1
  288. package/.next/static/chunks/app/api/git/diff/route-7c63ab7d3880fba7.js +0 -1
  289. package/.next/static/chunks/app/api/git/status/route-7c63ab7d3880fba7.js +0 -1
  290. package/.next/static/chunks/app/api/home/route-7c63ab7d3880fba7.js +0 -1
  291. package/.next/static/chunks/app/api/message-media/route-7c63ab7d3880fba7.js +0 -1
  292. package/.next/static/chunks/app/api/models/route-7c63ab7d3880fba7.js +0 -1
  293. package/.next/static/chunks/app/api/models-config/raw/route-7c63ab7d3880fba7.js +0 -1
  294. package/.next/static/chunks/app/api/models-config/route-7c63ab7d3880fba7.js +0 -1
  295. package/.next/static/chunks/app/api/models-config/test/route-7c63ab7d3880fba7.js +0 -1
  296. package/.next/static/chunks/app/api/plugins/route-7c63ab7d3880fba7.js +0 -1
  297. package/.next/static/chunks/app/api/plugins/search/route-7c63ab7d3880fba7.js +0 -1
  298. package/.next/static/chunks/app/api/plugins/updates/route-7c63ab7d3880fba7.js +0 -1
  299. package/.next/static/chunks/app/api/preferences/route-7c63ab7d3880fba7.js +0 -1
  300. package/.next/static/chunks/app/api/project-assets/route-7c63ab7d3880fba7.js +0 -1
  301. package/.next/static/chunks/app/api/prompts/route-7c63ab7d3880fba7.js +0 -1
  302. package/.next/static/chunks/app/api/pty/route-7c63ab7d3880fba7.js +0 -1
  303. package/.next/static/chunks/app/api/sessions/[id]/archive/route-7c63ab7d3880fba7.js +0 -1
  304. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-7c63ab7d3880fba7.js +0 -1
  305. package/.next/static/chunks/app/api/sessions/[id]/command-entry/route-7c63ab7d3880fba7.js +0 -1
  306. package/.next/static/chunks/app/api/sessions/[id]/context/route-7c63ab7d3880fba7.js +0 -1
  307. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-7c63ab7d3880fba7.js +0 -1
  308. package/.next/static/chunks/app/api/sessions/[id]/export/route-7c63ab7d3880fba7.js +0 -1
  309. package/.next/static/chunks/app/api/sessions/[id]/info/route-7c63ab7d3880fba7.js +0 -1
  310. package/.next/static/chunks/app/api/sessions/[id]/outline/route-7c63ab7d3880fba7.js +0 -1
  311. package/.next/static/chunks/app/api/sessions/[id]/route-7c63ab7d3880fba7.js +0 -1
  312. package/.next/static/chunks/app/api/sessions/[id]/state/route-7c63ab7d3880fba7.js +0 -1
  313. package/.next/static/chunks/app/api/sessions/[id]/tool-results/[toolCallId]/route-7c63ab7d3880fba7.js +0 -1
  314. package/.next/static/chunks/app/api/sessions/route-7c63ab7d3880fba7.js +0 -1
  315. package/.next/static/chunks/app/api/sessions/search/route-7c63ab7d3880fba7.js +0 -1
  316. package/.next/static/chunks/app/api/settings/raw/route-7c63ab7d3880fba7.js +0 -1
  317. package/.next/static/chunks/app/api/settings/remote/route-7c63ab7d3880fba7.js +0 -1
  318. package/.next/static/chunks/app/api/skills/check/route-7c63ab7d3880fba7.js +0 -1
  319. package/.next/static/chunks/app/api/skills/install/route-7c63ab7d3880fba7.js +0 -1
  320. package/.next/static/chunks/app/api/skills/route-7c63ab7d3880fba7.js +0 -1
  321. package/.next/static/chunks/app/api/skills/search/route-7c63ab7d3880fba7.js +0 -1
  322. package/.next/static/chunks/app/api/skills/update/route-7c63ab7d3880fba7.js +0 -1
  323. package/.next/static/chunks/app/api/subagent-runs/route-7c63ab7d3880fba7.js +0 -1
  324. package/.next/static/chunks/app/api/update/apply/route-7c63ab7d3880fba7.js +0 -1
  325. package/.next/static/chunks/app/api/update/check/route-7c63ab7d3880fba7.js +0 -1
  326. package/.next/static/chunks/app/page-d0e064d91cca6351.js +0 -24
  327. package/.next/static/chunks/framework-711ef29bc66f648c.js +0 -1
  328. package/.next/static/chunks/main-8e7ef001ea9dd641.js +0 -5
  329. package/.next/static/chunks/next/dist/client/components/builtin/app-error-7c63ab7d3880fba7.js +0 -1
  330. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-7c63ab7d3880fba7.js +0 -1
  331. package/.next/static/chunks/next/dist/client/components/builtin/not-found-7c63ab7d3880fba7.js +0 -1
  332. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-7c63ab7d3880fba7.js +0 -1
  333. package/.next/static/css/846691607ee7f74d.css +0 -1
  334. /package/.next/static/{WyhxhOSSU4IaU7cnCvJTt → qrH41YQOkbPr0RvEZs8IZ}/_ssgManifest.js +0 -0
@@ -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")},41979:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>k,PUT:()=>l,dynamic:()=>m});var e=c(23211),f=c(68524),g=c(75052),h=c(63726),i=c(72498),j=a([i]);i=(j.then?(await j)():j)[0];let m="force-dynamic";async function k(){try{let a=(0,h.Z)();return e.NextResponse.json({prefs:(0,f.rV)(),revision:a.revision(),bootId:a.bootId()},{headers:{"Cache-Control":"no-store"}})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function l(a){try{let b=await a.json().catch(()=>({}));if(Array.isArray(b.ops)){let a=b.ops.filter(a=>!!a&&"object"==typeof a&&"string"==typeof a.key&&"string"==typeof a.op&&(0,g.F)(a));if(0===a.length)return e.NextResponse.json({error:"ops 里没有受支持的命令"},{status:400});let c=(0,f.rV)(),d=(0,f.fN)(a),j=(0,f.rV)();if(0===Object.keys(d).length)return e.NextResponse.json({ok:!0,revision:(0,h.Z)().revision(),changed:{}});(0,i.zc)(c,j);let k=(0,h.Z)().publish(d);return e.NextResponse.json({ok:!0,revision:k.revision,changed:d})}let c=b.prefs;if("object"!=typeof c||null===c||Array.isArray(c))return e.NextResponse.json({error:"prefs must be a JSON object"},{status:400});let d=JSON.stringify(c);if(Buffer.byteLength(d,"utf8")>1e6)return e.NextResponse.json({error:"preferences exceed 1000000 bytes"},{status:413});let{patch:j,dropped:k}=(0,f.Nj)(c);k.length>0&&console.warn(`[pidance] ignored host-owned queue preferences from client: ${k.join(", ")}`);let l=(0,f.rV)(),m=(0,f.Gc)(j),n=(0,f.rV)(),o=(0,h.Z)();if(0===Object.keys(m).length)return e.NextResponse.json({ok:!0,revision:o.revision(),changed:{}});(0,i.zc)(l,n);let p=o.publish(m);return e.NextResponse.json({ok:!0,revision:p.revision,changed:m})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},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")},63726:(a,b,c)=>{"use strict";function d(){let a,b,c,d=globalThis;return d.__piPrefsBus||(a=0,b=Math.random().toString(36).slice(2)+Date.now().toString(36),c=new Set,d.__piPrefsBus={revision:()=>a,bootId:()=>b,subscribe:a=>(c.add(a),()=>{c.delete(a)}),publish(d){let e={changed:d,revision:a+=1,bootId:b,at:new Date().toISOString()};for(let a of c)try{a(e)}catch{}return e},resetForTests(){a=0,c.clear()}}),d.__piPrefsBus}c.d(b,{Z:()=>d})},68524:(a,b,c)=>{"use strict";c.d(b,{Gc:()=>q,Nj:()=>p,UQ:()=>i,fN:()=>r,m6:()=>h,ql:()=>n,rV:()=>j,xP:()=>o});var d=c(89477),e=c(86697),f=c(60396),g=c(75052);function h(a=(0,f.$M)()){return(0,e.join)(a,"pidance-preferences.json")}function i(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function j(a=(0,f.$M)()){let b=h(a);if(!(0,d.existsSync)(b))return{};try{let a=JSON.parse((0,d.readFileSync)(b,"utf8"));return i(a)?a:{}}catch{return{}}}function k(a,b){let c=h(a),f=(0,e.dirname)(c);(0,d.existsSync)(f)||(0,d.mkdirSync)(f,{recursive:!0,mode:448});let g=`${c}.lock`,i=Date.now()+15e3,j=null;for(;null===j;)try{j=(0,d.openSync)(g,"wx",384)}catch(a){if("EEXIST"!==a.code)throw a;try{Date.now()-(0,d.statSync)(g).mtimeMs>6e4&&(0,d.unlinkSync)(g)}catch{}if(Date.now()>=i)throw Error("Timed out acquiring Pidance preferences lock");!function(){let a=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(a,0,0,10)}()}try{return b()}finally{(0,d.closeSync)(j);try{(0,d.unlinkSync)(g)}catch{}}}function l(a,b){let c=h(b),f=(0,e.dirname)(c);(0,d.existsSync)(f)||(0,d.mkdirSync)(f,{recursive:!0,mode:448});let g=`${c}.${process.pid}.${Date.now()}.tmp`;try{(0,d.writeFileSync)(g,JSON.stringify(a,null,2),{flag:"wx",mode:384}),(0,d.renameSync)(g,c)}catch(a){try{(0,d.unlinkSync)(g)}catch{}throw a}}function m(a,b){let c=b.split("."),d=a;for(let a of c){if("object"!=typeof d||null===d)return;d=d[a]}return d}function n(a,b){return m(a,b)}function o(a,b,c=(0,f.$M)()){k(c,()=>{let d=j(c);!function(a,b,c){let d=b.split("."),e=a;for(let a=0;a<d.length-1;a++){let b=d[a],c=e[b];("object"!=typeof c||null===c||Array.isArray(c))&&(e[b]={}),e=e[b]}let f=d[d.length-1];null==c?delete e[f]:e[f]=c}(d,a,b),l(d,c)})}function p(a){let b={},c=[];for(let[d,e]of Object.entries(a)){if("sessionQueue"===d||d.startsWith("sessionQueue.")){c.push(d);continue}b[d]=e}return{patch:b,dropped:c}}function q(a,b=(0,f.$M)()){return k(b,()=>{let c=j(b),d=function(a,b){let c={...a};for(let[a,d]of Object.entries(b))if(null===d)delete c[a];else if(i(d)&&i(c[a])){let b={...c[a]};for(let[a,c]of Object.entries(d))null===c?delete b[a]:b[a]=c;c[a]=b}else c[a]=d;return c}(c,a),e=function(a,b,c){let d={};for(let[e,f]of Object.entries(b)){let b=a[e],g=c[e];if(i(f)&&i(b)){for(let a of Object.keys(f)){let c=`${e}.${a}`,f=b[a],h=i(g)?g[a]:void 0;JSON.stringify(f)!==JSON.stringify(h)&&(d[c]=h??null)}continue}JSON.stringify(b)!==JSON.stringify(g)&&(d[e]=g??null)}return d}(c,a,d);return Object.keys(e).length>0&&l(d,b),e})}function r(a,b=(0,f.$M)()){return k(b,()=>{let c=j(b),d=(0,g.W)(c,a);if(0===d.length)return{};l(c,b);let e={};for(let a of d)e[a]=m(c,a)??null;return e})}},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{zc:()=>n});var e=c(89477),f=c(86697),g=c(75430),h=c(60396),i=a([g]);function j(a,b){let c,d=(0,f.join)(b,"trust.json");if(!(0,e.existsSync)(d))return!1;try{let a=JSON.parse((0,e.readFileSync)(d,"utf8"));if("object"!=typeof a||null===a||Array.isArray(a))return!1;c=a}catch{return!1}let g=a;try{g=(0,e.realpathSync)(a)}catch{}return!0===c[g]||!0===c[a]}function k(a){return"object"!=typeof a||null===a||Array.isArray(a)?{}:a}function l(a,b){let c=k(a.sidebarUi);return function(a){if(!Array.isArray(a))return[];let b=[],c=new Set;for(let d of a){if("string"!=typeof d)continue;let a=d.trim();!a||c.has(a)||(c.add(a),b.push(a))}return b}(void 0!==c[b]?c[b]:a[b])}function m(a){return"string"==typeof a&&a.trim().length>0}function n(a,b,c=(0,h.$M)()){var d=c;try{let c=(()=>{let c,d,e;return c=new Set(l(k(a),"projectRoots")),d=l(k(b),"projectRoots"),e=new Set(d),{trust:d,revoke:[...c].filter(a=>!e.has(a))}})();if(0===c.trust.length&&0===c.revoke.length)return{trusted:0,revoked:0,failed:[]};return function(a,b=(0,h.$M)()){let c={trusted:0,revoked:0,failed:[]};for(let d of a.trust)if(m(d))try{(function(a,b=(0,h.$M)()){return!(!m(a)||j(a,b))&&(new g.ProjectTrustStore(b).set(a,!0),!0)})(d,b)&&(c.trusted+=1)}catch(a){c.failed.push(d),console.warn(`[pidance] failed to trust project ${d}: ${a instanceof Error?a.message:String(a)}`)}for(let d of a.revoke)if(m(d))try{(function(a,b=(0,h.$M)()){return!!m(a)&&!!j(a,b)&&(new g.ProjectTrustStore(b).set(a,null),!0)})(d,b)&&(c.revoked+=1)}catch(a){c.failed.push(d),console.warn(`[pidance] failed to revoke project trust ${d}: ${a instanceof Error?a.message:String(a)}`)}return c}(c,d)}catch(a){return console.warn(`[pidance] project trust sync failed: ${a instanceof Error?a.message:String(a)}`),{trusted:0,revoked:0,failed:[]}}}g=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},75052:(a,b,c)=>{"use strict";function d(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function e(a,b){let c=b.split("."),e=a;for(let a=0;a<c.length-1;a+=1){let b=c[a],f=e[b];if(!d(f)){let a={};e[b]=a,e=a;continue}e=f}let f=c[c.length-1];return{container:e,last:f,existed:Object.prototype.hasOwnProperty.call(e,f)}}function f(a){return!(!a||"string"!=typeof a.key||0===a.key.length||"sessionQueue"===a.key||a.key.startsWith("sessionQueue."))&&("add"===a.op||"remove"===a.op?"sidebarUi.projectRoots"===a.key||"sidebarUi.pinnedSessionIds"===a.key||"sidebarUi.ungroupedSessionIds"===a.key||"sidebarUi.collapsedProjectRoots"===a.key:"set"===a.op)}function g(a,b){let c=[],g=a=>{c.includes(a)||c.push(a)};for(let c of b){if(!f(c))continue;if("set"===c.op){let{container:b,last:d,existed:f}=e(a,c.key);if(null===c.value||void 0===c.value){if(!f)continue;delete b[d],g(c.key);continue}if(JSON.stringify(b[d])===JSON.stringify(c.value))continue;b[d]=c.value,g(c.key);continue}let b=function(a,b){let c=a;for(let a of b.split(".")){if(!d(c))return;c=c[a]}return c}(a,c.key),h=Array.isArray(b)?b.filter(a=>!0):[],i=c.value;if("string"!=typeof i||0===i.length)continue;if("add"===c.op){if(h.includes(i))continue;h.push(i)}else{if(!h.includes(i))continue;let a=h.filter(a=>a!==i);h.length=0,h.push(...a)}let{container:j,last:k}=e(a,c.key);j[k]=h,g(c.key)}return c}c.d(b,{F:()=>f,W:()=>g})},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},86697:a=>{"use strict";a.exports=require("node:path")},89477:a=>{"use strict";a.exports=require("node:fs")},96487:()=>{},98292:(a,b,c)=>{"use strict";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(41979),w=a([v]);v=(w.then?(await w)():w)[0];let z=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: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/preferences/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)}})}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=98292));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")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},41979:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>l,PUT:()=>m,dynamic:()=>n});var e=c(23211),f=c(68524),g=c(75052),h=c(63726),i=c(72498),j=c(55687),k=a([i]);i=(k.then?(await k)():k)[0];let n="force-dynamic";async function l(){try{let a=(0,h.Z)();return e.NextResponse.json({prefs:(0,f.rV)(),revision:a.revision(),bootId:a.bootId()},{headers:{"Cache-Control":"no-store"}})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function m(a){try{let b=await a.json().catch(()=>({}));if(Array.isArray(b.ops)){let a=b.ops.filter(a=>!!a&&"object"==typeof a&&"string"==typeof a.key&&"string"==typeof a.op&&(0,g.F)(a));if(0===a.length)return e.NextResponse.json({error:"ops 里没有受支持的命令"},{status:400});let c=(0,f.rV)(),d=(0,f.fN)(a),k=(0,f.rV)();if(0===Object.keys(d).length)return e.NextResponse.json({ok:!0,revision:(0,h.Z)().revision(),changed:{}});(0,i.zc)(c,k),(0,j.NG)(k);let l=(0,h.Z)().publish(d);return e.NextResponse.json({ok:!0,revision:l.revision,changed:d})}let c=b.prefs;if("object"!=typeof c||null===c||Array.isArray(c))return e.NextResponse.json({error:"prefs must be a JSON object"},{status:400});let d=JSON.stringify(c);if(Buffer.byteLength(d,"utf8")>1e6)return e.NextResponse.json({error:"preferences exceed 1000000 bytes"},{status:413});let{patch:k,dropped:l}=(0,f.Nj)(c);l.length>0&&console.warn(`[pidance] ignored host-owned queue preferences from client: ${l.join(", ")}`);let m=(0,f.rV)(),n=(0,f.Gc)(k),o=(0,f.rV)(),p=(0,h.Z)();if(0===Object.keys(n).length)return e.NextResponse.json({ok:!0,revision:p.revision(),changed:{}});(0,i.zc)(m,o),(0,j.NG)(o);let q=p.publish(n);return e.NextResponse.json({ok:!0,revision:q.revision,changed:n})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},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")},64765:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/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:()=>c(41979),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/preferences/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},72498:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{zc:()=>n});var e=c(89477),f=c(86697),g=c(75430),h=c(60396),i=a([g]);function j(a,b){let c,d=(0,f.join)(b,"trust.json");if(!(0,e.existsSync)(d))return!1;try{let a=JSON.parse((0,e.readFileSync)(d,"utf8"));if("object"!=typeof a||null===a||Array.isArray(a))return!1;c=a}catch{return!1}let g=a;try{g=(0,e.realpathSync)(a)}catch{}return!0===c[g]||!0===c[a]}function k(a){return"object"!=typeof a||null===a||Array.isArray(a)?{}:a}function l(a,b){let c=k(a.sidebarUi);return function(a){if(!Array.isArray(a))return[];let b=[],c=new Set;for(let d of a){if("string"!=typeof d)continue;let a=d.trim();!a||c.has(a)||(c.add(a),b.push(a))}return b}(void 0!==c[b]?c[b]:a[b])}function m(a){return"string"==typeof a&&a.trim().length>0}function n(a,b,c=(0,h.$M)()){var d=c;try{let c=(()=>{let c,d,e;return c=new Set(l(k(a),"projectRoots")),d=l(k(b),"projectRoots"),e=new Set(d),{trust:d,revoke:[...c].filter(a=>!e.has(a))}})();if(0===c.trust.length&&0===c.revoke.length)return{trusted:0,revoked:0,failed:[]};return function(a,b=(0,h.$M)()){let c={trusted:0,revoked:0,failed:[]};for(let d of a.trust)if(m(d))try{(function(a,b=(0,h.$M)()){return!(!m(a)||j(a,b))&&(new g.ProjectTrustStore(b).set(a,!0),!0)})(d,b)&&(c.trusted+=1)}catch(a){c.failed.push(d),console.warn(`[pidance] failed to trust project ${d}: ${a instanceof Error?a.message:String(a)}`)}for(let d of a.revoke)if(m(d))try{(function(a,b=(0,h.$M)()){return!!m(a)&&!!j(a,b)&&(new g.ProjectTrustStore(b).set(a,null),!0)})(d,b)&&(c.revoked+=1)}catch(a){c.failed.push(d),console.warn(`[pidance] failed to revoke project trust ${d}: ${a instanceof Error?a.message:String(a)}`)}return c}(c,d)}catch(a){return console.warn(`[pidance] project trust sync failed: ${a instanceof Error?a.message:String(a)}`),{trusted:0,revoked:0,failed:[]}}}g=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},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,9032],()=>b(b.s=64765));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")},25252:(a,b,c)=>{c.d(b,{HM:()=>e,wz:()=>f});var d=c(50593);function e(){return globalThis.__piAdditionalAllowedRoots||(globalThis.__piAdditionalAllowedRoots=new Set),globalThis.__piAdditionalAllowedRoots}function f(a){if(!a)return;let b=(0,d.Nw)(a);e().add(b),globalThis.__piAllowedRootsCache?.roots.add(b)}},27910:a=>{a.exports=require("stream")},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")},69835:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{$t:()=>w,Gt:()=>z,Lj:()=>y,Md:()=>x,eq:()=>n,fb:()=>u,fm:()=>v,ki:()=>r,qo:()=>m,uF:()=>o,vy:()=>t,xd:()=>q});var e=c(29021),f=c(33873),g=c(55511),h=c(27910),i=c(77725),j=c(60396),k=c(80547),l=a([k]);k=(l.then?(await l)():l)[0];let x=0x1900000,y=0x6400000,z=0x20000000;function m(a=(0,j.$M)()){return(0,k.Nw)((0,f.join)(a,"pidance-attachments"))}function n(a=(0,j.$M)()){let b=m(a);return(0,e.existsSync)(b)||(0,e.mkdirSync)(b,{recursive:!0,mode:448}),(0,k.wz)(b),b}function o(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 p(a,b=Date.now()){let c=o(a),d=new Date(b).toISOString().replace(/[:.]/g,"-"),e=(0,g.randomUUID)().slice(0,8);return`${d}_${e}_${c}`}async function q(a,b,c=(0,j.$M)(),d=z){let l=n(c),m=p(a),r=(0,f.join)(l,m),s=(0,f.join)(l,`.${m}.${(0,g.randomUUID)()}.tmp`),t=0,u=new h.Transform({transform(a,b,c){let e=Buffer.isBuffer(a)?a:Buffer.from(a);(t+=e.length)>d?c(Error(`message media exceeds ${d} bytes`)):c(null,e)}});try{await (0,i.pipeline)(h.Readable.fromWeb(b),u,(0,e.createWriteStream)(s,{flags:"wx",mode:384})),(0,e.renameSync)(s,r)}catch(a){try{(0,e.unlinkSync)(s)}catch{}throw a}return{path:(0,k.Nw)(r),name:o(a),storedName:m,size:t}}function r(a,b,c=(0,j.$M)()){let d=n(c),g=p(a),h=(0,f.join)(d,g);return(0,e.writeFileSync)(h,b,{flag:"wx",mode:384}),{path:(0,k.Nw)(h),name:o(a),storedName:g,size:b.length}}function s(a,b,c){let d=a.trim();if(!d)return null;try{let a=(0,k.Nw)((0,e.realpathSync)(n(b))),f=(0,k.Nw)((0,e.realpathSync)(d));if(f!==a&&!f.startsWith(`${a}/`)||!(0,e.statSync)(f).isFile())return null;return c(f)}catch{return null}}function t(a,b=(0,j.$M)()){return s(a,b,a=>(0,e.statSync)(a).size)}function u(a,b=(0,j.$M)(),c=0x1900000){return s(a,b,a=>(0,e.statSync)(a).size>c?null:(0,e.readFileSync)(a).toString("base64"))}function v(a,b=(0,j.$M)()){return s(a,b,a=>{try{return(0,e.unlinkSync)(a),!0}catch{return!1}})??!1}function w(a=(0,j.$M)()){let b=[];return function a(b,c){for(let d of(()=>{try{return(0,e.readdirSync)(b,{withFileTypes:!0})}catch{return[]}})()){let g=(0,f.join)(b,d.name);if(d.isDirectory()){a(g,c);continue}if(d.isFile())try{let a=(0,e.statSync)(g);c.push({path:(0,k.Nw)(g),size:a.size,mtimeMs:a.mtimeMs})}catch{}}}(m(a),b),b}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},77725:a=>{a.exports=require("stream/promises")},79748:a=>{a.exports=require("fs/promises")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>r,Nw:()=>j.Nw,bk:()=>q,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 s=/^[a-zA-Z]:[\\/]/;function o(a){return s.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(){return!0}function r(a,b){return!0}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")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},25252:(a,b,c)=>{c.d(b,{HM:()=>e,wz:()=>f});var d=c(50593);function e(){return globalThis.__piAdditionalAllowedRoots||(globalThis.__piAdditionalAllowedRoots=new Set),globalThis.__piAdditionalAllowedRoots}function f(a){if(!a)return;let b=(0,d.Nw)(a);e().add(b),globalThis.__piAllowedRootsCache?.roots.add(b)}},27910:a=>{a.exports=require("stream")},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")},69835:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{$t:()=>w,Gt:()=>z,Lj:()=>y,Md:()=>x,eq:()=>n,fb:()=>u,fm:()=>v,ki:()=>r,qo:()=>m,uF:()=>o,vy:()=>t,xd:()=>q});var e=c(29021),f=c(33873),g=c(55511),h=c(27910),i=c(77725),j=c(60396),k=c(80547),l=a([k]);k=(l.then?(await l)():l)[0];let x=0x1900000,y=0x6400000,z=0x20000000;function m(a=(0,j.$M)()){return(0,k.Nw)((0,f.join)(a,"pidance-attachments"))}function n(a=(0,j.$M)()){let b=m(a);return(0,e.existsSync)(b)||(0,e.mkdirSync)(b,{recursive:!0,mode:448}),(0,k.wz)(b),b}function o(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 p(a,b=Date.now()){let c=o(a),d=new Date(b).toISOString().replace(/[:.]/g,"-"),e=(0,g.randomUUID)().slice(0,8);return`${d}_${e}_${c}`}async function q(a,b,c=(0,j.$M)(),d=z){let l=n(c),m=p(a),r=(0,f.join)(l,m),s=(0,f.join)(l,`.${m}.${(0,g.randomUUID)()}.tmp`),t=0,u=new h.Transform({transform(a,b,c){let e=Buffer.isBuffer(a)?a:Buffer.from(a);(t+=e.length)>d?c(Error(`message media exceeds ${d} bytes`)):c(null,e)}});try{await (0,i.pipeline)(h.Readable.fromWeb(b),u,(0,e.createWriteStream)(s,{flags:"wx",mode:384})),(0,e.renameSync)(s,r)}catch(a){try{(0,e.unlinkSync)(s)}catch{}throw a}return{path:(0,k.Nw)(r),name:o(a),storedName:m,size:t}}function r(a,b,c=(0,j.$M)()){let d=n(c),g=p(a),h=(0,f.join)(d,g);return(0,e.writeFileSync)(h,b,{flag:"wx",mode:384}),{path:(0,k.Nw)(h),name:o(a),storedName:g,size:b.length}}function s(a,b,c){let d=a.trim();if(!d)return null;try{let a=(0,k.Nw)((0,e.realpathSync)(n(b))),f=(0,k.Nw)((0,e.realpathSync)(d));if(f!==a&&!f.startsWith(`${a}/`)||!(0,e.statSync)(f).isFile())return null;return c(f)}catch{return null}}function t(a,b=(0,j.$M)()){return s(a,b,a=>(0,e.statSync)(a).size)}function u(a,b=(0,j.$M)(),c=0x1900000){return s(a,b,a=>(0,e.statSync)(a).size>c?null:(0,e.readFileSync)(a).toString("base64"))}function v(a,b=(0,j.$M)()){return s(a,b,a=>{try{return(0,e.unlinkSync)(a),!0}catch{return!1}})??!1}function w(a=(0,j.$M)()){let b=[];return function a(b,c){for(let d of(()=>{try{return(0,e.readdirSync)(b,{withFileTypes:!0})}catch{return[]}})()){let g=(0,f.join)(b,d.name);if(d.isDirectory()){a(g,c);continue}if(d.isFile())try{let a=(0,e.statSync)(g);c.push({path:(0,k.Nw)(g),size:a.size,mtimeMs:a.mtimeMs})}catch{}}}(m(a),b),b}d()}catch(a){d(a)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},77725:a=>{a.exports=require("stream/promises")},79748:a=>{a.exports=require("fs/promises")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>r,Nw:()=>j.Nw,bk:()=>q,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 s=/^[a-zA-Z]:[\\/]/;function o(a){return s.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(){return!0}function r(a,b){return!0}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)}})},93174:(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)}})}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5726],()=>b(b.s=93174));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)}})},97863:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/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:()=>c(89516),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/project-assets/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5726],()=>b(b.s=97863));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")},64902:(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=64902));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")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},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")},71257:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/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:()=>c(81497),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/prompts/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},78335:()=>{},81497:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>l,PUT:()=>m,dynamic:()=>i});var d=c(23211),e=c(89477),f=c(86697),g=c(60396);let h={system:"SYSTEM.md",systemAppend:"APPEND_SYSTEM.md",agents:"AGENTS.md"},i="force-dynamic";function j(){return(0,f.join)((0,g.$M)(),"pidance-prompt-drafts.json")}function k(){let a=j();if(!(0,e.existsSync)(a))return{};try{let b=JSON.parse((0,e.readFileSync)(a,"utf8"));if("object"==typeof b&&null!==b&&!Array.isArray(b))return b}catch{}return{}}async function l(){try{let a=(0,g.$M)(),b=k(),c=Object.keys(h).map(c=>{let d=(0,f.join)(a,h[c]),g=(0,e.existsSync)(d),i=g?(()=>{try{return(0,e.readFileSync)(d,"utf8")}catch{return b[c]??""}})():b[c]??"";return{key:c,enabled:g,content:i}});return d.NextResponse.json({entries:c},{headers:{"Cache-Control":"no-store"}})}catch(a){return d.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function m(a){try{var b;let c=await a.json().catch(()=>({}));if(b=c.key,"string"!=typeof b||"system"!==b&&"systemAppend"!==b&&"agents"!==b)return d.NextResponse.json({error:"key must be system | systemAppend | agents"},{status:400});if(void 0!==c.enabled&&"boolean"!=typeof c.enabled)return d.NextResponse.json({error:"enabled must be a boolean"},{status:400});if(void 0!==c.content&&"string"!=typeof c.content)return d.NextResponse.json({error:"content must be a string"},{status:400});if(c.content&&Buffer.byteLength(c.content,"utf8")>524288)return d.NextResponse.json({error:"content exceeds 524288 bytes"},{status:413});let i=c.key,l=(0,g.$M)(),m=(0,f.join)(l,h[i]),n=k(),o=c.enabled??(0,e.existsSync)(m);void 0!==c.content&&(c.content?n[i]=c.content:delete n[i]);let p=j(),q=(0,f.dirname)(p);(0,e.existsSync)(q)||(0,e.mkdirSync)(q,{recursive:!0,mode:448});let r=`${p}.${process.pid}.${Date.now()}.tmp`;try{(0,e.writeFileSync)(r,JSON.stringify(n,null,2),{flag:"wx",mode:384}),(0,e.renameSync)(r,p)}catch(a){try{(0,e.unlinkSync)(r)}catch{}throw a}if(o){let a=c.content??n[i];null!=a?((0,e.mkdirSync)((0,f.dirname)(m),{recursive:!0}),(0,e.writeFileSync)(m,a,"utf8")):(0,e.existsSync)(m)||(0,e.writeFileSync)(m,"","utf8")}else(0,e.existsSync)(m)&&(0,e.unlinkSync)(m);return d.NextResponse.json({ok:!0})}catch(a){return d.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}},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=71257));module.exports=c})();
@@ -1,3 +1,4 @@
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")},20960:(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}}},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")},54361:a=>{"use strict";function b(a){return/^[A-Za-z]:[\\/]/.test(a)||a.startsWith("\\\\")}a.exports={resolveShell:function(a,c){let d="string"==typeof c?.SHELL?c.SHELL.trim():"";return"win32"!==a?d||"/bin/bash":d&&b(d)?d:("string"==typeof c?.COMSPEC?c.COMSPEC.trim():"")||"powershell.exe"},looksLikeWindowsPath:b}},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),{resolveShell:g}=c(54361),h=new f({noServer:!0});function i(){try{let a=c(14566);if("function"!=typeof a.spawn)return null;return a}catch{return null}}function j(a){if(!d(a))throw Error("PTY cwd 不存在");return e(a)}function k(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
- `),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?i():a.pty;if(!c)throw Error("node-pty 不可用");let d=j(a.cwd),e=a.cols&&a.cols>0?a.cols:80,f=a.rows&&a.rows>0?a.rows:24,h=g(process.platform,process.env),k=c.spawn(h,[],{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)}),l=!1,m=b=>{if(!l){let c="string"==typeof b?b:b.toString();a.onData(c)}};"function"==typeof k.on?k.on("data",m):"function"==typeof k.onData&&k.onData(m);let n=b=>{l||a.onExit("object"==typeof b&&b?b.exitCode:0)};return"function"==typeof k.on?k.on("exit",n):"function"==typeof k.onExit&&k.onExit(n),{pid:k.pid,write:a=>{l||k.write(a)},resize:(a,b)=>{!l&&a>0&&b>0&&k.resize(a,b)},dispose:()=>{if(!l){l=!0;try{k.pid>0&&process.kill(-k.pid,"SIGTERM")}catch{}try{k.kill("SIGTERM")}catch{}}}}},tryLoadNodePty:i,resolvePtyCwd:j,attachPtyToWebSocket:k,completePtyUpgrade:function(a,b,c,d){h.handleUpgrade(a,b,c,b=>{h.emit("connection",b,a),k(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=20960));module.exports=c})();
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")},8128:a=>{"use strict";a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12700:a=>{"use strict";function b(a){try{if(!a||!a.stdin||!1===a.stdin.writable)return!1;return a.stdin.write(`${JSON.stringify({type:"bye"})}
2
+ `),!0}catch{return!1}}a.exports={killPtyProcess:function(a,b="SIGTERM",c=process.platform){if(a&&a.pid>0){if("win32"!==c)try{process.kill(-a.pid,b)}catch{}if("function"==typeof a.kill)try{"win32"===c?a.kill():a.kill(b)}catch{}}},startParentWatchdog:function(a={}){let b=a.parentPid??process.ppid,c=a.intervalMs??5e3,d=a.missThreshold??2,e=a.setIntervalFn??setInterval,f=a.clearIntervalFn??clearInterval,g=a.isAlive??(a=>{try{return process.kill(a,0),!0}catch(a){return a&&"EPERM"===a.code}}),h=a.onGone??(()=>{}),i=0,j=e(()=>{if(g(b)){i=0;return}(i+=1)>=d&&h()},c);return j&&"function"==typeof j.unref&&j.unref(),()=>f(j)},requestWorkerShutdown:b,disposeWorkerChild:function(a,c={}){let d=c.platform??process.platform,e=c.graceMs??2e3,f=c.setTimer??setTimeout,g=c.clearTimer??clearTimeout,h=()=>{try{a.kill("SIGTERM")}catch{}};if("win32"===d&&b(a)){let b=f(h,e);b&&"function"==typeof b.unref&&b.unref(),"function"==typeof a.once&&a.once("exit",()=>g(b));return}h()}}},14566:a=>{"use strict";a.exports=require("node-pty")},15086:a=>{"use strict";a.exports=require("ws")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},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")},54361:a=>{"use strict";function b(a){return/^[A-Za-z]:[\\/]/.test(a)||a.startsWith("\\\\")}a.exports={resolveShell:function(a,c){let d="string"==typeof c?.SHELL?c.SHELL.trim():"";return"win32"!==a?d||"/bin/bash":d&&b(d)?d:("string"==typeof c?.COMSPEC?c.COMSPEC.trim():"")||"powershell.exe"},looksLikeWindowsPath:b}},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),{resolveShell:g}=c(54361),{killPtyProcess:h,disposeWorkerChild:i}=c(12700),j=new f({noServer:!0});function k(){try{let a=c(14566);if("function"!=typeof a.spawn)return null;return a}catch{return null}}function l(a){if(!d(a))throw Error("PTY cwd 不存在");return e(a)}function m(a,b={}){let c=b.intervalMs??3e4,d=b.maxMissed??2,e=b.setIntervalFn??setInterval,f=b.clearIntervalFn??clearInterval,g=b.isOpen??(()=>1===a.readyState),h=0,i=()=>{h=0};a.on("pong",i);let j=e(()=>{if(g()){if(h>=d){try{a.terminate()}catch{}return}h+=1;try{a.ping()}catch{}}},c);return j&&"function"==typeof j.unref&&j.unref(),()=>{f(j),"function"==typeof a.off&&a.off("pong",i)}}function n(a,b){let{spawn:d}=c(79646),e=c(33873).join(__dirname,"pty-worker.js"),f=!1,g=d(process.execPath,[e,b,"80","24"],{stdio:["pipe","pipe","pipe"],env:process.env});g.stdin.on("error",()=>{}),g.stderr.setEncoding("utf8"),g.stderr.on("data",a=>console.warn("[pidance] pty-worker stderr",a)),g.on("error",a=>console.warn("[pidance] pty-worker spawn",a.message));let h={pid:g.pid,write:a=>g.stdin.write(`${JSON.stringify({type:"in",d:a})}
3
+ `),resize:(a,b)=>g.stdin.write(`${JSON.stringify({type:"rs",cols:a,rows:b})}
4
+ `),dispose:()=>{f||(f=!0,i(g))}};g.stdout.setEncoding("utf8");let j="";g.stdout.on("data",b=>{let c;for(j+="string"==typeof b?b:Buffer.from(b).toString("utf8");(c=j.indexOf("\n"))>=0;){let b=j.slice(0,c);if(j=j.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{}}}}),g.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&&h.write(b.d),b&&"rs"===b.type&&b.cols>0&&b.rows>0&&h.resize(b.cols,b.rows)});let k=m(a),l=()=>{k(),h.dispose()};a.on("close",l),a.on("error",l);try{a.send(JSON.stringify({type:"out",d:"\r\n[pidance] terminal ready\r\n"}))}catch{}return h}a.exports={startPtySession:function(a){let b,c=void 0===a.pty?k():a.pty;if(!c)throw Error("node-pty 不可用");let d=l(a.cwd),e=a.cols&&a.cols>0?a.cols:80,f=a.rows&&a.rows>0?a.rows:24,i=g(process.platform,process.env),j=c.spawn(i,[],{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)}),m=!1,n=b=>{if(!m){let c="string"==typeof b?b:b.toString();a.onData(c)}};"function"==typeof j.on?j.on("data",n):"function"==typeof j.onData&&j.onData(n);let o=b=>{m||a.onExit("object"==typeof b&&b?b.exitCode:0)};return"function"==typeof j.on?j.on("exit",o):"function"==typeof j.onExit&&j.onExit(o),{pid:j.pid,write:a=>{m||j.write(a)},resize:(a,b)=>{!m&&a>0&&b>0&&j.resize(a,b)},dispose:()=>{m||(m=!0,h(j))}}},tryLoadNodePty:k,resolvePtyCwd:l,attachPtyToWebSocket:n,completePtyUpgrade:function(a,b,c,d){j.handleUpgrade(a,b,c,b=>{j.emit("connection",b,a),n(b,d)})},startPtyHeartbeat:m}},69978:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GET:()=>g,dynamic:()=>f});var d=c(23211);let{tryLoadNodePty:e}=c(63678),f="force-dynamic";async function g(){return d.NextResponse.json({available:null!==e()})}},74897:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/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:()=>c(69978),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/pty/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},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=74897));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")},21820:a=>{a.exports=require("os")},25680:a=>{a.exports=require("node:readline")},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},42524:a=>{a.exports=require("node:fs/promises")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},48404:(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)}})},55511:a=>{a.exports=require("crypto")},55822:a=>{a.exports=require("node:module")},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")},77725:a=>{a.exports=require("stream/promises")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},79868:a=>{a.exports=require("node:sqlite")},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,5726,7594],()=>b(b.s=48404));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")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4984:a=>{a.exports=require("readline")},6749:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/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:()=>c(82181),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/archive/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},25680:a=>{a.exports=require("node:readline")},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},42524:a=>{a.exports=require("node:fs/promises")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},55822:a=>{a.exports=require("node:module")},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")},77725:a=>{a.exports=require("stream/promises")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},79868:a=>{a.exports=require("node:sqlite")},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,5726,9032,9460,7594],()=>b(b.s=6749));module.exports=c})();
@@ -1 +1 @@
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")},25680:a=>{a.exports=require("node:readline")},25846:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(23211),f=c(37594),g=a([f]);async function h(a,{params:b}){let{id:c}=await b;try{let a=await f.mB.autoNameSession(c);return e.NextResponse.json(a)}catch(b){if(String(b)===f.DQ)return e.NextResponse.json({error:f.DQ},{status:403});let a=b instanceof Error?b.message:String(b);return e.NextResponse.json({error:a},{status:(0,f.Md)(b)})}}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},42524:a=>{a.exports=require("node:fs/promises")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},55822:a=>{a.exports=require("node:module")},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")},77725:a=>{a.exports=require("stream/promises")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},79868:a=>{a.exports=require("node:sqlite")},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")},99820:(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)}})}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,5726,7594],()=>b(b.s=99820));module.exports=c})();
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")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},25680:a=>{a.exports=require("node:readline")},25846:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>h});var e=c(23211),f=c(37594),g=a([f]);async function h(a,{params:b}){let{id:c}=await b;try{let a=await f.mB.autoNameSession(c);return e.NextResponse.json(a)}catch(b){if(String(b)===f.DQ)return e.NextResponse.json({error:f.DQ},{status:403});let a=b instanceof Error?b.message:String(b);return e.NextResponse.json({error:a},{status:(0,f.Md)(b)})}}f=(g.then?(await g)():g)[0],d()}catch(a){d(a)}})},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},42524:a=>{a.exports=require("node:fs/promises")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},55822:a=>{a.exports=require("node:module")},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")},77725:a=>{a.exports=require("stream/promises")},78149:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/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:()=>c(25846),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/auto-name/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},79868:a=>{a.exports=require("node:sqlite")},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,5726,9032,9460,7594],()=>b(b.s=78149));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")},21820:a=>{a.exports=require("os")},25680:a=>{a.exports=require("node:readline")},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},42524:a=>{a.exports=require("node:fs/promises")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},55822:a=>{a.exports=require("node:module")},59460:(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)}})},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")},77725:a=>{a.exports=require("stream/promises")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},79868:a=>{a.exports=require("node:sqlite")},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,5726,7594],()=>b(b.s=59460));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")},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{a.exports=require("os")},25680:a=>{a.exports=require("node:readline")},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},42524:a=>{a.exports=require("node:fs/promises")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},55822:a=>{a.exports=require("node:module")},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")},77725:a=>{a.exports=require("stream/promises")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},79868:a=>{a.exports=require("node:sqlite")},83821:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/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:()=>c(70343),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/command-entry/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},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,5726,9032,9460,7594],()=>b(b.s=83821));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=6709,a.ids=[6709],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")},6004:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i});var e=c(23211),f=c(46935),g=c(37594),h=a([g]);async function i(a,{params:b}){let{id:c}=await b,d=new URL(a.url),h=d.searchParams.get("leafId")??void 0,j=d.searchParams.get("before")??void 0,k=d.searchParams.get("around")??void 0,l=d.searchParams.get("after")??void 0,m="0"!==d.searchParams.get("toEnd"),n=d.searchParams.has("deferThinking"),o=d.searchParams.has("deferMedia"),p=(0,f.NN)(d.searchParams,j||k||l?f._w:f.Uf);try{let a=await g.mB.getContextPage(c,{leafId:h,before:j,around:k,after:l,aroundToEnd:void 0!==k?m:void 0,limit:p,deferThinking:n,deferToolResultImages:o}),b=a.context;if(!b){let b=a.notFound;return e.NextResponse.json(b?{error:"Entry not found in current branch",entryId:b}:{error:"Session not found"},{status:404})}return e.NextResponse.json({context:b})}catch{return e.NextResponse.json({context:{messages:[],entryIds:[],hasMoreBefore:!1,totalMessageCount:0}})}}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12180:(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(6004),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]/context/route",pathname:"/api/sessions/[id]/context",filename:"route",bundlePath:"app/api/sessions/[id]/context/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/sessions/[id]/context/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]/context/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")},25680:a=>{a.exports=require("node:readline")},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},42524:a=>{a.exports=require("node:fs/promises")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},55822:a=>{a.exports=require("node:module")},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")},77725:a=>{a.exports=require("stream/promises")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},79868:a=>{a.exports=require("node:sqlite")},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,5726,7594],()=>b(b.s=12180));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=6709,a.ids=[6709],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")},6004:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>i});var e=c(23211),f=c(46935),g=c(37594),h=a([g]);async function i(a,{params:b}){let{id:c}=await b,d=new URL(a.url),h=d.searchParams.get("leafId")??void 0,j=d.searchParams.get("before")??void 0,k=d.searchParams.get("around")??void 0,l=d.searchParams.get("after")??void 0,m="0"!==d.searchParams.get("toEnd"),n=d.searchParams.has("deferThinking"),o=d.searchParams.has("deferMedia"),p=(0,f.NN)(d.searchParams,j||k||l?f._w:f.Uf);try{let a=await g.mB.getContextPage(c,{leafId:h,before:j,around:k,after:l,aroundToEnd:void 0!==k?m:void 0,limit:p,deferThinking:n,deferToolResultImages:o}),b=a.context;if(!b){let b=a.notFound;return e.NextResponse.json(b?{error:"Entry not found in current branch",entryId:b}:{error:"Session not found"},{status:404})}return e.NextResponse.json({context:b})}catch{return e.NextResponse.json({context:{messages:[],entryIds:[],hasMoreBefore:!1,totalMessageCount:0}})}}g=(h.then?(await h)():h)[0],d()}catch(a){d(a)}})},8128:a=>{a.exports=require("next/dist/server/runtime-reacts.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},19121:a=>{a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},20893:(a,b,c)=>{c.r(b),c.d(b,{handler:()=>z,patchFetch:()=>y,routeModule:()=>u,serverHooks:()=>x,workAsyncStorage:()=>v,workUnitAsyncStorage:()=>w});var d=c(19225),e=c(84006),f=c(8317),g=c(99373),h=c(34775),i=c(24235),j=c(261),k=c(54365),l=c(90771),m=c(73461),n=c(67798),o=c(92280),p=c(62018),q=c(45696),r=c(47929),s=c(86439),t=c(37527);let u=new d.AppRouteRouteModule({definition:{kind:e.RouteKind.APP_ROUTE,page:"/api/sessions/[id]/context/route",pathname:"/api/sessions/[id]/context",filename:"route",bundlePath:"app/api/sessions/[id]/context/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/tmp/pidance-release-build/app/api/sessions/[id]/context/route.ts",nextConfigOutput:"",userland:()=>c(6004),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:w,serverHooks:x}=u;function y(){return(0,f.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:w})}async function z(a,b,c){c.requestMeta&&(0,g.setRequestMeta)(a,c.requestMeta),u.isDev&&(0,g.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/sessions/[id]/context/route";"/index"===d&&(d="/");let f=await u.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!f)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:v,deploymentId:w,params:x,nextConfig:y,parsedUrl:z,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=f,I=(0,j.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,z,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(y.adapterPath)return await K();throw new s.NoFallbackError}}let L=null;!J||u.isDev||A||(L="/index"===(L=F)?"/":L);let M=!0===u.isDev||!J,N=J&&!M;H&&G&&(0,i.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,h.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,g.getRequestMeta)(a,"minimalMode"),T=(0,g.getRequestMeta)(a,"incrementalCache")||await u.getIncrementalCache(a,y,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:x,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,supportsDynamicResponse:M,incrementalCache:T,hmrRefreshHash:(0,g.getRequestMeta)(a,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>u.onRequestError(a,b,d,e,C)},sharedContext:{buildId:v,deploymentId:w}},V=new k.NodeNextRequest(a),W=new k.NodeNextResponse(b),X=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(b)),Y=async({previousCacheEntry:e})=>{try{if(!S&&D&&E&&!e)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await u.handle(X,U);a.fetchMetrics=U.renderOpts.fetchMetrics;let f=U.renderOpts.pendingWaitUntil;f&&c.waitUntil&&(c.waitUntil(f),f=void 0);let g=U.renderOpts.collectedTags;if(!J)return await (0,o.I)(V,W,d,f),null;{let a=await d.blob(),b=(0,p.toNodeOutgoingHttpHeaders)(d.headers);g&&(b[r.NEXT_CACHE_TAGS_HEADER]=g),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=r.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=r.INFINITE_CACHE?!1!==c&&c>0?y.expireTime:void 0:U.renderOpts.collectedExpire;return{value:{kind:t.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==e?void 0:e.isStale)&&await u.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},Z=async(d,f)=>{try{var g,i;let d=await u.handleResponse({req:a,nextConfig:y,cacheKey:L,routeKind:e.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:Y,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return;if((null==d||null==(g=d.value)?void 0:g.kind)!==t.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==d||null==(i=d.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":d.isMiss?"MISS":d.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let f=(0,p.fromNodeOutgoingHttpHeaders)(d.value.headers);S&&J||f.delete(r.NEXT_CACHE_TAGS_HEADER),!d.cacheControl||b.getHeader("Cache-Control")||f.get("Cache-Control")||f.set("Cache-Control",(0,q.getCacheControlHeader)(d.cacheControl)),await (0,o.I)(V,W,new Response(d.value.body,{headers:f,status:d.value.status||200}));return}catch(b){if(b instanceof s.NoFallbackError||await u.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,n.getRevalidateReason)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;await (0,o.I)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!d)return;let a=b.statusCode;d.setAttributes({"http.status_code":a,"next.rsc":!1}),a&&a>=500&&(d.setStatus({code:h.SpanStatusCode.ERROR}),d.setAttribute("error.type",a.toString()));let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==m.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=c.get("next.route")||I,g=`${O} ${e}`;d.setAttributes({"next.route":e,"http.route":e,"next.span_name":g}),d.updateName(g),f&&f!==d&&(f.setAttribute("http.route",e),f.updateName(g))})()}};if(R&&Q)await Z(Q,void 0);else{let b=P.getActiveScopeSpan();await P.withPropagatedContext(a.headers,()=>P.trace(m.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:h.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},a=>Z(a,b)),void 0,!R)}}},21820:a=>{a.exports=require("os")},25680:a=>{a.exports=require("node:readline")},26238:a=>{a.exports=require("node:stream")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29862:a=>{a.exports=import("@earendil-works/pi-tui")},33873:a=>{a.exports=require("path")},42524:a=>{a.exports=require("node:fs/promises")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},55822:a=>{a.exports=require("node:module")},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")},77725:a=>{a.exports=require("stream/promises")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},79868:a=>{a.exports=require("node:sqlite")},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,5726,9032,9460,7594],()=>b(b.s=20893));module.exports=c})();