@qt4798/pi-web 0.9.21 → 0.9.22

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 (322) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +19 -17
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/routes-manifest.json +12 -0
  5. package/.next/server/app/_global-error/page.js +2 -2
  6. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  7. package/.next/server/app/_global-error.html +1 -1
  8. package/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page.js +2 -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.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  20. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  22. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  25. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  26. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  27. package/.next/server/app/api/agent/[id]/route.js +1 -1
  28. package/.next/server/app/api/agent/new/route.js +1 -1
  29. package/.next/server/app/api/agent/running/events/route.js +1 -1
  30. package/.next/server/app/api/agent/running/route.js +1 -1
  31. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  32. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  33. package/.next/server/app/api/auth/combined/route.js +1 -1
  34. package/.next/server/app/api/auth/login/[provider]/route.js +2 -2
  35. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  36. package/.next/server/app/api/auth/providers/route.js +1 -1
  37. package/.next/server/app/api/backup/export/route.js +1 -1
  38. package/.next/server/app/api/backup/import/route.js +1 -1
  39. package/.next/server/app/api/cwd/browse/route.js +1 -1
  40. package/.next/server/app/api/cwd/validate/route.js +1 -1
  41. package/.next/server/app/api/deepseek/balance/route.js +1 -1
  42. package/.next/server/app/api/default-cwd/route.js +1 -1
  43. package/.next/server/app/api/events/route.js +2 -2
  44. package/.next/server/app/api/features/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 +1 -1
  47. package/.next/server/app/api/git/diff/route.js +2 -2
  48. package/.next/server/app/api/git/push/route.js +1 -1
  49. package/.next/server/app/api/git/stash/route.js +1 -1
  50. package/.next/server/app/api/git/status/route.js +1 -1
  51. package/.next/server/app/api/home/route.js +1 -1
  52. package/.next/server/app/api/import/discover/route.js +1 -1
  53. package/.next/server/app/api/import/execute/route.js +1 -1
  54. package/.next/server/app/api/import/status/route.js +1 -1
  55. package/.next/server/app/api/logs/route.js +1 -1
  56. package/.next/server/app/api/mcp/restart/route.js +1 -0
  57. package/.next/server/app/api/mcp/restart/route.js.nft.json +1 -0
  58. package/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -0
  59. package/.next/server/app/api/mcp/route.js +1 -1
  60. package/.next/server/app/api/models/route.js +1 -1
  61. package/.next/server/app/api/models-config/builtin/route.js +1 -1
  62. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  63. package/.next/server/app/api/models-config/discover/route.js +1 -1
  64. package/.next/server/app/api/models-config/route.js +1 -1
  65. package/.next/server/app/api/models-config/test/route.js +1 -1
  66. package/.next/server/app/api/modes/route.js +1 -1
  67. package/.next/server/app/api/opencode-zen/external/key/route.js +1 -1
  68. package/.next/server/app/api/opencode-zen/external/test/route.js +1 -1
  69. package/.next/server/app/api/opencode-zen/import/route.js +1 -1
  70. package/.next/server/app/api/opencode-zen/key/route.js +1 -1
  71. package/.next/server/app/api/opencode-zen/route.js +1 -1
  72. package/.next/server/app/api/opencode-zen/test/route.js +1 -1
  73. package/.next/server/app/api/plugins/route.js +1 -1
  74. package/.next/server/app/api/project-trust/route.js +1 -1
  75. package/.next/server/app/api/proxy/route.js +1 -1
  76. package/.next/server/app/api/proxy/test/route.js +1 -1
  77. package/.next/server/app/api/sessions/[id]/auto-name/route.js +2 -2
  78. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  79. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  80. package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
  81. package/.next/server/app/api/sessions/[id]/queue-recovery/route.js +1 -1
  82. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  83. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  84. package/.next/server/app/api/sessions/route.js +1 -1
  85. package/.next/server/app/api/settings/title-model/route.js +1 -1
  86. package/.next/server/app/api/skills/check/route.js +1 -1
  87. package/.next/server/app/api/skills/install/route.js +1 -1
  88. package/.next/server/app/api/skills/route.js +2 -2
  89. package/.next/server/app/api/skills/search/route.js +1 -1
  90. package/.next/server/app/api/skills/update/route.js +1 -1
  91. package/.next/server/app/api/snippets/[id]/route.js +1 -1
  92. package/.next/server/app/api/snippets/route.js +1 -1
  93. package/.next/server/app/api/subagents/agents/[name]/route.js +2 -2
  94. package/.next/server/app/api/subagents/route.js +2 -2
  95. package/.next/server/app/api/subagents/transcript/route.js +1 -0
  96. package/.next/server/app/api/subagents/transcript/route.js.nft.json +1 -0
  97. package/.next/server/app/api/subagents/transcript/route_client-reference-manifest.js +1 -0
  98. package/.next/server/app/api/tasks/[id]/[action]/route.js +1 -1
  99. package/.next/server/app/api/tasks/[id]/changed-files/route.js +2 -2
  100. package/.next/server/app/api/tasks/[id]/diff/route.js +1 -1
  101. package/.next/server/app/api/tasks/[id]/events/route.js +1 -1
  102. package/.next/server/app/api/tasks/[id]/route.js +1 -1
  103. package/.next/server/app/api/tasks/batch/route.js +1 -1
  104. package/.next/server/app/api/tasks/events/route.js +2 -2
  105. package/.next/server/app/api/tasks/route.js +1 -1
  106. package/.next/server/app/api/tasks/settings/route.js +1 -1
  107. package/.next/server/app/api/tasks/templates/route.js +1 -1
  108. package/.next/server/app/api/themes/[name]/route.js +1 -1
  109. package/.next/server/app/api/themes/route.js +1 -1
  110. package/.next/server/app/api/usage/route.js +1 -1
  111. package/.next/server/app/api/vision-config/route.js +2 -2
  112. package/.next/server/app/api/worktrees/route.js +1 -1
  113. package/.next/server/app/icon.ico/route.js +1 -1
  114. package/.next/server/app/icon.png/route.js +1 -1
  115. package/.next/server/app/icon.svg/route.js +1 -1
  116. package/.next/server/app/index.html +1 -1
  117. package/.next/server/app/index.rsc +4 -4
  118. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  119. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  120. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  121. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  122. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  123. package/.next/server/app/page.js +15 -15
  124. package/.next/server/app/page_client-reference-manifest.js +1 -1
  125. package/.next/server/app-paths-manifest.json +19 -17
  126. package/.next/server/chunks/5582.js +1 -1
  127. package/.next/server/chunks/6429.js +1 -1
  128. package/.next/server/middleware-build-manifest.js +1 -1
  129. package/.next/server/pages/404.html +1 -1
  130. package/.next/server/pages/500.html +1 -1
  131. package/.next/static/5flUIYUxfgZfLvpZVYPQk/_buildManifest.js +1 -0
  132. package/.next/static/chunks/711-462ef5daacae3d6c.js +1 -0
  133. package/.next/static/chunks/app/_global-error/page-dd644cb953dc11f5.js +1 -0
  134. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-dd644cb953dc11f5.js +1 -0
  135. package/.next/static/chunks/app/api/agent/[id]/events/route-dd644cb953dc11f5.js +1 -0
  136. package/.next/static/chunks/app/api/agent/[id]/route-dd644cb953dc11f5.js +1 -0
  137. package/.next/static/chunks/app/api/agent/new/route-dd644cb953dc11f5.js +1 -0
  138. package/.next/static/chunks/app/api/agent/running/events/route-dd644cb953dc11f5.js +1 -0
  139. package/.next/static/chunks/app/api/agent/running/route-dd644cb953dc11f5.js +1 -0
  140. package/.next/static/chunks/app/api/auth/all-providers/route-dd644cb953dc11f5.js +1 -0
  141. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-dd644cb953dc11f5.js +1 -0
  142. package/.next/static/chunks/app/api/auth/combined/route-dd644cb953dc11f5.js +1 -0
  143. package/.next/static/chunks/app/api/auth/login/[provider]/route-dd644cb953dc11f5.js +1 -0
  144. package/.next/static/chunks/app/api/auth/logout/[provider]/route-dd644cb953dc11f5.js +1 -0
  145. package/.next/static/chunks/app/api/auth/providers/route-dd644cb953dc11f5.js +1 -0
  146. package/.next/static/chunks/app/api/backup/export/route-dd644cb953dc11f5.js +1 -0
  147. package/.next/static/chunks/app/api/backup/import/route-dd644cb953dc11f5.js +1 -0
  148. package/.next/static/chunks/app/api/cwd/browse/route-dd644cb953dc11f5.js +1 -0
  149. package/.next/static/chunks/app/api/cwd/validate/route-dd644cb953dc11f5.js +1 -0
  150. package/.next/static/chunks/app/api/deepseek/balance/route-dd644cb953dc11f5.js +1 -0
  151. package/.next/static/chunks/app/api/default-cwd/route-dd644cb953dc11f5.js +1 -0
  152. package/.next/static/chunks/app/api/events/route-dd644cb953dc11f5.js +1 -0
  153. package/.next/static/chunks/app/api/features/route-dd644cb953dc11f5.js +1 -0
  154. package/.next/static/chunks/app/api/file-index/route-dd644cb953dc11f5.js +1 -0
  155. package/.next/static/chunks/app/api/files/[...path]/route-dd644cb953dc11f5.js +1 -0
  156. package/.next/static/chunks/app/api/git/diff/route-dd644cb953dc11f5.js +1 -0
  157. package/.next/static/chunks/app/api/git/push/route-dd644cb953dc11f5.js +1 -0
  158. package/.next/static/chunks/app/api/git/stash/route-dd644cb953dc11f5.js +1 -0
  159. package/.next/static/chunks/app/api/git/status/route-dd644cb953dc11f5.js +1 -0
  160. package/.next/static/chunks/app/api/home/route-dd644cb953dc11f5.js +1 -0
  161. package/.next/static/chunks/app/api/import/discover/route-dd644cb953dc11f5.js +1 -0
  162. package/.next/static/chunks/app/api/import/execute/route-dd644cb953dc11f5.js +1 -0
  163. package/.next/static/chunks/app/api/import/status/route-dd644cb953dc11f5.js +1 -0
  164. package/.next/static/chunks/app/api/logs/route-dd644cb953dc11f5.js +1 -0
  165. package/.next/static/chunks/app/api/mcp/restart/route-dd644cb953dc11f5.js +1 -0
  166. package/.next/static/chunks/app/api/mcp/route-dd644cb953dc11f5.js +1 -0
  167. package/.next/static/chunks/app/api/models/route-dd644cb953dc11f5.js +1 -0
  168. package/.next/static/chunks/app/api/models-config/builtin/route-dd644cb953dc11f5.js +1 -0
  169. package/.next/static/chunks/app/api/models-config/catalog/route-dd644cb953dc11f5.js +1 -0
  170. package/.next/static/chunks/app/api/models-config/discover/route-dd644cb953dc11f5.js +1 -0
  171. package/.next/static/chunks/app/api/models-config/route-dd644cb953dc11f5.js +1 -0
  172. package/.next/static/chunks/app/api/models-config/test/route-dd644cb953dc11f5.js +1 -0
  173. package/.next/static/chunks/app/api/modes/route-dd644cb953dc11f5.js +1 -0
  174. package/.next/static/chunks/app/api/opencode-zen/external/key/route-dd644cb953dc11f5.js +1 -0
  175. package/.next/static/chunks/app/api/opencode-zen/external/test/route-dd644cb953dc11f5.js +1 -0
  176. package/.next/static/chunks/app/api/opencode-zen/import/route-dd644cb953dc11f5.js +1 -0
  177. package/.next/static/chunks/app/api/opencode-zen/key/route-dd644cb953dc11f5.js +1 -0
  178. package/.next/static/chunks/app/api/opencode-zen/route-dd644cb953dc11f5.js +1 -0
  179. package/.next/static/chunks/app/api/opencode-zen/test/route-dd644cb953dc11f5.js +1 -0
  180. package/.next/static/chunks/app/api/plugins/route-dd644cb953dc11f5.js +1 -0
  181. package/.next/static/chunks/app/api/project-trust/route-dd644cb953dc11f5.js +1 -0
  182. package/.next/static/chunks/app/api/proxy/route-dd644cb953dc11f5.js +1 -0
  183. package/.next/static/chunks/app/api/proxy/test/route-dd644cb953dc11f5.js +1 -0
  184. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-dd644cb953dc11f5.js +1 -0
  185. package/.next/static/chunks/app/api/sessions/[id]/context/route-dd644cb953dc11f5.js +1 -0
  186. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-dd644cb953dc11f5.js +1 -0
  187. package/.next/static/chunks/app/api/sessions/[id]/export/route-dd644cb953dc11f5.js +1 -0
  188. package/.next/static/chunks/app/api/sessions/[id]/queue-recovery/route-dd644cb953dc11f5.js +1 -0
  189. package/.next/static/chunks/app/api/sessions/[id]/route-dd644cb953dc11f5.js +1 -0
  190. package/.next/static/chunks/app/api/sessions/[id]/state/route-dd644cb953dc11f5.js +1 -0
  191. package/.next/static/chunks/app/api/sessions/route-dd644cb953dc11f5.js +1 -0
  192. package/.next/static/chunks/app/api/settings/title-model/route-dd644cb953dc11f5.js +1 -0
  193. package/.next/static/chunks/app/api/skills/check/route-dd644cb953dc11f5.js +1 -0
  194. package/.next/static/chunks/app/api/skills/install/route-dd644cb953dc11f5.js +1 -0
  195. package/.next/static/chunks/app/api/skills/route-dd644cb953dc11f5.js +1 -0
  196. package/.next/static/chunks/app/api/skills/search/route-dd644cb953dc11f5.js +1 -0
  197. package/.next/static/chunks/app/api/skills/update/route-dd644cb953dc11f5.js +1 -0
  198. package/.next/static/chunks/app/api/snippets/[id]/route-dd644cb953dc11f5.js +1 -0
  199. package/.next/static/chunks/app/api/snippets/route-dd644cb953dc11f5.js +1 -0
  200. package/.next/static/chunks/app/api/subagents/agents/[name]/route-dd644cb953dc11f5.js +1 -0
  201. package/.next/static/chunks/app/api/subagents/route-dd644cb953dc11f5.js +1 -0
  202. package/.next/static/chunks/app/api/subagents/transcript/route-dd644cb953dc11f5.js +1 -0
  203. package/.next/static/chunks/app/api/tasks/[id]/[action]/route-dd644cb953dc11f5.js +1 -0
  204. package/.next/static/chunks/app/api/tasks/[id]/changed-files/route-dd644cb953dc11f5.js +1 -0
  205. package/.next/static/chunks/app/api/tasks/[id]/diff/route-dd644cb953dc11f5.js +1 -0
  206. package/.next/static/chunks/app/api/tasks/[id]/events/route-dd644cb953dc11f5.js +1 -0
  207. package/.next/static/chunks/app/api/tasks/[id]/route-dd644cb953dc11f5.js +1 -0
  208. package/.next/static/chunks/app/api/tasks/batch/route-dd644cb953dc11f5.js +1 -0
  209. package/.next/static/chunks/app/api/tasks/events/route-dd644cb953dc11f5.js +1 -0
  210. package/.next/static/chunks/app/api/tasks/route-dd644cb953dc11f5.js +1 -0
  211. package/.next/static/chunks/app/api/tasks/settings/route-dd644cb953dc11f5.js +1 -0
  212. package/.next/static/chunks/app/api/tasks/templates/route-dd644cb953dc11f5.js +1 -0
  213. package/.next/static/chunks/app/api/themes/[name]/route-dd644cb953dc11f5.js +1 -0
  214. package/.next/static/chunks/app/api/themes/route-dd644cb953dc11f5.js +1 -0
  215. package/.next/static/chunks/app/api/usage/route-dd644cb953dc11f5.js +1 -0
  216. package/.next/static/chunks/app/api/vision-config/route-dd644cb953dc11f5.js +1 -0
  217. package/.next/static/chunks/app/api/worktrees/route-dd644cb953dc11f5.js +1 -0
  218. package/.next/static/chunks/app/page-13f035bcaf65b16c.js +53 -0
  219. package/.next/static/chunks/next/dist/client/components/builtin/app-error-dd644cb953dc11f5.js +1 -0
  220. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-dd644cb953dc11f5.js +1 -0
  221. package/.next/static/chunks/next/dist/client/components/builtin/not-found-dd644cb953dc11f5.js +1 -0
  222. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-dd644cb953dc11f5.js +1 -0
  223. package/.next/static/css/82bd0d6d352edbf3.css +1 -0
  224. package/.next/trace +9 -9
  225. package/.next/trace-build +1 -1
  226. package/.next/types/app/api/mcp/restart/route.ts +351 -0
  227. package/.next/types/app/api/subagents/transcript/route.ts +351 -0
  228. package/.next/types/routes.d.ts +3 -1
  229. package/.next/types/validator.ts +18 -0
  230. package/package.json +1 -1
  231. package/.next/static/GxM26wqNKTWNiNc1-YXns/_buildManifest.js +0 -1
  232. package/.next/static/chunks/3555-b9de79b68c0278d5.js +0 -1
  233. package/.next/static/chunks/app/_global-error/page-3581deaae88a2371.js +0 -1
  234. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-3581deaae88a2371.js +0 -1
  235. package/.next/static/chunks/app/api/agent/[id]/events/route-3581deaae88a2371.js +0 -1
  236. package/.next/static/chunks/app/api/agent/[id]/route-3581deaae88a2371.js +0 -1
  237. package/.next/static/chunks/app/api/agent/new/route-3581deaae88a2371.js +0 -1
  238. package/.next/static/chunks/app/api/agent/running/events/route-3581deaae88a2371.js +0 -1
  239. package/.next/static/chunks/app/api/agent/running/route-3581deaae88a2371.js +0 -1
  240. package/.next/static/chunks/app/api/auth/all-providers/route-3581deaae88a2371.js +0 -1
  241. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-3581deaae88a2371.js +0 -1
  242. package/.next/static/chunks/app/api/auth/combined/route-3581deaae88a2371.js +0 -1
  243. package/.next/static/chunks/app/api/auth/login/[provider]/route-3581deaae88a2371.js +0 -1
  244. package/.next/static/chunks/app/api/auth/logout/[provider]/route-3581deaae88a2371.js +0 -1
  245. package/.next/static/chunks/app/api/auth/providers/route-3581deaae88a2371.js +0 -1
  246. package/.next/static/chunks/app/api/backup/export/route-3581deaae88a2371.js +0 -1
  247. package/.next/static/chunks/app/api/backup/import/route-3581deaae88a2371.js +0 -1
  248. package/.next/static/chunks/app/api/cwd/browse/route-3581deaae88a2371.js +0 -1
  249. package/.next/static/chunks/app/api/cwd/validate/route-3581deaae88a2371.js +0 -1
  250. package/.next/static/chunks/app/api/deepseek/balance/route-3581deaae88a2371.js +0 -1
  251. package/.next/static/chunks/app/api/default-cwd/route-3581deaae88a2371.js +0 -1
  252. package/.next/static/chunks/app/api/events/route-3581deaae88a2371.js +0 -1
  253. package/.next/static/chunks/app/api/features/route-3581deaae88a2371.js +0 -1
  254. package/.next/static/chunks/app/api/file-index/route-3581deaae88a2371.js +0 -1
  255. package/.next/static/chunks/app/api/files/[...path]/route-3581deaae88a2371.js +0 -1
  256. package/.next/static/chunks/app/api/git/diff/route-3581deaae88a2371.js +0 -1
  257. package/.next/static/chunks/app/api/git/push/route-3581deaae88a2371.js +0 -1
  258. package/.next/static/chunks/app/api/git/stash/route-3581deaae88a2371.js +0 -1
  259. package/.next/static/chunks/app/api/git/status/route-3581deaae88a2371.js +0 -1
  260. package/.next/static/chunks/app/api/home/route-3581deaae88a2371.js +0 -1
  261. package/.next/static/chunks/app/api/import/discover/route-3581deaae88a2371.js +0 -1
  262. package/.next/static/chunks/app/api/import/execute/route-3581deaae88a2371.js +0 -1
  263. package/.next/static/chunks/app/api/import/status/route-3581deaae88a2371.js +0 -1
  264. package/.next/static/chunks/app/api/logs/route-3581deaae88a2371.js +0 -1
  265. package/.next/static/chunks/app/api/mcp/route-3581deaae88a2371.js +0 -1
  266. package/.next/static/chunks/app/api/models/route-3581deaae88a2371.js +0 -1
  267. package/.next/static/chunks/app/api/models-config/builtin/route-3581deaae88a2371.js +0 -1
  268. package/.next/static/chunks/app/api/models-config/catalog/route-3581deaae88a2371.js +0 -1
  269. package/.next/static/chunks/app/api/models-config/discover/route-3581deaae88a2371.js +0 -1
  270. package/.next/static/chunks/app/api/models-config/route-3581deaae88a2371.js +0 -1
  271. package/.next/static/chunks/app/api/models-config/test/route-3581deaae88a2371.js +0 -1
  272. package/.next/static/chunks/app/api/modes/route-3581deaae88a2371.js +0 -1
  273. package/.next/static/chunks/app/api/opencode-zen/external/key/route-3581deaae88a2371.js +0 -1
  274. package/.next/static/chunks/app/api/opencode-zen/external/test/route-3581deaae88a2371.js +0 -1
  275. package/.next/static/chunks/app/api/opencode-zen/import/route-3581deaae88a2371.js +0 -1
  276. package/.next/static/chunks/app/api/opencode-zen/key/route-3581deaae88a2371.js +0 -1
  277. package/.next/static/chunks/app/api/opencode-zen/route-3581deaae88a2371.js +0 -1
  278. package/.next/static/chunks/app/api/opencode-zen/test/route-3581deaae88a2371.js +0 -1
  279. package/.next/static/chunks/app/api/plugins/route-3581deaae88a2371.js +0 -1
  280. package/.next/static/chunks/app/api/project-trust/route-3581deaae88a2371.js +0 -1
  281. package/.next/static/chunks/app/api/proxy/route-3581deaae88a2371.js +0 -1
  282. package/.next/static/chunks/app/api/proxy/test/route-3581deaae88a2371.js +0 -1
  283. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-3581deaae88a2371.js +0 -1
  284. package/.next/static/chunks/app/api/sessions/[id]/context/route-3581deaae88a2371.js +0 -1
  285. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-3581deaae88a2371.js +0 -1
  286. package/.next/static/chunks/app/api/sessions/[id]/export/route-3581deaae88a2371.js +0 -1
  287. package/.next/static/chunks/app/api/sessions/[id]/queue-recovery/route-3581deaae88a2371.js +0 -1
  288. package/.next/static/chunks/app/api/sessions/[id]/route-3581deaae88a2371.js +0 -1
  289. package/.next/static/chunks/app/api/sessions/[id]/state/route-3581deaae88a2371.js +0 -1
  290. package/.next/static/chunks/app/api/sessions/route-3581deaae88a2371.js +0 -1
  291. package/.next/static/chunks/app/api/settings/title-model/route-3581deaae88a2371.js +0 -1
  292. package/.next/static/chunks/app/api/skills/check/route-3581deaae88a2371.js +0 -1
  293. package/.next/static/chunks/app/api/skills/install/route-3581deaae88a2371.js +0 -1
  294. package/.next/static/chunks/app/api/skills/route-3581deaae88a2371.js +0 -1
  295. package/.next/static/chunks/app/api/skills/search/route-3581deaae88a2371.js +0 -1
  296. package/.next/static/chunks/app/api/skills/update/route-3581deaae88a2371.js +0 -1
  297. package/.next/static/chunks/app/api/snippets/[id]/route-3581deaae88a2371.js +0 -1
  298. package/.next/static/chunks/app/api/snippets/route-3581deaae88a2371.js +0 -1
  299. package/.next/static/chunks/app/api/subagents/agents/[name]/route-3581deaae88a2371.js +0 -1
  300. package/.next/static/chunks/app/api/subagents/route-3581deaae88a2371.js +0 -1
  301. package/.next/static/chunks/app/api/tasks/[id]/[action]/route-3581deaae88a2371.js +0 -1
  302. package/.next/static/chunks/app/api/tasks/[id]/changed-files/route-3581deaae88a2371.js +0 -1
  303. package/.next/static/chunks/app/api/tasks/[id]/diff/route-3581deaae88a2371.js +0 -1
  304. package/.next/static/chunks/app/api/tasks/[id]/events/route-3581deaae88a2371.js +0 -1
  305. package/.next/static/chunks/app/api/tasks/[id]/route-3581deaae88a2371.js +0 -1
  306. package/.next/static/chunks/app/api/tasks/batch/route-3581deaae88a2371.js +0 -1
  307. package/.next/static/chunks/app/api/tasks/events/route-3581deaae88a2371.js +0 -1
  308. package/.next/static/chunks/app/api/tasks/route-3581deaae88a2371.js +0 -1
  309. package/.next/static/chunks/app/api/tasks/settings/route-3581deaae88a2371.js +0 -1
  310. package/.next/static/chunks/app/api/tasks/templates/route-3581deaae88a2371.js +0 -1
  311. package/.next/static/chunks/app/api/themes/[name]/route-3581deaae88a2371.js +0 -1
  312. package/.next/static/chunks/app/api/themes/route-3581deaae88a2371.js +0 -1
  313. package/.next/static/chunks/app/api/usage/route-3581deaae88a2371.js +0 -1
  314. package/.next/static/chunks/app/api/vision-config/route-3581deaae88a2371.js +0 -1
  315. package/.next/static/chunks/app/api/worktrees/route-3581deaae88a2371.js +0 -1
  316. package/.next/static/chunks/app/page-3de6991e0964e474.js +0 -53
  317. package/.next/static/chunks/next/dist/client/components/builtin/app-error-3581deaae88a2371.js +0 -1
  318. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-3581deaae88a2371.js +0 -1
  319. package/.next/static/chunks/next/dist/client/components/builtin/not-found-3581deaae88a2371.js +0 -1
  320. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-3581deaae88a2371.js +0 -1
  321. package/.next/static/css/096d7027f97f110c.css +0 -1
  322. /package/.next/static/{GxM26wqNKTWNiNc1-YXns → 5flUIYUxfgZfLvpZVYPQk}/_ssgManifest.js +0 -0
