@rexvane/piweb 0.3.21 → 0.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +6 -4
  3. package/.next/build-manifest.json +5 -5
  4. package/.next/next-minimal-server.js.nft.json +1 -1
  5. package/.next/next-server.js.nft.json +1 -1
  6. package/.next/prerender-manifest.json +7 -7
  7. package/.next/react-loadable-manifest.json +10 -10
  8. package/.next/required-server-files.js +16 -1
  9. package/.next/required-server-files.json +16 -1
  10. package/.next/routes-manifest.json +12 -0
  11. package/.next/server/app/_global-error/page.js +2 -2
  12. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  13. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_global-error.html +1 -1
  15. package/.next/server/app/_global-error.meta +8 -0
  16. package/.next/server/app/_global-error.rsc +15 -11
  17. package/.next/server/app/_global-error.segments/_full.segment.rsc +15 -11
  18. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +20 -16
  19. package/.next/server/app/_global-error.segments/_tree.segment.rsc +3 -1
  20. package/.next/server/app/_not-found/page.js +1 -1
  21. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/_not-found.html +1 -1
  24. package/.next/server/app/_not-found.meta +8 -0
  25. package/.next/server/app/_not-found.rsc +17 -13
  26. package/.next/server/app/_not-found.segments/_full.segment.rsc +17 -13
  27. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +24 -20
  28. package/.next/server/app/_not-found.segments/_tree.segment.rsc +4 -2
  29. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  30. package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
  31. package/.next/server/app/api/agent/[id]/route.js +1 -1
  32. package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
  33. package/.next/server/app/api/agent/[id]/tree/route.js +1 -1
  34. package/.next/server/app/api/agent/[id]/tree/route.js.nft.json +1 -1
  35. package/.next/server/app/api/agent/new/route.js +1 -1
  36. package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
  37. package/.next/server/app/api/config/route.js +1 -1
  38. package/.next/server/app/api/config/route.js.nft.json +1 -1
  39. package/.next/server/app/api/files/route.js +1 -1
  40. package/.next/server/app/api/files/route.js.nft.json +1 -1
  41. package/.next/server/app/api/fs/route.js +1 -1
  42. package/.next/server/app/api/fs/route.js.nft.json +1 -1
  43. package/.next/server/app/api/git/route.js +4 -4
  44. package/.next/server/app/api/git/route.js.nft.json +1 -1
  45. package/.next/server/app/api/github/route.js +5 -0
  46. package/.next/server/app/api/github/route.js.nft.json +1 -0
  47. package/.next/server/app/api/github/route_client-reference-manifest.js +1 -0
  48. package/.next/server/app/api/growth/route.js +1 -1
  49. package/.next/server/app/api/growth/route.js.nft.json +1 -1
  50. package/.next/server/app/api/health/route.js +1 -1
  51. package/.next/server/app/api/health/route.js.nft.json +1 -1
  52. package/.next/server/app/api/models/defaults/route.js +1 -0
  53. package/.next/server/app/api/models/defaults/route.js.nft.json +1 -0
  54. package/.next/server/app/api/models/defaults/route_client-reference-manifest.js +1 -0
  55. package/.next/server/app/api/models/route.js +1 -1
  56. package/.next/server/app/api/models/route.js.nft.json +1 -1
  57. package/.next/server/app/api/pi-settings/route.js +1 -1
  58. package/.next/server/app/api/pi-settings/route.js.nft.json +1 -1
  59. package/.next/server/app/api/plugins/route.js +1 -1
  60. package/.next/server/app/api/plugins/route.js.nft.json +1 -1
  61. package/.next/server/app/api/prompts/route.js +1 -1
  62. package/.next/server/app/api/prompts/route.js.nft.json +1 -1
  63. package/.next/server/app/api/remote/route.js +3 -3
  64. package/.next/server/app/api/remote/route.js.nft.json +1 -1
  65. package/.next/server/app/api/security/route.js +1 -1
  66. package/.next/server/app/api/security/route.js.nft.json +1 -1
  67. package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
  68. package/.next/server/app/api/sessions/[id]/export/route.js.nft.json +1 -1
  69. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  70. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  71. package/.next/server/app/api/sessions/import/route.js +2 -2
  72. package/.next/server/app/api/sessions/import/route.js.nft.json +1 -1
  73. package/.next/server/app/api/sessions/route.js +1 -1
  74. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  75. package/.next/server/app/api/skills/route.js +2 -2
  76. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  77. package/.next/server/app/api/update/route.js +2 -2
  78. package/.next/server/app/api/update/route.js.nft.json +1 -1
  79. package/.next/server/app/api/version/route.js +1 -1
  80. package/.next/server/app/api/version/route.js.nft.json +1 -1
  81. package/.next/server/app/api/web-auth/route.js +1 -1
  82. package/.next/server/app/api/web-auth/route.js.nft.json +1 -1
  83. package/.next/server/app/api/workspaces/route.js +1 -1
  84. package/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  85. package/.next/server/app/icon.svg/route.js +1 -1
  86. package/.next/server/app/icon.svg/route.js.nft.json +1 -1
  87. package/.next/server/app/icon.svg.meta +1 -1
  88. package/.next/server/app/index.html +1 -1
  89. package/.next/server/app/index.meta +8 -0
  90. package/.next/server/app/index.rsc +19 -13
  91. package/.next/server/app/index.segments/__PAGE__.segment.rsc +25 -19
  92. package/.next/server/app/index.segments/_full.segment.rsc +19 -13
  93. package/.next/server/app/index.segments/_tree.segment.rsc +3 -2
  94. package/.next/server/app/login/page.js +1 -1
  95. package/.next/server/app/login/page.js.nft.json +1 -1
  96. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  97. package/.next/server/app/login.html +1 -1
  98. package/.next/server/app/login.meta +8 -0
  99. package/.next/server/app/login.rsc +23 -17
  100. package/.next/server/app/login.segments/_full.segment.rsc +23 -17
  101. package/.next/server/app/login.segments/_tree.segment.rsc +4 -2
  102. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +30 -24
  103. package/.next/server/app/page.js +1 -1
  104. package/.next/server/app/page.js.nft.json +1 -1
  105. package/.next/server/app/page_client-reference-manifest.js +1 -1
  106. package/.next/server/app-paths-manifest.json +6 -4
  107. package/.next/server/chunks/229.js +1 -1
  108. package/.next/server/chunks/421.js +1 -1
  109. package/.next/server/chunks/430.js +215 -31
  110. package/.next/server/chunks/496.js +1 -1
  111. package/.next/server/chunks/538.js +1 -1
  112. package/.next/server/chunks/662.js +2 -2
  113. package/.next/server/chunks/686.js +1 -1
  114. package/.next/server/chunks/813.js +23 -1
  115. package/.next/server/chunks/920.js +2 -2
  116. package/.next/server/chunks/924.js +1 -1
  117. package/.next/server/chunks/970.js +305 -0
  118. package/.next/server/middleware-build-manifest.js +1 -1
  119. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  120. package/.next/server/middleware.js +185 -23
  121. package/.next/server/middleware.js.nft.json +1 -1
  122. package/.next/server/pages/404.html +1 -1
  123. package/.next/server/pages/500.html +1 -1
  124. package/.next/server/preview-props.json +5 -0
  125. package/.next/server/server-reference-manifest.json +1 -1
  126. package/.next/static/WMazYvD-gbeLsCUfUxvvM/_buildManifest.js +1 -0
  127. package/.next/static/chunks/316-698d10eb465bd8ef.js +1 -0
  128. package/.next/static/chunks/3794-0978865cda773008.js +52 -0
  129. package/.next/static/chunks/4673.4cf66cbdd8364c57.js +1 -0
  130. package/.next/static/chunks/4686-09fcd0028079006c.js +1 -0
  131. package/.next/static/chunks/4778.eddd3a5813f85824.js +1 -0
  132. package/.next/static/chunks/4bd1b696-e199e788e58acf79.js +1 -0
  133. package/.next/static/chunks/{5173.91ddb803785009f8.js → 5173.dfd1cbb795b9a21c.js} +1 -1
  134. package/.next/static/chunks/618.949981da99be7182.js +4 -0
  135. package/.next/static/chunks/7411.67366dc5032a141d.js +1 -0
  136. package/.next/static/chunks/app/_global-error/page-f977af7f858990a2.js +1 -0
  137. package/.next/static/chunks/app/api/agent/[id]/events/route-f977af7f858990a2.js +1 -0
  138. package/.next/static/chunks/app/api/agent/[id]/route-f977af7f858990a2.js +1 -0
  139. package/.next/static/chunks/app/api/agent/[id]/tree/route-f977af7f858990a2.js +1 -0
  140. package/.next/static/chunks/app/api/agent/new/route-f977af7f858990a2.js +1 -0
  141. package/.next/static/chunks/app/api/config/route-f977af7f858990a2.js +1 -0
  142. package/.next/static/chunks/app/api/files/route-f977af7f858990a2.js +1 -0
  143. package/.next/static/chunks/app/api/fs/route-f977af7f858990a2.js +1 -0
  144. package/.next/static/chunks/app/api/git/route-f977af7f858990a2.js +1 -0
  145. package/.next/static/chunks/app/api/github/route-f977af7f858990a2.js +1 -0
  146. package/.next/static/chunks/app/api/growth/route-f977af7f858990a2.js +1 -0
  147. package/.next/static/chunks/app/api/health/route-f977af7f858990a2.js +1 -0
  148. package/.next/static/chunks/app/api/models/defaults/route-f977af7f858990a2.js +1 -0
  149. package/.next/static/chunks/app/api/models/route-f977af7f858990a2.js +1 -0
  150. package/.next/static/chunks/app/api/pi-settings/route-f977af7f858990a2.js +1 -0
  151. package/.next/static/chunks/app/api/plugins/route-f977af7f858990a2.js +1 -0
  152. package/.next/static/chunks/app/api/prompts/route-f977af7f858990a2.js +1 -0
  153. package/.next/static/chunks/app/api/remote/route-f977af7f858990a2.js +1 -0
  154. package/.next/static/chunks/app/api/security/route-f977af7f858990a2.js +1 -0
  155. package/.next/static/chunks/app/api/sessions/[id]/export/route-f977af7f858990a2.js +1 -0
  156. package/.next/static/chunks/app/api/sessions/[id]/route-f977af7f858990a2.js +1 -0
  157. package/.next/static/chunks/app/api/sessions/import/route-f977af7f858990a2.js +1 -0
  158. package/.next/static/chunks/app/api/sessions/route-f977af7f858990a2.js +1 -0
  159. package/.next/static/chunks/app/api/skills/route-f977af7f858990a2.js +1 -0
  160. package/.next/static/chunks/app/api/update/route-f977af7f858990a2.js +1 -0
  161. package/.next/static/chunks/app/api/version/route-f977af7f858990a2.js +1 -0
  162. package/.next/static/chunks/app/api/web-auth/route-f977af7f858990a2.js +1 -0
  163. package/.next/static/chunks/app/api/workspaces/route-f977af7f858990a2.js +1 -0
  164. package/.next/static/chunks/app/page-fc4ed2ff29b6235e.js +1 -0
  165. package/.next/static/chunks/framework-47b723d27f4a4963.js +1 -0
  166. package/.next/static/chunks/main-5403f0764579e5fe.js +5 -0
  167. package/.next/static/chunks/next/dist/client/components/builtin/app-error-f977af7f858990a2.js +1 -0
  168. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-f977af7f858990a2.js +1 -0
  169. package/.next/static/chunks/next/dist/client/components/builtin/not-found-f977af7f858990a2.js +1 -0
  170. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f977af7f858990a2.js +1 -0
  171. package/.next/static/chunks/webpack-22ebffc20adb44ae.js +1 -0
  172. package/.next/static/css/6671d0d1589fdc0e.css +1 -0
  173. package/.next/static/css/{2959bd6b626b7ffe.css → f15a853af8b5127f.css} +1 -1
  174. package/.next/types/app/api/agent/[id]/events/route.ts +3 -1
  175. package/.next/types/app/api/agent/[id]/route.ts +3 -1
  176. package/.next/types/app/api/agent/[id]/tree/route.ts +3 -1
  177. package/.next/types/app/api/agent/new/route.ts +3 -1
  178. package/.next/types/app/api/config/route.ts +3 -1
  179. package/.next/types/app/api/files/route.ts +3 -1
  180. package/.next/types/app/api/fs/route.ts +3 -1
  181. package/.next/types/app/api/git/route.ts +3 -1
  182. package/.next/types/app/api/github/route.ts +355 -0
  183. package/.next/types/app/api/growth/route.ts +3 -1
  184. package/.next/types/app/api/health/route.ts +3 -1
  185. package/.next/types/app/api/models/defaults/route.ts +355 -0
  186. package/.next/types/app/api/models/route.ts +3 -1
  187. package/.next/types/app/api/pi-settings/route.ts +3 -1
  188. package/.next/types/app/api/plugins/route.ts +3 -1
  189. package/.next/types/app/api/prompts/route.ts +3 -1
  190. package/.next/types/app/api/remote/route.ts +3 -1
  191. package/.next/types/app/api/security/route.ts +3 -1
  192. package/.next/types/app/api/sessions/[id]/export/route.ts +3 -1
  193. package/.next/types/app/api/sessions/[id]/route.ts +3 -1
  194. package/.next/types/app/api/sessions/import/route.ts +3 -1
  195. package/.next/types/app/api/sessions/route.ts +3 -1
  196. package/.next/types/app/api/skills/route.ts +3 -1
  197. package/.next/types/app/api/update/route.ts +3 -1
  198. package/.next/types/app/api/version/route.ts +3 -1
  199. package/.next/types/app/api/web-auth/route.ts +3 -1
  200. package/.next/types/app/api/workspaces/route.ts +3 -1
  201. package/.next/types/app/layout.ts +4 -1
  202. package/.next/types/app/login/page.ts +4 -1
  203. package/.next/types/app/page.ts +4 -1
  204. package/.next/types/cache-life.d.ts +11 -43
  205. package/.next/types/routes.d.ts +3 -1
  206. package/.next/types/validator.ts +76 -2
  207. package/package.json +2 -2
  208. package/src/app/api/files/route.ts +5 -2
  209. package/src/app/api/github/route.ts +26 -0
  210. package/src/app/api/models/defaults/route.ts +18 -0
  211. package/src/app/api/models/route.ts +24 -1
  212. package/src/app/globals.css +186 -0
  213. package/src/components/AppShell.tsx +82 -30
  214. package/src/components/ChatInput.tsx +244 -63
  215. package/src/components/ChatWindow.tsx +18 -27
  216. package/src/components/ContextMeter.tsx +193 -143
  217. package/src/components/GitPanel.tsx +110 -40
  218. package/src/components/ProjectPanel.tsx +55 -30
  219. package/src/components/PromptPanel.tsx +2 -4
  220. package/src/components/ProviderSetupModal.module.css +20 -0
  221. package/src/components/ProviderSetupModal.tsx +134 -29
  222. package/src/components/SettingsPanel.tsx +243 -27
  223. package/src/components/TrajectoryView.tsx +4 -6
  224. package/src/components/composer/ComposerImages.tsx +306 -0
  225. package/src/hooks/useGrowth.ts +3 -0
  226. package/src/hooks/usePiWeb.ts +12 -2
  227. package/src/hooks/useWorkspaceFiles.ts +93 -0
  228. package/src/i18n.tsx +108 -2
  229. package/src/lib/agent-manager.ts +135 -104
  230. package/src/lib/files-service.ts +100 -1
  231. package/src/lib/format.ts +56 -0
  232. package/src/lib/git-service.ts +45 -13
  233. package/src/lib/github-identity.ts +245 -0
  234. package/src/lib/growth-service.ts +6 -2
  235. package/src/lib/hero-model-memory.ts +28 -0
  236. package/src/lib/model-defaults.ts +105 -0
  237. package/src/lib/model-draft.ts +257 -9
  238. package/src/lib/model-endpoint.ts +23 -0
  239. package/src/lib/model-files.ts +33 -0
  240. package/src/lib/models-service.ts +240 -78
  241. package/src/lib/pi.ts +27 -2
  242. package/src/lib/process-format.ts +3 -2
  243. package/src/lib/session/metrics.ts +31 -0
  244. package/src/lib/thinking-level.ts +39 -0
  245. package/src/lib/trajectory.ts +17 -3
  246. package/src/lib/types.ts +12 -1
  247. package/src/lib/workspace-index.ts +270 -0
  248. package/.next/server/chunks/741.js +0 -165
  249. package/.next/static/chunks/316-5ea443ee6b512aa9.js +0 -1
  250. package/.next/static/chunks/3794-3679f1c05160977c.js +0 -52
  251. package/.next/static/chunks/4673.8a5a9e6855350e34.js +0 -1
  252. package/.next/static/chunks/4686-882531aef1d2e250.js +0 -1
  253. package/.next/static/chunks/4778.305dc6abb9889627.js +0 -1
  254. package/.next/static/chunks/4bd1b696-93bf506b236d6248.js +0 -1
  255. package/.next/static/chunks/618.ee5d5bf1c647e483.js +0 -4
  256. package/.next/static/chunks/839.bfd2db36483faa3e.js +0 -1
  257. package/.next/static/chunks/app/_global-error/page-b179d9f7f6f2daf9.js +0 -1
  258. package/.next/static/chunks/app/api/agent/[id]/events/route-b179d9f7f6f2daf9.js +0 -1
  259. package/.next/static/chunks/app/api/agent/[id]/route-b179d9f7f6f2daf9.js +0 -1
  260. package/.next/static/chunks/app/api/agent/[id]/tree/route-b179d9f7f6f2daf9.js +0 -1
  261. package/.next/static/chunks/app/api/agent/new/route-b179d9f7f6f2daf9.js +0 -1
  262. package/.next/static/chunks/app/api/config/route-b179d9f7f6f2daf9.js +0 -1
  263. package/.next/static/chunks/app/api/files/route-b179d9f7f6f2daf9.js +0 -1
  264. package/.next/static/chunks/app/api/fs/route-b179d9f7f6f2daf9.js +0 -1
  265. package/.next/static/chunks/app/api/git/route-b179d9f7f6f2daf9.js +0 -1
  266. package/.next/static/chunks/app/api/growth/route-b179d9f7f6f2daf9.js +0 -1
  267. package/.next/static/chunks/app/api/health/route-b179d9f7f6f2daf9.js +0 -1
  268. package/.next/static/chunks/app/api/models/route-b179d9f7f6f2daf9.js +0 -1
  269. package/.next/static/chunks/app/api/pi-settings/route-b179d9f7f6f2daf9.js +0 -1
  270. package/.next/static/chunks/app/api/plugins/route-b179d9f7f6f2daf9.js +0 -1
  271. package/.next/static/chunks/app/api/prompts/route-b179d9f7f6f2daf9.js +0 -1
  272. package/.next/static/chunks/app/api/remote/route-b179d9f7f6f2daf9.js +0 -1
  273. package/.next/static/chunks/app/api/security/route-b179d9f7f6f2daf9.js +0 -1
  274. package/.next/static/chunks/app/api/sessions/[id]/export/route-b179d9f7f6f2daf9.js +0 -1
  275. package/.next/static/chunks/app/api/sessions/[id]/route-b179d9f7f6f2daf9.js +0 -1
  276. package/.next/static/chunks/app/api/sessions/import/route-b179d9f7f6f2daf9.js +0 -1
  277. package/.next/static/chunks/app/api/sessions/route-b179d9f7f6f2daf9.js +0 -1
  278. package/.next/static/chunks/app/api/skills/route-b179d9f7f6f2daf9.js +0 -1
  279. package/.next/static/chunks/app/api/update/route-b179d9f7f6f2daf9.js +0 -1
  280. package/.next/static/chunks/app/api/version/route-b179d9f7f6f2daf9.js +0 -1
  281. package/.next/static/chunks/app/api/web-auth/route-b179d9f7f6f2daf9.js +0 -1
  282. package/.next/static/chunks/app/api/workspaces/route-b179d9f7f6f2daf9.js +0 -1
  283. package/.next/static/chunks/app/page-c04af72e549695bd.js +0 -1
  284. package/.next/static/chunks/framework-c4e651fe89edfa91.js +0 -1
  285. package/.next/static/chunks/main-6159b22a8cb0b7c5.js +0 -5
  286. package/.next/static/chunks/next/dist/client/components/builtin/app-error-b179d9f7f6f2daf9.js +0 -1
  287. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-b179d9f7f6f2daf9.js +0 -1
  288. package/.next/static/chunks/next/dist/client/components/builtin/not-found-b179d9f7f6f2daf9.js +0 -1
  289. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-b179d9f7f6f2daf9.js +0 -1
  290. package/.next/static/chunks/webpack-9b4bb574e5817654.js +0 -1
  291. package/.next/static/css/ea27b9e30f76303f.css +0 -1
  292. package/.next/static/sNX5GQkOWuK5YEID1hT-C/_buildManifest.js +0 -1
  293. /package/.next/static/{sNX5GQkOWuK5YEID1hT-C → WMazYvD-gbeLsCUfUxvvM}/_ssgManifest.js +0 -0
