@qt4798/pi-web 0.9.16-beta.1 → 0.9.17-beta.2

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 (266) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +4 -3
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/required-server-files.js +1 -1
  5. package/.next/required-server-files.json +1 -1
  6. package/.next/routes-manifest.json +6 -0
  7. package/.next/server/app/_global-error/page.js +3 -3
  8. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/.next/server/app/_not-found/page.js +2 -2
  18. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/.next/server/app/_not-found.html +1 -1
  20. package/.next/server/app/_not-found.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  22. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  24. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  26. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  27. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  28. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  29. package/.next/server/app/api/agent/[id]/route.js +1 -1
  30. package/.next/server/app/api/agent/new/route.js +1 -1
  31. package/.next/server/app/api/agent/running/route.js +1 -1
  32. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  33. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  34. package/.next/server/app/api/auth/login/[provider]/route.js +1 -1
  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/default-cwd/route.js +1 -1
  42. package/.next/server/app/api/features/route.js +1 -1
  43. package/.next/server/app/api/file-index/route.js +1 -1
  44. package/.next/server/app/api/files/[...path]/route.js +1 -1
  45. package/.next/server/app/api/git/diff/route.js +1 -1
  46. package/.next/server/app/api/git/push/route.js +1 -1
  47. package/.next/server/app/api/git/stash/route.js +1 -1
  48. package/.next/server/app/api/git/status/route.js +2 -2
  49. package/.next/server/app/api/home/route.js +1 -1
  50. package/.next/server/app/api/import/discover/route.js +1 -1
  51. package/.next/server/app/api/import/execute/route.js +1 -1
  52. package/.next/server/app/api/import/status/route.js +1 -1
  53. package/.next/server/app/api/models/route.js +1 -1
  54. package/.next/server/app/api/models-config/builtin/route.js +1 -1
  55. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  56. package/.next/server/app/api/models-config/discover/route.js +1 -1
  57. package/.next/server/app/api/models-config/route.js +1 -1
  58. package/.next/server/app/api/models-config/test/route.js +1 -1
  59. package/.next/server/app/api/modes/route.js +1 -0
  60. package/.next/server/app/api/modes/route.js.nft.json +1 -0
  61. package/.next/server/app/api/modes/route_client-reference-manifest.js +1 -0
  62. package/.next/server/app/api/plugins/route.js +1 -1
  63. package/.next/server/app/api/project-trust/route.js +1 -1
  64. package/.next/server/app/api/proxy/route.js +1 -1
  65. package/.next/server/app/api/proxy/test/route.js +1 -1
  66. package/.next/server/app/api/sessions/[id]/auto-name/route.js +3 -3
  67. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  68. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  69. package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
  70. package/.next/server/app/api/sessions/[id]/queue-recovery/route.js +1 -1
  71. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  72. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  73. package/.next/server/app/api/sessions/route.js +1 -1
  74. package/.next/server/app/api/settings/title-model/route.js +1 -1
  75. package/.next/server/app/api/skills/check/route.js +1 -1
  76. package/.next/server/app/api/skills/install/route.js +1 -1
  77. package/.next/server/app/api/skills/route.js +1 -1
  78. package/.next/server/app/api/skills/search/route.js +1 -1
  79. package/.next/server/app/api/skills/update/route.js +1 -1
  80. package/.next/server/app/api/tasks/[id]/[action]/route.js +1 -1
  81. package/.next/server/app/api/tasks/[id]/changed-files/route.js +2 -2
  82. package/.next/server/app/api/tasks/[id]/diff/route.js +2 -2
  83. package/.next/server/app/api/tasks/[id]/events/route.js +1 -1
  84. package/.next/server/app/api/tasks/[id]/route.js +1 -1
  85. package/.next/server/app/api/tasks/batch/route.js +1 -1
  86. package/.next/server/app/api/tasks/events/route.js +1 -1
  87. package/.next/server/app/api/tasks/route.js +1 -1
  88. package/.next/server/app/api/tasks/settings/route.js +1 -1
  89. package/.next/server/app/api/tasks/templates/route.js +1 -1
  90. package/.next/server/app/api/themes/[name]/route.js +1 -1
  91. package/.next/server/app/api/themes/route.js +1 -1
  92. package/.next/server/app/api/usage/route.js +1 -1
  93. package/.next/server/app/api/worktrees/route.js +1 -1
  94. package/.next/server/app/icon.ico/route.js +1 -1
  95. package/.next/server/app/icon.png/route.js +1 -1
  96. package/.next/server/app/icon.svg/route.js +1 -1
  97. package/.next/server/app/index.html +1 -1
  98. package/.next/server/app/index.rsc +4 -4
  99. package/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  100. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  101. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  102. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  103. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  104. package/.next/server/app/page.js +35 -7
  105. package/.next/server/app/page_client-reference-manifest.js +1 -1
  106. package/.next/server/app-paths-manifest.json +4 -3
  107. package/.next/server/chunks/2349.js +2 -2
  108. package/.next/server/chunks/4253.js +2 -2
  109. package/.next/server/chunks/440.js +1 -1
  110. package/.next/server/chunks/6429.js +1 -1
  111. package/.next/server/chunks/7774.js +1 -1
  112. package/.next/server/chunks/7915.js +1 -1
  113. package/.next/server/middleware-build-manifest.js +1 -1
  114. package/.next/server/pages/404.html +1 -1
  115. package/.next/server/pages/500.html +1 -1
  116. package/.next/static/chunks/{8898-89d80b9022b54177.js → 3878-d79ef6662348a2e2.js} +1 -1
  117. package/.next/static/chunks/app/{api/agent/[id]/bash-output/route-fc8ab8f162e8d6f5.js → _global-error/page-3be1b7dbe464ad95.js} +1 -1
  118. package/.next/static/chunks/app/api/agent/[id]/{events/route-fc8ab8f162e8d6f5.js → bash-output/route-3be1b7dbe464ad95.js} +1 -1
  119. package/.next/static/chunks/app/api/agent/[id]/{route-fc8ab8f162e8d6f5.js → events/route-3be1b7dbe464ad95.js} +1 -1
  120. package/.next/static/chunks/app/{_global-error/page-fc8ab8f162e8d6f5.js → api/agent/[id]/route-3be1b7dbe464ad95.js} +1 -1
  121. package/.next/static/chunks/app/api/agent/new/route-3be1b7dbe464ad95.js +1 -0
  122. package/.next/static/chunks/app/api/agent/running/route-3be1b7dbe464ad95.js +1 -0
  123. package/.next/static/chunks/app/api/auth/all-providers/route-3be1b7dbe464ad95.js +1 -0
  124. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-3be1b7dbe464ad95.js +1 -0
  125. package/.next/static/chunks/app/api/auth/login/[provider]/route-3be1b7dbe464ad95.js +1 -0
  126. package/.next/static/chunks/app/api/auth/logout/[provider]/route-3be1b7dbe464ad95.js +1 -0
  127. package/.next/static/chunks/app/api/auth/providers/route-3be1b7dbe464ad95.js +1 -0
  128. package/.next/static/chunks/app/api/backup/export/route-3be1b7dbe464ad95.js +1 -0
  129. package/.next/static/chunks/app/api/backup/import/route-3be1b7dbe464ad95.js +1 -0
  130. package/.next/static/chunks/app/api/cwd/browse/route-3be1b7dbe464ad95.js +1 -0
  131. package/.next/static/chunks/app/api/cwd/validate/route-3be1b7dbe464ad95.js +1 -0
  132. package/.next/static/chunks/app/api/default-cwd/route-3be1b7dbe464ad95.js +1 -0
  133. package/.next/static/chunks/app/api/features/route-3be1b7dbe464ad95.js +1 -0
  134. package/.next/static/chunks/app/api/file-index/route-3be1b7dbe464ad95.js +1 -0
  135. package/.next/static/chunks/app/api/files/[...path]/route-3be1b7dbe464ad95.js +1 -0
  136. package/.next/static/chunks/app/api/git/diff/route-3be1b7dbe464ad95.js +1 -0
  137. package/.next/static/chunks/app/api/git/push/route-3be1b7dbe464ad95.js +1 -0
  138. package/.next/static/chunks/app/api/git/stash/route-3be1b7dbe464ad95.js +1 -0
  139. package/.next/static/chunks/app/api/git/status/route-3be1b7dbe464ad95.js +1 -0
  140. package/.next/static/chunks/app/api/home/route-3be1b7dbe464ad95.js +1 -0
  141. package/.next/static/chunks/app/api/import/discover/route-3be1b7dbe464ad95.js +1 -0
  142. package/.next/static/chunks/app/api/import/execute/route-3be1b7dbe464ad95.js +1 -0
  143. package/.next/static/chunks/app/api/import/status/route-3be1b7dbe464ad95.js +1 -0
  144. package/.next/static/chunks/app/api/models/route-3be1b7dbe464ad95.js +1 -0
  145. package/.next/static/chunks/app/api/models-config/builtin/route-3be1b7dbe464ad95.js +1 -0
  146. package/.next/static/chunks/app/api/models-config/catalog/route-3be1b7dbe464ad95.js +1 -0
  147. package/.next/static/chunks/app/api/models-config/discover/route-3be1b7dbe464ad95.js +1 -0
  148. package/.next/static/chunks/app/api/models-config/route-3be1b7dbe464ad95.js +1 -0
  149. package/.next/static/chunks/app/api/models-config/test/route-3be1b7dbe464ad95.js +1 -0
  150. package/.next/static/chunks/app/api/modes/route-3be1b7dbe464ad95.js +1 -0
  151. package/.next/static/chunks/app/api/plugins/route-3be1b7dbe464ad95.js +1 -0
  152. package/.next/static/chunks/app/api/project-trust/route-3be1b7dbe464ad95.js +1 -0
  153. package/.next/static/chunks/app/api/proxy/route-3be1b7dbe464ad95.js +1 -0
  154. package/.next/static/chunks/app/api/proxy/test/route-3be1b7dbe464ad95.js +1 -0
  155. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-3be1b7dbe464ad95.js +1 -0
  156. package/.next/static/chunks/app/api/sessions/[id]/context/route-3be1b7dbe464ad95.js +1 -0
  157. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-3be1b7dbe464ad95.js +1 -0
  158. package/.next/static/chunks/app/api/sessions/[id]/export/route-3be1b7dbe464ad95.js +1 -0
  159. package/.next/static/chunks/app/api/sessions/[id]/queue-recovery/route-3be1b7dbe464ad95.js +1 -0
  160. package/.next/static/chunks/app/api/sessions/[id]/route-3be1b7dbe464ad95.js +1 -0
  161. package/.next/static/chunks/app/api/sessions/[id]/state/route-3be1b7dbe464ad95.js +1 -0
  162. package/.next/static/chunks/app/api/sessions/route-3be1b7dbe464ad95.js +1 -0
  163. package/.next/static/chunks/app/api/settings/title-model/route-3be1b7dbe464ad95.js +1 -0
  164. package/.next/static/chunks/app/api/skills/check/route-3be1b7dbe464ad95.js +1 -0
  165. package/.next/static/chunks/app/api/skills/install/route-3be1b7dbe464ad95.js +1 -0
  166. package/.next/static/chunks/app/api/skills/route-3be1b7dbe464ad95.js +1 -0
  167. package/.next/static/chunks/app/api/skills/search/route-3be1b7dbe464ad95.js +1 -0
  168. package/.next/static/chunks/app/api/skills/update/route-3be1b7dbe464ad95.js +1 -0
  169. package/.next/static/chunks/app/api/tasks/[id]/[action]/route-3be1b7dbe464ad95.js +1 -0
  170. package/.next/static/chunks/app/api/tasks/[id]/changed-files/route-3be1b7dbe464ad95.js +1 -0
  171. package/.next/static/chunks/app/api/tasks/[id]/diff/route-3be1b7dbe464ad95.js +1 -0
  172. package/.next/static/chunks/app/api/tasks/[id]/events/route-3be1b7dbe464ad95.js +1 -0
  173. package/.next/static/chunks/app/api/tasks/[id]/route-3be1b7dbe464ad95.js +1 -0
  174. package/.next/static/chunks/app/api/tasks/batch/route-3be1b7dbe464ad95.js +1 -0
  175. package/.next/static/chunks/app/api/tasks/events/route-3be1b7dbe464ad95.js +1 -0
  176. package/.next/static/chunks/app/api/tasks/route-3be1b7dbe464ad95.js +1 -0
  177. package/.next/static/chunks/app/api/tasks/settings/route-3be1b7dbe464ad95.js +1 -0
  178. package/.next/static/chunks/app/api/tasks/templates/route-3be1b7dbe464ad95.js +1 -0
  179. package/.next/static/chunks/app/api/themes/[name]/route-3be1b7dbe464ad95.js +1 -0
  180. package/.next/static/chunks/app/api/themes/route-3be1b7dbe464ad95.js +1 -0
  181. package/.next/static/chunks/app/api/usage/route-3be1b7dbe464ad95.js +1 -0
  182. package/.next/static/chunks/app/api/worktrees/route-3be1b7dbe464ad95.js +1 -0
  183. package/.next/static/chunks/app/page-ddcad605657cfba0.js +50 -0
  184. package/.next/static/chunks/next/dist/client/components/builtin/app-error-3be1b7dbe464ad95.js +1 -0
  185. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-3be1b7dbe464ad95.js +1 -0
  186. package/.next/static/chunks/next/dist/client/components/builtin/not-found-3be1b7dbe464ad95.js +1 -0
  187. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-3be1b7dbe464ad95.js +1 -0
  188. package/.next/static/css/26cede2ceec5c771.css +1 -0
  189. package/.next/static/d97gg7mRKGwB8zja1Q4TZ/_buildManifest.js +1 -0
  190. package/.next/trace +9 -179
  191. package/.next/trace-build +1 -1
  192. package/.next/types/app/api/modes/route.ts +351 -0
  193. package/.next/types/routes.d.ts +2 -1
  194. package/.next/types/validator.ts +9 -0
  195. package/README.en.md +16 -0
  196. package/README.md +18 -2
  197. package/package.json +1 -1
  198. package/.next/static/bQwfA6rX4NaYbsubUoY4b/_buildManifest.js +0 -1
  199. package/.next/static/chunks/app/api/agent/new/route-fc8ab8f162e8d6f5.js +0 -1
  200. package/.next/static/chunks/app/api/agent/running/route-fc8ab8f162e8d6f5.js +0 -1
  201. package/.next/static/chunks/app/api/auth/all-providers/route-fc8ab8f162e8d6f5.js +0 -1
  202. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-fc8ab8f162e8d6f5.js +0 -1
  203. package/.next/static/chunks/app/api/auth/login/[provider]/route-fc8ab8f162e8d6f5.js +0 -1
  204. package/.next/static/chunks/app/api/auth/logout/[provider]/route-fc8ab8f162e8d6f5.js +0 -1
  205. package/.next/static/chunks/app/api/auth/providers/route-fc8ab8f162e8d6f5.js +0 -1
  206. package/.next/static/chunks/app/api/backup/export/route-fc8ab8f162e8d6f5.js +0 -1
  207. package/.next/static/chunks/app/api/backup/import/route-fc8ab8f162e8d6f5.js +0 -1
  208. package/.next/static/chunks/app/api/cwd/browse/route-fc8ab8f162e8d6f5.js +0 -1
  209. package/.next/static/chunks/app/api/cwd/validate/route-fc8ab8f162e8d6f5.js +0 -1
  210. package/.next/static/chunks/app/api/default-cwd/route-fc8ab8f162e8d6f5.js +0 -1
  211. package/.next/static/chunks/app/api/features/route-fc8ab8f162e8d6f5.js +0 -1
  212. package/.next/static/chunks/app/api/file-index/route-fc8ab8f162e8d6f5.js +0 -1
  213. package/.next/static/chunks/app/api/files/[...path]/route-fc8ab8f162e8d6f5.js +0 -1
  214. package/.next/static/chunks/app/api/git/diff/route-fc8ab8f162e8d6f5.js +0 -1
  215. package/.next/static/chunks/app/api/git/push/route-fc8ab8f162e8d6f5.js +0 -1
  216. package/.next/static/chunks/app/api/git/stash/route-fc8ab8f162e8d6f5.js +0 -1
  217. package/.next/static/chunks/app/api/git/status/route-fc8ab8f162e8d6f5.js +0 -1
  218. package/.next/static/chunks/app/api/home/route-fc8ab8f162e8d6f5.js +0 -1
  219. package/.next/static/chunks/app/api/import/discover/route-fc8ab8f162e8d6f5.js +0 -1
  220. package/.next/static/chunks/app/api/import/execute/route-fc8ab8f162e8d6f5.js +0 -1
  221. package/.next/static/chunks/app/api/import/status/route-fc8ab8f162e8d6f5.js +0 -1
  222. package/.next/static/chunks/app/api/models/route-fc8ab8f162e8d6f5.js +0 -1
  223. package/.next/static/chunks/app/api/models-config/builtin/route-fc8ab8f162e8d6f5.js +0 -1
  224. package/.next/static/chunks/app/api/models-config/catalog/route-fc8ab8f162e8d6f5.js +0 -1
  225. package/.next/static/chunks/app/api/models-config/discover/route-fc8ab8f162e8d6f5.js +0 -1
  226. package/.next/static/chunks/app/api/models-config/route-fc8ab8f162e8d6f5.js +0 -1
  227. package/.next/static/chunks/app/api/models-config/test/route-fc8ab8f162e8d6f5.js +0 -1
  228. package/.next/static/chunks/app/api/plugins/route-fc8ab8f162e8d6f5.js +0 -1
  229. package/.next/static/chunks/app/api/project-trust/route-fc8ab8f162e8d6f5.js +0 -1
  230. package/.next/static/chunks/app/api/proxy/route-fc8ab8f162e8d6f5.js +0 -1
  231. package/.next/static/chunks/app/api/proxy/test/route-fc8ab8f162e8d6f5.js +0 -1
  232. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-fc8ab8f162e8d6f5.js +0 -1
  233. package/.next/static/chunks/app/api/sessions/[id]/context/route-fc8ab8f162e8d6f5.js +0 -1
  234. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-fc8ab8f162e8d6f5.js +0 -1
  235. package/.next/static/chunks/app/api/sessions/[id]/export/route-fc8ab8f162e8d6f5.js +0 -1
  236. package/.next/static/chunks/app/api/sessions/[id]/queue-recovery/route-fc8ab8f162e8d6f5.js +0 -1
  237. package/.next/static/chunks/app/api/sessions/[id]/route-fc8ab8f162e8d6f5.js +0 -1
  238. package/.next/static/chunks/app/api/sessions/[id]/state/route-fc8ab8f162e8d6f5.js +0 -1
  239. package/.next/static/chunks/app/api/sessions/route-fc8ab8f162e8d6f5.js +0 -1
  240. package/.next/static/chunks/app/api/settings/title-model/route-fc8ab8f162e8d6f5.js +0 -1
  241. package/.next/static/chunks/app/api/skills/check/route-fc8ab8f162e8d6f5.js +0 -1
  242. package/.next/static/chunks/app/api/skills/install/route-fc8ab8f162e8d6f5.js +0 -1
  243. package/.next/static/chunks/app/api/skills/route-fc8ab8f162e8d6f5.js +0 -1
  244. package/.next/static/chunks/app/api/skills/search/route-fc8ab8f162e8d6f5.js +0 -1
  245. package/.next/static/chunks/app/api/skills/update/route-fc8ab8f162e8d6f5.js +0 -1
  246. package/.next/static/chunks/app/api/tasks/[id]/[action]/route-fc8ab8f162e8d6f5.js +0 -1
  247. package/.next/static/chunks/app/api/tasks/[id]/changed-files/route-fc8ab8f162e8d6f5.js +0 -1
  248. package/.next/static/chunks/app/api/tasks/[id]/diff/route-fc8ab8f162e8d6f5.js +0 -1
  249. package/.next/static/chunks/app/api/tasks/[id]/events/route-fc8ab8f162e8d6f5.js +0 -1
  250. package/.next/static/chunks/app/api/tasks/[id]/route-fc8ab8f162e8d6f5.js +0 -1
  251. package/.next/static/chunks/app/api/tasks/batch/route-fc8ab8f162e8d6f5.js +0 -1
  252. package/.next/static/chunks/app/api/tasks/events/route-fc8ab8f162e8d6f5.js +0 -1
  253. package/.next/static/chunks/app/api/tasks/route-fc8ab8f162e8d6f5.js +0 -1
  254. package/.next/static/chunks/app/api/tasks/settings/route-fc8ab8f162e8d6f5.js +0 -1
  255. package/.next/static/chunks/app/api/tasks/templates/route-fc8ab8f162e8d6f5.js +0 -1
  256. package/.next/static/chunks/app/api/themes/[name]/route-fc8ab8f162e8d6f5.js +0 -1
  257. package/.next/static/chunks/app/api/themes/route-fc8ab8f162e8d6f5.js +0 -1
  258. package/.next/static/chunks/app/api/usage/route-fc8ab8f162e8d6f5.js +0 -1
  259. package/.next/static/chunks/app/api/worktrees/route-fc8ab8f162e8d6f5.js +0 -1
  260. package/.next/static/chunks/app/page-3a71956f793d87f7.js +0 -22
  261. package/.next/static/chunks/next/dist/client/components/builtin/app-error-fc8ab8f162e8d6f5.js +0 -1
  262. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-fc8ab8f162e8d6f5.js +0 -1
  263. package/.next/static/chunks/next/dist/client/components/builtin/not-found-fc8ab8f162e8d6f5.js +0 -1
  264. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-fc8ab8f162e8d6f5.js +0 -1
  265. package/.next/static/css/f8b227e230256326.css +0 -1
  266. /package/.next/static/{bQwfA6rX4NaYbsubUoY4b → d97gg7mRKGwB8zja1Q4TZ}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (()=>{var a={};a.id=9787,a.ids=[9787],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},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")},26777:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{u:()=>k});var e=c(29021),f=c(21820),g=c(33873),h=c(75430),i=a([h]);function j(a){return"object"!=typeof a||null===a||Array.isArray(a)?{}:Object.fromEntries(Object.entries(a).filter(a=>"string"==typeof a[1]))}async function k(a,b){let c;try{c=(0,e.mkdtempSync)((0,g.join)((0,f.tmpdir)(),"pi-web-model-discovery-"));let d=(0,g.join)(c,"models.json"),i="__pi_web_model_discovery__";(0,e.writeFileSync)(d,JSON.stringify({providers:{[a]:{...b,models:[{id:i}]}}},null,2),"utf8");try{(0,e.chmodSync)(d,384)}catch{}let k=await h.ModelRuntime.create({modelsPath:d}),l=k.getError();if(l)throw Error(l);let m=k.getModel(a,i);if(!m)throw Error(`Unable to load provider "${a}"`);let n=await k.getAuth(m);if(n)return{apiKey:n.auth.apiKey,headers:j(n.auth.headers)};return{headers:j(k.getCompatibilityRequestConfig(m).headers)}}finally{c&&(0,e.rmSync)(c,{recursive:!0,force:!0})}}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51874:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>k,dynamic:()=>l});var e=c(23211),f=c(77030),g=c(26777),h=c(93598),i=c(66544),j=a([g]);g=(j.then?(await j)():j)[0];let l="force-dynamic";async function k(a){try{var b;let c,d;if(!(0,i.EN)(a))return e.NextResponse.json({error:"Request not allowed"},{status:403});if(!(0,i.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});let j=await a.json(),k="string"==typeof j.providerName?j.providerName.trim():"";if(!k)return e.NextResponse.json({error:"providerName is required"},{status:400});if(b=j.provider,"object"!=typeof b||null===b||Array.isArray(b))return e.NextResponse.json({error:"provider is required"},{status:400});let l="string"==typeof j.provider.baseUrl?j.provider.baseUrl.trim():"";if(!l)return e.NextResponse.json({error:"Base URL is required"},{status:400});let m="string"==typeof j.provider.api&&j.provider.api?j.provider.api:"openai-completions";try{c=(0,h.y)(l,m)}catch{return e.NextResponse.json({error:"Base URL is invalid"},{status:400})}if("https:"!==c.protocol)return e.NextResponse.json({error:"Only https:// base URLs are allowed"},{status:400});if(function(a){let b=a.toLocaleLowerCase();if("localhost"===b||b.endsWith(".localhost"))return!0;if(4===(0,f.isIP)(b)){let[a,c]=b.split(".").map(Number);return 10===a||127===a||169===a&&254===c||172===a&&c>=16&&c<=31||192===a&&168===c||0===a||a>=224||!1}if(6===(0,f.isIP)(b)){let a=b.split(":").find(a=>""!==a),c=a?.toLocaleLowerCase()??"";if("fe80"===c||"fc"===c||"fd"===c||"::"===c||"0"===c)return!0}return!1}(c.hostname))return e.NextResponse.json({error:"Private and local network addresses are not allowed"},{status:400});let n=await (0,g.u)(k,j.provider);if("string"==typeof j.provider.apiKey&&j.provider.apiKey.trim()&&!n.apiKey)return e.NextResponse.json({error:`No API key found for "${k}"`},{status:400});let o=await fetch(c,{cache:"no-store",headers:function(a,b,c){let d=new Headers(c);return(d.has("accept")||d.set("Accept","application/json"),b)?("anthropic-messages"===a?(d.has("x-api-key")||d.set("x-api-key",b),d.has("anthropic-version")||d.set("anthropic-version","2023-06-01")):"google-generative-ai"===a?d.has("x-goog-api-key")||d.set("x-goog-api-key",b):d.has("authorization")||d.set("Authorization",`Bearer ${b}`),d):d}(m,n.apiKey,n.headers),signal:AbortSignal.timeout(2e4)}),p=await o.text();if(!o.ok)return e.NextResponse.json({error:p.slice(0,500)||`Upstream returned HTTP ${o.status}`,status:o.status},{status:502});try{d=JSON.parse(p)}catch{return e.NextResponse.json({error:"Upstream model list was not valid JSON"},{status:502})}let q=(0,h.f)(d);if(0===q.length)return e.NextResponse.json({error:"No models found in the upstream response"},{status:502});return e.NextResponse.json({models:q,endpoint:c.toString()})}catch(c){let a=c instanceof Error?c.message:String(c),b=c instanceof DOMException&&"TimeoutError"===c.name?504:500;return e.NextResponse.json({error:a},{status:b})}}d()}catch(a){d(a)}})},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},66544:(a,b,c)=>{"use strict";c.d(b,{E2:()=>j,EN:()=>i});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}function i(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c;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))}function j(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},82859:(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(51874),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/models-config/discover/route",pathname:"/api/models-config/discover",filename:"route",bundlePath:"app/api/models-config/discover/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/models-config/discover/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/models-config/discover/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)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},93598:(a,b,c)=>{"use strict";function d(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function e(a){return"string"==typeof a&&a.trim()?a.trim():void 0}function f(a){let b=new Set,c=[];for(let f of function(a){if(Array.isArray(a))return a;if(!d(a))return[];for(let b of["data","models","results","items"]){let c=a[b];if(Array.isArray(c))return c;if(d(c))return Object.values(c)}return[]}(a)){let a=function(a){if("string"==typeof a){let b=a.trim();return b?{id:b}:null}if(!d(a))return null;let b=e(a.id)??e(a.model)??e(a.name);if(!b)return null;let c=b.startsWith("models/")?b.slice(7):b;if(!c)return null;let f=e(a.display_name)??e(a.displayName)??(e(a.id)||e(a.model)?e(a.name):void 0);return f&&f!==c?{id:c,name:f}:{id:c}}(f);!a||b.has(a.id)||(b.add(a.id),c.push(a))}return c.sort((a,b)=>(a.name??a.id).localeCompare(b.name??b.id,void 0,{numeric:!0,sensitivity:"base"}))}function g(a,b){let c=new URL(a.trim()),d=c.pathname.replace(/\/+$/,"");if(!/\/models$/i.test(d)){let a=d;"anthropic-messages"!==b||/\/v\d+(?:beta)?$/i.test(a)||(a+="/v1"),"google-generative-ai"!==b||/\/v\d+(?:beta)?$/i.test(a)||(a+="/v1beta"),c.pathname=`${a}/models`.replace(/\/+/g,"/")}return"anthropic-messages"!==b||c.searchParams.has("limit")||c.searchParams.set("limit","1000"),"google-generative-ai"!==b||c.searchParams.has("pageSize")||c.searchParams.set("pageSize","1000"),c}c.d(b,{f:()=>f,y:()=>g})},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=82859));module.exports=c})();
1
+ (()=>{var a={};a.id=9787,a.ids=[9787],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},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")},26777:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{u:()=>k});var e=c(29021),f=c(21820),g=c(33873),h=c(75430),i=a([h]);function j(a){return"object"!=typeof a||null===a||Array.isArray(a)?{}:Object.fromEntries(Object.entries(a).filter(a=>"string"==typeof a[1]))}async function k(a,b){let c;try{c=(0,e.mkdtempSync)((0,g.join)((0,f.tmpdir)(),"pi-web-model-discovery-"));let d=(0,g.join)(c,"models.json"),i="__pi_web_model_discovery__";(0,e.writeFileSync)(d,JSON.stringify({providers:{[a]:{...b,models:[{id:i}]}}},null,2),"utf8");try{(0,e.chmodSync)(d,384)}catch{}let k=await h.ModelRuntime.create({modelsPath:d}),l=k.getError();if(l)throw Error(l);let m=k.getModel(a,i);if(!m)throw Error(`Unable to load provider "${a}"`);let n=await k.getAuth(m);if(n)return{apiKey:n.auth.apiKey,headers:j(n.auth.headers)};return{headers:j(k.getCompatibilityRequestConfig(m).headers)}}finally{c&&(0,e.rmSync)(c,{recursive:!0,force:!0})}}h=(i.then?(await i)():i)[0],d()}catch(a){d(a)}})},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},33873:a=>{"use strict";a.exports=require("path")},44870:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},51874:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>k,dynamic:()=>l});var e=c(23211),f=c(77030),g=c(26777),h=c(93598),i=c(66544),j=a([g]);g=(j.then?(await j)():j)[0];let l="force-dynamic";async function k(a){try{var b;let c,d;if(!(0,i.EN)(a))return e.NextResponse.json({error:"Request not allowed"},{status:403});if(!(0,i.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});let j=await a.json(),k="string"==typeof j.providerName?j.providerName.trim():"";if(!k)return e.NextResponse.json({error:"providerName is required"},{status:400});if(b=j.provider,"object"!=typeof b||null===b||Array.isArray(b))return e.NextResponse.json({error:"provider is required"},{status:400});let l="string"==typeof j.provider.baseUrl?j.provider.baseUrl.trim():"";if(!l)return e.NextResponse.json({error:"Base URL is required"},{status:400});let m="string"==typeof j.provider.api&&j.provider.api?j.provider.api:"openai-completions";try{c=(0,h.y)(l,m)}catch{return e.NextResponse.json({error:"Base URL is invalid"},{status:400})}if("https:"!==c.protocol)return e.NextResponse.json({error:"Only https:// base URLs are allowed"},{status:400});if(function(a){let b=a.toLocaleLowerCase();if("localhost"===b||b.endsWith(".localhost"))return!0;if(4===(0,f.isIP)(b)){let[a,c]=b.split(".").map(Number);return 10===a||127===a||169===a&&254===c||172===a&&c>=16&&c<=31||192===a&&168===c||0===a||a>=224||!1}if(6===(0,f.isIP)(b)){let a=b.split(":").find(a=>""!==a),c=a?.toLocaleLowerCase()??"";if("fe80"===c||"fc"===c||"fd"===c||"::"===c||"0"===c)return!0}return!1}(c.hostname))return e.NextResponse.json({error:"Private and local network addresses are not allowed"},{status:400});let n=await (0,g.u)(k,j.provider);if("string"==typeof j.provider.apiKey&&j.provider.apiKey.trim()&&!n.apiKey)return e.NextResponse.json({error:`No API key found for "${k}"`},{status:400});let o=await fetch(c,{cache:"no-store",headers:function(a,b,c){let d=new Headers(c);return(d.has("accept")||d.set("Accept","application/json"),b)?("anthropic-messages"===a?(d.has("x-api-key")||d.set("x-api-key",b),d.has("anthropic-version")||d.set("anthropic-version","2023-06-01")):"google-generative-ai"===a?d.has("x-goog-api-key")||d.set("x-goog-api-key",b):d.has("authorization")||d.set("Authorization",`Bearer ${b}`),d):d}(m,n.apiKey,n.headers),signal:AbortSignal.timeout(2e4)}),p=await o.text();if(!o.ok)return e.NextResponse.json({error:p.slice(0,500)||`Upstream returned HTTP ${o.status}`,status:o.status},{status:502});try{d=JSON.parse(p)}catch{return e.NextResponse.json({error:"Upstream model list was not valid JSON"},{status:502})}let q=(0,h.f)(d);if(0===q.length)return e.NextResponse.json({error:"No models found in the upstream response"},{status:502});return e.NextResponse.json({models:q,endpoint:c.toString()})}catch(c){let a=c instanceof Error?c.message:String(c),b=c instanceof DOMException&&"TimeoutError"===c.name?504:500;return e.NextResponse.json({error:a},{status:b})}}d()}catch(a){d(a)}})},55389:(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(51874),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/models-config/discover/route",pathname:"/api/models-config/discover",filename:"route",bundlePath:"app/api/models-config/discover/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/models-config/discover/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/models-config/discover/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=>{"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:()=>j,EN:()=>i});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}function i(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c;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))}function j(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},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")},93598:(a,b,c)=>{"use strict";function d(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function e(a){return"string"==typeof a&&a.trim()?a.trim():void 0}function f(a){let b=new Set,c=[];for(let f of function(a){if(Array.isArray(a))return a;if(!d(a))return[];for(let b of["data","models","results","items"]){let c=a[b];if(Array.isArray(c))return c;if(d(c))return Object.values(c)}return[]}(a)){let a=function(a){if("string"==typeof a){let b=a.trim();return b?{id:b}:null}if(!d(a))return null;let b=e(a.id)??e(a.model)??e(a.name);if(!b)return null;let c=b.startsWith("models/")?b.slice(7):b;if(!c)return null;let f=e(a.display_name)??e(a.displayName)??(e(a.id)||e(a.model)?e(a.name):void 0);return f&&f!==c?{id:c,name:f}:{id:c}}(f);!a||b.has(a.id)||(b.add(a.id),c.push(a))}return c.sort((a,b)=>(a.name??a.id).localeCompare(b.name??b.id,void 0,{numeric:!0,sensitivity:"base"}))}function g(a,b){let c=new URL(a.trim()),d=c.pathname.replace(/\/+$/,"");if(!/\/models$/i.test(d)){let a=d;"anthropic-messages"!==b||/\/v\d+(?:beta)?$/i.test(a)||(a+="/v1"),"google-generative-ai"!==b||/\/v\d+(?:beta)?$/i.test(a)||(a+="/v1beta"),c.pathname=`${a}/models`.replace(/\/+/g,"/")}return"anthropic-messages"!==b||c.searchParams.has("limit")||c.searchParams.set("limit","1000"),"google-generative-ai"!==b||c.searchParams.has("pageSize")||c.searchParams.set("pageSize","1000"),c}c.d(b,{f:()=>f,y:()=>g})},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=55389));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=7483,a.ids=[7483],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")},12412:a=>{"use strict";a.exports=require("assert")},17551:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Br:()=>p,V6:()=>o,z0:()=>q});var e=c(73024),f=c(76760),g=c(80974),h=c.n(g),i=c(75430),j=c(8102),k=c(28967),l=a([i]);i=(l.then?(await l)():l)[0];let r={retries:{retries:10,factor:2,minTimeout:50,maxTimeout:2e3,randomize:!0},stale:3e4};function m(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function n(a=(0,i.getAgentDir)()){return(0,f.join)(a,"models.json")}function o(a=n()){if(!(0,e.existsSync)(a))return{providers:{}};let b=JSON.parse((0,e.readFileSync)(a,"utf8"));if(!m(b))throw Error("Invalid models.json: expected an object");if(void 0!==b.providers&&!m(b.providers))throw Error("Invalid models.json: providers must be an object");return b}async function p(a,b=n()){let c,d=(0,f.dirname)(b);if((0,e.existsSync)(d)||(0,e.mkdirSync)(d,{recursive:!0,mode:448}),!(0,e.existsSync)(b))try{(0,e.writeFileSync)(b,JSON.stringify({providers:{}},null,2),{encoding:"utf8",flag:"wx",mode:384})}catch(a){if("EEXIST"!==a.code)throw a}let g=await h().lock(b,{...r,onCompromised:a=>{c=a}}),i=()=>{if(c)throw c};try{i();let c=o(b),d=await a(c);if(!m(d.data))throw Error("Invalid models.json mutation result");return i(),!1!==d.changed&&((0,j.$)(b,JSON.stringify(d.data,null,2)),(0,k.k)(),i()),d.result}finally{try{await g()}catch(a){if(c)throw c;throw a}}}function q(a){if(!m(a))throw Error("models.json payload must be an object");if(void 0!==a.providers&&!m(a.providers))throw Error("models.json payload providers must be an object")}d()}catch(a){d(a)}})},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28967:(a,b,c)=>{"use strict";function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear()}function f(a,b){let c=d(),e=c.entries.get(a);if(e){if(e.expiresAt>Date.now())return Promise.resolve(e.data);c.entries.delete(a)}let f=c.inFlight.get(a);if(f)return f;let g=c.generation,h=Promise.resolve().then(b).then(b=>{if(c.generation===g&&c.inFlight.get(a)===h){let d=Date.now();for(let[a,b]of c.entries)b.expiresAt<=d&&c.entries.delete(a);for(;c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(a,{data:b,expiresAt:d+6e4})}return b}).finally(()=>{c.inFlight.get(a)===h&&c.inFlight.delete(a)});return c.inFlight.set(a,h),h}c.d(b,{k:()=>e,r:()=>f})},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")},53718:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>j,PUT:()=>k,dynamic:()=>l});var e=c(23211),f=c(17551),g=c(66544),h=a([f]);f=(h.then?(await h)():h)[0];let l="force-dynamic";function i(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}async function j(a){if(!(0,g.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});try{return e.NextResponse.json((0,f.V6)())}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function k(a){if(!(0,g.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});if(!(0,g.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let b=await a.json();(0,f.z0)(b);let c=await (0,f.Br)(a=>{let c=function(a,b){let c=i(a.providers)?a.providers:{},d=i(b.providers)?b.providers:{},e={...d};for(let[a,b]of Object.entries(d)){if(!i(b))continue;let d=c[a],f={...b};i(d)&&void 0!==d.modelOverrides?f.modelOverrides=d.modelOverrides:delete f.modelOverrides,e[a]=f}return{...b,providers:e}}(a,b);return{data:c,result:c}});return e.NextResponse.json({success:!0,config:c})}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:()=>j,EN:()=>i});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}function i(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c;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))}function j(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},70487:(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(53718),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/models-config/route",pathname:"/api/models-config",filename:"route",bundlePath:"app/api/models-config/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/models-config/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/models-config/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)}})},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974],()=>b(b.s=70487));module.exports=c})();
1
+ (()=>{var a={};a.id=7483,a.ids=[7483],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")},12412:a=>{"use strict";a.exports=require("assert")},17551:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Br:()=>p,V6:()=>o,z0:()=>q});var e=c(73024),f=c(76760),g=c(80974),h=c.n(g),i=c(75430),j=c(8102),k=c(28967),l=a([i]);i=(l.then?(await l)():l)[0];let r={retries:{retries:10,factor:2,minTimeout:50,maxTimeout:2e3,randomize:!0},stale:3e4};function m(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function n(a=(0,i.getAgentDir)()){return(0,f.join)(a,"models.json")}function o(a=n()){if(!(0,e.existsSync)(a))return{providers:{}};let b=JSON.parse((0,e.readFileSync)(a,"utf8"));if(!m(b))throw Error("Invalid models.json: expected an object");if(void 0!==b.providers&&!m(b.providers))throw Error("Invalid models.json: providers must be an object");return b}async function p(a,b=n()){let c,d=(0,f.dirname)(b);if((0,e.existsSync)(d)||(0,e.mkdirSync)(d,{recursive:!0,mode:448}),!(0,e.existsSync)(b))try{(0,e.writeFileSync)(b,JSON.stringify({providers:{}},null,2),{encoding:"utf8",flag:"wx",mode:384})}catch(a){if("EEXIST"!==a.code)throw a}let g=await h().lock(b,{...r,onCompromised:a=>{c=a}}),i=()=>{if(c)throw c};try{i();let c=o(b),d=await a(c);if(!m(d.data))throw Error("Invalid models.json mutation result");return i(),!1!==d.changed&&((0,j.$)(b,JSON.stringify(d.data,null,2)),(0,k.k)(),i()),d.result}finally{try{await g()}catch(a){if(c)throw c;throw a}}}function q(a){if(!m(a))throw Error("models.json payload must be an object");if(void 0!==a.providers&&!m(a.providers))throw Error("models.json payload providers must be an object")}d()}catch(a){d(a)}})},26409:(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(53718),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/models-config/route",pathname:"/api/models-config",filename:"route",bundlePath:"app/api/models-config/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/models-config/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/models-config/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)}})},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28967:(a,b,c)=>{"use strict";function d(){return globalThis.__piModelsCacheState||(globalThis.__piModelsCacheState={entries:new Map,inFlight:new Map,generation:0}),globalThis.__piModelsCacheState}function e(){let a=d();a.generation+=1,a.entries.clear(),a.inFlight.clear()}function f(a,b){let c=d(),e=c.entries.get(a);if(e){if(e.expiresAt>Date.now())return Promise.resolve(e.data);c.entries.delete(a)}let f=c.inFlight.get(a);if(f)return f;let g=c.generation,h=Promise.resolve().then(b).then(b=>{if(c.generation===g&&c.inFlight.get(a)===h){let d=Date.now();for(let[a,b]of c.entries)b.expiresAt<=d&&c.entries.delete(a);for(;c.entries.size>=32;){let a=c.entries.keys().next().value;if(void 0===a)break;c.entries.delete(a)}c.entries.set(a,{data:b,expiresAt:d+6e4})}return b}).finally(()=>{c.inFlight.get(a)===h&&c.inFlight.delete(a)});return c.inFlight.set(a,h),h}c.d(b,{k:()=>e,r:()=>f})},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")},53718:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>j,PUT:()=>k,dynamic:()=>l});var e=c(23211),f=c(17551),g=c(66544),h=a([f]);f=(h.then?(await h)():h)[0];let l="force-dynamic";function i(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}async function j(a){if(!(0,g.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});try{return e.NextResponse.json((0,f.V6)())}catch(a){return e.NextResponse.json({error:a instanceof Error?a.message:String(a)},{status:500})}}async function k(a){if(!(0,g.EN)(a))return e.NextResponse.json({error:"Access denied"},{status:403});if(!(0,g.E2)(a))return e.NextResponse.json({error:"Content-Type must be application/json"},{status:415});try{let b=await a.json();(0,f.z0)(b);let c=await (0,f.Br)(a=>{let c=function(a,b){let c=i(a.providers)?a.providers:{},d=i(b.providers)?b.providers:{},e={...d};for(let[a,b]of Object.entries(d)){if(!i(b))continue;let d=c[a],f={...b};i(d)&&void 0!==d.modelOverrides?f.modelOverrides=d.modelOverrides:delete f.modelOverrides,e[a]=f}return{...b,providers:e}}(a,b);return{data:c,result:c}});return e.NextResponse.json({success:!0,config:c})}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:()=>j,EN:()=>i});var d=c(77030);function e(a){return(a.startsWith("[")&&a.endsWith("]")?a.slice(1,-1):a).toLowerCase().replace(/\.$/,"")}function f(a){if(!a||/[\s/@\\]/.test(a))return null;try{let b=new URL(`http://${a}`);if(b.username||b.password||"/"!==b.pathname||b.search||b.hash)return null;return e(b.hostname)}catch{return null}}function g(){return[process.env.PI_WEB_HOSTNAME,...process.env.PI_WEB_ALLOWED_HOSTS?.split(",")??[]].filter(a=>!!a?.trim())}function h(a){try{return new URL(a).origin}catch{return null}}function i(a,b=g()){return!!function(a,b=g()){let c=a.headers.get("host"),h=c?f(c):null;return!!h&&(!!("localhost"===h||h.endsWith(".localhost")||(0,d.isIP)(h))||b.some(a=>{let b;return((b=a?.trim())?(0,d.isIP)(b)?e(b):f(b):null)===h}))}(a,b)&&(!!function(a){if("GET"!==a.method||"navigate"!==a.headers.get("sec-fetch-mode")||"document"!==a.headers.get("sec-fetch-dest")||"?1"!==a.headers.get("sec-fetch-user"))return!1;try{return/^\/api\/sessions\/[^/]+\/export$/.test(new URL(a.url).pathname)}catch{return!1}}(a)||!(a.headers.has("origin")||a.headers.has("sec-fetch-site"))||function(a){let b,c;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))}function j(a){let b=a.headers.get("content-type")?.split(";",1)[0]?.trim().toLowerCase();return"application/json"===b||!!(b?.startsWith("application/")&&b.endsWith("+json"))}},73024:a=>{"use strict";a.exports=require("node:fs")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},78335:()=>{},81115:a=>{"use strict";a.exports=require("constants")},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},94735:a=>{"use strict";a.exports=require("events")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813,974],()=>b(b.s=26409));module.exports=c})();
@@ -1 +1 @@
1
- (()=>{var a={};a.id=8658,a.ids=[8658],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")},4833:(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(12773),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/models-config/test/route",pathname:"/api/models-config/test",filename:"route",bundlePath:"app/api/models-config/test/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/models-config/test/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/models-config/test/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")},12773:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>m,dynamic:()=>n});var e=c(23211),f=c(29021),g=c(21820),h=c(33873),i=c(19821),j=c(75430),k=a([i,j]);[i,j]=k.then?(await k)():k;let n="force-dynamic";function l(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}async function m(a){let b;try{let c,d=await a.json(),k="string"==typeof d.providerName?d.providerName.trim():"";if(!k)return e.NextResponse.json({ok:!1,error:"providerName is required"},{status:400});if(!l(d.provider))return e.NextResponse.json({ok:!1,error:"provider is required"},{status:400});if(!l(d.model))return e.NextResponse.json({ok:!1,error:"model is required"},{status:400});let m="string"==typeof d.model.id?d.model.id.trim():"";if(!m)return e.NextResponse.json({ok:!1,error:"Model ID is required"},{status:400});b=(0,f.mkdtempSync)((0,h.join)((0,g.tmpdir)(),"pi-web-model-test-"));let n=(0,h.join)(b,"models.json");(0,f.writeFileSync)(n,JSON.stringify({providers:{[k]:{...d.provider,models:[{...d.model,id:m}]}}},null,2),"utf8");let o=await j.ModelRuntime.create({modelsPath:n}),p=o.getError();if(p)return e.NextResponse.json({ok:!1,error:p});let q=o.getModel(k,m);if(!q)return e.NextResponse.json({ok:!1,error:`Model not found: ${k}/${m}`});let r=await o.getAuth(q);if(!r?.auth.apiKey)return e.NextResponse.json({ok:!1,error:`No API key found for "${k}"`});let s=new AbortController,t=setTimeout(()=>s.abort(),2e4),u=Date.now();try{let a=await (0,i.completeSimple)(q,{messages:[{role:"user",content:"Reply with OK only.",timestamp:Date.now()}]},{apiKey:r.auth.apiKey,headers:r.auth.headers,maxTokens:16,timeoutMs:2e4,maxRetries:0,cacheRetention:"none",signal:s.signal,onResponse:a=>{c=a.status}}),b=Date.now()-u;if("error"===a.stopReason||"aborted"===a.stopReason)return e.NextResponse.json({ok:!1,error:a.errorMessage??(s.signal.aborted?"Test timed out":"Model returned an error"),latencyMs:b,status:c});return e.NextResponse.json({ok:!0,latencyMs:b,status:c,responseText:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("").slice(0,300)})}finally{clearTimeout(t)}}catch(a){return e.NextResponse.json({ok:!1,error:a instanceof Error?a.message:String(a)},{status:500})}finally{b&&(0,f.rmSync)(b,{recursive:!0,force:!0})}}d()}catch(a){d(a)}})},19821:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/compat")},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")},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=4833));module.exports=c})();
1
+ (()=>{var a={};a.id=8658,a.ids=[8658],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")},12773:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{POST:()=>m,dynamic:()=>n});var e=c(23211),f=c(29021),g=c(21820),h=c(33873),i=c(19821),j=c(75430),k=a([i,j]);[i,j]=k.then?(await k)():k;let n="force-dynamic";function l(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}async function m(a){let b;try{let c,d=await a.json(),k="string"==typeof d.providerName?d.providerName.trim():"";if(!k)return e.NextResponse.json({ok:!1,error:"providerName is required"},{status:400});if(!l(d.provider))return e.NextResponse.json({ok:!1,error:"provider is required"},{status:400});if(!l(d.model))return e.NextResponse.json({ok:!1,error:"model is required"},{status:400});let m="string"==typeof d.model.id?d.model.id.trim():"";if(!m)return e.NextResponse.json({ok:!1,error:"Model ID is required"},{status:400});b=(0,f.mkdtempSync)((0,h.join)((0,g.tmpdir)(),"pi-web-model-test-"));let n=(0,h.join)(b,"models.json");(0,f.writeFileSync)(n,JSON.stringify({providers:{[k]:{...d.provider,models:[{...d.model,id:m}]}}},null,2),"utf8");let o=await j.ModelRuntime.create({modelsPath:n}),p=o.getError();if(p)return e.NextResponse.json({ok:!1,error:p});let q=o.getModel(k,m);if(!q)return e.NextResponse.json({ok:!1,error:`Model not found: ${k}/${m}`});let r=await o.getAuth(q);if(!r?.auth.apiKey)return e.NextResponse.json({ok:!1,error:`No API key found for "${k}"`});let s=new AbortController,t=setTimeout(()=>s.abort(),2e4),u=Date.now();try{let a=await (0,i.completeSimple)(q,{messages:[{role:"user",content:"Reply with OK only.",timestamp:Date.now()}]},{apiKey:r.auth.apiKey,headers:r.auth.headers,maxTokens:16,timeoutMs:2e4,maxRetries:0,cacheRetention:"none",signal:s.signal,onResponse:a=>{c=a.status}}),b=Date.now()-u;if("error"===a.stopReason||"aborted"===a.stopReason)return e.NextResponse.json({ok:!1,error:a.errorMessage??(s.signal.aborted?"Test timed out":"Model returned an error"),latencyMs:b,status:c});return e.NextResponse.json({ok:!0,latencyMs:b,status:c,responseText:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("").slice(0,300)})}finally{clearTimeout(t)}}catch(a){return e.NextResponse.json({ok:!1,error:a instanceof Error?a.message:String(a)},{status:500})}finally{b&&(0,f.rmSync)(b,{recursive:!0,force:!0})}}d()}catch(a){d(a)}})},19821:a=>{"use strict";a.exports=import("@earendil-works/pi-ai/compat")},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")},74575:(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(12773),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/models-config/test/route",pathname:"/api/models-config/test",filename:"route",bundlePath:"app/api/models-config/test/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/models-config/test/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/models-config/test/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=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=74575));module.exports=c})();
@@ -0,0 +1 @@
1
+ (()=>{var a={};a.id=9502,a.ids=[9502],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")},22241:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{GET:()=>h,PUT:()=>i,dynamic:()=>j});var e=c(23211),f=c(64735),g=a([f]);f=(g.then?(await g)():g)[0];let j="force-dynamic";async function h(){return e.NextResponse.json((0,f.lN)())}async function i(a){try{let b=await a.json(),c=(0,f.lN)(),d=b.collaborationMode,g=b.tokenMode,h=b.toolApprovalMode,i=b.permissionRules,j={collaborationMode:"normal"===d||"plan"===d||"goal"===d?d:c.collaborationMode,tokenMode:"full"===g||"economy"===g||"delivery"===g?g:c.tokenMode,toolApprovalMode:"ask"===h||"auto"===h||"yolo"===h?h:c.toolApprovalMode,permissionRules:i&&"object"==typeof i&&!Array.isArray(i)?{allow:Array.isArray(i.allow)?i.allow:c.permissionRules.allow,ask:Array.isArray(i.ask)?i.ask:c.permissionRules.ask,deny:Array.isArray(i.deny)?i.deny:c.permissionRules.deny}:c.permissionRules};return(0,f.S3)(j),e.NextResponse.json({success:!0,modes:j})}catch(b){let a=b instanceof Error?b.message:String(b);return e.NextResponse.json({error:a},{status:500})}}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")},34243:(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(22241),w=a([v]);v=(w.then?(await w)():w)[0];let z=new e.AppRouteRouteModule({definition:{kind:f.RouteKind.APP_ROUTE,page:"/api/modes/route",pathname:"/api/modes",filename:"route",bundlePath:"app/api/modes/route"},distDir:".next",relativeProjectDir:"",resolvedPagePath:"/Volumes/1T 原装/项目研发/pi-web-QT/app/api/modes/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/modes/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)}})},36193:(a,b,c)=>{"use strict";c.d(b,{LD:()=>m,kP:()=>o,ni:()=>n});var d=c(67264);function e(a){if(!a)return[];let b=[];for(let c of a){let a=function(a){let b=a.trim();if(!b)return null;let c=b.indexOf("="),d=b.indexOf("(");if(c>0&&(d<0||c<d)){let a=b.slice(0,c).trim();return a?{tool:a,subject:b.slice(c+1),literal:!0}:null}if(d>=0&&b.endsWith(")")){let a=b.slice(0,d).trim();return a?{tool:a,subject:b.slice(d+1,-1)}:null}return{tool:b}}(c);a&&b.push(a)}return b}function f(a){return void 0===a.subject?a.tool:a.literal?`${a.tool}=${a.subject}`:`${a.tool}(${a.subject})`}function g(a){return a.includes("*")||a.includes("?")}function h(a,b){return void 0===b.subject||""!==a&&(b.literal||!g(b.subject)?a===b.subject:(function(a){let b="^";for(let c of a)"*"===c?b+=".*":"?"===c?b+=".":b+=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return RegExp(b+"$")})(b.subject).test(a))}function i(a,b){return a.toLowerCase()===b.toLowerCase()}function j(a,b,c){for(let d of a)if(i(d.tool,b)&&h(c,d))return!0;return!1}function k(a){let b=a.trim();return!!b&&!!(/\$\(/.test(b)||/`/.test(b)||/(^|\s)(python|python3|node|ruby|perl|php)\s+-[a-z]*c(\s|$)/i.test(b)||/(^|\s)(sh|bash|zsh)\s+-c(\s|$)/i.test(b)||/(^|\s)(sudo|su)\s/i.test(b)||/;\s*[a-z]/i.test(b)||/\|\s*(sh|bash|zsh|python|python3|node)\b/i.test(b)||/\|\s*tee\b/i.test(b))}let l=["ls","cat","head","tail","grep","rg","find","wc","echo","pwd","cd","git status","git diff","git log","git branch","git remote","git stash list","git show","git ls-files","which","type","env","file","stat","du","df","history","man","less","more","tree","git diff --","git log --","curl -I","curl --head"];function m(a,b,c={}){let e=c.mode??"auto",f=c.readOnly??d.MJ.has(b.toLowerCase()),n=function(a,b){if("bash"===a.toLowerCase()){let a=b?.command;return"string"==typeof a&&a.trim()?`command:${a.trim()}`:""}let c=b??{},d="string"==typeof c.source_path?c.source_path:"",e="string"==typeof c.destination_path?c.destination_path:"";if(d&&e)return e!==d?`${d}\u0000${e}`:d;for(let a of["path","file_path","file","glob","pattern","directory"]){let b=c[a];if("string"==typeof b&&b)return b}return""}(b,c.args),o="bash"===b.toLowerCase(),p=o&&n.startsWith("command:")?n.slice(8):"";if(j(a.deny,b,n))return"deny";if(o&&p){let c=k(p);return j(a.allow,b,n)&&!c?"allow":j(a.ask,b,n)?"ask":c?a.allow.some(a=>i(a.tool,b)&&void 0!==a.subject&&!g(a.subject)&&h(n,a))||"yolo"===e?"allow":"ask":!function(a){let b=a.trim();if(!b||k(b)||/[;&|>]/.test(b))return!1;let c=b.toLowerCase();for(let a of l)if(c===a||c.startsWith(a+" "))return!0;return!1}(p)?"ask"===e?"ask":"allow":"allow"}return j(a.allow,b,n)?"allow":j(a.ask,b,n)?"ask":f?"allow":"ask"===e?"ask":"allow"}function n(a){return{allow:e(a?.allow),ask:e(a?.ask),deny:e(a?.deny)}}function o(a){return{allow:a.allow.map(f),ask:a.ask.map(f),deny:a.deny.map(f)}}},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")},64735:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{S3:()=>o,lN:()=>n});var e=c(29021),f=c(33873),g=c(75430),h=c(8102),i=c(67264),j=c(36193),k=a([g]);g=(k.then?(await k)():k)[0];let p="modes";function l(){return(0,f.join)((0,g.getAgentDir)(),"settings.json")}function m(){let a=l();if(!(0,e.existsSync)(a))return{};try{let b=JSON.parse((0,e.readFileSync)(a,"utf8"));return null===b||"object"!=typeof b||Array.isArray(b)?{}:b}catch{return{}}}function n(){let a=(0,i.Md)(),b=m()[p];if(!b||"object"!=typeof b||Array.isArray(b))return a;let c=b.permissionRules,d=(0,j.kP)((0,j.ni)(c));return{collaborationMode:(0,i.UY)(b.collaborationMode),tokenMode:(0,i.wI)(b.tokenMode),toolApprovalMode:(0,i.g0)(b.toolApprovalMode),permissionRules:{allow:Array.isArray(d.allow)?d.allow:[],ask:Array.isArray(d.ask)?d.ask:[],deny:Array.isArray(d.deny)?d.deny:[]}}}function o(a){let b=m();b[p]={collaborationMode:(0,i.UY)(a.collaborationMode),tokenMode:(0,i.wI)(a.tokenMode),toolApprovalMode:(0,i.g0)(a.toolApprovalMode),permissionRules:a.permissionRules},(0,h.$)(l(),JSON.stringify(b,null,2))}d()}catch(a){d(a)}})},67264:(a,b,c)=>{"use strict";c.d(b,{MJ:()=>k,Md:()=>g,UY:()=>h,g0:()=>j,wI:()=>i});let d="normal",e="full",f="auto";function g(){return{collaborationMode:d,tokenMode:e,toolApprovalMode:f,permissionRules:{allow:[],ask:[],deny:[]}}}function h(a){return"normal"===a||"plan"===a||"goal"===a?a:d}function i(a){return"economy"===a||"delivery"===a||"full"===a?a:e}function j(a){return"ask"===a||"auto"===a||"yolo"===a?a:f}let k=new Set(["read","grep","find","ls","bash_output","get_tools","get_commands","get_session_stats"])},75430:a=>{"use strict";a.exports=import("@earendil-works/pi-coding-agent")},78335:()=>{},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},96487:()=>{}};var b=require("../../../webpack-runtime.js");b.C(a);var c=b.X(0,[4741,1813],()=>b(b.s=34243));module.exports=c})();