@@ -1,6 +1,6 @@
1
- "use strict";(()=>{var a={};a.id=9968,a.ids=[9968],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},6513:(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(45403),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/skills/route",pathname:"/api/skills",filename:"route",bundlePath:"app/api/skills/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/skills/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/skills/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)}})},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},21278:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{y:()=>i});var e=c(75430),f=c(75805),g=c(72498),h=a([e,g]);async function i(a){let b=(0,e.getAgentDir)(),c=new e.DefaultResourceLoader({cwd:a,agentDir:b});await c.reload((0,g.Fk)(a,b));let{skills:d,diagnostics:h}=c.getSkills();return{skills:(0,f._)(d,{cwd:a,agentDir:b}),diagnostics:h,projectResourcesLoaded:(0,g.Y1)(a,b).trusted}}[e,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},21820:a=>{a.exports=require("os")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},45403:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>p,PATCH:()=>q,dynamic:()=>r});var e=c(23211),f=c(29021),g=c(21820),h=c(33873),i=c.n(h),j=c(75430),k=c(21278),l=c(80547),m=c(66544),n=c(72498),o=a([j,k,l,n]);[j,k,l,n]=o.then?(await o)():o;let r="force-dynamic";async function p(a){let{searchParams:b}=new URL(a.url),c=b.get("cwd");if(!c)return e.NextResponse.json({error:"cwd required"},{status:400});try{let a=await (0,l.mc)();if(!(0,l.A$)(c,a))return e.NextResponse.json({error:"Access denied"},{status:403});return e.NextResponse.json(await (0,k.y)(c))}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function q(a){if(!(0,m.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,m.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let b=await a.json(),c="string"==typeof b.cwd?b.cwd:"",d="string"==typeof b.filePath?b.filePath:"",h=b.disableModelInvocation;if(!c)return e.NextResponse.json({error:"cwd required"},{status:400});if(!d)return e.NextResponse.json({error:"filePath required"},{status:400});if("boolean"!=typeof h)return e.NextResponse.json({error:"disableModelInvocation must be boolean"},{status:400});if(!(0,f.existsSync)(d))return e.NextResponse.json({error:"file not found"},{status:404});let k=await (0,l.mc)();if(!(0,l.A$)(c,k))return e.NextResponse.json({error:"Access denied"},{status:403});let m=(0,j.getAgentDir)(),o=i().join((0,g.homedir)(),".agents","skills"),p=new Set([c]),q=new Set([m,o]);if(!(0,l.A$)(d,p)&&!(0,l.A$)(d,q))return e.NextResponse.json({error:"Access denied"},{status:403});if((0,l.A$)(d,p)&&!(0,n.Y1)(c,m).trusted)return e.NextResponse.json({error:"Project resources must be trusted before modifying project skills"},{status:403});let r=(0,f.readFileSync)(d,"utf8"),s="disable-model-invocation",{frontmatter:t}=(0,j.parseFrontmatter)(r),u=!!t[s],v=r;return h&&!u?(v=r.replace(/^---\r?\n/,`---
1
+ "use strict";(()=>{var a={};a.id=9968,a.ids=[9968],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},21278:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{y:()=>i});var e=c(75430),f=c(75805),g=c(72498),h=a([e,g]);async function i(a){let b=(0,e.getAgentDir)(),c=new e.DefaultResourceLoader({cwd:a,agentDir:b});await c.reload((0,g.Fk)(a,b));let{skills:d,diagnostics:h}=c.getSkills();return{skills:(0,f._)(d,{cwd:a,agentDir:b}),diagnostics:h,projectResourcesLoaded:(0,g.Y1)(a,b).trusted}}[e,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},21820:a=>{a.exports=require("os")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},45403:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>p,PATCH:()=>q,dynamic:()=>r});var e=c(23211),f=c(29021),g=c(21820),h=c(33873),i=c.n(h),j=c(75430),k=c(21278),l=c(80547),m=c(66544),n=c(72498),o=a([j,k,l,n]);[j,k,l,n]=o.then?(await o)():o;let r="force-dynamic";async function p(a){let{searchParams:b}=new URL(a.url),c=b.get("cwd");if(!c)return e.NextResponse.json({error:"cwd required"},{status:400});try{let a=await (0,l.mc)();if(!(0,l.A$)(c,a))return e.NextResponse.json({error:"Access denied"},{status:403});return e.NextResponse.json(await (0,k.y)(c))}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}async function q(a){if(!(0,m.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,m.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let b=await a.json(),c="string"==typeof b.cwd?b.cwd:"",d="string"==typeof b.filePath?b.filePath:"",h=b.disableModelInvocation;if(!c)return e.NextResponse.json({error:"cwd required"},{status:400});if(!d)return e.NextResponse.json({error:"filePath required"},{status:400});if("boolean"!=typeof h)return e.NextResponse.json({error:"disableModelInvocation must be boolean"},{status:400});if(!(0,f.existsSync)(d))return e.NextResponse.json({error:"file not found"},{status:404});let k=await (0,l.mc)();if(!(0,l.A$)(c,k))return e.NextResponse.json({error:"Access denied"},{status:403});let m=(0,j.getAgentDir)(),o=i().join((0,g.homedir)(),".agents","skills"),p=new Set([c]),q=new Set([m,o]);if(!(0,l.A$)(d,p)&&!(0,l.A$)(d,q))return e.NextResponse.json({error:"Access denied"},{status:403});if((0,l.A$)(d,p)&&!(0,n.Y1)(c,m).trusted)return e.NextResponse.json({error:"Project resources must be trusted before modifying project skills"},{status:403});let r=(0,f.readFileSync)(d,"utf8"),s="disable-model-invocation",{frontmatter:t}=(0,j.parseFrontmatter)(r),u=!!t[s],v=r;return h&&!u?(v=r.replace(/^---\r?\n/,`---
2
2
  ${s}: true
3
3
  `))===r&&(v=`---
4
4
  ${s}: true
5
5
  ---
6
- ${r}`):!h&&u&&(v=r.replace(RegExp(`^${s}\\s*:.*\\r?\\n`,"m"),"")),(0,f.writeFileSync)(d,v,"utf8"),e.NextResponse.json({success:!0})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},55511:a=>{a.exports=require("crypto")},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},72498:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){return a&&(0,e.hasTrustRequiringProjectResources)(a)?{requiresTrust:!0,trusted:!0===new e.ProjectTrustStore(b).get(a)}:{requiresTrust:!1,trusted:!0}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},75805:(a,b,c)=>{c.d(b,{_:()=>j});var d=c(29021),e=c(21820),f=c(33873);function g(a){try{let b=JSON.parse((0,d.readFileSync)(a,"utf8"));return b.skills&&"object"==typeof b.skills?b.skills:{}}catch{return{}}}function h(a,b){let c=(0,f.relative)((0,f.resolve)(b),(0,f.resolve)(a));return""!==c&&".."!==c&&!c.startsWith(`..${f.sep}`)&&!(0,f.isAbsolute)(c)}function i(a,b,c){var d;let e=function(a,b){if(a[b])return a[b];let c=b.toLowerCase(),d=Object.keys(a).find(a=>a.toLowerCase()===c);return d?a[d]:void 0}(a,b);if(!e||"string"!=typeof e.source||!e.source.trim())return;let f="string"==typeof e.sourceType?e.sourceType:void 0,g=(d=e.source.trim(),"github"!==f?d.replace(/\/$/,""):d.replace(/^git\+/,"").replace(/^https?:\/\/github\.com\//,"").replace(/^git@github\.com:/,"").replace(/\.git$/,"").replace(/\/$/,""));if(!g)return;let h="string"==typeof e.skillPath?e.skillPath:void 0,i="string"==typeof e.ref?e.ref:void 0,j="global"===c?e.skillFolderHash:e.computedHash,k="string"==typeof j&&j?j:void 0,l="github"===f&&/^[\w.-]+\/[\w.-]+$/.test(g);return{package:`${g}@${b}`,scope:c,source:g,sourceType:f,skillsShUrl:"local"===f?void 0:function(a,b){if(!a||a.includes("://")||a.startsWith("git@"))return;let c=a.split("/").filter(Boolean).map(encodeURIComponent).join("/");if(c)return`https://skills.sh/${c}/${encodeURIComponent(b)}`}(g,b),...h&&{skillPath:h},...i&&{ref:i},...k&&{versionHash:k},canCheckForUpdates:!!(l&&h&&k&&("global"===c||!i))}}function j(a,{cwd:b,agentDir:c,globalLockPath:k=function({homeDir:a=(0,e.homedir)(),xdgStateHome:b=process.env.XDG_STATE_HOME}={}){return b?(0,f.join)(b,"skills",".skill-lock.json"):(0,f.join)(a,".agents",".skill-lock.json")}(),projectLockPath:l=(0,f.join)(b,"skills-lock.json")}){let m=g(k),n=g(l),o=(0,f.join)(c,"skills"),p=(0,f.join)(b,".pi","skills");return a.map(a=>{if(!(0,d.existsSync)(a.filePath))return a;let b=h(a.filePath,o)?i(m,a.name,"global"):h(a.filePath,p)?i(n,a.name,"project"):void 0;return b?{...a,install:b}:a})}},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>n,Nw:()=>i.Nw,mc:()=>m,uK:()=>l,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(40402),k=a([j]);j=(k.then?(await k)():k)[0];let o=/^[a-zA-Z]:[\\/]/;function l(a){return o.test(a)||a.startsWith("\\\\")||a.startsWith("//")}async function m(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,j.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function n(a,b){for(let c of b){let b=l(a)||l(c),d=b?h().win32:h(),e=b?"\\":h().sep,f=d.resolve(a),g=d.resolve(c),i=b?f.toLowerCase():f,j=b?g.toLowerCase():g,k=j.endsWith(e)?j:j+e;if(i===j||i.startsWith(k))return!0}return!1}d()}catch(a){d(a)}})},81115:a=>{a.exports=require("constants")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{a.exports=require("events")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,5582],()=>b(b.s=6513));module.exports=c})();
6
+ ${r}`):!h&&u&&(v=r.replace(RegExp(`^${s}\\s*:.*\\r?\\n`,"m"),"")),(0,f.writeFileSync)(d,v,"utf8"),e.NextResponse.json({success:!0})}catch(a){return e.NextResponse.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},55511:a=>{a.exports=require("crypto")},62438:(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(45403),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/skills/route",pathname:"/api/skills",filename:"route",bundlePath:"app/api/skills/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/skills/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/skills/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)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},72498:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){return a&&(0,e.hasTrustRequiringProjectResources)(a)?{requiresTrust:!0,trusted:!0===new e.ProjectTrustStore(b).get(a)}:{requiresTrust:!1,trusted:!0}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},75805:(a,b,c)=>{c.d(b,{_:()=>j});var d=c(29021),e=c(21820),f=c(33873);function g(a){try{let b=JSON.parse((0,d.readFileSync)(a,"utf8"));return b.skills&&"object"==typeof b.skills?b.skills:{}}catch{return{}}}function h(a,b){let c=(0,f.relative)((0,f.resolve)(b),(0,f.resolve)(a));return""!==c&&".."!==c&&!c.startsWith(`..${f.sep}`)&&!(0,f.isAbsolute)(c)}function i(a,b,c){var d;let e=function(a,b){if(a[b])return a[b];let c=b.toLowerCase(),d=Object.keys(a).find(a=>a.toLowerCase()===c);return d?a[d]:void 0}(a,b);if(!e||"string"!=typeof e.source||!e.source.trim())return;let f="string"==typeof e.sourceType?e.sourceType:void 0,g=(d=e.source.trim(),"github"!==f?d.replace(/\/$/,""):d.replace(/^git\+/,"").replace(/^https?:\/\/github\.com\//,"").replace(/^git@github\.com:/,"").replace(/\.git$/,"").replace(/\/$/,""));if(!g)return;let h="string"==typeof e.skillPath?e.skillPath:void 0,i="string"==typeof e.ref?e.ref:void 0,j="global"===c?e.skillFolderHash:e.computedHash,k="string"==typeof j&&j?j:void 0,l="github"===f&&/^[\w.-]+\/[\w.-]+$/.test(g);return{package:`${g}@${b}`,scope:c,source:g,sourceType:f,skillsShUrl:"local"===f?void 0:function(a,b){if(!a||a.includes("://")||a.startsWith("git@"))return;let c=a.split("/").filter(Boolean).map(encodeURIComponent).join("/");if(c)return`https://skills.sh/${c}/${encodeURIComponent(b)}`}(g,b),...h&&{skillPath:h},...i&&{ref:i},...k&&{versionHash:k},canCheckForUpdates:!!(l&&h&&k&&("global"===c||!i))}}function j(a,{cwd:b,agentDir:c,globalLockPath:k=function({homeDir:a=(0,e.homedir)(),xdgStateHome:b=process.env.XDG_STATE_HOME}={}){return b?(0,f.join)(b,"skills",".skill-lock.json"):(0,f.join)(a,".agents",".skill-lock.json")}(),projectLockPath:l=(0,f.join)(b,"skills-lock.json")}){let m=g(k),n=g(l),o=(0,f.join)(c,"skills"),p=(0,f.join)(b,".pi","skills");return a.map(a=>{if(!(0,d.existsSync)(a.filePath))return a;let b=h(a.filePath,o)?i(m,a.name,"global"):h(a.filePath,p)?i(n,a.name,"project"):void 0;return b?{...a,install:b}:a})}},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},79646:a=>{a.exports=require("child_process")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>n,Nw:()=>i.Nw,mc:()=>m,uK:()=>l,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(40402),k=a([j]);j=(k.then?(await k)():k)[0];let o=/^[a-zA-Z]:[\\/]/;function l(a){return o.test(a)||a.startsWith("\\\\")||a.startsWith("//")}async function m(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,j.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function n(a,b){for(let c of b){let b=l(a)||l(c),d=b?h().win32:h(),e=b?"\\":h().sep,f=d.resolve(a),g=d.resolve(c),i=b?f.toLowerCase():f,j=b?g.toLowerCase():g,k=j.endsWith(e)?j:j+e;if(i===j||i.startsWith(k))return!0}return!1}d()}catch(a){d(a)}})},81115:a=>{a.exports=require("constants")},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{a.exports=require("events")}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,5582],()=>b(b.s=62438));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=3955,a.ids=[3955],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")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},84107:(a,b,c)=>{"use strict";c.d(b,{a:()=>j});var d=c(79646),e=c(28354),f=c(29021),g=c(33873);let h=require("process"),i=(0,e.promisify)(d.execFile);async function j(a,b={}){let c=function(){let a=(0,g.dirname)(h.execPath);for(let b of[(0,g.join)(a,"node_modules","npm","bin","npx-cli.js"),(0,g.join)(a,"..","lib","node_modules","npm","bin","npx-cli.js")])try{if((0,f.existsSync)(b))return b}catch{}return null}(),{command:d,commandArgs:e}=c?{command:h.execPath,commandArgs:[c,...a]}:{command:"npx",commandArgs:a};return i(d,e,{timeout:b.timeout,cwd:b.cwd,env:b.env})}},85244:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>J,patchFetch:()=>I,routeModule:()=>E,serverHooks:()=>H,workAsyncStorage:()=>F,workUnitAsyncStorage:()=>G});var d={};c.r(d),c.d(d,{POST:()=>D,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),w=c(84107);let x="force-dynamic",y=/\x1B\[[0-9;]*m/g,z=process.env.SKILLS_API_URL||"https://skills.sh";function A(a){let b=a.replace(y,""),c=[],d=b.split("\n");for(let a=0;a<d.length;a++){let b=d[a].trim().match(/^([\w.\-]+\/[\w.\-@:]+)\s+([\d.,]+[KMB]?\s+installs)$/);if(b){let e=d[a+1]?.trim().replace(/^└\s*/,"");c.push({package:b[1],installs:b[2],url:e?.startsWith("https://")?e:""})}}return c}async function B(a,b){let c=`${z}/api/search?q=${encodeURIComponent(a)}&limit=${b}`,d=await fetch(c,{cache:"no-store"});if(!d.ok)throw Error(`skills.sh search failed: HTTP ${d.status}`);return((await d.json()).skills??[]).map(a=>{var b;let c=a.name?.trim(),d=a.source?.trim(),e=a.id?.trim();return c&&(d||e)?{package:`${d||e}@${c}`,installs:(b=a.installs)&&!(b<=0)?b>=1e6?`${(b/1e6).toFixed(1).replace(/\.0$/,"")}M installs`:b>=1e3?`${(b/1e3).toFixed(1).replace(/\.0$/,"")}K installs`:`${b} install${1===b?"":"s"}`:"",url:e?`${z}/${e}`:""}:null}).filter(a=>null!==a).sort((a,b)=>C(b.installs)-C(a.installs))}function C(a){let b=a.match(/^([\d.]+)([KMB])?\s+installs?$/);if(!b)return 0;let c=Number(b[1]);return Number.isFinite(c)?c*("B"===b[2]?1e9:"M"===b[2]?1e6:"K"===b[2]?1e3:1):0}async function D(a){try{let b,{query:c,limit:d}=await a.json();if(!c?.trim())return v.NextResponse.json({error:"query required"},{status:400});let e=(b="number"==typeof d?d:Number(d),Number.isFinite(b)?Math.min(50,Math.max(1,Math.floor(b))):50);try{let a=await B(c.trim(),e);return v.NextResponse.json({results:a})}catch{let{stdout:a,stderr:b}=await (0,w.a)(["skills","find",c.trim()],{timeout:2e4,env:{...process.env,FORCE_COLOR:"0"}}),d=A(a+b).slice(0,e);return v.NextResponse.json({results:d})}}catch(c){let a=(c.stdout??"")+(c.stderr??""),b=a?A(a):[];if(b.length>0)return v.NextResponse.json({results:b});return v.NextResponse.json({error:c.message??String(c)},{status:500})}}let E=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/skills/search/route",pathname:"/api/skills/search",filename:"route",bundlePath:"app/api/skills/search/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/skills/search/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:F,workUnitAsyncStorage:G,serverHooks:H}=E;function I(){return(0,g.patchFetch)({workAsyncStorage:F,workUnitAsyncStorage:G})}async function J(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),E.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/skills/search/route";"/index"===d&&(d="/");let e=await E.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:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[F]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[F],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||E.isDev||z||(L="/index"===(L=F)?"/":L);let M=!0===E.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 E.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)=>E.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=>E.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 E.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await E.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 E.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}}},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=85244));module.exports=c})();
1
+ (()=>{var a={};a.id=3955,a.ids=[3955],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")},24057:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>J,patchFetch:()=>I,routeModule:()=>E,serverHooks:()=>H,workAsyncStorage:()=>F,workUnitAsyncStorage:()=>G});var d={};c.r(d),c.d(d,{POST:()=>D,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),w=c(84107);let x="force-dynamic",y=/\x1B\[[0-9;]*m/g,z=process.env.SKILLS_API_URL||"https://skills.sh";function A(a){let b=a.replace(y,""),c=[],d=b.split("\n");for(let a=0;a<d.length;a++){let b=d[a].trim().match(/^([\w.\-]+\/[\w.\-@:]+)\s+([\d.,]+[KMB]?\s+installs)$/);if(b){let e=d[a+1]?.trim().replace(/^└\s*/,"");c.push({package:b[1],installs:b[2],url:e?.startsWith("https://")?e:""})}}return c}async function B(a,b){let c=`${z}/api/search?q=${encodeURIComponent(a)}&limit=${b}`,d=await fetch(c,{cache:"no-store"});if(!d.ok)throw Error(`skills.sh search failed: HTTP ${d.status}`);return((await d.json()).skills??[]).map(a=>{var b;let c=a.name?.trim(),d=a.source?.trim(),e=a.id?.trim();return c&&(d||e)?{package:`${d||e}@${c}`,installs:(b=a.installs)&&!(b<=0)?b>=1e6?`${(b/1e6).toFixed(1).replace(/\.0$/,"")}M installs`:b>=1e3?`${(b/1e3).toFixed(1).replace(/\.0$/,"")}K installs`:`${b} install${1===b?"":"s"}`:"",url:e?`${z}/${e}`:""}:null}).filter(a=>null!==a).sort((a,b)=>C(b.installs)-C(a.installs))}function C(a){let b=a.match(/^([\d.]+)([KMB])?\s+installs?$/);if(!b)return 0;let c=Number(b[1]);return Number.isFinite(c)?c*("B"===b[2]?1e9:"M"===b[2]?1e6:"K"===b[2]?1e3:1):0}async function D(a){try{let b,{query:c,limit:d}=await a.json();if(!c?.trim())return v.NextResponse.json({error:"query required"},{status:400});let e=(b="number"==typeof d?d:Number(d),Number.isFinite(b)?Math.min(50,Math.max(1,Math.floor(b))):50);try{let a=await B(c.trim(),e);return v.NextResponse.json({results:a})}catch{let{stdout:a,stderr:b}=await (0,w.a)(["skills","find",c.trim()],{timeout:2e4,env:{...process.env,FORCE_COLOR:"0"}}),d=A(a+b).slice(0,e);return v.NextResponse.json({results:d})}}catch(c){let a=(c.stdout??"")+(c.stderr??""),b=a?A(a):[];if(b.length>0)return v.NextResponse.json({results:b});return v.NextResponse.json({error:c.message??String(c)},{status:500})}}let E=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/skills/search/route",pathname:"/api/skills/search",filename:"route",bundlePath:"app/api/skills/search/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/skills/search/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:F,workUnitAsyncStorage:G,serverHooks:H}=E;function I(){return(0,g.patchFetch)({workAsyncStorage:F,workUnitAsyncStorage:G})}async function J(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),E.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/skills/search/route";"/index"===d&&(d="/");let e=await E.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:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[F]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[F],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||E.isDev||z||(L="/index"===(L=F)?"/":L);let M=!0===E.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 E.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)=>E.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=>E.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 E.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await E.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 E.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}}},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},78335:()=>{},79646:a=>{"use strict";a.exports=require("child_process")},84107:(a,b,c)=>{"use strict";c.d(b,{a:()=>j});var d=c(79646),e=c(28354),f=c(29021),g=c(33873);let h=require("process"),i=(0,e.promisify)(d.execFile);async function j(a,b={}){let c=function(){let a=(0,g.dirname)(h.execPath);for(let b of[(0,g.join)(a,"node_modules","npm","bin","npx-cli.js"),(0,g.join)(a,"..","lib","node_modules","npm","bin","npx-cli.js")])try{if((0,f.existsSync)(b))return b}catch{}return null}(),{command:d,commandArgs:e}=c?{command:h.execPath,commandArgs:[c,...a]}:{command:"npx",commandArgs:a};return i(d,e,{timeout:b.timeout,cwd:b.cwd,env:b.env})}},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=24057));module.exports=c})();
@@ -1 +1 @@
1
- "use strict";(()=>{var a={};a.id=9156,a.ids=[9156],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19038:(a,b,c)=>{c.d(b,{CU:()=>l,S7:()=>u});var d=c(79646),e=c(79748),f=c(21820),g=c(33873),h=c(28354);let i=process.env.SKILLS_API_URL||"https://skills.sh",j=(0,h.promisify)(d.execFile);class k extends Error{constructor(a){super(`HTTP ${a}`),this.status=a}}function l(a){let b=n(a.skillPath??""),c=b?`${a.source}/${b}`:a.source,d=a.ref?`#${encodeURIComponent(a.ref)}`:"",e=["skills","add",`${c}${d}`,"--skill",m(a.package),"-y","--agent","pi"];return"global"===a.scope&&e.push("-g"),e}function m(a){let b=a.lastIndexOf("@");return b>=0?a.slice(b+1):a}function n(a){let b=a.replace(/\\/g,"/");return b.toLowerCase().endsWith("/skill.md")?b=b.slice(0,-9):b.toLowerCase().endsWith("skill.md")&&(b=b.slice(0,-8)),b.replace(/\/$/,"")}function o(a,b,c,d){return{package:a.package,scope:a.scope,state:b,currentVersion:a.versionHash,latestVersion:c,message:d}}async function p(a,b,c){let d=await b(a,{cache:"no-store",headers:c,signal:AbortSignal.timeout(15e3)});if(!d.ok)throw new k(d.status);return d.json()}async function q(a){let b=`https://github.com/${a.source}.git`,c=a.ref||"HEAD",d=n(a.skillPath),h=await (0,e.mkdtemp)((0,g.join)((0,f.tmpdir)(),"pi-web-skill-check-"));try{await j("git",["init","--bare",h],{timeout:3e4}),await j("git",[`--git-dir=${h}`,"fetch","--depth=1","--filter=blob:none","--no-tags",b,c],{timeout:3e4});let a=d?`FETCH_HEAD:${d}`:"FETCH_HEAD^{tree}",{stdout:e}=await j("git",[`--git-dir=${h}`,"rev-parse",a],{timeout:3e4}),f=e.trim();if(!/^[0-9a-f]{40}$/i.test(f))throw Error("Invalid Git tree hash");return f}finally{await (0,e.rm)(h,{recursive:!0,force:!0})}}async function r(a,b){let c,d=a.ref||"HEAD",e=`https://api.github.com/repos/${a.source}/git/trees/${encodeURIComponent(d)}?recursive=1`,f={Accept:"application/vnd.github.v3+json","User-Agent":"pi-web"};b.githubToken&&(f.Authorization=`Bearer ${b.githubToken}`);let g=n(a.skillPath);try{let a=await p(e,b.fetcher,f);if(c="string"!=typeof a.sha||g?void 0:a.sha,g&&Array.isArray(a.tree)){let b=a.tree.find(a=>"tree"===a.type&&a.path===g);b&&"string"==typeof b.sha&&(c=b.sha)}}catch(d){if(!(d instanceof k)||![401,403,429].includes(d.status))throw d;c=await b.resolveGitTreeHash(a)}return c?o(a,c===a.versionHash?"up-to-date":"update-available",c):o(a,"error",void 0,"Remote skill path was not found.")}async function s(a,b){let[c,d]=a.source.split("/"),e=m(a.package).toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""),f=`${b.skillsApiBase}/api/download/${encodeURIComponent(c)}/${encodeURIComponent(d)}/${encodeURIComponent(e)}`,g=await p(f,b.fetcher),h="string"==typeof g.hash?g.hash:void 0;return h?o(a,h===a.versionHash?"up-to-date":"update-available",h):o(a,"error",void 0,"skills.sh did not return a version hash.")}async function t(a,b={}){if(!a.canCheckForUpdates||!a.versionHash||!a.skillPath)return o(a,"unsupported",void 0,"This lock entry cannot be checked automatically.");let c={...b,fetcher:b.fetcher??fetch,skillsApiBase:b.skillsApiBase??i,resolveGitTreeHash:b.resolveGitTreeHash??q};try{return"global"===a.scope?await r(a,c):await s(a,c)}catch(b){return o(a,"error",void 0,b instanceof Error?b.message:String(b))}}async function u(a,b={}){let c=b.fetcher??fetch,d=new Map,e=async(a,b)=>{let e=d.get(a);return e||(e=c(a,b),d.set(a,e)),(await e).clone()};return Promise.all(a.map(a=>t(a,{...b,fetcher:e})))}},21278:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{y:()=>i});var e=c(75430),f=c(75805),g=c(72498),h=a([e,g]);async function i(a){let b=(0,e.getAgentDir)(),c=new e.DefaultResourceLoader({cwd:a,agentDir:b});await c.reload((0,g.Fk)(a,b));let{skills:d,diagnostics:h}=c.getSkills();return{skills:(0,f._)(d,{cwd:a,agentDir:b}),diagnostics:h,projectResourcesLoaded:(0,g.Y1)(a,b).trusted}}[e,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},21820:a=>{a.exports=require("os")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},56679:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>n,dynamic:()=>o});var e=c(23211),f=c(75430),g=c(84107),h=c(80547),i=c(72498),j=c(66544),k=c(19038),l=c(21278),m=a([f,h,i,l]);[f,h,i,l]=m.then?(await m)():m;let o="force-dynamic";async function n(a){if(!(0,j.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,j.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let b=await a.json(),c="string"==typeof b.cwd?b.cwd:"",d="string"==typeof b.package?b.package:"",j="global"===b.scope||"project"===b.scope?b.scope:void 0;if(!c||!d||!j)return e.NextResponse.json({error:"cwd, package, and scope are required"},{status:400});let m=await (0,h.mc)();if(!(0,h.A$)(c,m))return e.NextResponse.json({error:"Access denied"},{status:403});if("project"===j&&!(0,i.Y1)(c,(0,f.getAgentDir)()).trusted)return e.NextResponse.json({error:"Project resources must be trusted before updating project skills"},{status:403});let{skills:n}=await (0,l.y)(c),o=n.find(a=>a.install?.package===d&&a.install.scope===j);if(!o?.install)return e.NextResponse.json({error:"Installed skill not found"},{status:404});if(!o.install.canCheckForUpdates)return e.NextResponse.json({error:"This skill cannot be updated automatically"},{status:400});let{stdout:p,stderr:q}=await (0,g.a)((0,k.CU)(o.install),{timeout:6e4,cwd:"project"===j?c:void 0,env:{...process.env,FORCE_COLOR:"0"}}),r=(await (0,l.y)(c)).skills.find(a=>a.install?.package===d&&a.install.scope===j);return e.NextResponse.json({success:!0,skill:r,output:`${p}${q}`.slice(-500)})}catch(b){let a=`${b.stdout??""}${b.stderr??""}`;return e.NextResponse.json({error:a||b.message||String(b)},{status:500})}}d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},72498:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){return a&&(0,e.hasTrustRequiringProjectResources)(a)?{requiresTrust:!0,trusted:!0===new e.ProjectTrustStore(b).get(a)}:{requiresTrust:!1,trusted:!0}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{a.exports=require("node:fs")},74921:(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(56679),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/skills/update/route",pathname:"/api/skills/update",filename:"route",bundlePath:"app/api/skills/update/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/skills/update/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/skills/update/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)}})},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},75805:(a,b,c)=>{c.d(b,{_:()=>j});var d=c(29021),e=c(21820),f=c(33873);function g(a){try{let b=JSON.parse((0,d.readFileSync)(a,"utf8"));return b.skills&&"object"==typeof b.skills?b.skills:{}}catch{return{}}}function h(a,b){let c=(0,f.relative)((0,f.resolve)(b),(0,f.resolve)(a));return""!==c&&".."!==c&&!c.startsWith(`..${f.sep}`)&&!(0,f.isAbsolute)(c)}function i(a,b,c){var d;let e=function(a,b){if(a[b])return a[b];let c=b.toLowerCase(),d=Object.keys(a).find(a=>a.toLowerCase()===c);return d?a[d]:void 0}(a,b);if(!e||"string"!=typeof e.source||!e.source.trim())return;let f="string"==typeof e.sourceType?e.sourceType:void 0,g=(d=e.source.trim(),"github"!==f?d.replace(/\/$/,""):d.replace(/^git\+/,"").replace(/^https?:\/\/github\.com\//,"").replace(/^git@github\.com:/,"").replace(/\.git$/,"").replace(/\/$/,""));if(!g)return;let h="string"==typeof e.skillPath?e.skillPath:void 0,i="string"==typeof e.ref?e.ref:void 0,j="global"===c?e.skillFolderHash:e.computedHash,k="string"==typeof j&&j?j:void 0,l="github"===f&&/^[\w.-]+\/[\w.-]+$/.test(g);return{package:`${g}@${b}`,scope:c,source:g,sourceType:f,skillsShUrl:"local"===f?void 0:function(a,b){if(!a||a.includes("://")||a.startsWith("git@"))return;let c=a.split("/").filter(Boolean).map(encodeURIComponent).join("/");if(c)return`https://skills.sh/${c}/${encodeURIComponent(b)}`}(g,b),...h&&{skillPath:h},...i&&{ref:i},...k&&{versionHash:k},canCheckForUpdates:!!(l&&h&&k&&("global"===c||!i))}}function j(a,{cwd:b,agentDir:c,globalLockPath:k=function({homeDir:a=(0,e.homedir)(),xdgStateHome:b=process.env.XDG_STATE_HOME}={}){return b?(0,f.join)(b,"skills",".skill-lock.json"):(0,f.join)(a,".agents",".skill-lock.json")}(),projectLockPath:l=(0,f.join)(b,"skills-lock.json")}){let m=g(k),n=g(l),o=(0,f.join)(c,"skills"),p=(0,f.join)(b,".pi","skills");return a.map(a=>{if(!(0,d.existsSync)(a.filePath))return a;let b=h(a.filePath,o)?i(m,a.name,"global"):h(a.filePath,p)?i(n,a.name,"project"):void 0;return b?{...a,install:b}:a})}},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>n,Nw:()=>i.Nw,mc:()=>m,uK:()=>l,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(40402),k=a([j]);j=(k.then?(await k)():k)[0];let o=/^[a-zA-Z]:[\\/]/;function l(a){return o.test(a)||a.startsWith("\\\\")||a.startsWith("//")}async function m(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,j.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function n(a,b){for(let c of b){let b=l(a)||l(c),d=b?h().win32:h(),e=b?"\\":h().sep,f=d.resolve(a),g=d.resolve(c),i=b?f.toLowerCase():f,j=b?g.toLowerCase():g,k=j.endsWith(e)?j:j+e;if(i===j||i.startsWith(k))return!0}return!1}d()}catch(a){d(a)}})},81115:a=>{a.exports=require("constants")},84107:(a,b,c)=>{c.d(b,{a:()=>j});var d=c(79646),e=c(28354),f=c(29021),g=c(33873);let h=require("process"),i=(0,e.promisify)(d.execFile);async function j(a,b={}){let c=function(){let a=(0,g.dirname)(h.execPath);for(let b of[(0,g.join)(a,"node_modules","npm","bin","npx-cli.js"),(0,g.join)(a,"..","lib","node_modules","npm","bin","npx-cli.js")])try{if((0,f.existsSync)(b))return b}catch{}return null}(),{command:d,commandArgs:e}=c?{command:h.execPath,commandArgs:[c,...a]}:{command:"npx",commandArgs:a};return i(d,e,{timeout:b.timeout,cwd:b.cwd,env:b.env})}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,5582],()=>b(b.s=74921));module.exports=c})();
1
+ "use strict";(()=>{var a={};a.id=9156,a.ids=[9156],a.modules={261:a=>{a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},8814:(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(56679),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/skills/update/route",pathname:"/api/skills/update",filename:"route",bundlePath:"app/api/skills/update/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/skills/update/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/skills/update/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)}})},10846:a=>{a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12412:a=>{a.exports=require("assert")},19038:(a,b,c)=>{c.d(b,{CU:()=>l,S7:()=>u});var d=c(79646),e=c(79748),f=c(21820),g=c(33873),h=c(28354);let i=process.env.SKILLS_API_URL||"https://skills.sh",j=(0,h.promisify)(d.execFile);class k extends Error{constructor(a){super(`HTTP ${a}`),this.status=a}}function l(a){let b=n(a.skillPath??""),c=b?`${a.source}/${b}`:a.source,d=a.ref?`#${encodeURIComponent(a.ref)}`:"",e=["skills","add",`${c}${d}`,"--skill",m(a.package),"-y","--agent","pi"];return"global"===a.scope&&e.push("-g"),e}function m(a){let b=a.lastIndexOf("@");return b>=0?a.slice(b+1):a}function n(a){let b=a.replace(/\\/g,"/");return b.toLowerCase().endsWith("/skill.md")?b=b.slice(0,-9):b.toLowerCase().endsWith("skill.md")&&(b=b.slice(0,-8)),b.replace(/\/$/,"")}function o(a,b,c,d){return{package:a.package,scope:a.scope,state:b,currentVersion:a.versionHash,latestVersion:c,message:d}}async function p(a,b,c){let d=await b(a,{cache:"no-store",headers:c,signal:AbortSignal.timeout(15e3)});if(!d.ok)throw new k(d.status);return d.json()}async function q(a){let b=`https://github.com/${a.source}.git`,c=a.ref||"HEAD",d=n(a.skillPath),h=await (0,e.mkdtemp)((0,g.join)((0,f.tmpdir)(),"pi-web-skill-check-"));try{await j("git",["init","--bare",h],{timeout:3e4}),await j("git",[`--git-dir=${h}`,"fetch","--depth=1","--filter=blob:none","--no-tags",b,c],{timeout:3e4});let a=d?`FETCH_HEAD:${d}`:"FETCH_HEAD^{tree}",{stdout:e}=await j("git",[`--git-dir=${h}`,"rev-parse",a],{timeout:3e4}),f=e.trim();if(!/^[0-9a-f]{40}$/i.test(f))throw Error("Invalid Git tree hash");return f}finally{await (0,e.rm)(h,{recursive:!0,force:!0})}}async function r(a,b){let c,d=a.ref||"HEAD",e=`https://api.github.com/repos/${a.source}/git/trees/${encodeURIComponent(d)}?recursive=1`,f={Accept:"application/vnd.github.v3+json","User-Agent":"pi-web"};b.githubToken&&(f.Authorization=`Bearer ${b.githubToken}`);let g=n(a.skillPath);try{let a=await p(e,b.fetcher,f);if(c="string"!=typeof a.sha||g?void 0:a.sha,g&&Array.isArray(a.tree)){let b=a.tree.find(a=>"tree"===a.type&&a.path===g);b&&"string"==typeof b.sha&&(c=b.sha)}}catch(d){if(!(d instanceof k)||![401,403,429].includes(d.status))throw d;c=await b.resolveGitTreeHash(a)}return c?o(a,c===a.versionHash?"up-to-date":"update-available",c):o(a,"error",void 0,"Remote skill path was not found.")}async function s(a,b){let[c,d]=a.source.split("/"),e=m(a.package).toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""),f=`${b.skillsApiBase}/api/download/${encodeURIComponent(c)}/${encodeURIComponent(d)}/${encodeURIComponent(e)}`,g=await p(f,b.fetcher),h="string"==typeof g.hash?g.hash:void 0;return h?o(a,h===a.versionHash?"up-to-date":"update-available",h):o(a,"error",void 0,"skills.sh did not return a version hash.")}async function t(a,b={}){if(!a.canCheckForUpdates||!a.versionHash||!a.skillPath)return o(a,"unsupported",void 0,"This lock entry cannot be checked automatically.");let c={...b,fetcher:b.fetcher??fetch,skillsApiBase:b.skillsApiBase??i,resolveGitTreeHash:b.resolveGitTreeHash??q};try{return"global"===a.scope?await r(a,c):await s(a,c)}catch(b){return o(a,"error",void 0,b instanceof Error?b.message:String(b))}}async function u(a,b={}){let c=b.fetcher??fetch,d=new Map,e=async(a,b)=>{let e=d.get(a);return e||(e=c(a,b),d.set(a,e)),(await e).clone()};return Promise.all(a.map(a=>t(a,{...b,fetcher:e})))}},21278:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{y:()=>i});var e=c(75430),f=c(75805),g=c(72498),h=a([e,g]);async function i(a){let b=(0,e.getAgentDir)(),c=new e.DefaultResourceLoader({cwd:a,agentDir:b});await c.reload((0,g.Fk)(a,b));let{skills:d,diagnostics:h}=c.getSkills();return{skills:(0,f._)(d,{cwd:a,agentDir:b}),diagnostics:h,projectResourcesLoaded:(0,g.Y1)(a,b).trusted}}[e,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},21820:a=>{a.exports=require("os")},27910:a=>{a.exports=require("stream")},28354:a=>{a.exports=require("util")},29021:a=>{a.exports=require("fs")},29294:a=>{a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{a.exports=require("path")},44870:a=>{a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{a.exports=require("crypto")},56679:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>n,dynamic:()=>o});var e=c(23211),f=c(75430),g=c(84107),h=c(80547),i=c(72498),j=c(66544),k=c(19038),l=c(21278),m=a([f,h,i,l]);[f,h,i,l]=m.then?(await m)():m;let o="force-dynamic";async function n(a){if(!(0,j.EN)(a))return e.NextResponse.json({error:"Untrusted API request"},{status:403});if(!(0,j.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let b=await a.json(),c="string"==typeof b.cwd?b.cwd:"",d="string"==typeof b.package?b.package:"",j="global"===b.scope||"project"===b.scope?b.scope:void 0;if(!c||!d||!j)return e.NextResponse.json({error:"cwd, package, and scope are required"},{status:400});let m=await (0,h.mc)();if(!(0,h.A$)(c,m))return e.NextResponse.json({error:"Access denied"},{status:403});if("project"===j&&!(0,i.Y1)(c,(0,f.getAgentDir)()).trusted)return e.NextResponse.json({error:"Project resources must be trusted before updating project skills"},{status:403});let{skills:n}=await (0,l.y)(c),o=n.find(a=>a.install?.package===d&&a.install.scope===j);if(!o?.install)return e.NextResponse.json({error:"Installed skill not found"},{status:404});if(!o.install.canCheckForUpdates)return e.NextResponse.json({error:"This skill cannot be updated automatically"},{status:400});let{stdout:p,stderr:q}=await (0,g.a)((0,k.CU)(o.install),{timeout:6e4,cwd:"project"===j?c:void 0,env:{...process.env,FORCE_COLOR:"0"}}),r=(await (0,l.y)(c)).skills.find(a=>a.install?.package===d&&a.install.scope===j);return e.NextResponse.json({success:!0,skill:r,output:`${p}${q}`.slice(-500)})}catch(b){let a=`${b.stdout??""}${b.stderr??""}`;return e.NextResponse.json({error:a||b.message||String(b)},{status:500})}}d()}catch(a){d(a)}})},63033:a=>{a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},72498:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Fk:()=>i,Y1:()=>g,er:()=>h});var e=c(75430),f=a([e]);function g(a,b){return a&&(0,e.hasTrustRequiringProjectResources)(a)?{requiresTrust:!0,trusted:!0===new e.ProjectTrustStore(b).get(a)}:{requiresTrust:!1,trusted:!0}}function h(a,b){let c=g(a,b);return c.requiresTrust?(new e.ProjectTrustStore(b).set(a,!0),{requiresTrust:!0,trusted:!0}):c}function i(a,b){if(!g(a,b).requiresTrust)return;let c=new e.ProjectTrustStore(b);return{resolveProjectTrust:async()=>!0===c.get(a)}}e=(f.then?(await f)():f)[0],d()}catch(a){d(a)}})},73024:a=>{a.exports=require("node:fs")},75430:a=>{a.exports=import("@earendil-works/pi-coding-agent")},75805:(a,b,c)=>{c.d(b,{_:()=>j});var d=c(29021),e=c(21820),f=c(33873);function g(a){try{let b=JSON.parse((0,d.readFileSync)(a,"utf8"));return b.skills&&"object"==typeof b.skills?b.skills:{}}catch{return{}}}function h(a,b){let c=(0,f.relative)((0,f.resolve)(b),(0,f.resolve)(a));return""!==c&&".."!==c&&!c.startsWith(`..${f.sep}`)&&!(0,f.isAbsolute)(c)}function i(a,b,c){var d;let e=function(a,b){if(a[b])return a[b];let c=b.toLowerCase(),d=Object.keys(a).find(a=>a.toLowerCase()===c);return d?a[d]:void 0}(a,b);if(!e||"string"!=typeof e.source||!e.source.trim())return;let f="string"==typeof e.sourceType?e.sourceType:void 0,g=(d=e.source.trim(),"github"!==f?d.replace(/\/$/,""):d.replace(/^git\+/,"").replace(/^https?:\/\/github\.com\//,"").replace(/^git@github\.com:/,"").replace(/\.git$/,"").replace(/\/$/,""));if(!g)return;let h="string"==typeof e.skillPath?e.skillPath:void 0,i="string"==typeof e.ref?e.ref:void 0,j="global"===c?e.skillFolderHash:e.computedHash,k="string"==typeof j&&j?j:void 0,l="github"===f&&/^[\w.-]+\/[\w.-]+$/.test(g);return{package:`${g}@${b}`,scope:c,source:g,sourceType:f,skillsShUrl:"local"===f?void 0:function(a,b){if(!a||a.includes("://")||a.startsWith("git@"))return;let c=a.split("/").filter(Boolean).map(encodeURIComponent).join("/");if(c)return`https://skills.sh/${c}/${encodeURIComponent(b)}`}(g,b),...h&&{skillPath:h},...i&&{ref:i},...k&&{versionHash:k},canCheckForUpdates:!!(l&&h&&k&&("global"===c||!i))}}function j(a,{cwd:b,agentDir:c,globalLockPath:k=function({homeDir:a=(0,e.homedir)(),xdgStateHome:b=process.env.XDG_STATE_HOME}={}){return b?(0,f.join)(b,"skills",".skill-lock.json"):(0,f.join)(a,".agents",".skill-lock.json")}(),projectLockPath:l=(0,f.join)(b,"skills-lock.json")}){let m=g(k),n=g(l),o=(0,f.join)(c,"skills"),p=(0,f.join)(b,".pi","skills");return a.map(a=>{if(!(0,d.existsSync)(a.filePath))return a;let b=h(a.filePath,o)?i(m,a.name,"global"):h(a.filePath,p)?i(n,a.name,"project"):void 0;return b?{...a,install:b}:a})}},76760:a=>{a.exports=require("node:path")},77030:a=>{a.exports=require("node:net")},79646:a=>{a.exports=require("child_process")},79748:a=>{a.exports=require("fs/promises")},80547:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{A$:()=>n,Nw:()=>i.Nw,mc:()=>m,uK:()=>l,wz:()=>i.wz});var e=c(29021),f=c(21820),g=c(33873),h=c.n(g),i=c(25252),j=c(40402),k=a([j]);j=(k.then?(await k)():k)[0];let o=/^[a-zA-Z]:[\\/]/;function l(a){return o.test(a)||a.startsWith("\\\\")||a.startsWith("//")}async function m(){let a=Date.now(),b=globalThis.__piAllowedRootsCache;if(b&&b.expiresAt>a)return b.roots;let c=await (0,j.dQ)(),d=new Set;for(let a of c)a.cwd&&d.add((0,i.Nw)(a.cwd)),a.projectRoot&&d.add((0,i.Nw)(a.projectRoot));try{for(let a of(0,e.readdirSync)((0,f.homedir)()))/^pi-cwd-\d{8}$/.test(a)&&d.add((0,i.Nw)(h().join((0,f.homedir)(),a)))}catch{}for(let a of(0,i.HM)())d.add(a);return globalThis.__piAllowedRootsCache={roots:d,expiresAt:a+5e3},d}function n(a,b){for(let c of b){let b=l(a)||l(c),d=b?h().win32:h(),e=b?"\\":h().sep,f=d.resolve(a),g=d.resolve(c),i=b?f.toLowerCase():f,j=b?g.toLowerCase():g,k=j.endsWith(e)?j:j+e;if(i===j||i.startsWith(k))return!0}return!1}d()}catch(a){d(a)}})},81115:a=>{a.exports=require("constants")},84107:(a,b,c)=>{c.d(b,{a:()=>j});var d=c(79646),e=c(28354),f=c(29021),g=c(33873);let h=require("process"),i=(0,e.promisify)(d.execFile);async function j(a,b={}){let c=function(){let a=(0,g.dirname)(h.execPath);for(let b of[(0,g.join)(a,"node_modules","npm","bin","npx-cli.js"),(0,g.join)(a,"..","lib","node_modules","npm","bin","npx-cli.js")])try{if((0,f.existsSync)(b))return b}catch{}return null}(),{command:d,commandArgs:e}=c?{command:h.execPath,commandArgs:[c,...a]}:{command:"npx",commandArgs:a};return i(d,e,{timeout:b.timeout,cwd:b.cwd,env:b.env})}},86439:a=>{a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{a.exports=require("events")}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974,5582],()=>b(b.s=8814));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=4266,a.ids=[4266],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},18189:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TA:()=>o,hw:()=>n,k0:()=>m,xV:()=>k});var e=c(73024),f=c(76760),g=c(75430),h=c(8102),i=a([g]);g=(i.then?(await i)():i)[0];let p=process.env.PI_SNIPPETS_FILE?process.env.PI_SNIPPETS_FILE.startsWith("/")?process.env.PI_SNIPPETS_FILE:(0,f.join)(process.cwd(),process.env.PI_SNIPPETS_FILE):(0,f.join)((0,g.getAgentDir)(),"snippets.json");function j(){return globalThis.__piSnippetsState||(globalThis.__piSnippetsState={loaded:!1,snippets:[]}),globalThis.__piSnippetsState}function k(){let a=j();return a.loaded||(a.snippets=function(){try{if(!(0,e.existsSync)(p))return[];let a=(0,e.readFileSync)(p,"utf8"),b=JSON.parse(a);if(!Array.isArray(b.snippets))return[];return b.snippets.filter(a=>"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.name&&"string"==typeof a.content)}catch{return[]}}(),a.loaded=!0),a.snippets}function l(a){(0,h.$)(p,JSON.stringify({snippets:a},null,2)+"\n");let b=j();b.snippets=a,b.loaded=!0}function m(a){let b=Date.now(),c={id:`snip-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,name:a.name.trim(),content:a.content,createdAt:b,updatedAt:b};return l([...k(),c]),c}function n(a,b){let c=null,d=k().map(d=>d.id!==a?d:c={...d,...void 0!==b.name?{name:b.name.trim()}:{},...void 0!==b.content?{content:b.content}:{},updatedAt:Date.now()});return c?(l(d),c):null}function o(a){let b=k(),c=b.filter(b=>b.id!==a);return c.length!==b.length&&(l(c),!0)}d()}catch(a){d(a)}})},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},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")},38801:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>i,PUT:()=>h,dynamic:()=>j});var e=c(18189),f=c(66544),g=a([e]);e=(g.then?(await g)():g)[0];let j="force-dynamic";async function h(a,{params:b}){if(!(0,f.EN)(a))return new Response("Access denied",{status:403});let{id:c}=await b;try{let b=await a.json();if("object"!=typeof b||null===b||Array.isArray(b))return Response.json({error:"Invalid body"},{status:400});let d={};if(void 0!==b.name){if("string"!=typeof b.name)return Response.json({error:"name must be a string"},{status:400});d.name=b.name}if(void 0!==b.content){if("string"!=typeof b.content)return Response.json({error:"content must be a string"},{status:400});d.content=b.content}let f=(0,e.hw)(c,d);if(!f)return Response.json({error:"Snippet not found"},{status:404});return Response.json({snippet:f})}catch(a){return Response.json({error:String(a)},{status:500})}}async function i(a,{params:b}){if(!(0,f.EN)(a))return new Response("Access denied",{status:403});let{id:c}=await b;return(0,e.TA)(c)?Response.json({deleted:!0}):Response.json({error:"Snippet not found"},{status:404})}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},53133:(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(38801),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/snippets/[id]/route",pathname:"/api/snippets/[id]",filename:"route",bundlePath:"app/api/snippets/[id]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/snippets/[id]/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/snippets/[id]/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=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741],()=>b(b.s=53133));module.exports=c})();
1
+ (()=>{var a={};a.id=4266,a.ids=[4266],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},18189:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TA:()=>o,hw:()=>n,k0:()=>m,xV:()=>k});var e=c(73024),f=c(76760),g=c(75430),h=c(8102),i=a([g]);g=(i.then?(await i)():i)[0];let p=process.env.PI_SNIPPETS_FILE?process.env.PI_SNIPPETS_FILE.startsWith("/")?process.env.PI_SNIPPETS_FILE:(0,f.join)(process.cwd(),process.env.PI_SNIPPETS_FILE):(0,f.join)((0,g.getAgentDir)(),"snippets.json");function j(){return globalThis.__piSnippetsState||(globalThis.__piSnippetsState={loaded:!1,snippets:[]}),globalThis.__piSnippetsState}function k(){let a=j();return a.loaded||(a.snippets=function(){try{if(!(0,e.existsSync)(p))return[];let a=(0,e.readFileSync)(p,"utf8"),b=JSON.parse(a);if(!Array.isArray(b.snippets))return[];return b.snippets.filter(a=>"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.name&&"string"==typeof a.content)}catch{return[]}}(),a.loaded=!0),a.snippets}function l(a){(0,h.$)(p,JSON.stringify({snippets:a},null,2)+"\n");let b=j();b.snippets=a,b.loaded=!0}function m(a){let b=Date.now(),c={id:`snip-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,name:a.name.trim(),content:a.content,createdAt:b,updatedAt:b};return l([...k(),c]),c}function n(a,b){let c=null,d=k().map(d=>d.id!==a?d:c={...d,...void 0!==b.name?{name:b.name.trim()}:{},...void 0!==b.content?{content:b.content}:{},updatedAt:Date.now()});return c?(l(d),c):null}function o(a){let b=k(),c=b.filter(b=>b.id!==a);return c.length!==b.length&&(l(c),!0)}d()}catch(a){d(a)}})},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},23338:(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(38801),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/snippets/[id]/route",pathname:"/api/snippets/[id]",filename:"route",bundlePath:"app/api/snippets/[id]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/snippets/[id]/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/snippets/[id]/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)}})},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")},38801:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{DELETE:()=>i,PUT:()=>h,dynamic:()=>j});var e=c(18189),f=c(66544),g=a([e]);e=(g.then?(await g)():g)[0];let j="force-dynamic";async function h(a,{params:b}){if(!(0,f.EN)(a))return new Response("Access denied",{status:403});let{id:c}=await b;try{let b=await a.json();if("object"!=typeof b||null===b||Array.isArray(b))return Response.json({error:"Invalid body"},{status:400});let d={};if(void 0!==b.name){if("string"!=typeof b.name)return Response.json({error:"name must be a string"},{status:400});d.name=b.name}if(void 0!==b.content){if("string"!=typeof b.content)return Response.json({error:"content must be a string"},{status:400});d.content=b.content}let f=(0,e.hw)(c,d);if(!f)return Response.json({error:"Snippet not found"},{status:404});return Response.json({snippet:f})}catch(a){return Response.json({error:String(a)},{status:500})}}async function i(a,{params:b}){if(!(0,f.EN)(a))return new Response("Access denied",{status:403});let{id:c}=await b;return(0,e.TA)(c)?Response.json({deleted:!0}):Response.json({error:"Snippet not found"},{status:404})}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741],()=>b(b.s=23338));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=2480,a.ids=[2480],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},18189:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TA:()=>o,hw:()=>n,k0:()=>m,xV:()=>k});var e=c(73024),f=c(76760),g=c(75430),h=c(8102),i=a([g]);g=(i.then?(await i)():i)[0];let p=process.env.PI_SNIPPETS_FILE?process.env.PI_SNIPPETS_FILE.startsWith("/")?process.env.PI_SNIPPETS_FILE:(0,f.join)(process.cwd(),process.env.PI_SNIPPETS_FILE):(0,f.join)((0,g.getAgentDir)(),"snippets.json");function j(){return globalThis.__piSnippetsState||(globalThis.__piSnippetsState={loaded:!1,snippets:[]}),globalThis.__piSnippetsState}function k(){let a=j();return a.loaded||(a.snippets=function(){try{if(!(0,e.existsSync)(p))return[];let a=(0,e.readFileSync)(p,"utf8"),b=JSON.parse(a);if(!Array.isArray(b.snippets))return[];return b.snippets.filter(a=>"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.name&&"string"==typeof a.content)}catch{return[]}}(),a.loaded=!0),a.snippets}function l(a){(0,h.$)(p,JSON.stringify({snippets:a},null,2)+"\n");let b=j();b.snippets=a,b.loaded=!0}function m(a){let b=Date.now(),c={id:`snip-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,name:a.name.trim(),content:a.content,createdAt:b,updatedAt:b};return l([...k(),c]),c}function n(a,b){let c=null,d=k().map(d=>d.id!==a?d:c={...d,...void 0!==b.name?{name:b.name.trim()}:{},...void 0!==b.content?{content:b.content}:{},updatedAt:Date.now()});return c?(l(d),c):null}function o(a){let b=k(),c=b.filter(b=>b.id!==a);return c.length!==b.length&&(l(c),!0)}d()}catch(a){d(a)}})},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},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")},46547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>h,POST:()=>i,dynamic:()=>j});var e=c(18189),f=c(66544),g=a([e]);e=(g.then?(await g)():g)[0];let j="force-dynamic";async function h(a){return(0,f.EN)(a)?Response.json({snippets:(0,e.xV)()}):new Response("Access denied",{status:403})}async function i(a){if(!(0,f.EN)(a))return new Response("Access denied",{status:403});try{let b=await a.json();if("object"!=typeof b||null===b||Array.isArray(b)||"string"!=typeof b.name||"string"!=typeof b.content)return Response.json({error:"name and content (strings) are required"},{status:400});let c=b.name.trim();if(!c)return Response.json({error:"name is required"},{status:400});let d=(0,e.k0)({name:c,content:b.content});return Response.json({snippet:d},{status:201})}catch(a){return Response.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},49665:(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(46547),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/snippets/route",pathname:"/api/snippets",filename:"route",bundlePath:"app/api/snippets/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/snippets/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/snippets/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=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741],()=>b(b.s=49665));module.exports=c})();
1
+ (()=>{var a={};a.id=2480,a.ids=[2480],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},14230:(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(46547),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/snippets/route",pathname:"/api/snippets",filename:"route",bundlePath:"app/api/snippets/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/snippets/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/snippets/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)}})},18189:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{TA:()=>o,hw:()=>n,k0:()=>m,xV:()=>k});var e=c(73024),f=c(76760),g=c(75430),h=c(8102),i=a([g]);g=(i.then?(await i)():i)[0];let p=process.env.PI_SNIPPETS_FILE?process.env.PI_SNIPPETS_FILE.startsWith("/")?process.env.PI_SNIPPETS_FILE:(0,f.join)(process.cwd(),process.env.PI_SNIPPETS_FILE):(0,f.join)((0,g.getAgentDir)(),"snippets.json");function j(){return globalThis.__piSnippetsState||(globalThis.__piSnippetsState={loaded:!1,snippets:[]}),globalThis.__piSnippetsState}function k(){let a=j();return a.loaded||(a.snippets=function(){try{if(!(0,e.existsSync)(p))return[];let a=(0,e.readFileSync)(p,"utf8"),b=JSON.parse(a);if(!Array.isArray(b.snippets))return[];return b.snippets.filter(a=>"object"==typeof a&&null!==a&&"string"==typeof a.id&&"string"==typeof a.name&&"string"==typeof a.content)}catch{return[]}}(),a.loaded=!0),a.snippets}function l(a){(0,h.$)(p,JSON.stringify({snippets:a},null,2)+"\n");let b=j();b.snippets=a,b.loaded=!0}function m(a){let b=Date.now(),c={id:`snip-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,name:a.name.trim(),content:a.content,createdAt:b,updatedAt:b};return l([...k(),c]),c}function n(a,b){let c=null,d=k().map(d=>d.id!==a?d:c={...d,...void 0!==b.name?{name:b.name.trim()}:{},...void 0!==b.content?{content:b.content}:{},updatedAt:Date.now()});return c?(l(d),c):null}function o(a){let b=k(),c=b.filter(b=>b.id!==a);return c.length!==b.length&&(l(c),!0)}d()}catch(a){d(a)}})},19225:(a,b,c)=>{"use strict";a.exports=c(44870)},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")},46547:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>h,POST:()=>i,dynamic:()=>j});var e=c(18189),f=c(66544),g=a([e]);e=(g.then?(await g)():g)[0];let j="force-dynamic";async function h(a){return(0,f.EN)(a)?Response.json({snippets:(0,e.xV)()}):new Response("Access denied",{status:403})}async function i(a){if(!(0,f.EN)(a))return new Response("Access denied",{status:403});try{let b=await a.json();if("object"!=typeof b||null===b||Array.isArray(b)||"string"!=typeof b.name||"string"!=typeof b.content)return Response.json({error:"name and content (strings) are required"},{status:400});let c=b.name.trim();if(!c)return Response.json({error:"name is required"},{status:400});let d=(0,e.k0)({name:c,content:b.content});return Response.json({snippet:d},{status:201})}catch(a){return Response.json({error:String(a)},{status:500})}}d()}catch(a){d(a)}})},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},92280:(a,b,c)=>{"use strict";Object.defineProperty(b,"I",{enumerable:!0,get:function(){return g}});let d=c(28208),e=c(47617),f=c(62018);async function g(a,b,c,g){if((0,d.isNodeNextResponse)(b)){var h;b.statusCode=c.status,b.statusMessage=c.statusText;let d=["set-cookie","www-authenticate","proxy-authenticate","vary"];null==(h=c.headers)||h.forEach((a,c)=>{if("x-middleware-set-cookie"!==c.toLowerCase())if("set-cookie"===c.toLowerCase())for(let d of(0,f.splitCookiesString)(a))b.appendHeader(c,d);else{let e=void 0!==b.getHeader(c);(d.includes(c.toLowerCase())||!e)&&b.appendHeader(c,a)}});let{originalResponse:i}=b;c.body&&"HEAD"!==a.method?await (0,e.pipeToNodeResponse)(c.body,i,g):i.end()}}},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741],()=>b(b.s=14230));module.exports=c})();
@@ -1,6 +1,6 @@
1
- (()=>{var a={};a.id=6269,a.ids=[6269],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")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.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")},54916:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{PATCH:()=>m,dynamic:()=>n});var e=c(23211),f=c(29021),g=c(33873),h=c.n(g),i=c(75430),j=c(8102),k=c(66544),l=a([i]);i=(l.then?(await l)():l)[0];let n="force-dynamic";async function m(a,{params:b}){if(!(0,k.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});if(!(0,k.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let{name:c}=await b,d=!c||c.includes("/")||c.includes("\\")||c.includes("..")||"."===c?null:h().join((0,i.getAgentDir)(),"agents",`${c}.md`);if(!d||!(0,f.existsSync)(d))return e.NextResponse.json({error:"Agent not found"},{status:404});let g=await a.json();if(void 0!==g.model&&null!==g.model&&"string"!=typeof g.model)return e.NextResponse.json({error:"model must be a string or null"},{status:400});let k="string"==typeof g.model&&g.model.trim()?g.model.trim():null,l=(0,f.readFileSync)(d,"utf8"),m="model",{frontmatter:n}=(0,i.parseFrontmatter)(l),o="string"==typeof n[m]?n[m]:null,p=l;return null===k?null!==o&&(p=l.replace(RegExp(`^${m}\\s*:.*\\r?\\n`,"m"),"")):p=null!==o?l.replace(RegExp(`^${m}\\s*:.*$`,"m"),`${m}: ${k}`):/^---\r?\n/.test(l)?l.replace(/^---\r?\n/,`---
1
+ (()=>{var a={};a.id=6269,a.ids=[6269],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")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},10108:(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(54916),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/subagents/agents/[name]/route",pathname:"/api/subagents/agents/[name]",filename:"route",bundlePath:"app/api/subagents/agents/[name]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/subagents/agents/[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/subagents/agents/[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)}})},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.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")},54916:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{PATCH:()=>m,dynamic:()=>n});var e=c(23211),f=c(29021),g=c(33873),h=c.n(g),i=c(75430),j=c(8102),k=c(66544),l=a([i]);i=(l.then?(await l)():l)[0];let n="force-dynamic";async function m(a,{params:b}){if(!(0,k.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});if(!(0,k.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let{name:c}=await b,d=!c||c.includes("/")||c.includes("\\")||c.includes("..")||"."===c?null:h().join((0,i.getAgentDir)(),"agents",`${c}.md`);if(!d||!(0,f.existsSync)(d))return e.NextResponse.json({error:"Agent not found"},{status:404});let g=await a.json();if(void 0!==g.model&&null!==g.model&&"string"!=typeof g.model)return e.NextResponse.json({error:"model must be a string or null"},{status:400});let k="string"==typeof g.model&&g.model.trim()?g.model.trim():null,l=(0,f.readFileSync)(d,"utf8"),m="model",{frontmatter:n}=(0,i.parseFrontmatter)(l),o="string"==typeof n[m]?n[m]:null,p=l;return null===k?null!==o&&(p=l.replace(RegExp(`^${m}\\s*:.*\\r?\\n`,"m"),"")):p=null!==o?l.replace(RegExp(`^${m}\\s*:.*$`,"m"),`${m}: ${k}`):/^---\r?\n/.test(l)?l.replace(/^---\r?\n/,`---
2
2
  ${m}: ${k}
3
3
  `):`---
4
4
  ${m}: ${k}
5
5
  ---
6
- ${l}`,(0,j.$)(d,p),e.NextResponse.json({success:!0,agent:c,model:k})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},91083:(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(54916),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/subagents/agents/[name]/route",pathname:"/api/subagents/agents/[name]",filename:"route",bundlePath:"app/api/subagents/agents/[name]/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/subagents/agents/[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/subagents/agents/[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)}})},96487:()=>{}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=91083));module.exports=c})();
6
+ ${l}`,(0,j.$)(d,p),e.NextResponse.json({success:!0,agent:c,model:k})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=10108));module.exports=c})();
@@ -1,2 +1,2 @@
1
- (()=>{var a={};a.id=9026,a.ids=[9026],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")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.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")},36825:(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(89721),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/subagents/route",pathname:"/api/subagents",filename:"route",bundlePath:"app/api/subagents/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/subagents/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/subagents/route";"/index"===d&&(d="/");let e=await z.prepare(a,b,{srcPage:d,multiZoneDraftMode:!1});if(!e)return b.statusCode=400,b.end("Bad Request"),null==c.waitUntil||c.waitUntil.call(c,Promise.resolve()),null;let{buildId:g,deploymentId:v,params:w,nextConfig:x,parsedUrl:y,isDraftMode:A,prerenderManifest:B,routerServerContext:C,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(B.dynamicRoutes[I]||B.routes[F]),K=async()=>((null==C?void 0:C.render404)?await C.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!A){let a=!!B.routes[F],b=B.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||z.isDev||A||(L=F,L="/index"===L?"/":L);let M=!0===z.isDev||!J,N=J&&!M;H&&G&&(0,j.setManifestsSingleton)({page:d,clientReferenceManifest:G,serverActionsManifest:H});let O=a.method||"GET",P=(0,i.getTracer)(),Q=P.getActiveScopeSpan(),R=!!(null==C?void 0:C.isWrappedByNextServer),S=!!(0,h.getRequestMeta)(a,"minimalMode"),T=(0,h.getRequestMeta)(a,"incrementalCache")||await z.getIncrementalCache(a,x,B,S);null==T||T.resetRequestCache(),globalThis.__incrementalCache=T;let U={params:w,previewProps:B.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts},cacheComponents:!!x.cacheComponents,supportsDynamicResponse:M,incrementalCache:T,cacheLifeProfiles:x.cacheLife,waitUntil:c.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:void 0,onInstrumentationRequestError:(b,c,d,e)=>z.onRequestError(a,b,d,e,C)},sharedContext:{buildId:g,deploymentId:v}},V=new l.NodeNextRequest(a),W=new l.NodeNextResponse(b),X=m.NextRequestAdapter.fromNodeNextRequest(V,(0,m.signalFromNodeResponse)(b));try{let e,g=async a=>z.handle(X,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let c=P.getRootSpanAttributes();if(!c)return;if(c.get("next.span_type")!==n.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${c.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let f=c.get("next.route");if(f){let b=`${O} ${f}`;a.setAttributes({"next.route":f,"http.route":f,"next.span_name":b}),a.updateName(b),e&&e!==a&&(e.setAttribute("http.route",f),e.updateName(b))}else a.updateName(`${O} ${d}`)}),h=async e=>{var h,i;let j=async({previousCacheEntry:f})=>{try{if(!S&&D&&E&&!f)return b.statusCode=404,b.setHeader("x-nextjs-cache","REVALIDATED"),b.end("This page could not be found"),null;let d=await g(e);a.fetchMetrics=U.renderOpts.fetchMetrics;let h=U.renderOpts.pendingWaitUntil;h&&c.waitUntil&&(c.waitUntil(h),h=void 0);let i=U.renderOpts.collectedTags;if(!J)return await (0,p.I)(V,W,d,U.renderOpts.pendingWaitUntil),null;{let a=await d.blob(),b=(0,q.toNodeOutgoingHttpHeaders)(d.headers);i&&(b[s.NEXT_CACHE_TAGS_HEADER]=i),!b["content-type"]&&a.type&&(b["content-type"]=a.type);let c=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=s.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,e=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=s.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:u.CachedRouteKind.APP_ROUTE,status:d.status,body:Buffer.from(await a.arrayBuffer()),headers:b},cacheControl:{revalidate:c,expire:e}}}}catch(b){throw(null==f?void 0:f.isStale)&&await z.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),b}},k=await z.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:B,isRoutePPREnabled:!1,isOnDemandRevalidate:D,revalidateOnlyGenerated:E,responseGenerator:j,waitUntil:c.waitUntil,isMinimalMode:S});if(!J)return null;if((null==k||null==(h=k.value)?void 0:h.kind)!==u.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==k||null==(i=k.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});S||b.setHeader("x-nextjs-cache",D?"REVALIDATED":k.isMiss?"MISS":k.isStale?"STALE":"HIT"),A&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let l=(0,q.fromNodeOutgoingHttpHeaders)(k.value.headers);return S&&J||l.delete(s.NEXT_CACHE_TAGS_HEADER),!k.cacheControl||b.getHeader("Cache-Control")||l.get("Cache-Control")||l.set("Cache-Control",(0,r.getCacheControlHeader)(k.cacheControl)),await (0,p.I)(V,W,new Response(k.value.body,{headers:l,status:k.value.status||200})),null};R&&Q?await h(Q):(e=P.getActiveScopeSpan(),await P.withPropagatedContext(a.headers,()=>P.trace(n.BaseServerSpan.handleRequest,{spanName:`${O} ${d}`,kind:i.SpanKind.SERVER,attributes:{"http.method":O,"http.target":a.url}},h),void 0,!R))}catch(b){if(b instanceof t.NoFallbackError||await z.onRequestError(a,b,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:D})},!1,C),J)throw b;return await (0,p.I)(V,W,new Response(null,{status:500})),null}}d()}catch(a){d(a)}})},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},55511:a=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},89721:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>o,PUT:()=>p,dynamic:()=>q});var e=c(23211),f=c(29021),g=c(33873),h=c.n(g),i=c(75430),j=c(8102),k=c(66544),l=a([i]);i=(l.then?(await l)():l)[0];let q="force-dynamic",r=[{key:"maxConcurrent",kind:"number"},{key:"defaultMaxTurns",kind:"number"},{key:"graceTurns",kind:"number"},{key:"defaultJoinMode",kind:"string"},{key:"schedulingEnabled",kind:"boolean"},{key:"scopeModels",kind:"boolean"},{key:"disableDefaultAgents",kind:"boolean"},{key:"toolDescriptionMode",kind:"string"},{key:"fleetView",kind:"boolean"},{key:"widgetMode",kind:"string"},{key:"outputTranscript",kind:"boolean"}],s=new Set(["async","group","smart"]),t=new Set(["full","compact","custom"]),u=new Set(["all","background","off"]);function m(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function n(){return h().join((0,i.getAgentDir)(),"subagents.json")}async function o(a){if(!(0,k.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});try{return e.NextResponse.json({config:function(){let a=n();if(!(0,f.existsSync)(a))return{};try{let b=JSON.parse((0,f.readFileSync)(a,"utf8"));return m(b)?b:{}}catch{return{}}}(),filePath:n(),agents:function(){let a=h().join((0,i.getAgentDir)(),"agents");if(!(0,f.existsSync)(a))return[];let b=[];for(let c of(0,f.readdirSync)(a)){if(!c.endsWith(".md"))continue;let d=h().join(a,c),e={name:c.replace(/\.md$/,"")};try{let a=(0,f.readFileSync)(d,"utf8"),{frontmatter:c}=(0,i.parseFrontmatter)(a);if(m(c)){b.push({...e,displayName:"string"==typeof c.display_name?c.display_name:void 0,description:"string"==typeof c.description?c.description:void 0,model:"string"==typeof c.model?c.model:void 0});continue}}catch{}let g={...e};try{for(let a of(/^---\r?\n([\s\S]*?)\r?\n---/.exec((0,f.readFileSync)(d,"utf8"))?.[1]??"").split(/\r?\n/)){let b=/^([A-Za-z_][A-Za-z0-9_-]*):\s*(.*)$/.exec(a);if(!b)continue;let c=b[2].replace(/^["']|["']$/g,"");"display_name"===b[1]&&void 0===g.displayName?g.displayName=c:"description"===b[1]&&void 0===g.description?g.description=c:"model"===b[1]&&void 0===g.model&&(g.model=c)}}catch{}b.push(g)}return b.sort((a,b)=>a.name.localeCompare(b.name))}()})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function p(a){if(!(0,k.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});if(!(0,k.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let b=await a.json(),c=function(a){let b={};if(!m(a))return b;for(let{key:c,kind:d}of r){if(void 0===a[c]||null===a[c])continue;let e=function(a,b,c){switch(b){case"number":if("number"==typeof c&&Number.isFinite(c)&&c>=0)return c;if("string"==typeof c&&""!==c.trim()&&Number.isFinite(Number(c))){let a=Number(c);return a>=0?a:void 0}return;case"boolean":return"boolean"==typeof c?c:void 0;case"string":if("string"!=typeof c||"defaultJoinMode"===a&&!s.has(c)||"toolDescriptionMode"===a&&!t.has(c)||"widgetMode"===a&&!u.has(c))return;return c}}(c,d,a[c]);void 0!==e&&(b[c]=e)}return b}(b);return(0,j.$)(n(),`${JSON.stringify(c,null,2)}
2
- `),e.NextResponse.json({success:!0,filePath:n(),config:c})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=36825));module.exports=c})();
1
+ (()=>{var a={};a.id=9026,a.ids=[9026],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")},8102:(a,b,c)=>{"use strict";c.d(b,{$:()=>g});var d=c(55511),e=c(29021),f=c(33873);function g(a,b){let c=(0,f.dirname)(a),g=(0,f.join)(c,`.${(0,f.basename)(a)}-${(0,d.randomUUID)()}.tmp`),h=!1;try{(0,e.writeFileSync)(g,b,{encoding:"utf8",flag:"wx",mode:384,flush:!0}),(0,e.renameSync)(g,a)}catch(a){throw h=!0,a}finally{try{(0,e.unlinkSync)(g)}catch(a){if("ENOENT"!==a.code&&!h)throw a}}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.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")},53758:(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(89721),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/subagents/route",pathname:"/api/subagents",filename:"route",bundlePath:"app/api/subagents/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/subagents/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/subagents/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=>{"use strict";a.exports=require("crypto")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},89721:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>o,PUT:()=>p,dynamic:()=>q});var e=c(23211),f=c(29021),g=c(33873),h=c.n(g),i=c(75430),j=c(8102),k=c(66544),l=a([i]);i=(l.then?(await l)():l)[0];let q="force-dynamic",r=[{key:"maxConcurrent",kind:"number"},{key:"defaultMaxTurns",kind:"number"},{key:"graceTurns",kind:"number"},{key:"defaultJoinMode",kind:"string"},{key:"schedulingEnabled",kind:"boolean"},{key:"scopeModels",kind:"boolean"},{key:"disableDefaultAgents",kind:"boolean"},{key:"toolDescriptionMode",kind:"string"},{key:"fleetView",kind:"boolean"},{key:"widgetMode",kind:"string"},{key:"outputTranscript",kind:"boolean"}],s=new Set(["async","group","smart"]),t=new Set(["full","compact","custom"]),u=new Set(["all","background","off"]);function m(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function n(){return h().join((0,i.getAgentDir)(),"subagents.json")}async function o(a){if(!(0,k.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});try{return e.NextResponse.json({config:function(){let a=n();if(!(0,f.existsSync)(a))return{};try{let b=JSON.parse((0,f.readFileSync)(a,"utf8"));return m(b)?b:{}}catch{return{}}}(),filePath:n(),agents:function(){let a=h().join((0,i.getAgentDir)(),"agents");if(!(0,f.existsSync)(a))return[];let b=[];for(let c of(0,f.readdirSync)(a)){if(!c.endsWith(".md"))continue;let d=h().join(a,c),e={name:c.replace(/\.md$/,"")};try{let a=(0,f.readFileSync)(d,"utf8"),{frontmatter:c}=(0,i.parseFrontmatter)(a);if(m(c)){b.push({...e,displayName:"string"==typeof c.display_name?c.display_name:void 0,description:"string"==typeof c.description?c.description:void 0,model:"string"==typeof c.model?c.model:void 0});continue}}catch{}let g={...e};try{for(let a of(/^---\r?\n([\s\S]*?)\r?\n---/.exec((0,f.readFileSync)(d,"utf8"))?.[1]??"").split(/\r?\n/)){let b=/^([A-Za-z_][A-Za-z0-9_-]*):\s*(.*)$/.exec(a);if(!b)continue;let c=b[2].replace(/^["']|["']$/g,"");"display_name"===b[1]&&void 0===g.displayName?g.displayName=c:"description"===b[1]&&void 0===g.description?g.description=c:"model"===b[1]&&void 0===g.model&&(g.model=c)}}catch{}b.push(g)}return b.sort((a,b)=>a.name.localeCompare(b.name))}()})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function p(a){if(!(0,k.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});if(!(0,k.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let b=await a.json(),c=function(a){let b={};if(!m(a))return b;for(let{key:c,kind:d}of r){if(void 0===a[c]||null===a[c])continue;let e=function(a,b,c){switch(b){case"number":if("number"==typeof c&&Number.isFinite(c)&&c>=0)return c;if("string"==typeof c&&""!==c.trim()&&Number.isFinite(Number(c))){let a=Number(c);return a>=0?a:void 0}return;case"boolean":return"boolean"==typeof c?c:void 0;case"string":if("string"!=typeof c||"defaultJoinMode"===a&&!s.has(c)||"toolDescriptionMode"===a&&!t.has(c)||"widgetMode"===a&&!u.has(c))return;return c}}(c,d,a[c]);void 0!==e&&(b[c]=e)}return b}(b);return(0,j.$)(n(),`${JSON.stringify(c,null,2)}
2
+ `),e.NextResponse.json({success:!0,filePath:n(),config:c})}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}d()}catch(a){d(a)}})},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=53758));module.exports=c})();
@@ -0,0 +1 @@
1
+ (()=>{var a={};a.id=5195,a.ids=[5195],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")},5805:(a,b,c)=>{"use strict";c.r(b),c.d(b,{handler:()=>I,patchFetch:()=>H,routeModule:()=>D,serverHooks:()=>G,workAsyncStorage:()=>E,workUnitAsyncStorage:()=>F});var d={};c.r(d),c.d(d,{GET:()=>C,dynamic:()=>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(23211),w=c(66544),x=c(29021),y=c(21820),z=c(33873);function A(a){if(!a)return"";let b=a.content;if("string"==typeof b)return b;if(Array.isArray(b)){let a=[];for(let c of b)"string"==typeof c?a.push(c):c&&"object"==typeof c&&"string"==typeof c.text&&a.push(c.text);return a.join("\n")}return""}let B="force-dynamic";async function C(a){if(!(0,w.EN)(a))return v.NextResponse.json({error:"Access denied"},{status:403});try{let b=new URL(a.url),c=b.searchParams.get("id")??"",d=b.searchParams.get("cwd")??"",e=b.searchParams.get("sessionId")??void 0;if(!c||!d)return v.NextResponse.json({error:"id and cwd are required"},{status:400});let f=function(a,b,c){let d=a.replace(/[/\\]/g,"-").replace(/^[A-Za-z]:-/,"").replace(/^-+/,""),e=(void 0)??(0,z.join)((0,y.tmpdir)(),`pi-subagents-${process.getuid?.()??0}`),f=[];c&&f.push((0,z.join)(e,d,c,"tasks",`${b}.output`)),f.push((0,z.join)(e,d,"tasks",`${b}.output`));try{let a=(0,z.join)(e,d);if((0,x.existsSync)(a))for(let c of(0,x.readdirSync)(a)){let d=(0,z.join)(a,c,"tasks",`${b}.output`);if((0,x.existsSync)(d))return d}}catch{}for(let a of f)if((0,x.existsSync)(a))return a;return null}(d,c,e),g=f?function(a,b=400){if(!(0,x.existsSync)(a))return[];try{let c=(0,x.readFileSync)(a,"utf8"),d=[];for(let a of c.split("\n"))if(a.trim()){try{let b=JSON.parse(a),c=function(a){let b="string"==typeof a.type?a.type:"",c="object"==typeof a.message&&null!==a.message?a.message:void 0;switch(b){case"user":{let a=A(c);return a.trim()?{role:"user",text:a,message:c}:null}case"assistant":{let a=[],b=[],d=c?.content;if(Array.isArray(d)){for(let c of d)if("string"==typeof c)a.push(c);else if(c&&"object"==typeof c){if("string"==typeof c.text&&c.text)a.push(c.text);else if("toolCall"===c.type){let a="string"==typeof c.name?c.name:"string"==typeof c.toolName?c.toolName:"tool";b.push(a)}}}let e=[];for(let c of(a.length>0&&e.push(a.join("\n").trim()),b))e.push(`[Tool: ${c}]`);let f=e.join("\n");return f.trim()?{role:"assistant",text:f,message:c}:null}case"toolResult":{let a=A(c),b=a.length>600?`${a.slice(0,600)}… (truncated)`:a;return b.trim()?{role:"toolResult",text:b,message:c}:null}default:return null}}(b);c&&d.push(c)}catch{}if(d.length>=b)break}return d}catch{return[]}}(f):[];return v.NextResponse.json({lines:g,path:f})}catch(a){return v.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}let D=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/subagents/transcript/route",pathname:"/api/subagents/transcript",filename:"route",bundlePath:"app/api/subagents/transcript/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/subagents/transcript/route.ts",nextConfigOutput:"",userland:d,...{}}),{workAsyncStorage:E,workUnitAsyncStorage:F,serverHooks:G}=D;function H(){return(0,g.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:F})}async function I(a,b,c){c.requestMeta&&(0,h.setRequestMeta)(a,c.requestMeta),D.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let d="/api/subagents/transcript/route";"/index"===d&&(d="/");let e=await D.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:E,resolvedPathname:F,clientReferenceManifest:G,serverActionsManifest:H}=e,I=(0,k.normalizeAppPath)(d),J=!!(A.dynamicRoutes[I]||A.routes[F]),K=async()=>((null==B?void 0:B.render404)?await B.render404(a,b,y,!1):b.end("This page could not be found"),null);if(J&&!z){let a=!!A.routes[F],b=A.dynamicRoutes[I];if(b&&!1===b.fallback&&!a){if(x.adapterPath)return await K();throw new t.NoFallbackError}}let L=null;!J||D.isDev||z||(L="/index"===(L=F)?"/":L);let M=!0===D.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 D.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)=>D.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=>D.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&&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 D.onRequestError(a,b,{routerKind:"App Router",routePath:d,routeType:"route",revalidateReason:(0,o.c)({isStaticGeneration:N,isOnDemandRevalidate:C})},!1,B),b}},k=await D.handleResponse({req:a,nextConfig:x,cacheKey:L,routeKind:f.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:C,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",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 D.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}}},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},21820:a=>{"use strict";a.exports=require("os")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>k,EN:()=>j});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}let i=new Set(["POST","PUT","PATCH","DELETE"]);function j(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||(a.headers.has("origin")||a.headers.has("sec-fetch-site")?function(a){let b,c;if("cross-site"===a.headers.get("sec-fetch-site"))return!1;let d=a.headers.get("origin");if(!d)return!0;let e=(b=new URL(a.url),(c=a.headers.get("host"))?h(`${b.protocol}//${c}`):null);return null!==e&&h(d)===e}(a):!i.has((a.method??"GET").toUpperCase())))}function k(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=5805));module.exports=c})();