@@ -2,7 +2,7 @@
2
2
  import * as entry from '../../../src/app/layout.js'
3
3
  import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'
4
4
 
5
- import type { InstantConfigForTypeCheckInternal, Prefetch } from 'next/dist/build/segment-config/app/app-segment-config.js'
5
+ import type { InstantConfigForTypeCheckInternal, Prefetch, EnsureStatic } from 'next/dist/build/segment-config/app/app-segment-config.js'
6
6
 
7
7
  type TEntry = typeof import('../../../src/app/layout.js')
8
8
 
@@ -15,8 +15,11 @@ checkFields<Diff<{
15
15
  default: Function
16
16
  config?: {}
17
17
  generateStaticParams?: Function
18
+ unstable_paramMatching?: {}
19
+ unstable_generateParamMatching?: Function
18
20
  instant?: InstantConfigForTypeCheckInternal
19
21
  prefetch?: Prefetch
22
+ ensureStatic?: EnsureStatic
20
23
  unstable_dynamicStaleTime?: number
21
24
  revalidate?: RevalidateRange<TEntry> | false
22
25
  dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
@@ -2,7 +2,7 @@
2
2
  import * as entry from '../../../../src/app/login/page.js'
3
3
  import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'
4
4
 
5
- import type { InstantConfigForTypeCheckInternal, Prefetch } from 'next/dist/build/segment-config/app/app-segment-config.js'
5
+ import type { InstantConfigForTypeCheckInternal, Prefetch, EnsureStatic } from 'next/dist/build/segment-config/app/app-segment-config.js'
6
6
 
7
7
  type TEntry = typeof import('../../../../src/app/login/page.js')
8
8
 
@@ -15,8 +15,11 @@ checkFields<Diff<{
15
15
  default: Function
16
16
  config?: {}
17
17
  generateStaticParams?: Function
18
+ unstable_paramMatching?: {}
19
+ unstable_generateParamMatching?: Function
18
20
  instant?: InstantConfigForTypeCheckInternal
19
21
  prefetch?: Prefetch
22
+ ensureStatic?: EnsureStatic
20
23
  unstable_dynamicStaleTime?: number
21
24
  revalidate?: RevalidateRange<TEntry> | false
22
25
  dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
@@ -2,7 +2,7 @@
2
2
  import * as entry from '../../../src/app/page.js'
3
3
  import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'
4
4
 
5
- import type { InstantConfigForTypeCheckInternal, Prefetch } from 'next/dist/build/segment-config/app/app-segment-config.js'
5
+ import type { InstantConfigForTypeCheckInternal, Prefetch, EnsureStatic } from 'next/dist/build/segment-config/app/app-segment-config.js'
6
6
 
7
7
  type TEntry = typeof import('../../../src/app/page.js')
8
8
 
@@ -15,8 +15,11 @@ checkFields<Diff<{
15
15
  default: Function
16
16
  config?: {}
17
17
  generateStaticParams?: Function
18
+ unstable_paramMatching?: {}
19
+ unstable_generateParamMatching?: Function
18
20
  instant?: InstantConfigForTypeCheckInternal
19
21
  prefetch?: Prefetch
22
+ ensureStatic?: EnsureStatic
20
23
  unstable_dynamicStaleTime?: number
21
24
  revalidate?: RevalidateRange<TEntry> | false
22
25
  dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
@@ -1,16 +1,17 @@
1
1
  // Type definitions for Next.js cacheLife configs
2
2
 
3
- declare module 'next/cache' {
4
- export { unstable_cache } from 'next/dist/server/web/spec-extension/unstable-cache'
5
- export {
6
- updateTag,
7
- revalidateTag,
8
- revalidatePath,
9
- refresh,
10
- } from 'next/dist/server/web/spec-extension/revalidate'
11
- export { unstable_noStore } from 'next/dist/server/web/spec-extension/unstable-no-store'
12
- export { io } from 'next/dist/server/request/io'
3
+ export {}
13
4
 
5
+ declare module 'next/cache' {
6
+ export interface CacheLifeProfiles {
7
+ "default": true
8
+ "seconds": true
9
+ "minutes": true
10
+ "hours": true
11
+ "days": true
12
+ "weeks": true
13
+ "max": true
14
+ }
14
15
 
15
16
  /**
16
17
  * Cache this `"use cache"` for a timespan defined by the `"default"` profile.
@@ -110,37 +111,4 @@ declare module 'next/cache' {
110
111
  */
111
112
  export function cacheLife(profile: "max"): void
112
113
 
113
- /**
114
- * Cache this `"use cache"` using a custom timespan.
115
- * ```
116
- * stale: ... // seconds
117
- * revalidate: ... // seconds
118
- * expire: ... // seconds
119
- * ```
120
- *
121
- * This is similar to Cache-Control: max-age=`stale`,s-max-age=`revalidate`,stale-while-revalidate=`expire-revalidate`
122
- *
123
- * If a value is left out, the lowest of other cacheLife() calls or the default, is used instead.
124
- */
125
- export function cacheLife(profile: {
126
- /**
127
- * This cache may be stale on clients for ... seconds before checking with the server.
128
- */
129
- stale?: number,
130
- /**
131
- * If the server receives a new request after ... seconds, start revalidating new values in the background.
132
- */
133
- revalidate?: number,
134
- /**
135
- * If this entry has no traffic for ... seconds it will expire. The next request will recompute it.
136
- */
137
- expire?: number
138
- }): void
139
-
140
-
141
- import { cacheTag } from 'next/dist/server/use-cache/cache-tag'
142
- export { cacheTag }
143
-
144
- export const unstable_cacheTag: typeof cacheTag
145
- export const unstable_cacheLife: typeof cacheLife
146
114
  }
@@ -2,7 +2,7 @@
2
2
  // Do not edit this file manually
3
3
 
4
4
  type AppRoutes = "/" | "/login"
5
- type AppRouteHandlerRoutes = "/api/agent/[id]" | "/api/agent/[id]/events" | "/api/agent/[id]/tree" | "/api/agent/new" | "/api/config" | "/api/files" | "/api/fs" | "/api/git" | "/api/growth" | "/api/health" | "/api/models" | "/api/pi-settings" | "/api/plugins" | "/api/prompts" | "/api/remote" | "/api/security" | "/api/sessions" | "/api/sessions/[id]" | "/api/sessions/[id]/export" | "/api/sessions/import" | "/api/skills" | "/api/update" | "/api/version" | "/api/web-auth" | "/api/workspaces"
5
+ type AppRouteHandlerRoutes = "/api/agent/[id]" | "/api/agent/[id]/events" | "/api/agent/[id]/tree" | "/api/agent/new" | "/api/config" | "/api/files" | "/api/fs" | "/api/git" | "/api/github" | "/api/growth" | "/api/health" | "/api/models" | "/api/models/defaults" | "/api/pi-settings" | "/api/plugins" | "/api/prompts" | "/api/remote" | "/api/security" | "/api/sessions" | "/api/sessions/[id]" | "/api/sessions/[id]/export" | "/api/sessions/import" | "/api/skills" | "/api/update" | "/api/version" | "/api/web-auth" | "/api/workspaces"
6
6
  type PageRoutes = never
7
7
  type LayoutRoutes = "/"
8
8
  type RedirectRoutes = never
@@ -20,9 +20,11 @@ interface ParamMap {
20
20
  "/api/files": {}
21
21
  "/api/fs": {}
22
22
  "/api/git": {}
23
+ "/api/github": {}
23
24
  "/api/growth": {}
24
25
  "/api/health": {}
25
26
  "/api/models": {}
27
+ "/api/models/defaults": {}
26
28
  "/api/pi-settings": {}
27
29
  "/api/plugins": {}
28
30
  "/api/prompts": {}
@@ -6,6 +6,11 @@ import type { AppRoutes, LayoutRoutes, ParamMap, AppRouteHandlerRoutes } from ".
6
6
  import type { ResolvingMetadata, ResolvingViewport } from "next/types.js"
7
7
  import type { NextRequest } from 'next/server.js'
8
8
 
9
+ type ParamMatchFragment<Route extends keyof ParamMap> = Partial<Record<keyof ParamMap[Route], string>>
10
+ type ParamMatchingExports<Route extends keyof ParamMap> =
11
+ | { unstable_paramMatching?: ParamMatchFragment<Route>; unstable_generateParamMatching?: never }
12
+ | { unstable_paramMatching?: never; unstable_generateParamMatching?: () => Promise<ParamMatchFragment<Route>> | ParamMatchFragment<Route> }
13
+
9
14
  type AppPageConfig<Route extends AppRoutes = AppRoutes> = {
10
15
  default: React.ComponentType<{ params: Promise<ParamMap[Route]> } & any> | ((props: { params: Promise<ParamMap[Route]> } & any) => React.ReactNode | Promise<React.ReactNode> | never | void | Promise<void>)
11
16
  generateStaticParams?: (props: { params: ParamMap[Route] }) => Promise<any[]> | any[]
@@ -19,7 +24,7 @@ type AppPageConfig<Route extends AppRoutes = AppRoutes> = {
19
24
  ) => Promise<any> | any
20
25
  metadata?: any
21
26
  viewport?: any
22
- }
27
+ } & ParamMatchingExports<Route>
23
28
 
24
29
  type LayoutConfig<Route extends LayoutRoutes = LayoutRoutes> = {
25
30
  default: React.ComponentType<LayoutProps<Route>> | ((props: LayoutProps<Route>) => React.ReactNode | Promise<React.ReactNode> | never | void | Promise<void>)
@@ -34,7 +39,7 @@ type LayoutConfig<Route extends LayoutRoutes = LayoutRoutes> = {
34
39
  ) => Promise<any> | any
35
40
  metadata?: any
36
41
  viewport?: any
37
- }
42
+ } & ParamMatchingExports<Route>
38
43
 
39
44
  type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRoutes> = {
40
45
  GET?: (request: NextRequest, context: { params: Promise<ParamMap[Route]> }) => Promise<Response | void> | Response | void
@@ -52,6 +57,14 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
52
57
  type __IsExpected<Specific extends AppPageConfig<"/login">> = Specific
53
58
  const handler = {} as typeof import("../../src/app/login/page.js")
54
59
  type __Check = __IsExpected<typeof handler>
60
+
61
+ type __ParamMatchingValue =
62
+ typeof handler extends { unstable_paramMatching: infer Matcher } ? Matcher :
63
+ typeof handler extends { unstable_generateParamMatching: (...args: any[]) => infer Matcher } ? Awaited<Matcher> : {}
64
+ type __InvalidParamMatchingKeys = Exclude<keyof __ParamMatchingValue, keyof ParamMap["/login"]>
65
+ type __AssertNoInvalidParamMatchingKeys<Invalid extends never> = Invalid
66
+ const __paramMatchingKeyCheck: __AssertNoInvalidParamMatchingKeys<__InvalidParamMatchingKeys> | undefined = undefined
67
+ void __paramMatchingKeyCheck
55
68
  // @ts-ignore
56
69
  type __Unused = __Check
57
70
  }
@@ -61,6 +74,14 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
61
74
  type __IsExpected<Specific extends AppPageConfig<"/">> = Specific
62
75
  const handler = {} as typeof import("../../src/app/page.js")
63
76
  type __Check = __IsExpected<typeof handler>
77
+
78
+ type __ParamMatchingValue =
79
+ typeof handler extends { unstable_paramMatching: infer Matcher } ? Matcher :
80
+ typeof handler extends { unstable_generateParamMatching: (...args: any[]) => infer Matcher } ? Awaited<Matcher> : {}
81
+ type __InvalidParamMatchingKeys = Exclude<keyof __ParamMatchingValue, keyof ParamMap["/"]>
82
+ type __AssertNoInvalidParamMatchingKeys<Invalid extends never> = Invalid
83
+ const __paramMatchingKeyCheck: __AssertNoInvalidParamMatchingKeys<__InvalidParamMatchingKeys> | undefined = undefined
84
+ void __paramMatchingKeyCheck
64
85
  // @ts-ignore
65
86
  type __Unused = __Check
66
87
  }
@@ -70,6 +91,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
70
91
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/agent/[id]/events">> = Specific
71
92
  const handler = {} as typeof import("../../src/app/api/agent/[id]/events/route.js")
72
93
  type __Check = __IsExpected<typeof handler>
94
+
73
95
  // @ts-ignore
74
96
  type __Unused = __Check
75
97
  }
@@ -79,6 +101,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
79
101
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/agent/[id]">> = Specific
80
102
  const handler = {} as typeof import("../../src/app/api/agent/[id]/route.js")
81
103
  type __Check = __IsExpected<typeof handler>
104
+
82
105
  // @ts-ignore
83
106
  type __Unused = __Check
84
107
  }
