@rexvane/piweb 0.3.20 → 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 (317) 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 +12 -12
  8. package/.next/required-server-files.js +18 -2
  9. package/.next/required-server-files.json +18 -2
  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 +3 -3
  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 -0
  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 -0
  113. package/.next/server/chunks/686.js +1 -1
  114. package/.next/server/chunks/807.js +1 -1
  115. package/.next/server/chunks/813.js +23 -1
  116. package/.next/server/chunks/920.js +2 -2
  117. package/.next/server/chunks/924.js +1 -1
  118. package/.next/server/chunks/970.js +305 -0
  119. package/.next/server/instrumentation.js +1 -1
  120. package/.next/server/instrumentation.js.nft.json +1 -1
  121. package/.next/server/middleware-build-manifest.js +1 -1
  122. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  123. package/.next/server/middleware.js +185 -23
  124. package/.next/server/middleware.js.nft.json +1 -1
  125. package/.next/server/pages/404.html +1 -1
  126. package/.next/server/pages/500.html +1 -1
  127. package/.next/server/preview-props.json +5 -0
  128. package/.next/server/server-reference-manifest.json +1 -1
  129. package/.next/static/WMazYvD-gbeLsCUfUxvvM/_buildManifest.js +1 -0
  130. package/.next/static/chunks/316-698d10eb465bd8ef.js +1 -0
  131. package/.next/static/chunks/3794-0978865cda773008.js +52 -0
  132. package/.next/static/chunks/4673.4cf66cbdd8364c57.js +1 -0
  133. package/.next/static/chunks/4686-09fcd0028079006c.js +1 -0
  134. package/.next/static/chunks/4778.eddd3a5813f85824.js +1 -0
  135. package/.next/static/chunks/4bd1b696-e199e788e58acf79.js +1 -0
  136. package/.next/static/chunks/{5173.91ddb803785009f8.js → 5173.dfd1cbb795b9a21c.js} +1 -1
  137. package/.next/static/chunks/618.949981da99be7182.js +4 -0
  138. package/.next/static/chunks/7411.67366dc5032a141d.js +1 -0
  139. package/.next/static/chunks/8552.25c39ef4c995eba0.js +1 -0
  140. package/.next/static/chunks/app/_global-error/page-f977af7f858990a2.js +1 -0
  141. package/.next/static/chunks/app/api/agent/[id]/events/route-f977af7f858990a2.js +1 -0
  142. package/.next/static/chunks/app/api/agent/[id]/route-f977af7f858990a2.js +1 -0
  143. package/.next/static/chunks/app/api/agent/[id]/tree/route-f977af7f858990a2.js +1 -0
  144. package/.next/static/chunks/app/api/agent/new/route-f977af7f858990a2.js +1 -0
  145. package/.next/static/chunks/app/api/config/route-f977af7f858990a2.js +1 -0
  146. package/.next/static/chunks/app/api/files/route-f977af7f858990a2.js +1 -0
  147. package/.next/static/chunks/app/api/fs/route-f977af7f858990a2.js +1 -0
  148. package/.next/static/chunks/app/api/git/route-f977af7f858990a2.js +1 -0
  149. package/.next/static/chunks/app/api/github/route-f977af7f858990a2.js +1 -0
  150. package/.next/static/chunks/app/api/growth/route-f977af7f858990a2.js +1 -0
  151. package/.next/static/chunks/app/api/health/route-f977af7f858990a2.js +1 -0
  152. package/.next/static/chunks/app/api/models/defaults/route-f977af7f858990a2.js +1 -0
  153. package/.next/static/chunks/app/api/models/route-f977af7f858990a2.js +1 -0
  154. package/.next/static/chunks/app/api/pi-settings/route-f977af7f858990a2.js +1 -0
  155. package/.next/static/chunks/app/api/plugins/route-f977af7f858990a2.js +1 -0
  156. package/.next/static/chunks/app/api/prompts/route-f977af7f858990a2.js +1 -0
  157. package/.next/static/chunks/app/api/remote/route-f977af7f858990a2.js +1 -0
  158. package/.next/static/chunks/app/api/security/route-f977af7f858990a2.js +1 -0
  159. package/.next/static/chunks/app/api/sessions/[id]/export/route-f977af7f858990a2.js +1 -0
  160. package/.next/static/chunks/app/api/sessions/[id]/route-f977af7f858990a2.js +1 -0
  161. package/.next/static/chunks/app/api/sessions/import/route-f977af7f858990a2.js +1 -0
  162. package/.next/static/chunks/app/api/sessions/route-f977af7f858990a2.js +1 -0
  163. package/.next/static/chunks/app/api/skills/route-f977af7f858990a2.js +1 -0
  164. package/.next/static/chunks/app/api/update/route-f977af7f858990a2.js +1 -0
  165. package/.next/static/chunks/app/api/version/route-f977af7f858990a2.js +1 -0
  166. package/.next/static/chunks/app/api/web-auth/route-f977af7f858990a2.js +1 -0
  167. package/.next/static/chunks/app/api/workspaces/route-f977af7f858990a2.js +1 -0
  168. package/.next/static/chunks/app/page-fc4ed2ff29b6235e.js +1 -0
  169. package/.next/static/chunks/framework-47b723d27f4a4963.js +1 -0
  170. package/.next/static/chunks/main-5403f0764579e5fe.js +5 -0
  171. package/.next/static/chunks/next/dist/client/components/builtin/app-error-f977af7f858990a2.js +1 -0
  172. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-f977af7f858990a2.js +1 -0
  173. package/.next/static/chunks/next/dist/client/components/builtin/not-found-f977af7f858990a2.js +1 -0
  174. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-f977af7f858990a2.js +1 -0
  175. package/.next/static/chunks/webpack-22ebffc20adb44ae.js +1 -0
  176. package/.next/static/css/6671d0d1589fdc0e.css +1 -0
  177. package/.next/static/css/{2959bd6b626b7ffe.css → f15a853af8b5127f.css} +1 -1
  178. package/.next/types/app/api/agent/[id]/events/route.ts +3 -1
  179. package/.next/types/app/api/agent/[id]/route.ts +3 -1
  180. package/.next/types/app/api/agent/[id]/tree/route.ts +3 -1
  181. package/.next/types/app/api/agent/new/route.ts +3 -1
  182. package/.next/types/app/api/config/route.ts +3 -1
  183. package/.next/types/app/api/files/route.ts +3 -1
  184. package/.next/types/app/api/fs/route.ts +3 -1
  185. package/.next/types/app/api/git/route.ts +3 -1
  186. package/.next/types/app/api/github/route.ts +355 -0
  187. package/.next/types/app/api/growth/route.ts +3 -1
  188. package/.next/types/app/api/health/route.ts +3 -1
  189. package/.next/types/app/api/models/defaults/route.ts +355 -0
  190. package/.next/types/app/api/models/route.ts +3 -1
  191. package/.next/types/app/api/pi-settings/route.ts +3 -1
  192. package/.next/types/app/api/plugins/route.ts +3 -1
  193. package/.next/types/app/api/prompts/route.ts +3 -1
  194. package/.next/types/app/api/remote/route.ts +3 -1
  195. package/.next/types/app/api/security/route.ts +3 -1
  196. package/.next/types/app/api/sessions/[id]/export/route.ts +3 -1
  197. package/.next/types/app/api/sessions/[id]/route.ts +3 -1
  198. package/.next/types/app/api/sessions/import/route.ts +3 -1
  199. package/.next/types/app/api/sessions/route.ts +3 -1
  200. package/.next/types/app/api/skills/route.ts +3 -1
  201. package/.next/types/app/api/update/route.ts +3 -1
  202. package/.next/types/app/api/version/route.ts +3 -1
  203. package/.next/types/app/api/web-auth/route.ts +3 -1
  204. package/.next/types/app/api/workspaces/route.ts +3 -1
  205. package/.next/types/app/layout.ts +4 -1
  206. package/.next/types/app/login/page.ts +4 -1
  207. package/.next/types/app/page.ts +4 -1
  208. package/.next/types/cache-life.d.ts +11 -43
  209. package/.next/types/routes.d.ts +3 -1
  210. package/.next/types/validator.ts +76 -2
  211. package/README.md +14 -5
  212. package/next.config.ts +4 -2
  213. package/package.json +2 -2
  214. package/scripts/release.mjs +1 -1
  215. package/src/app/api/agent/[id]/events/route.ts +42 -13
  216. package/src/app/api/files/route.ts +5 -2
  217. package/src/app/api/github/route.ts +26 -0
  218. package/src/app/api/models/defaults/route.ts +18 -0
  219. package/src/app/api/models/route.ts +24 -1
  220. package/src/app/api/update/route.ts +18 -2
  221. package/src/app/globals.css +275 -0
  222. package/src/components/AppShell.tsx +89 -33
  223. package/src/components/ChatInput.tsx +245 -63
  224. package/src/components/ChatWindow.tsx +123 -108
  225. package/src/components/ContextMeter.tsx +204 -123
  226. package/src/components/DrawerPanel.tsx +19 -26
  227. package/src/components/ExtensionUI.tsx +8 -2
  228. package/src/components/GitPanel.tsx +110 -40
  229. package/src/components/MarkdownBlock.tsx +333 -37
  230. package/src/components/ProjectPanel.tsx +55 -30
  231. package/src/components/PromptPanel.tsx +2 -4
  232. package/src/components/ProviderSetupModal.module.css +20 -0
  233. package/src/components/ProviderSetupModal.tsx +134 -29
  234. package/src/components/SettingsPanel.tsx +365 -80
  235. package/src/components/TrajectoryView.tsx +4 -6
  236. package/src/components/chat/chat-scroll.ts +18 -0
  237. package/src/components/composer/ComposerImages.tsx +306 -0
  238. package/src/components/update/CopyCommand.tsx +34 -0
  239. package/src/components/update/UpdateNotice.tsx +130 -0
  240. package/src/components/update/update-store.ts +155 -0
  241. package/src/hooks/useGrowth.ts +3 -0
  242. package/src/hooks/usePiWeb.ts +54 -27
  243. package/src/hooks/useWorkspaceFiles.ts +93 -0
  244. package/src/i18n.tsx +182 -6
  245. package/src/instrumentation-node.ts +3 -0
  246. package/src/lib/agent-manager.ts +193 -119
  247. package/src/lib/chat/event-stream.ts +113 -0
  248. package/src/lib/chat/stream-settings.ts +192 -0
  249. package/src/lib/files-service.ts +100 -1
  250. package/src/lib/format.ts +56 -0
  251. package/src/lib/git-service.ts +45 -13
  252. package/src/lib/github-identity.ts +245 -0
  253. package/src/lib/growth-service.ts +6 -2
  254. package/src/lib/hero-model-memory.ts +28 -0
  255. package/src/lib/model-defaults.ts +105 -0
  256. package/src/lib/model-draft.ts +257 -9
  257. package/src/lib/model-endpoint.ts +23 -0
  258. package/src/lib/model-files.ts +33 -0
  259. package/src/lib/models-service.ts +240 -78
  260. package/src/lib/pi.ts +27 -2
  261. package/src/lib/process-format.ts +3 -2
  262. package/src/lib/session/metrics.ts +31 -0
  263. package/src/lib/thinking-level.ts +39 -0
  264. package/src/lib/trajectory.ts +17 -3
  265. package/src/lib/types.ts +19 -1
  266. package/src/lib/update/startup-check.ts +117 -0
  267. package/src/lib/update-service.ts +23 -3
  268. package/src/lib/workspace-index.ts +270 -0
  269. package/.next/server/chunks/131.js +0 -1
  270. package/.next/server/chunks/243.js +0 -1
  271. package/.next/server/chunks/741.js +0 -165
  272. package/.next/static/_Y3Lq0lI5RJ1tFSOnDi0L/_buildManifest.js +0 -1
  273. package/.next/static/chunks/316-5ea443ee6b512aa9.js +0 -1
  274. package/.next/static/chunks/3794-3679f1c05160977c.js +0 -52
  275. package/.next/static/chunks/4673.8a5a9e6855350e34.js +0 -1
  276. package/.next/static/chunks/4686-b1e9fa876d0ea671.js +0 -1
  277. package/.next/static/chunks/4778.e4c9ed093a413bc4.js +0 -1
  278. package/.next/static/chunks/4bd1b696-93bf506b236d6248.js +0 -1
  279. package/.next/static/chunks/618.ee5d5bf1c647e483.js +0 -4
  280. package/.next/static/chunks/839.d3fe337a9117c325.js +0 -1
  281. package/.next/static/chunks/8552.6bfe3e101250b20f.js +0 -1
  282. package/.next/static/chunks/app/_global-error/page-b179d9f7f6f2daf9.js +0 -1
  283. package/.next/static/chunks/app/api/agent/[id]/events/route-b179d9f7f6f2daf9.js +0 -1
  284. package/.next/static/chunks/app/api/agent/[id]/route-b179d9f7f6f2daf9.js +0 -1
  285. package/.next/static/chunks/app/api/agent/[id]/tree/route-b179d9f7f6f2daf9.js +0 -1
  286. package/.next/static/chunks/app/api/agent/new/route-b179d9f7f6f2daf9.js +0 -1
  287. package/.next/static/chunks/app/api/config/route-b179d9f7f6f2daf9.js +0 -1
  288. package/.next/static/chunks/app/api/files/route-b179d9f7f6f2daf9.js +0 -1
  289. package/.next/static/chunks/app/api/fs/route-b179d9f7f6f2daf9.js +0 -1
  290. package/.next/static/chunks/app/api/git/route-b179d9f7f6f2daf9.js +0 -1
  291. package/.next/static/chunks/app/api/growth/route-b179d9f7f6f2daf9.js +0 -1
  292. package/.next/static/chunks/app/api/health/route-b179d9f7f6f2daf9.js +0 -1
  293. package/.next/static/chunks/app/api/models/route-b179d9f7f6f2daf9.js +0 -1
  294. package/.next/static/chunks/app/api/pi-settings/route-b179d9f7f6f2daf9.js +0 -1
  295. package/.next/static/chunks/app/api/plugins/route-b179d9f7f6f2daf9.js +0 -1
  296. package/.next/static/chunks/app/api/prompts/route-b179d9f7f6f2daf9.js +0 -1
  297. package/.next/static/chunks/app/api/remote/route-b179d9f7f6f2daf9.js +0 -1
  298. package/.next/static/chunks/app/api/security/route-b179d9f7f6f2daf9.js +0 -1
  299. package/.next/static/chunks/app/api/sessions/[id]/export/route-b179d9f7f6f2daf9.js +0 -1
  300. package/.next/static/chunks/app/api/sessions/[id]/route-b179d9f7f6f2daf9.js +0 -1
  301. package/.next/static/chunks/app/api/sessions/import/route-b179d9f7f6f2daf9.js +0 -1
  302. package/.next/static/chunks/app/api/sessions/route-b179d9f7f6f2daf9.js +0 -1
  303. package/.next/static/chunks/app/api/skills/route-b179d9f7f6f2daf9.js +0 -1
  304. package/.next/static/chunks/app/api/update/route-b179d9f7f6f2daf9.js +0 -1
  305. package/.next/static/chunks/app/api/version/route-b179d9f7f6f2daf9.js +0 -1
  306. package/.next/static/chunks/app/api/web-auth/route-b179d9f7f6f2daf9.js +0 -1
  307. package/.next/static/chunks/app/api/workspaces/route-b179d9f7f6f2daf9.js +0 -1
  308. package/.next/static/chunks/app/page-2e425ef83fba0782.js +0 -1
  309. package/.next/static/chunks/framework-c4e651fe89edfa91.js +0 -1
  310. package/.next/static/chunks/main-6159b22a8cb0b7c5.js +0 -5
  311. package/.next/static/chunks/next/dist/client/components/builtin/app-error-b179d9f7f6f2daf9.js +0 -1
  312. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-b179d9f7f6f2daf9.js +0 -1
  313. package/.next/static/chunks/next/dist/client/components/builtin/not-found-b179d9f7f6f2daf9.js +0 -1
  314. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-b179d9f7f6f2daf9.js +0 -1
  315. package/.next/static/chunks/webpack-3614a8337843456b.js +0 -1
  316. package/.next/static/css/7391c42e1ae617f9.css +0 -1
  317. /package/.next/static/{_Y3Lq0lI5RJ1tFSOnDi0L → 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/README.md CHANGED
@@ -105,14 +105,23 @@ The package registers only the `piweb` command, so it never conflicts with the o
105
105
  npm install -g @rexvane/piweb@latest
106
106
  ```
107
107
 
108
- npm replaces the installed version in place, so there is nothing to uninstall first. This is
109
- the same command the in-app "Check for updates" button runs. `latest` is npm's default tag,
110
- so `npm install -g @rexvane/piweb` behaves identically; if your registry is a mirror that
111
- syncs with a delay, add `--registry=https://registry.npmjs.org` to get a release the moment
112
- it is published. Restart `piweb` afterwards to serve the new version.
108
+ npm replaces the installed version in place, so there is nothing to uninstall first. `latest`
109
+ is npm's default tag, so `npm install -g @rexvane/piweb` behaves identically; if your registry
110
+ is a mirror that syncs with a delay, add `--registry=https://registry.npmjs.org` to get a
111
+ release the moment it is published. Restart `piweb` afterwards to serve the new version.
113
112
 
114
113
  Or install a specific version: `npm install -g @rexvane/piweb@0.3.4`.
115
114
 
115
+ **Updating from the UI**: every time PiWeb starts it checks PiWeb and pi for new versions in the
116
+ background. When one is available it prints `[更新] 有新版本:…` in the terminal and shows a notice
117
+ in the bottom-right corner of the page (once per start). Click "Update" in the notice or in
118
+ Settings → General to install in place — no trip to the repository. Restart `piweb` when it says
119
+ so; the process never restarts itself.
120
+
121
+ - The pi engine can be updated on its own (npm installs swap only pi's two packages, no rebuild).
122
+ - On Windows a running npm install cannot replace itself (files are locked), so the PiWeb entry shows the command with a copy button: stop `piweb` first, then run the command above.
123
+ - To skip the network check, set `PI_WEB_UPDATE_CHECK=0` before starting; "Check for updates" in Settings still works.
124
+
116
125
  ### Uninstall
117
126
 
118
127
  ```bash
package/next.config.ts CHANGED
@@ -43,8 +43,10 @@ export default (phase: string): NextConfig => {
43
43
  // Webpack's dev chunk names are stable. A per-process prefix prevents an older
44
44
  // browser cache entry from hydrating HTML emitted by a newer dev server.
45
45
  assetPrefix: development ? `/_piweb-dev/${devAssetId}` : undefined,
46
- // pi SDK 与其动态加载的扩展都运行在服务端(Node runtime),不对客户端打包
47
- serverExternalPackages: ["@earendil-works/pi-coding-agent"],
46
+ // pi SDK 与其动态加载的扩展都运行在服务端(Node runtime),不对客户端打包。
47
+ // pi-ai 也走运行时加载:打进 .next 的话,服务里会有两份 pi-ai(pi-coding-agent 自己从
48
+ // node_modules 再加载一份),npm 成品包单独更新 pi 后打包的那份还停在旧版本。
49
+ serverExternalPackages: ["@earendil-works/pi-coding-agent", "@earendil-works/pi-ai"],
48
50
  // Image prompts allow 268 MB of base64 plus text and JSON framing.
49
51
  experimental: { proxyClientMaxBodySize: "272mb" },
50
52
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rexvane/piweb",
3
- "version": "0.3.20",
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",
@@ -93,7 +93,7 @@ export async function verifyReleaseConfig(root = process.cwd(), env = process.en
93
93
  }
94
94
 
95
95
  export const PI_PACKAGE = "@earendil-works/pi-coding-agent";
96
- const PI_AI_PACKAGE = "@earendil-works/pi-ai";
96
+ export const PI_AI_PACKAGE = "@earendil-works/pi-ai";
97
97
 
98
98
  /**
99
99
  * Shared by the UI and update:pi; called only after the building state is durable.
@@ -1,11 +1,23 @@
1
- import { buildSnapshot, getManaged, parseLastEventId, sseEventId, subscribe, unsubscribe } from "@/lib/agent-manager";
1
+ import { buildSnapshot, getManaged, holdViewer, parseLastEventId, sseEventId, subscribe, unsubscribe } from "@/lib/agent-manager";
2
2
  import { BoundaryError, resolveSessionPath } from "@/lib/path-security";
3
3
 
4
4
  export const dynamic = "force-dynamic";
5
5
 
6
- /** SSE:先推完整快照,再推增量;心跳保活;断线由浏览器 EventSource 自动重连(带 Last-Event-ID) */
6
+ /** 轮询模式:第一条事件写出后再等这么久把同一批凑齐,然后结束响应 */
7
+ const POLL_BATCH_MS = 50;
8
+ /** 轮询模式:一直没有事件就在这么久后空着结束,浏览器马上再来 */
9
+ const POLL_HOLD_MS = 25_000;
10
+ /** 轮询模式:两次请求之间仍算有人在看(扩展弹窗不被当成无人值守、会话不被回收) */
11
+ const POLL_VIEWER_GRACE_MS = 30_000;
12
+
13
+ /**
14
+ * SSE:先推完整快照,再推增量;心跳保活;断线由浏览器 EventSource 自动重连(带 Last-Event-ID)。
15
+ * `?poll=1` 是给 Cloudflare 快速隧道用的长轮询(隧道不支持 SSE,见 lib/chat/event-stream):
16
+ * 同样的帧格式,但发完一批就结束响应,由浏览器带着 Last-Event-ID 再来取下一批。
17
+ */
7
18
  export async function GET(req: Request, { params }: { params: Promise<{ id: string }> }) {
8
19
  const { id } = await params;
20
+ const poll = new URL(req.url).searchParams.get("poll") === "1";
9
21
  let sessionPath: string;
10
22
  try {
11
23
  // allowPending:Hero 发首条消息时订阅先于 JSONL 落盘;此时拒绝会让
@@ -28,6 +40,17 @@ export async function GET(req: Request, { params }: { params: Promise<{ id: stri
28
40
  let closed = false;
29
41
  let subscriber: ((seq: number, json: string) => void) | null = null;
30
42
  let ping: ReturnType<typeof setInterval> | null = null;
43
+ let pollTimer: ReturnType<typeof setTimeout> | null = null;
44
+ let batchTimer: ReturnType<typeof setTimeout> | null = null;
45
+
46
+ const stop = () => {
47
+ closed = true;
48
+ if (ping) clearInterval(ping);
49
+ if (pollTimer) clearTimeout(pollTimer);
50
+ if (batchTimer) clearTimeout(batchTimer);
51
+ if (subscriber) unsubscribe(m, subscriber);
52
+ if (poll) holdViewer(m, POLL_VIEWER_GRACE_MS);
53
+ };
31
54
 
32
55
  const stream = new ReadableStream<Uint8Array>({
33
56
  async start(controller) {
@@ -36,9 +59,7 @@ export async function GET(req: Request, { params }: { params: Promise<{ id: stri
36
59
  };
37
60
  const close = () => {
38
61
  if (closed) return;
39
- closed = true;
40
- if (ping) clearInterval(ping);
41
- if (subscriber) unsubscribe(m, subscriber);
62
+ stop();
42
63
  try {
43
64
  controller.close();
44
65
  } catch {
@@ -48,11 +69,15 @@ export async function GET(req: Request, { params }: { params: Promise<{ id: stri
48
69
  subscriber = (seq: number, json: string) => {
49
70
  write(`id: ${sseEventId(m, seq)}\ndata: ${json}\n\n`);
50
71
  if (json.includes('"state":"disposed"')) close();
72
+ else if (poll && !batchTimer) batchTimer = setTimeout(close, POLL_BATCH_MS);
51
73
  };
52
74
  const send = subscriber;
53
75
 
54
- ping = setInterval(() => write(`: ping\n\n`), 15_000);
55
- write(`retry: 2000\n\n`);
76
+ if (poll) pollTimer = setTimeout(close, POLL_HOLD_MS);
77
+ else {
78
+ ping = setInterval(() => write(`: ping\n\n`), 15_000);
79
+ write(`retry: 2000\n\n`);
80
+ }
56
81
 
57
82
  req.signal.addEventListener("abort", close, { once: true });
58
83
 
@@ -61,24 +86,28 @@ export async function GET(req: Request, { params }: { params: Promise<{ id: stri
61
86
  const snap = await buildSnapshot(m);
62
87
  if (closed) return;
63
88
  send(snap.seq, JSON.stringify({ type: "snapshot", snapshot: snap, ts: Date.now() }));
89
+ // send 里可能已经关了流:这时再订阅就是一个永远不退订的死订阅者,会话也永远回收不掉
90
+ if (closed) return;
64
91
  if (!subscribe(m, send, snap.seq)) {
65
92
  const latest = await buildSnapshot(m);
66
93
  if (closed) return;
67
94
  send(latest.seq, JSON.stringify({ type: "snapshot", snapshot: latest, ts: Date.now() }));
68
- subscribe(m, send, latest.seq);
95
+ if (!closed) subscribe(m, send, latest.seq);
69
96
  }
70
97
  },
71
98
  cancel() {
72
- closed = true;
73
- if (ping) clearInterval(ping);
74
- if (subscriber) unsubscribe(m, subscriber);
99
+ if (!closed) stop();
75
100
  },
76
101
  });
77
102
 
78
103
  return new Response(stream, {
79
104
  headers: {
80
- "Content-Type": "text/event-stream; charset=utf-8",
81
- "Cache-Control": "no-cache, no-transform",
105
+ // 轮询的响应不标成 SSE:隧道对 text/event-stream 另有处理,普通文本响应结束时一定整份送达
106
+ "Content-Type": poll ? "text/plain; charset=utf-8" : "text/event-stream; charset=utf-8",
107
+ // no-transform 让中间代理(Cloudflare 隧道边缘)不再压缩:SSE 必须带(压缩会把流攒住);
108
+ // 轮询的响应很快就结束,放开让隧道压(实测快照 41 KB → 8.5 KB,流式批次约少九成)。
109
+ // Next 自己不压缩路由处理器的响应,所以本机、局域网不受影响
110
+ "Cache-Control": poll ? "no-cache" : "no-cache, no-transform",
82
111
  Connection: "keep-alive",
83
112
  "X-Accel-Buffering": "no",
84
113
  },
@@ -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(