@@ -88,6 +111,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
88
111
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/agent/[id]/tree">> = Specific
89
112
  const handler = {} as typeof import("../../src/app/api/agent/[id]/tree/route.js")
90
113
  type __Check = __IsExpected<typeof handler>
114
+
91
115
  // @ts-ignore
92
116
  type __Unused = __Check
93
117
  }
@@ -97,6 +121,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
97
121
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/agent/new">> = Specific
98
122
  const handler = {} as typeof import("../../src/app/api/agent/new/route.js")
99
123
  type __Check = __IsExpected<typeof handler>
124
+
100
125
  // @ts-ignore
101
126
  type __Unused = __Check
102
127
  }
@@ -106,6 +131,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
106
131
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/config">> = Specific
107
132
  const handler = {} as typeof import("../../src/app/api/config/route.js")
108
133
  type __Check = __IsExpected<typeof handler>
134
+
109
135
  // @ts-ignore
110
136
  type __Unused = __Check
111
137
  }
@@ -115,6 +141,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
115
141
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/files">> = Specific
116
142
  const handler = {} as typeof import("../../src/app/api/files/route.js")
117
143
  type __Check = __IsExpected<typeof handler>
144
+
118
145
  // @ts-ignore
119
146
  type __Unused = __Check
120
147
  }
@@ -124,6 +151,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
124
151
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/fs">> = Specific
125
152
  const handler = {} as typeof import("../../src/app/api/fs/route.js")
126
153
  type __Check = __IsExpected<typeof handler>
154
+
127
155
  // @ts-ignore
128
156
  type __Unused = __Check
129
157
  }
@@ -133,6 +161,17 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
133
161
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/git">> = Specific
134
162
  const handler = {} as typeof import("../../src/app/api/git/route.js")
135
163
  type __Check = __IsExpected<typeof handler>
164
+
165
+ // @ts-ignore
166
+ type __Unused = __Check
167
+ }
168
+
169
+ // Validate ../../src/app/api/github/route.ts
170
+ {
171
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/github">> = Specific
172
+ const handler = {} as typeof import("../../src/app/api/github/route.js")
173
+ type __Check = __IsExpected<typeof handler>
174
+
136
175
  // @ts-ignore
137
176
  type __Unused = __Check
138
177
  }
@@ -142,6 +181,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
142
181
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/growth">> = Specific
143
182
  const handler = {} as typeof import("../../src/app/api/growth/route.js")
144
183
  type __Check = __IsExpected<typeof handler>
184
+
145
185
  // @ts-ignore
146
186
  type __Unused = __Check
147
187
  }
@@ -151,6 +191,17 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
151
191
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/health">> = Specific
152
192
  const handler = {} as typeof import("../../src/app/api/health/route.js")
153
193
  type __Check = __IsExpected<typeof handler>
194
+
195
+ // @ts-ignore
196
+ type __Unused = __Check
197
+ }
198
+
199
+ // Validate ../../src/app/api/models/defaults/route.ts
200
+ {
201
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/models/defaults">> = Specific
202
+ const handler = {} as typeof import("../../src/app/api/models/defaults/route.js")
203
+ type __Check = __IsExpected<typeof handler>
204
+
154
205
  // @ts-ignore
155
206
  type __Unused = __Check
156
207
  }
@@ -160,6 +211,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
160
211
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/models">> = Specific
161
212
  const handler = {} as typeof import("../../src/app/api/models/route.js")
162
213
  type __Check = __IsExpected<typeof handler>
214
+
163
215
  // @ts-ignore
164
216
  type __Unused = __Check
165
217
  }
@@ -169,6 +221,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
169
221
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/pi-settings">> = Specific
170
222
  const handler = {} as typeof import("../../src/app/api/pi-settings/route.js")
171
223
  type __Check = __IsExpected<typeof handler>
224
+
172
225
  // @ts-ignore
173
226
  type __Unused = __Check
174
227
  }
@@ -178,6 +231,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
178
231
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/plugins">> = Specific
179
232
  const handler = {} as typeof import("../../src/app/api/plugins/route.js")
180
233
  type __Check = __IsExpected<typeof handler>
234
+
181
235
  // @ts-ignore
182
236
  type __Unused = __Check
183
237
  }
@@ -187,6 +241,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
187
241
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/prompts">> = Specific
188
242
  const handler = {} as typeof import("../../src/app/api/prompts/route.js")
189
243
  type __Check = __IsExpected<typeof handler>
244
+
190
245
  // @ts-ignore
191
246
  type __Unused = __Check
192
247
  }
@@ -196,6 +251,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
196
251
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/remote">> = Specific
197
252
  const handler = {} as typeof import("../../src/app/api/remote/route.js")
198
253
  type __Check = __IsExpected<typeof handler>
254
+
199
255
  // @ts-ignore
200
256
  type __Unused = __Check
201
257
  }
@@ -205,6 +261,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
205
261
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/security">> = Specific
206
262
  const handler = {} as typeof import("../../src/app/api/security/route.js")
207
263
  type __Check = __IsExpected<typeof handler>
264
+
208
265
  // @ts-ignore
209
266
  type __Unused = __Check
210
267
  }
@@ -214,6 +271,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
214
271
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/sessions/[id]/export">> = Specific
215
272
  const handler = {} as typeof import("../../src/app/api/sessions/[id]/export/route.js")
216
273
  type __Check = __IsExpected<typeof handler>
274
+
217
275
  // @ts-ignore
218
276
  type __Unused = __Check
219
277
  }
@@ -223,6 +281,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
223
281
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/sessions/[id]">> = Specific
224
282
  const handler = {} as typeof import("../../src/app/api/sessions/[id]/route.js")
225
283
  type __Check = __IsExpected<typeof handler>
284
+
226
285
  // @ts-ignore
227
286
  type __Unused = __Check
228
287
  }
@@ -232,6 +291,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
232
291
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/sessions/import">> = Specific
233
292
  const handler = {} as typeof import("../../src/app/api/sessions/import/route.js")
234
293
  type __Check = __IsExpected<typeof handler>
294
+
235
295
  // @ts-ignore
236
296
  type __Unused = __Check
237
297
  }
@@ -241,6 +301,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
241
301
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/sessions">> = Specific
242
302
  const handler = {} as typeof import("../../src/app/api/sessions/route.js")
243
303
  type __Check = __IsExpected<typeof handler>
304
+
244
305
  // @ts-ignore
245
306
  type __Unused = __Check
246
307
  }
@@ -250,6 +311,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
250
311
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/skills">> = Specific
251
312
  const handler = {} as typeof import("../../src/app/api/skills/route.js")
252
313
  type __Check = __IsExpected<typeof handler>
314
+
253
315
  // @ts-ignore
254
316
  type __Unused = __Check
255
317
  }
@@ -259,6 +321,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
259
321
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/update">> = Specific
260
322
  const handler = {} as typeof import("../../src/app/api/update/route.js")
261
323
  type __Check = __IsExpected<typeof handler>
324
+
262
325
  // @ts-ignore
263
326
  type __Unused = __Check
264
327
  }
@@ -268,6 +331,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
268
331
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/version">> = Specific
269
332
  const handler = {} as typeof import("../../src/app/api/version/route.js")
270
333
  type __Check = __IsExpected<typeof handler>
334
+
271
335
  // @ts-ignore
272
336
  type __Unused = __Check
273
337
  }
@@ -277,6 +341,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
277
341
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/web-auth">> = Specific
278
342
  const handler = {} as typeof import("../../src/app/api/web-auth/route.js")
279
343
  type __Check = __IsExpected<typeof handler>
344
+
280
345
  // @ts-ignore
281
346
  type __Unused = __Check
282
347
  }
@@ -286,6 +351,7 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
286
351
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/workspaces">> = Specific
287
352
  const handler = {} as typeof import("../../src/app/api/workspaces/route.js")
288
353
  type __Check = __IsExpected<typeof handler>
354
+
289
355
  // @ts-ignore
290
356
  type __Unused = __Check
291
357
  }
@@ -299,6 +365,14 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
299
365
  type __IsExpected<Specific extends LayoutConfig<"/">> = Specific
300
366
  const handler = {} as typeof import("../../src/app/layout.js")
301
367
  type __Check = __IsExpected<typeof handler>
368
+
369
+ type __ParamMatchingValue =
370
+ typeof handler extends { unstable_paramMatching: infer Matcher } ? Matcher :
371
+ typeof handler extends { unstable_generateParamMatching: (...args: any[]) => infer Matcher } ? Awaited<Matcher> : {}
372
+ type __InvalidParamMatchingKeys = Exclude<keyof __ParamMatchingValue, keyof ParamMap["/"]>
373
+ type __AssertNoInvalidParamMatchingKeys<Invalid extends never> = Invalid
374
+ const __paramMatchingKeyCheck: __AssertNoInvalidParamMatchingKeys<__InvalidParamMatchingKeys> | undefined = undefined
375
+ void __paramMatchingKeyCheck
302
376
  // @ts-ignore
303
377
  type __Unused = __Check
304
378
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rexvane/piweb",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Modern web UI for the pi coding agent, driven by the official pi SDK without modifying pi",
@@ -62,7 +62,7 @@
62
62
  "@types/react-dom": "^19",
63
63
  "highlight.js": "^11.11.1",
64
64
  "jsonc-parser": "3.3.1",
65
- "next": "16.3.4",
65
+ "next": "16.4.0",
66
66
  "postcss": "^8.5.26",
67
67
  "proper-lockfile": "4.1.2",
68
68
  "react": "^19.3.0",
@@ -1,16 +1,19 @@
1
1
  import { NextResponse } from "next/server";
2
2
  import { BoundaryError } from "@/lib/path-security";
3
- import { listWorkspaceDir, openInEditor, parseUploadLength, readWorkspaceFile, saveUploadStream } from "@/lib/files-service";
3
+ import { listWorkspaceDir, listWorkspaceIndex, openInEditor, parseUploadLength, readWorkspaceFile, saveUploadStream } from "@/lib/files-service";
4
4
 
5
5
  export const dynamic = "force-dynamic";
6
6
 
7
- /** 工作区文件浏览:?cwd=&path=(目录列表);?read=1&cwd=&path=(文本预览) */
7
+ /** 工作区文件浏览:?cwd=&path=(目录列表);?read=1&cwd=&path=(文本预览);?index=1&cwd=(@ 引用候选全量清单) */
8
8
  export async function GET(req: Request) {
9
9
  const url = new URL(req.url);
10
10
  try {
11
11
  if (url.searchParams.get("read") === "1") {
12
12
  return NextResponse.json({ success: true, data: await readWorkspaceFile(url.searchParams.get("cwd"), url.searchParams.get("path")) });
13
13
  }
14
+ if (url.searchParams.get("index") === "1") {
15
+ return NextResponse.json({ success: true, data: await listWorkspaceIndex(url.searchParams.get("cwd")) });
16
+ }
14
17
  return NextResponse.json({ success: true, data: await listWorkspaceDir(url.searchParams.get("cwd"), url.searchParams.get("path"), url.searchParams.get("offset")) });
15
18
  } catch (err: any) {
16
19
  return NextResponse.json(
@@ -0,0 +1,26 @@
1
+ import { NextResponse } from "next/server";
2
+ import { repoRoot } from "@/lib/git-service";
3
+ import { awaitGithubIdentity } from "@/lib/github-identity";
4
+ import { BoundaryError, resolveWorkspacePath } from "@/lib/path-security";
5
+
6
+ export const dynamic = "force-dynamic";
7
+
8
+ /**
9
+ * Git 面板头部的 GitHub 身份(头像 + 账号)。
10
+ *
11
+ * 与 /api/git 分开:身份要走网络(gh / 头像),不该拖慢分支与文件状态那条纯本地读取。
12
+ * 取不到就回 identity: null,前端只显示分支信息,不报错。
13
+ */
14
+ export async function GET(req: Request) {
15
+ const cwd = new URL(req.url).searchParams.get("cwd");
16
+ try {
17
+ const resolved = await resolveWorkspacePath(cwd);
18
+ const { root } = await repoRoot(resolved);
19
+ if (!root) return NextResponse.json({ success: true, data: { identity: null } });
20
+ return NextResponse.json({ success: true, data: { identity: await awaitGithubIdentity(root) } });
21
+ } catch (err: any) {
22
+ if (err instanceof BoundaryError) return NextResponse.json({ success: false, error: err.message }, { status: 400 });
23
+ // 身份只是装饰:任何失败都不该让面板变红
24
+ return NextResponse.json({ success: true, data: { identity: null } });
25
+ }
26
+ }
@@ -0,0 +1,18 @@
1
+ import { NextResponse } from "next/server";
2
+ import { newSessionDefaults } from "@/lib/model-defaults";
3
+ import { BoundaryError, resolveWorkspacePath } from "@/lib/path-security";
4
+
5
+ export const dynamic = "force-dynamic";
6
+
7
+ /** 新会话页的默认模型与思考档位:按工作区读 pi 的设置 */
8
+ export async function GET(req: Request) {
9
+ try {
10
+ const cwd = await resolveWorkspacePath(new URL(req.url).searchParams.get("cwd"));
11
+ return NextResponse.json({ success: true, data: await newSessionDefaults(cwd) });
12
+ } catch (error) {
13
+ return NextResponse.json(
14
+ { success: false, error: error instanceof Error ? error.message : "request failed" },
15
+ { status: error instanceof BoundaryError ? 400 : 500 },
16
+ );
17
+ }
18
+ }
@@ -2,7 +2,9 @@ import { gzipSync } from "node:zlib";
2
2
  import { NextResponse } from "next/server";
3
3
  import {
4
4
  answerLogin,
5
+ builtinCatalogModelIds,
5
6
  cancelLogin,
7
+ contextWindowInfo,
6
8
  CustomProvidersConflictError,
7
9
  CustomProvidersValidationError,
8
10
  discoverModels,
@@ -14,6 +16,7 @@ import {
14
16
  readCustomProviders,
15
17
  removeApiKey,
16
18
  setApiKey,
19
+ setModelContextWindow,
17
20
  startLogin,
18
21
  writeCustomProviders,
19
22
  } from "@/lib/models-service";
@@ -58,7 +61,13 @@ export async function GET(req: Request) {
58
61
  const providers = full
59
62
  ? data.providers
60
63
  : data.providers.map((p) => ({ id: p.id, name: p.name, authReady: p.authReady, builtIn: p.builtIn, modelCount: p.modelCount }));
61
- return jsonMaybeGzip(req, { success: true, data: { providers, models, customProviders } }, `${modelListStamp()}:${full ? "full" : "piweb"}`);
64
+ // 设置页编辑内置 provider 时据此把「覆盖已有模型」写进 modelOverrides,而不是 models[]
65
+ const catalogModelIds = customProviders ? await builtinCatalogModelIds(customProviders.content, data.models) : undefined;
66
+ return jsonMaybeGzip(
67
+ req,
68
+ { success: true, data: { providers, models, customProviders, ...(catalogModelIds ? { catalogModelIds } : {}) } },
69
+ `${modelListStamp()}:${custom ? "custom" : full ? "full" : "piweb"}`,
70
+ );
62
71
  } catch (err: any) {
63
72
  return NextResponse.json({ success: false, error: String(err?.message ?? err) }, { status: 500 });
64
73
  }
@@ -73,11 +82,15 @@ export async function POST(req: Request) {
73
82
  | "saveCustomProviders"
74
83
  | "discoverModels"
75
84
  | "providerUsage"
85
+ | "contextWindowInfo"
86
+ | "setContextWindow"
76
87
  | "loginStart"
77
88
  | "loginState"
78
89
  | "loginAnswer"
79
90
  | "loginCancel";
80
91
  providerId?: string;
92
+ modelId?: string;
93
+ contextWindow?: number;
81
94
  apiKey?: string;
82
95
  baseUrl?: string;
83
96
  api?: string;
@@ -115,6 +128,16 @@ export async function POST(req: Request) {
115
128
  const usage = await providerUsage(body.providerId, body.force === true);
116
129
  return NextResponse.json({ success: true, data: { usage } });
117
130
  }
131
+ if (body.action === "contextWindowInfo" || body.action === "setContextWindow") {
132
+ if (typeof body.providerId !== "string" || !body.providerId || typeof body.modelId !== "string" || !body.modelId) {
133
+ return NextResponse.json({ success: false, error: "missing providerId or modelId" }, { status: 400 });
134
+ }
135
+ if (body.action === "contextWindowInfo") {
136
+ return NextResponse.json({ success: true, data: await contextWindowInfo(body.providerId, body.modelId) });
137
+ }
138
+ if (typeof body.contextWindow !== "number") return NextResponse.json({ success: false, error: "missing contextWindow" }, { status: 400 });
139
+ return NextResponse.json({ success: true, data: await setModelContextWindow(body.providerId, body.modelId, body.contextWindow) });
140
+ }
118
141
  if (body.action === "loginStart") {
119
142
  if (!body.providerId) return NextResponse.json({ success: false, error: "missing providerId" }, { status: 400 });
120
143
  await startLogin(body.providerId);