@tasselx/pi-web 1.1.0 → 1.2.1

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 +14 -12
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +1 -1
  5. package/.next/react-loadable-manifest.json +2 -2
  6. package/.next/required-server-files.js +1 -1
  7. package/.next/required-server-files.json +1 -1
  8. package/.next/routes-manifest.json +12 -0
  9. package/.next/server/app/_global-error/page.js +1 -1
  10. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/_global-error.html +1 -1
  12. package/.next/server/app/_global-error.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page.js +1 -1
  17. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/server/app/_not-found.html +1 -1
  19. package/.next/server/app/_not-found.rsc +4 -4
  20. package/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -3
  23. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  24. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  25. package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
  26. package/.next/server/app/api/agent/[id]/lease/route.js +1 -1
  27. package/.next/server/app/api/agent/[id]/lease/route.js.nft.json +1 -1
  28. package/.next/server/app/api/agent/[id]/route.js +1 -1
  29. package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
  30. package/.next/server/app/api/agent/new/route.js +1 -1
  31. package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
  32. package/.next/server/app/api/agent/running/route.js +1 -1
  33. package/.next/server/app/api/agent/running/route.js.nft.json +1 -1
  34. package/.next/server/app/api/app-update/route.js +1 -1
  35. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  36. package/.next/server/app/api/auth/login/[provider]/route.js +1 -1
  37. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  38. package/.next/server/app/api/auth/providers/route.js +1 -1
  39. package/.next/server/app/api/cache-miss-notices/route.js +1 -1
  40. package/.next/server/app/api/cwd/browse/route.js +1 -1
  41. package/.next/server/app/api/cwd/pick/route.js +1 -0
  42. package/.next/server/app/api/cwd/pick/route.js.nft.json +1 -0
  43. package/.next/server/app/api/cwd/pick/route_client-reference-manifest.js +1 -0
  44. package/.next/server/app/api/cwd/validate/route.js +1 -1
  45. package/.next/server/app/api/default-cwd/route.js +1 -1
  46. package/.next/server/app/api/file-index/route.js +1 -1
  47. package/.next/server/app/api/files/[...path]/route.js +1 -1
  48. package/.next/server/app/api/git/diff/route.js +2 -2
  49. package/.next/server/app/api/git/status/route.js +1 -1
  50. package/.next/server/app/api/home/route.js +1 -1
  51. package/.next/server/app/api/mcp/route.js +2 -2
  52. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  53. package/.next/server/app/api/mcp/sign-in/[flowId]/route.js +1 -1
  54. package/.next/server/app/api/mcp/sign-in/route.js +1 -1
  55. package/.next/server/app/api/mcp/sign-in/route.js.nft.json +1 -1
  56. package/.next/server/app/api/mcp/test/route.js +1 -1
  57. package/.next/server/app/api/mcp/test/route.js.nft.json +1 -1
  58. package/.next/server/app/api/models/default/route.js +1 -1
  59. package/.next/server/app/api/models/enabled/route.js +1 -1
  60. package/.next/server/app/api/models/refresh/route.js +1 -1
  61. package/.next/server/app/api/models/route.js +1 -1
  62. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  63. package/.next/server/app/api/models-config/discover/route.js +1 -1
  64. package/.next/server/app/api/models-config/route.js +1 -1
  65. package/.next/server/app/api/models-config/test/route.js +1 -1
  66. package/.next/server/app/api/open-in-explorer/route.js +1 -1
  67. package/.next/server/app/api/plugins/check/route.js +1 -1
  68. package/.next/server/app/api/plugins/route.js +1 -1
  69. package/.next/server/app/api/plugins/route.js.nft.json +1 -1
  70. package/.next/server/app/api/project-trust/route.js +1 -1
  71. package/.next/server/app/api/project-trust/route.js.nft.json +1 -1
  72. package/.next/server/app/api/provider-usage/query/route.js +1 -1
  73. package/.next/server/app/api/push/config/route.js +1 -1
  74. package/.next/server/app/api/push/subscribe/route.js +1 -1
  75. package/.next/server/app/api/sessions/[id]/auto-name/route.js +2 -2
  76. package/.next/server/app/api/sessions/[id]/auto-name/route.js.nft.json +1 -1
  77. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  78. package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
  79. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  80. package/.next/server/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route.js +1 -1
  81. package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
  82. package/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  83. package/.next/server/app/api/sessions/[id]/fork/route.js.nft.json +1 -1
  84. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  85. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  86. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  87. package/.next/server/app/api/sessions/[id]/state/route.js.nft.json +1 -1
  88. package/.next/server/app/api/sessions/delete/route.js +1 -1
  89. package/.next/server/app/api/sessions/delete/route.js.nft.json +1 -1
  90. package/.next/server/app/api/sessions/route.js +1 -1
  91. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  92. package/.next/server/app/api/sessions/search/route.js +1 -1
  93. package/.next/server/app/api/sessions/stats/route.js +1 -1
  94. package/.next/server/app/api/sessions/stats/route.js.nft.json +1 -1
  95. package/.next/server/app/api/sessions/ui-state/route.js +1 -1
  96. package/.next/server/app/api/skills/check/route.js +1 -1
  97. package/.next/server/app/api/skills/content/route.js +1 -1
  98. package/.next/server/app/api/skills/install/route.js +1 -1
  99. package/.next/server/app/api/skills/route.js +1 -1
  100. package/.next/server/app/api/skills/search/route.js +1 -1
  101. package/.next/server/app/api/skills/update/route.js +1 -1
  102. package/.next/server/app/api/sleep-inhibit/route.js +1 -0
  103. package/.next/server/app/api/sleep-inhibit/route.js.nft.json +1 -0
  104. package/.next/server/app/api/sleep-inhibit/route_client-reference-manifest.js +1 -0
  105. package/.next/server/app/api/subagents/[id]/route.js +1 -1
  106. package/.next/server/app/api/subagents/[id]/route.js.nft.json +1 -1
  107. package/.next/server/app/api/subagents/profiles/route.js +1 -1
  108. package/.next/server/app/api/subagents/settings/route.js +1 -1
  109. package/.next/server/app/api/terminal/[id]/events/route.js +2 -2
  110. package/.next/server/app/api/terminal/[id]/route.js +1 -1
  111. package/.next/server/app/api/terminal/route.js +1 -1
  112. package/.next/server/app/api/tools/settings/route.js +1 -1
  113. package/.next/server/app/api/web-auth/route.js +1 -1
  114. package/.next/server/app/api/worktrees/route.js +1 -1
  115. package/.next/server/app/favicon.ico/route.js +1 -1
  116. package/.next/server/app/index.html +1 -1
  117. package/.next/server/app/index.rsc +9 -9
  118. package/.next/server/app/index.segments/__PAGE__.segment.rsc +9 -9
  119. package/.next/server/app/index.segments/_full.segment.rsc +9 -9
  120. package/.next/server/app/index.segments/_tree.segment.rsc +4 -4
  121. package/.next/server/app/login/page.js +1 -1
  122. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  123. package/.next/server/app/login.html +1 -1
  124. package/.next/server/app/login.rsc +5 -5
  125. package/.next/server/app/login.segments/_full.segment.rsc +5 -5
  126. package/.next/server/app/login.segments/_tree.segment.rsc +3 -3
  127. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
  128. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  129. package/.next/server/app/page.js +134 -82
  130. package/.next/server/app/page_client-reference-manifest.js +1 -1
  131. package/.next/server/app-paths-manifest.json +14 -12
  132. package/.next/server/chunks/2243.js +1 -1
  133. package/.next/server/chunks/2650.js +1 -0
  134. package/.next/server/chunks/4315.js +2 -2
  135. package/.next/server/chunks/6216.js +6 -0
  136. package/.next/server/chunks/6429.js +2 -2
  137. package/.next/server/chunks/7979.js +1 -1
  138. package/.next/server/chunks/9165.js +1 -1
  139. package/.next/server/functions-config-manifest.json +1 -0
  140. package/.next/server/middleware-build-manifest.js +1 -1
  141. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  142. package/.next/server/pages/404.html +1 -1
  143. package/.next/server/pages/500.html +1 -1
  144. package/.next/static/chunks/1278-acbd0cb712f7f8f0.js +1 -0
  145. package/.next/static/chunks/7379.f16ffe41e8afa0ef.js +3 -0
  146. package/.next/static/chunks/app/_global-error/page-a509ce75fed6d8b0.js +1 -0
  147. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-a509ce75fed6d8b0.js +1 -0
  148. package/.next/static/chunks/app/api/agent/[id]/events/route-a509ce75fed6d8b0.js +1 -0
  149. package/.next/static/chunks/app/api/agent/[id]/lease/route-a509ce75fed6d8b0.js +1 -0
  150. package/.next/static/chunks/app/api/agent/[id]/route-a509ce75fed6d8b0.js +1 -0
  151. package/.next/static/chunks/app/api/agent/new/route-a509ce75fed6d8b0.js +1 -0
  152. package/.next/static/chunks/app/api/agent/running/route-a509ce75fed6d8b0.js +1 -0
  153. package/.next/static/chunks/app/api/app-update/route-a509ce75fed6d8b0.js +1 -0
  154. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-a509ce75fed6d8b0.js +1 -0
  155. package/.next/static/chunks/app/api/auth/login/[provider]/route-a509ce75fed6d8b0.js +1 -0
  156. package/.next/static/chunks/app/api/auth/logout/[provider]/route-a509ce75fed6d8b0.js +1 -0
  157. package/.next/static/chunks/app/api/auth/providers/route-a509ce75fed6d8b0.js +1 -0
  158. package/.next/static/chunks/app/api/cache-miss-notices/route-a509ce75fed6d8b0.js +1 -0
  159. package/.next/static/chunks/app/api/cwd/browse/route-a509ce75fed6d8b0.js +1 -0
  160. package/.next/static/chunks/app/api/cwd/pick/route-a509ce75fed6d8b0.js +1 -0
  161. package/.next/static/chunks/app/api/cwd/validate/route-a509ce75fed6d8b0.js +1 -0
  162. package/.next/static/chunks/app/api/default-cwd/route-a509ce75fed6d8b0.js +1 -0
  163. package/.next/static/chunks/app/api/file-index/route-a509ce75fed6d8b0.js +1 -0
  164. package/.next/static/chunks/app/api/files/[...path]/route-a509ce75fed6d8b0.js +1 -0
  165. package/.next/static/chunks/app/api/git/diff/route-a509ce75fed6d8b0.js +1 -0
  166. package/.next/static/chunks/app/api/git/status/route-a509ce75fed6d8b0.js +1 -0
  167. package/.next/static/chunks/app/api/home/route-a509ce75fed6d8b0.js +1 -0
  168. package/.next/static/chunks/app/api/mcp/route-a509ce75fed6d8b0.js +1 -0
  169. package/.next/static/chunks/app/api/mcp/sign-in/[flowId]/route-a509ce75fed6d8b0.js +1 -0
  170. package/.next/static/chunks/app/api/mcp/sign-in/route-a509ce75fed6d8b0.js +1 -0
  171. package/.next/static/chunks/app/api/mcp/test/route-a509ce75fed6d8b0.js +1 -0
  172. package/.next/static/chunks/app/api/models/default/route-a509ce75fed6d8b0.js +1 -0
  173. package/.next/static/chunks/app/api/models/enabled/route-a509ce75fed6d8b0.js +1 -0
  174. package/.next/static/chunks/app/api/models/refresh/route-a509ce75fed6d8b0.js +1 -0
  175. package/.next/static/chunks/app/api/models/route-a509ce75fed6d8b0.js +1 -0
  176. package/.next/static/chunks/app/api/models-config/catalog/route-a509ce75fed6d8b0.js +1 -0
  177. package/.next/static/chunks/app/api/models-config/discover/route-a509ce75fed6d8b0.js +1 -0
  178. package/.next/static/chunks/app/api/models-config/route-a509ce75fed6d8b0.js +1 -0
  179. package/.next/static/chunks/app/api/models-config/test/route-a509ce75fed6d8b0.js +1 -0
  180. package/.next/static/chunks/app/api/open-in-explorer/route-a509ce75fed6d8b0.js +1 -0
  181. package/.next/static/chunks/app/api/plugins/check/route-a509ce75fed6d8b0.js +1 -0
  182. package/.next/static/chunks/app/api/plugins/route-a509ce75fed6d8b0.js +1 -0
  183. package/.next/static/chunks/app/api/project-trust/route-a509ce75fed6d8b0.js +1 -0
  184. package/.next/static/chunks/app/api/provider-usage/query/route-a509ce75fed6d8b0.js +1 -0
  185. package/.next/static/chunks/app/api/push/config/route-a509ce75fed6d8b0.js +1 -0
  186. package/.next/static/chunks/app/api/push/subscribe/route-a509ce75fed6d8b0.js +1 -0
  187. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-a509ce75fed6d8b0.js +1 -0
  188. package/.next/static/chunks/app/api/sessions/[id]/context/route-a509ce75fed6d8b0.js +1 -0
  189. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-a509ce75fed6d8b0.js +1 -0
  190. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-a509ce75fed6d8b0.js +1 -0
  191. package/.next/static/chunks/app/api/sessions/[id]/export/route-a509ce75fed6d8b0.js +1 -0
  192. package/.next/static/chunks/app/api/sessions/[id]/fork/route-a509ce75fed6d8b0.js +1 -0
  193. package/.next/static/chunks/app/api/sessions/[id]/route-a509ce75fed6d8b0.js +1 -0
  194. package/.next/static/chunks/app/api/sessions/[id]/state/route-a509ce75fed6d8b0.js +1 -0
  195. package/.next/static/chunks/app/api/sessions/delete/route-a509ce75fed6d8b0.js +1 -0
  196. package/.next/static/chunks/app/api/sessions/route-a509ce75fed6d8b0.js +1 -0
  197. package/.next/static/chunks/app/api/sessions/search/route-a509ce75fed6d8b0.js +1 -0
  198. package/.next/static/chunks/app/api/sessions/stats/route-a509ce75fed6d8b0.js +1 -0
  199. package/.next/static/chunks/app/api/sessions/ui-state/route-a509ce75fed6d8b0.js +1 -0
  200. package/.next/static/chunks/app/api/skills/check/route-a509ce75fed6d8b0.js +1 -0
  201. package/.next/static/chunks/app/api/skills/content/route-a509ce75fed6d8b0.js +1 -0
  202. package/.next/static/chunks/app/api/skills/install/route-a509ce75fed6d8b0.js +1 -0
  203. package/.next/static/chunks/app/api/skills/route-a509ce75fed6d8b0.js +1 -0
  204. package/.next/static/chunks/app/api/skills/search/route-a509ce75fed6d8b0.js +1 -0
  205. package/.next/static/chunks/app/api/skills/update/route-a509ce75fed6d8b0.js +1 -0
  206. package/.next/static/chunks/app/api/sleep-inhibit/route-a509ce75fed6d8b0.js +1 -0
  207. package/.next/static/chunks/app/api/subagents/[id]/route-a509ce75fed6d8b0.js +1 -0
  208. package/.next/static/chunks/app/api/subagents/profiles/route-a509ce75fed6d8b0.js +1 -0
  209. package/.next/static/chunks/app/api/subagents/settings/route-a509ce75fed6d8b0.js +1 -0
  210. package/.next/static/chunks/app/api/terminal/[id]/events/route-a509ce75fed6d8b0.js +1 -0
  211. package/.next/static/chunks/app/api/terminal/[id]/route-a509ce75fed6d8b0.js +1 -0
  212. package/.next/static/chunks/app/api/terminal/route-a509ce75fed6d8b0.js +1 -0
  213. package/.next/static/chunks/app/api/tools/settings/route-a509ce75fed6d8b0.js +1 -0
  214. package/.next/static/chunks/app/api/web-auth/route-a509ce75fed6d8b0.js +1 -0
  215. package/.next/static/chunks/app/api/worktrees/route-a509ce75fed6d8b0.js +1 -0
  216. package/.next/static/chunks/app/{layout-4fac0a406b05e28e.js → layout-fba9ec844c19ded5.js} +1 -1
  217. package/.next/static/chunks/app/manifest.webmanifest/route-a509ce75fed6d8b0.js +1 -0
  218. package/.next/static/chunks/app/page-020b7792f47e61a6.js +338 -0
  219. package/.next/static/chunks/next/dist/client/components/builtin/app-error-a509ce75fed6d8b0.js +1 -0
  220. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-a509ce75fed6d8b0.js +1 -0
  221. package/.next/static/chunks/next/dist/client/components/builtin/not-found-a509ce75fed6d8b0.js +1 -0
  222. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-a509ce75fed6d8b0.js +1 -0
  223. package/.next/static/chunks/{webpack-b3e6fd1801874f85.js → webpack-10ae3428600991e0.js} +1 -1
  224. package/.next/static/css/{ad96e794a9954323.css → bf4305e2891fcef1.css} +1 -1
  225. package/.next/static/css/{2c3ed27b408ff881.css → dac4513c1f26d498.css} +1 -1
  226. package/.next/static/css/dc78b381ecea7676.css +1 -0
  227. package/.next/static/css/e423cf64c3a31a65.css +1 -0
  228. package/.next/static/d8QChh2wYaULqtNavrBMx/_buildManifest.js +1 -0
  229. package/.next/trace +59 -178
  230. package/.next/trace-build +1 -1
  231. package/.next/types/app/api/cwd/pick/route.ts +355 -0
  232. package/.next/types/app/api/sleep-inhibit/route.ts +355 -0
  233. package/.next/types/routes.d.ts +3 -1
  234. package/.next/types/validator.ts +20 -0
  235. package/README.md +1 -0
  236. package/package.json +1 -1
  237. package/.next/server/chunks/4698.js +0 -1
  238. package/.next/static/chunks/1278-04df33c86a8cedbb.js +0 -1
  239. package/.next/static/chunks/7379.49eae68e886f95ce.js +0 -3
  240. package/.next/static/chunks/app/_global-error/page-cbe4231fb889bdce.js +0 -1
  241. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-cbe4231fb889bdce.js +0 -1
  242. package/.next/static/chunks/app/api/agent/[id]/events/route-cbe4231fb889bdce.js +0 -1
  243. package/.next/static/chunks/app/api/agent/[id]/lease/route-cbe4231fb889bdce.js +0 -1
  244. package/.next/static/chunks/app/api/agent/[id]/route-cbe4231fb889bdce.js +0 -1
  245. package/.next/static/chunks/app/api/agent/new/route-cbe4231fb889bdce.js +0 -1
  246. package/.next/static/chunks/app/api/agent/running/route-cbe4231fb889bdce.js +0 -1
  247. package/.next/static/chunks/app/api/app-update/route-cbe4231fb889bdce.js +0 -1
  248. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-cbe4231fb889bdce.js +0 -1
  249. package/.next/static/chunks/app/api/auth/login/[provider]/route-cbe4231fb889bdce.js +0 -1
  250. package/.next/static/chunks/app/api/auth/logout/[provider]/route-cbe4231fb889bdce.js +0 -1
  251. package/.next/static/chunks/app/api/auth/providers/route-cbe4231fb889bdce.js +0 -1
  252. package/.next/static/chunks/app/api/cache-miss-notices/route-cbe4231fb889bdce.js +0 -1
  253. package/.next/static/chunks/app/api/cwd/browse/route-cbe4231fb889bdce.js +0 -1
  254. package/.next/static/chunks/app/api/cwd/validate/route-cbe4231fb889bdce.js +0 -1
  255. package/.next/static/chunks/app/api/default-cwd/route-cbe4231fb889bdce.js +0 -1
  256. package/.next/static/chunks/app/api/file-index/route-cbe4231fb889bdce.js +0 -1
  257. package/.next/static/chunks/app/api/files/[...path]/route-cbe4231fb889bdce.js +0 -1
  258. package/.next/static/chunks/app/api/git/diff/route-cbe4231fb889bdce.js +0 -1
  259. package/.next/static/chunks/app/api/git/status/route-cbe4231fb889bdce.js +0 -1
  260. package/.next/static/chunks/app/api/home/route-cbe4231fb889bdce.js +0 -1
  261. package/.next/static/chunks/app/api/mcp/route-cbe4231fb889bdce.js +0 -1
  262. package/.next/static/chunks/app/api/mcp/sign-in/[flowId]/route-cbe4231fb889bdce.js +0 -1
  263. package/.next/static/chunks/app/api/mcp/sign-in/route-cbe4231fb889bdce.js +0 -1
  264. package/.next/static/chunks/app/api/mcp/test/route-cbe4231fb889bdce.js +0 -1
  265. package/.next/static/chunks/app/api/models/default/route-cbe4231fb889bdce.js +0 -1
  266. package/.next/static/chunks/app/api/models/enabled/route-cbe4231fb889bdce.js +0 -1
  267. package/.next/static/chunks/app/api/models/refresh/route-cbe4231fb889bdce.js +0 -1
  268. package/.next/static/chunks/app/api/models/route-cbe4231fb889bdce.js +0 -1
  269. package/.next/static/chunks/app/api/models-config/catalog/route-cbe4231fb889bdce.js +0 -1
  270. package/.next/static/chunks/app/api/models-config/discover/route-cbe4231fb889bdce.js +0 -1
  271. package/.next/static/chunks/app/api/models-config/route-cbe4231fb889bdce.js +0 -1
  272. package/.next/static/chunks/app/api/models-config/test/route-cbe4231fb889bdce.js +0 -1
  273. package/.next/static/chunks/app/api/open-in-explorer/route-cbe4231fb889bdce.js +0 -1
  274. package/.next/static/chunks/app/api/plugins/check/route-cbe4231fb889bdce.js +0 -1
  275. package/.next/static/chunks/app/api/plugins/route-cbe4231fb889bdce.js +0 -1
  276. package/.next/static/chunks/app/api/project-trust/route-cbe4231fb889bdce.js +0 -1
  277. package/.next/static/chunks/app/api/provider-usage/query/route-cbe4231fb889bdce.js +0 -1
  278. package/.next/static/chunks/app/api/push/config/route-cbe4231fb889bdce.js +0 -1
  279. package/.next/static/chunks/app/api/push/subscribe/route-cbe4231fb889bdce.js +0 -1
  280. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-cbe4231fb889bdce.js +0 -1
  281. package/.next/static/chunks/app/api/sessions/[id]/context/route-cbe4231fb889bdce.js +0 -1
  282. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-cbe4231fb889bdce.js +0 -1
  283. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-cbe4231fb889bdce.js +0 -1
  284. package/.next/static/chunks/app/api/sessions/[id]/export/route-cbe4231fb889bdce.js +0 -1
  285. package/.next/static/chunks/app/api/sessions/[id]/fork/route-cbe4231fb889bdce.js +0 -1
  286. package/.next/static/chunks/app/api/sessions/[id]/route-cbe4231fb889bdce.js +0 -1
  287. package/.next/static/chunks/app/api/sessions/[id]/state/route-cbe4231fb889bdce.js +0 -1
  288. package/.next/static/chunks/app/api/sessions/delete/route-cbe4231fb889bdce.js +0 -1
  289. package/.next/static/chunks/app/api/sessions/route-cbe4231fb889bdce.js +0 -1
  290. package/.next/static/chunks/app/api/sessions/search/route-cbe4231fb889bdce.js +0 -1
  291. package/.next/static/chunks/app/api/sessions/stats/route-cbe4231fb889bdce.js +0 -1
  292. package/.next/static/chunks/app/api/sessions/ui-state/route-cbe4231fb889bdce.js +0 -1
  293. package/.next/static/chunks/app/api/skills/check/route-cbe4231fb889bdce.js +0 -1
  294. package/.next/static/chunks/app/api/skills/content/route-cbe4231fb889bdce.js +0 -1
  295. package/.next/static/chunks/app/api/skills/install/route-cbe4231fb889bdce.js +0 -1
  296. package/.next/static/chunks/app/api/skills/route-cbe4231fb889bdce.js +0 -1
  297. package/.next/static/chunks/app/api/skills/search/route-cbe4231fb889bdce.js +0 -1
  298. package/.next/static/chunks/app/api/skills/update/route-cbe4231fb889bdce.js +0 -1
  299. package/.next/static/chunks/app/api/subagents/[id]/route-cbe4231fb889bdce.js +0 -1
  300. package/.next/static/chunks/app/api/subagents/profiles/route-cbe4231fb889bdce.js +0 -1
  301. package/.next/static/chunks/app/api/subagents/settings/route-cbe4231fb889bdce.js +0 -1
  302. package/.next/static/chunks/app/api/terminal/[id]/events/route-cbe4231fb889bdce.js +0 -1
  303. package/.next/static/chunks/app/api/terminal/[id]/route-cbe4231fb889bdce.js +0 -1
  304. package/.next/static/chunks/app/api/terminal/route-cbe4231fb889bdce.js +0 -1
  305. package/.next/static/chunks/app/api/tools/settings/route-cbe4231fb889bdce.js +0 -1
  306. package/.next/static/chunks/app/api/web-auth/route-cbe4231fb889bdce.js +0 -1
  307. package/.next/static/chunks/app/api/worktrees/route-cbe4231fb889bdce.js +0 -1
  308. package/.next/static/chunks/app/manifest.webmanifest/route-cbe4231fb889bdce.js +0 -1
  309. package/.next/static/chunks/app/page-55d6c63b3fad59ba.js +0 -286
  310. package/.next/static/chunks/next/dist/client/components/builtin/app-error-cbe4231fb889bdce.js +0 -1
  311. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-cbe4231fb889bdce.js +0 -1
  312. package/.next/static/chunks/next/dist/client/components/builtin/not-found-cbe4231fb889bdce.js +0 -1
  313. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-cbe4231fb889bdce.js +0 -1
  314. package/.next/static/css/2e00ddf94db0ac93.css +0 -1
  315. package/.next/static/css/992381f1f993c50d.css +0 -1
  316. package/.next/static/kGHKpcRcJUSY2DuTSILsx/_buildManifest.js +0 -1
  317. /package/.next/static/{kGHKpcRcJUSY2DuTSILsx → d8QChh2wYaULqtNavrBMx}/_ssgManifest.js +0 -0
@@ -0,0 +1,355 @@
1
+ // File: /Users/tassel/pi-web/app/api/sleep-inhibit/route.ts
2
+ import * as entry from '../../../../../app/api/sleep-inhibit/route.js'
3
+ import type { NextRequest } from 'next/server.js'
4
+
5
+ import type { InstantConfigForTypeCheckInternal, Prefetch, EnsureStatic } from 'next/dist/build/segment-config/app/app-segment-config.js'
6
+
7
+ type TEntry = typeof import('../../../../../app/api/sleep-inhibit/route.js')
8
+
9
+ type SegmentParams<T extends Object = any> = T extends Record<string, any>
10
+ ? { [K in keyof T]: T[K] extends string ? string | string[] | undefined : never }
11
+ : T
12
+
13
+ // Check that the entry is a valid entry
14
+ checkFields<Diff<{
15
+ GET?: Function
16
+ HEAD?: Function
17
+ OPTIONS?: Function
18
+ POST?: Function
19
+ PUT?: Function
20
+ DELETE?: Function
21
+ PATCH?: Function
22
+ config?: {}
23
+ generateStaticParams?: Function
24
+
25
+ instant?: InstantConfigForTypeCheckInternal
26
+ prefetch?: Prefetch
27
+ ensureStatic?: EnsureStatic
28
+ unstable_dynamicStaleTime?: number
29
+ revalidate?: RevalidateRange<TEntry> | false
30
+ dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
31
+ dynamicParams?: boolean
32
+ fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'
33
+ /** @deprecated The `preferredRegion` config is deprecated. Remove this export. */
34
+ preferredRegion?: 'auto' | 'global' | 'home' | string | string[]
35
+ runtime?: 'nodejs' | 'experimental-edge' | 'edge'
36
+ maxDuration?: number
37
+
38
+ }, TEntry, ''>>()
39
+
40
+ type RouteContext = { params: Promise<SegmentParams> }
41
+ // Check the prop type of the entry function
42
+ if ('GET' in entry) {
43
+ checkFields<
44
+ Diff<
45
+ ParamCheck<Request | NextRequest>,
46
+ {
47
+ __tag__: 'GET'
48
+ __param_position__: 'first'
49
+ __param_type__: FirstArg<MaybeField<TEntry, 'GET'>>
50
+ },
51
+ 'GET'
52
+ >
53
+ >()
54
+ checkFields<
55
+ Diff<
56
+ ParamCheck<RouteContext>,
57
+ {
58
+ __tag__: 'GET'
59
+ __param_position__: 'second'
60
+ __param_type__: SecondArg<MaybeField<TEntry, 'GET'>>
61
+ },
62
+ 'GET'
63
+ >
64
+ >()
65
+
66
+ checkFields<
67
+ Diff<
68
+ {
69
+ __tag__: 'GET',
70
+ __return_type__: Response | void | never | Promise<Response | void | never>
71
+ },
72
+ {
73
+ __tag__: 'GET',
74
+ __return_type__: ReturnType<MaybeField<TEntry, 'GET'>>
75
+ },
76
+ 'GET'
77
+ >
78
+ >()
79
+ }
80
+ // Check the prop type of the entry function
81
+ if ('HEAD' in entry) {
82
+ checkFields<
83
+ Diff<
84
+ ParamCheck<Request | NextRequest>,
85
+ {
86
+ __tag__: 'HEAD'
87
+ __param_position__: 'first'
88
+ __param_type__: FirstArg<MaybeField<TEntry, 'HEAD'>>
89
+ },
90
+ 'HEAD'
91
+ >
92
+ >()
93
+ checkFields<
94
+ Diff<
95
+ ParamCheck<RouteContext>,
96
+ {
97
+ __tag__: 'HEAD'
98
+ __param_position__: 'second'
99
+ __param_type__: SecondArg<MaybeField<TEntry, 'HEAD'>>
100
+ },
101
+ 'HEAD'
102
+ >
103
+ >()
104
+
105
+ checkFields<
106
+ Diff<
107
+ {
108
+ __tag__: 'HEAD',
109
+ __return_type__: Response | void | never | Promise<Response | void | never>
110
+ },
111
+ {
112
+ __tag__: 'HEAD',
113
+ __return_type__: ReturnType<MaybeField<TEntry, 'HEAD'>>
114
+ },
115
+ 'HEAD'
116
+ >
117
+ >()
118
+ }
119
+ // Check the prop type of the entry function
120
+ if ('OPTIONS' in entry) {
121
+ checkFields<
122
+ Diff<
123
+ ParamCheck<Request | NextRequest>,
124
+ {
125
+ __tag__: 'OPTIONS'
126
+ __param_position__: 'first'
127
+ __param_type__: FirstArg<MaybeField<TEntry, 'OPTIONS'>>
128
+ },
129
+ 'OPTIONS'
130
+ >
131
+ >()
132
+ checkFields<
133
+ Diff<
134
+ ParamCheck<RouteContext>,
135
+ {
136
+ __tag__: 'OPTIONS'
137
+ __param_position__: 'second'
138
+ __param_type__: SecondArg<MaybeField<TEntry, 'OPTIONS'>>
139
+ },
140
+ 'OPTIONS'
141
+ >
142
+ >()
143
+
144
+ checkFields<
145
+ Diff<
146
+ {
147
+ __tag__: 'OPTIONS',
148
+ __return_type__: Response | void | never | Promise<Response | void | never>
149
+ },
150
+ {
151
+ __tag__: 'OPTIONS',
152
+ __return_type__: ReturnType<MaybeField<TEntry, 'OPTIONS'>>
153
+ },
154
+ 'OPTIONS'
155
+ >
156
+ >()
157
+ }
158
+ // Check the prop type of the entry function
159
+ if ('POST' in entry) {
160
+ checkFields<
161
+ Diff<
162
+ ParamCheck<Request | NextRequest>,
163
+ {
164
+ __tag__: 'POST'
165
+ __param_position__: 'first'
166
+ __param_type__: FirstArg<MaybeField<TEntry, 'POST'>>
167
+ },
168
+ 'POST'
169
+ >
170
+ >()
171
+ checkFields<
172
+ Diff<
173
+ ParamCheck<RouteContext>,
174
+ {
175
+ __tag__: 'POST'
176
+ __param_position__: 'second'
177
+ __param_type__: SecondArg<MaybeField<TEntry, 'POST'>>
178
+ },
179
+ 'POST'
180
+ >
181
+ >()
182
+
183
+ checkFields<
184
+ Diff<
185
+ {
186
+ __tag__: 'POST',
187
+ __return_type__: Response | void | never | Promise<Response | void | never>
188
+ },
189
+ {
190
+ __tag__: 'POST',
191
+ __return_type__: ReturnType<MaybeField<TEntry, 'POST'>>
192
+ },
193
+ 'POST'
194
+ >
195
+ >()
196
+ }
197
+ // Check the prop type of the entry function
198
+ if ('PUT' in entry) {
199
+ checkFields<
200
+ Diff<
201
+ ParamCheck<Request | NextRequest>,
202
+ {
203
+ __tag__: 'PUT'
204
+ __param_position__: 'first'
205
+ __param_type__: FirstArg<MaybeField<TEntry, 'PUT'>>
206
+ },
207
+ 'PUT'
208
+ >
209
+ >()
210
+ checkFields<
211
+ Diff<
212
+ ParamCheck<RouteContext>,
213
+ {
214
+ __tag__: 'PUT'
215
+ __param_position__: 'second'
216
+ __param_type__: SecondArg<MaybeField<TEntry, 'PUT'>>
217
+ },
218
+ 'PUT'
219
+ >
220
+ >()
221
+
222
+ checkFields<
223
+ Diff<
224
+ {
225
+ __tag__: 'PUT',
226
+ __return_type__: Response | void | never | Promise<Response | void | never>
227
+ },
228
+ {
229
+ __tag__: 'PUT',
230
+ __return_type__: ReturnType<MaybeField<TEntry, 'PUT'>>
231
+ },
232
+ 'PUT'
233
+ >
234
+ >()
235
+ }
236
+ // Check the prop type of the entry function
237
+ if ('DELETE' in entry) {
238
+ checkFields<
239
+ Diff<
240
+ ParamCheck<Request | NextRequest>,
241
+ {
242
+ __tag__: 'DELETE'
243
+ __param_position__: 'first'
244
+ __param_type__: FirstArg<MaybeField<TEntry, 'DELETE'>>
245
+ },
246
+ 'DELETE'
247
+ >
248
+ >()
249
+ checkFields<
250
+ Diff<
251
+ ParamCheck<RouteContext>,
252
+ {
253
+ __tag__: 'DELETE'
254
+ __param_position__: 'second'
255
+ __param_type__: SecondArg<MaybeField<TEntry, 'DELETE'>>
256
+ },
257
+ 'DELETE'
258
+ >
259
+ >()
260
+
261
+ checkFields<
262
+ Diff<
263
+ {
264
+ __tag__: 'DELETE',
265
+ __return_type__: Response | void | never | Promise<Response | void | never>
266
+ },
267
+ {
268
+ __tag__: 'DELETE',
269
+ __return_type__: ReturnType<MaybeField<TEntry, 'DELETE'>>
270
+ },
271
+ 'DELETE'
272
+ >
273
+ >()
274
+ }
275
+ // Check the prop type of the entry function
276
+ if ('PATCH' in entry) {
277
+ checkFields<
278
+ Diff<
279
+ ParamCheck<Request | NextRequest>,
280
+ {
281
+ __tag__: 'PATCH'
282
+ __param_position__: 'first'
283
+ __param_type__: FirstArg<MaybeField<TEntry, 'PATCH'>>
284
+ },
285
+ 'PATCH'
286
+ >
287
+ >()
288
+ checkFields<
289
+ Diff<
290
+ ParamCheck<RouteContext>,
291
+ {
292
+ __tag__: 'PATCH'
293
+ __param_position__: 'second'
294
+ __param_type__: SecondArg<MaybeField<TEntry, 'PATCH'>>
295
+ },
296
+ 'PATCH'
297
+ >
298
+ >()
299
+
300
+ checkFields<
301
+ Diff<
302
+ {
303
+ __tag__: 'PATCH',
304
+ __return_type__: Response | void | never | Promise<Response | void | never>
305
+ },
306
+ {
307
+ __tag__: 'PATCH',
308
+ __return_type__: ReturnType<MaybeField<TEntry, 'PATCH'>>
309
+ },
310
+ 'PATCH'
311
+ >
312
+ >()
313
+ }
314
+
315
+ // Check the arguments and return type of the generateStaticParams function
316
+ if ('generateStaticParams' in entry) {
317
+ checkFields<Diff<{ params: SegmentParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()
318
+ checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()
319
+ }
320
+
321
+ export interface PageProps {
322
+ params?: Promise<SegmentParams>
323
+ searchParams?: Promise<any>
324
+ }
325
+ export interface LayoutProps {
326
+ children?: React.ReactNode
327
+
328
+ params?: Promise<SegmentParams>
329
+ }
330
+
331
+ // =============
332
+ // Utility types
333
+ type RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never
334
+
335
+ // If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.
336
+ type OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>
337
+ type Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>
338
+
339
+ type FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never
340
+ type SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never
341
+ type MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never
342
+
343
+ type ParamCheck<T> = {
344
+ __tag__: string
345
+ __param_position__: string
346
+ __param_type__: T
347
+ }
348
+
349
+ function checkFields<_ extends { [k in keyof any]: never }>() {}
350
+
351
+ // https://github.com/sindresorhus/type-fest
352
+ type Numeric = number | bigint
353
+ type Zero = 0 | 0n
354
+ type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never
355
+ type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'
@@ -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]/bash-output" | "/api/agent/[id]/events" | "/api/agent/[id]/lease" | "/api/agent/new" | "/api/agent/running" | "/api/app-update" | "/api/auth/api-key/[provider]" | "/api/auth/login/[provider]" | "/api/auth/logout/[provider]" | "/api/auth/providers" | "/api/cache-miss-notices" | "/api/cwd/browse" | "/api/cwd/validate" | "/api/default-cwd" | "/api/file-index" | "/api/files/[...path]" | "/api/git/diff" | "/api/git/status" | "/api/home" | "/api/mcp" | "/api/mcp/sign-in" | "/api/mcp/sign-in/[flowId]" | "/api/mcp/test" | "/api/models" | "/api/models-config" | "/api/models-config/catalog" | "/api/models-config/discover" | "/api/models-config/test" | "/api/models/default" | "/api/models/enabled" | "/api/models/refresh" | "/api/open-in-explorer" | "/api/plugins" | "/api/plugins/check" | "/api/project-trust" | "/api/provider-usage/query" | "/api/push/config" | "/api/push/subscribe" | "/api/sessions" | "/api/sessions/[id]" | "/api/sessions/[id]/auto-name" | "/api/sessions/[id]/context" | "/api/sessions/[id]/entries/[entryId]/thinking" | "/api/sessions/[id]/entries/[entryId]/tool-result-image" | "/api/sessions/[id]/export" | "/api/sessions/[id]/fork" | "/api/sessions/[id]/state" | "/api/sessions/delete" | "/api/sessions/search" | "/api/sessions/stats" | "/api/sessions/ui-state" | "/api/skills" | "/api/skills/check" | "/api/skills/content" | "/api/skills/install" | "/api/skills/search" | "/api/skills/update" | "/api/subagents/[id]" | "/api/subagents/profiles" | "/api/subagents/settings" | "/api/terminal" | "/api/terminal/[id]" | "/api/terminal/[id]/events" | "/api/tools/settings" | "/api/web-auth" | "/api/worktrees"
5
+ type AppRouteHandlerRoutes = "/api/agent/[id]" | "/api/agent/[id]/bash-output" | "/api/agent/[id]/events" | "/api/agent/[id]/lease" | "/api/agent/new" | "/api/agent/running" | "/api/app-update" | "/api/auth/api-key/[provider]" | "/api/auth/login/[provider]" | "/api/auth/logout/[provider]" | "/api/auth/providers" | "/api/cache-miss-notices" | "/api/cwd/browse" | "/api/cwd/pick" | "/api/cwd/validate" | "/api/default-cwd" | "/api/file-index" | "/api/files/[...path]" | "/api/git/diff" | "/api/git/status" | "/api/home" | "/api/mcp" | "/api/mcp/sign-in" | "/api/mcp/sign-in/[flowId]" | "/api/mcp/test" | "/api/models" | "/api/models-config" | "/api/models-config/catalog" | "/api/models-config/discover" | "/api/models-config/test" | "/api/models/default" | "/api/models/enabled" | "/api/models/refresh" | "/api/open-in-explorer" | "/api/plugins" | "/api/plugins/check" | "/api/project-trust" | "/api/provider-usage/query" | "/api/push/config" | "/api/push/subscribe" | "/api/sessions" | "/api/sessions/[id]" | "/api/sessions/[id]/auto-name" | "/api/sessions/[id]/context" | "/api/sessions/[id]/entries/[entryId]/thinking" | "/api/sessions/[id]/entries/[entryId]/tool-result-image" | "/api/sessions/[id]/export" | "/api/sessions/[id]/fork" | "/api/sessions/[id]/state" | "/api/sessions/delete" | "/api/sessions/search" | "/api/sessions/stats" | "/api/sessions/ui-state" | "/api/skills" | "/api/skills/check" | "/api/skills/content" | "/api/skills/install" | "/api/skills/search" | "/api/skills/update" | "/api/sleep-inhibit" | "/api/subagents/[id]" | "/api/subagents/profiles" | "/api/subagents/settings" | "/api/terminal" | "/api/terminal/[id]" | "/api/terminal/[id]/events" | "/api/tools/settings" | "/api/web-auth" | "/api/worktrees"
6
6
  type PageRoutes = never
7
7
  type LayoutRoutes = "/"
8
8
  type RedirectRoutes = never
@@ -25,6 +25,7 @@ interface ParamMap {
25
25
  "/api/auth/providers": {}
26
26
  "/api/cache-miss-notices": {}
27
27
  "/api/cwd/browse": {}
28
+ "/api/cwd/pick": {}
28
29
  "/api/cwd/validate": {}
29
30
  "/api/default-cwd": {}
30
31
  "/api/file-index": {}
@@ -70,6 +71,7 @@ interface ParamMap {
70
71
  "/api/skills/install": {}
71
72
  "/api/skills/search": {}
72
73
  "/api/skills/update": {}
74
+ "/api/sleep-inhibit": {}
73
75
  "/api/subagents/[id]": { "id": string; }
74
76
  "/api/subagents/profiles": {}
75
77
  "/api/subagents/settings": {}
@@ -216,6 +216,16 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
216
216
  type __Unused = __Check
217
217
  }
218
218
 
219
+ // Validate ../../app/api/cwd/pick/route.ts
220
+ {
221
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/cwd/pick">> = Specific
222
+ const handler = {} as typeof import("../../app/api/cwd/pick/route.js")
223
+ type __Check = __IsExpected<typeof handler>
224
+
225
+ // @ts-ignore
226
+ type __Unused = __Check
227
+ }
228
+
219
229
  // Validate ../../app/api/cwd/validate/route.ts
220
230
  {
221
231
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/cwd/validate">> = Specific
@@ -666,6 +676,16 @@ type RouteHandlerConfig<Route extends AppRouteHandlerRoutes = AppRouteHandlerRou
666
676
  type __Unused = __Check
667
677
  }
668
678
 
679
+ // Validate ../../app/api/sleep-inhibit/route.ts
680
+ {
681
+ type __IsExpected<Specific extends RouteHandlerConfig<"/api/sleep-inhibit">> = Specific
682
+ const handler = {} as typeof import("../../app/api/sleep-inhibit/route.js")
683
+ type __Check = __IsExpected<typeof handler>
684
+
685
+ // @ts-ignore
686
+ type __Unused = __Check
687
+ }
688
+
669
689
  // Validate ../../app/api/subagents/[id]/route.ts
670
690
  {
671
691
  type __IsExpected<Specific extends RouteHandlerConfig<"/api/subagents/[id]">> = Specific
package/README.md CHANGED
@@ -128,6 +128,7 @@ npx @tasselx/pi-web@latest
128
128
  - **Agent data**: Pi Web reads pi data from `~/.pi/agent` by default, including session files under `sessions/<encoded-cwd>/<timestamp>_<uuid>.jsonl`. Set `PI_CODING_AGENT_DIR` to use another pi agent directory.
129
129
  - **Filesystem access**: Pi Web must be able to read the agent data directory and the working directories recorded by its sessions. Run Pi Web in the same filesystem environment as pi when sharing existing sessions.
130
130
  - **Shared configuration**: the Models panel uses pi's model, settings, and credential storage, so changes are visible to both interfaces. An open session applies a saved edit of its model when you select the model again.
131
+ - **Code mode workers**: pi runs Code mode scripts in at most two sandbox workers at a time, shared by every session and in-process subagent of the Pi Web server. A further script waits up to 60 seconds for a free worker. If several sessions run scripts at once, set `PI_CODEMODE_MAX_WORKERS` to a larger whole number before starting Pi Web; each worker's script may use up to 256 MB.
131
132
  - **File access boundary**: the file browser is limited to working directories selected in Pi Web and project or session roots it already knows about; it is not a general filesystem browser.
132
133
  - **Git worktrees**: see [Worktrees in Pi Web](./docs/worktrees.md) for switcher visibility, worktree creation, and removal behavior.
133
134
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tasselx/pi-web",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "Web UI for the pi coding agent",
5
5
  "homepage": "https://github.com/tasselx/pi-web#readme",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- "use strict";exports.id=4698,exports.ids=[4698],exports.modules={305:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{Up:()=>n,dp:()=>m,e5:()=>k,wQ:()=>i});var e=c(10674),f=a([e]);e=(f.then?(await f)():f)[0];let o=["read","bash","edit","write"],p=new Set(["bash","powershell"]);function g(a,b=process.platform){return"win32"===b&&a?.includes("powershell")===!0&&!a.includes("bash")}function h(a,b){let c=b?"powershell":"bash",d=[];for(let b of a){let a=p.has(b)?c:b;d.includes(a)||d.push(a)}return d}function i(a,b,c=process.platform){return h(a,g(b,c))}function j(a){return a.startsWith("+")||a.startsWith("-")}function k(a){let b=a.filter(a=>!j(a)),c=b.length>0||0===a.length?b:[...o];for(let b of a){if(!j(b))continue;let a=b.slice(1),d=c.indexOf(a);b.startsWith("+")&&-1===d&&a?c.push(a):b.startsWith("-")&&-1!==d&&c.splice(d,1)}return c}function l(a){let b=(0,e.cj)(a);return void 0===b?void 0:k(b)}async function m(a=(0,e.WD)(void 0),b=process.platform){return(0,e.lz)(a,a=>g(l(a),b))}async function n(a,b=(0,e.WD)(void 0),c=process.platform){if("win32"!==c)throw Error("PowerShell tool settings are only available on Windows");return await (0,e.AC)(b,b=>{let c=l(b)??o,d=h(c,a);c.some(a=>p.has(a))||d.push(a?"powershell":"bash"),b.defaultTools=d}),a}d()}catch(a){d(a)}})},2650:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{B6:()=>A,Db:()=>x,M7:()=>y,Vq:()=>u,cu:()=>m,n7:()=>z,t1:()=>q});var e=c(76760),f=c(75430),g=c(99999),h=c(43084),i=c(49507),j=c(72498),k=c(37431),l=a([f,g,h,i,j]);[f,g,h,i,j]=l.then?(await l)():l;let A="PI_WEB_DISABLE_MCP";function m(a=process.env){let b=a[A]?.trim().toLowerCase();return void 0!==b&&""!==b&&"0"!==b&&"false"!==b}async function n(){let a;if(await (0,f.createCodemodeExtension)({models:!1})({registerTool:b=>{a=b},getSettings:()=>({}),getAllTools:()=>[],appendEntry:()=>{}}),!a)throw Error("the codemode extension registered no tool");return a}async function o(a={}){let b,c=a.timeoutMs??1e4,d=new AbortController,e=new Promise((a,e)=>{b=setTimeout(()=>{d.abort(),e(Error(`the sandbox did not answer within ${c} ms`))},c),b.unref?.()});try{let b=(async()=>{let b=await (a.createDefinition??n)();return await b.execute("pi-web-self-test",{code:"return 6 * 7"},d.signal,void 0,void 0)})();b.catch(()=>{});let c=await Promise.race([b,e]),f=(c.content??[]).flatMap(a=>"text"===a.type&&void 0!==a.text?[a.text]:[]);if(c.isError)return{available:!1,reason:`the self-test script failed: ${f.join(" ").trim()||"no output"}`};if(!f.some(a=>"42"===a.trim()))return{available:!1,reason:`the self-test script returned ${JSON.stringify(f.join(" ").trim())}`};return{available:!0}}catch(a){return{available:!1,reason:a instanceof Error?a.message:String(a)}}finally{clearTimeout(b)}}let B=Symbol.for("pi-web.codemodeSandbox");function p(){let a=globalThis;return a[B]??=o().then(a=>(a.available||console.warn(`[pi-web] Code mode is off: ${a.reason}`),a))}let C=Symbol("not settled");async function q(){let a=globalThis[B];if(!a)return{checked:!1};let b=await Promise.race([a,Promise.resolve(C)]);return b===C?{checked:!1}:{checked:!0,...b}}let D=Symbol.for("pi-web.mcpOffWarned");async function r(){let a=function(a,b=process.env){return m(b)?{available:!1,reason:`${A} is set`}:a.ok?{available:!0,internals:a}:{available:!1,reason:a.reason}}(await (0,i.U)()),b=globalThis;return a.available||m()||b[D]===a.reason||(b[D]=a.reason,console.warn(`[pi-web] MCP is off: ${a.reason}`)),a}let E=["codemode","tool-search","mcp"];function s(a,b){let c,d=(0,k.y)(a,b);if(void 0===d)return;try{c=JSON.parse(65279===d.charCodeAt(0)?d.slice(1):d)}catch{return}let e="object"==typeof c&&null!==c?c.extensions:void 0;return Array.isArray(e)?e.filter(a=>"string"==typeof a):void 0}async function t(a,b,c){let{agentDir:d,cwd:e,projectTrusted:g}=a,h=new f.DefaultPackageManager({cwd:e,agentDir:d,settingsManager:f.SettingsManager.fromStorage({withLock:(a,c)=>{let d=b[a];c(d?JSON.stringify({extensions:d}):void 0)}},{projectTrusted:g}),builtinExtensions:[...E]}),i=await h.resolve(async()=>"skip"),j={};for(let a of E){let b=i.extensions.find(b=>b.path===`builtin:${a}`),d=b?.enabled??!0;j[a]=d?{enabled:d}:{enabled:d,settingsPath:b?.metadata.scope==="project"?c.project:c.global}}return j}async function u(a){let{agentDir:b}=a,c=void 0!==a.cwd&&a.projectTrusted,d=a.cwd??b,g={global:(0,e.join)(b,"settings.json"),project:(0,e.join)(d,f.CONFIG_DIR_NAME,"settings.json")},h=s(g.global),i=c?s(g.project,k.T):void 0,j=await t({agentDir:b,cwd:d,projectTrusted:c},{global:h,project:i},g);if(void 0===i)return j;let l=await t({agentDir:b,cwd:d,projectTrusted:!1},{global:h},g);for(let a of E)j[a].global=l[a];return j}let F=()=>{};function v(a,b){return{name:a,factory:b,replaceable:!0,builtin:!0}}function w(a,b){let c=b.gate??((a,b)=>b),d=a.available?new g.nx({...b.mcpHost,agentDir:b.agentDir,internals:a.internals,codemodeAvailable:b.codemodeAvailable}):void 0,e=[v("tool-search",c("tool-search",(0,f.createToolSearchExtension)())),v("mcp",c("mcp",a.available&&d?(0,f.createMcpExtension)({loadConfig:function(a,b,c=a=>(0,j.n)(a,b)){return d=>{let e;try{e=a.loadMcpConfig({agentDir:b,cwd:d.cwd,projectTrusted:c(d.cwd)}).autoEnableCodemode}catch{}return{servers:[],errors:[],...void 0===e?{}:{autoEnableCodemode:e}}}}(a.internals,b.agentDir),createTransport:d.wrapTransportFactory((0,h.Pn)(a.internals)),startupWaitMs:0,openUrl:()=>{}}):F))];return d&&e.push(d.extension()),{extensions:e,mcpHost:d}}async function x(a){let b=await p();if(!b.available)throw Error(`Code mode is unavailable: ${b.reason}`);let c=(0,f.createCodemodeExtension)();return{name:"codemode",replaceable:!0,factory:async b=>{(await u({agentDir:a.agentDir,cwd:a.cwd,projectTrusted:a.projectTrusted()})).codemode.enabled&&await c(b)}}}async function y(a){return w(await r(),{agentDir:a.agentDir,codemodeAvailable:()=>a.codemode,...a.mcpHost?{mcpHost:a.mcpHost}:{},gate:(b,c)=>async d=>{(await u({agentDir:a.agentDir,cwd:a.cwd,projectTrusted:a.projectTrusted()}))[b].enabled&&await c(d)}})}async function z(a){let[b,c]=await Promise.all([p(),r()]),{extensions:d,mcpHost:e}=w(c,{agentDir:a.agentDir,codemodeAvailable:()=>b.available,...a.mcpHost?{mcpHost:a.mcpHost}:{}});return{extensions:[v("codemode",b.available?(0,f.createCodemodeExtension)():F),...d],mcpHost:e}}d()}catch(a){d(a)}})},10674:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{AC:()=>o,WD:()=>k,cj:()=>m,lz:()=>n});var e=c(73024),f=c(76760),g=c(75430),h=c(80974),i=c.n(h),j=a([g]);function k(a=(0,g.getAgentDir)()){return(0,f.join)(a,"settings.json")}function l(a){if(!(0,e.existsSync)(a))return{};let b=JSON.parse((0,e.readFileSync)(a,"utf8"));if(!("object"==typeof b&&null!==b&&!Array.isArray(b)))throw Error("Invalid settings.json: expected an object");return b}function m(a){if(void 0!==a.defaultTools){if(!Array.isArray(a.defaultTools)||a.defaultTools.some(a=>"string"!=typeof a))throw Error("Invalid settings.json: defaultTools must be an array of strings");return[...a.defaultTools]}}async function n(a,b){if(!(0,e.existsSync)(a))return b({});let c=await i().lock(a,{realpath:!1,retries:10});try{return b(l(a))}finally{await c()}}async function o(a,b){(0,e.mkdirSync)((0,f.dirname)(a),{recursive:!0});try{(0,e.writeFileSync)(a,"{}",{flag:"wx",mode:384})}catch(a){if("EEXIST"!==a.code)throw a}let c=await i().lock(a,{realpath:!1,retries:10});try{let c=l(a),d=b(c);return(0,e.writeFileSync)(a,JSON.stringify(c,null,2),"utf8"),(0,e.chmodSync)(a,384),d}finally{await c()}}g=(j.then?(await j)():j)[0],d()}catch(a){d(a)}})},11784:(a,b,c)=>{c.d(b,{Y:()=>e,y:()=>g});let d=/^Unexpected token '([\s\S])', ([\s\S]*) is not valid JSON$/;function e(a,b){let c,e,f,g=a instanceof Error?a.message:String(a);if(!g.includes('"'))return g;let h=d.exec(g);if(!h)return"Not valid JSON";let[,i,j]=h,k=i.charCodeAt(0),l=/[\p{L}\p{N}]/u.test(i)?"":/[\p{P}\p{S}]/u.test(i)?` '${i}'`:` U+${k.toString(16).toUpperCase().padStart(4,"0")}`,m=function(a,b,c){let d,e=c.startsWith('..."'),f=c.endsWith('"...'),g=c.slice(3*!!e,f?-3:void 0);if(g.length<2||!g.startsWith('"')||!g.endsWith('"')||!e&&!f)return;let h=g.slice(1,-1);if(e)if(f){for(d=a.indexOf(h);d>=0&&a[d+10]!==b;)d=a.indexOf(h,d+1);if(d<0)return;d+=10}else{if(!a.endsWith(h))return;d=a.length-h.length+10}else{if(!a.startsWith(h))return;d=h.length-10}return a[d]===b?d:void 0}(b,i,j);return`Unexpected token${l} in JSON${void 0===m?"":` ${e=(c=b.slice(0,m)).split("\n").length,f=m-c.lastIndexOf("\n"),`at position ${m} (line ${e} column ${f})`}`}`}let f=/is not valid JSON$/;function g(a,b){let c=b.map(a=>`${a}: `).find(b=>a.startsWith(b))??"",d=a.slice(c.length);return f.test(d)?`${c}${e(d,"")}`:a}},37431:(a,b,c)=>{c.d(b,{T:()=>f,y:()=>g});var d=c(73024);let e=d.constants.O_RDONLY|(d.constants.O_NONBLOCK||0),f=1048576;function g(a,b){let c;try{c=(0,d.openSync)(a,e)}catch(b){let a;if("ENOENT"===(a=b?.code)||"ENOTDIR"===a)return;throw b}try{let e=(0,d.fstatSync)(c);if(!e.isFile())throw Error(`${a} is not a regular file`);if(void 0===b)return(0,d.readFileSync)(c,"utf8");if(e.size>b)throw Error(`${a} is larger than ${b} bytes`);let f=b+1,g=[],h=0;for(;h<f;){let a=Buffer.alloc(Math.min(f-h,65536)),b=(0,d.readSync)(c,a,0,a.length,null);if(0===b)break;g.push(a.subarray(0,b)),h+=b}if(h>b)throw Error(`${a} is larger than ${b} bytes`);return Buffer.concat(g,h).toString("utf8")}finally{(0,d.closeSync)(c)}}},44088:(a,b,c)=>{c.d(b,{Ai:()=>g,Ll:()=>e,pM:()=>d,zT:()=>f});let d="builtin:mcp";function e(a){return"mcp"===a.name&&a.sourceInfo?.path===d}function f(a){return"prompt"!==a.source&&("mcp"===a.name||/^mcp:\d+$/.test(a.name))}function g(a,b){if(!a.startsWith("/"))return"wait";let c=a.indexOf(" "),d=-1===c?a.slice(1):a.slice(1,c),f=b.find(a=>a.name===d);return f?e(f)?"register":"none":"wait"}},49507:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{U:()=>p});var e=c(75430),f=c(73024),g=c(98995),h=c(76760),i=c(73136),j=a([e]);e=(j.then?(await j)():j)[0];let q="@earendil-works/pi-coding-agent",r="@earendil-works/pi-mcp",s={mcpExtension:"dist/extensions/mcp/index.js",mcpRuntime:"dist/extensions/mcp/runtime.js",mcpConfig:"dist/extensions/mcp/config.js",mcpOAuth:"dist/extensions/mcp/oauth.js",mcpServers:"dist/core/mcp-servers.js",configValues:"dist/core/resolve-config-value.js"},t={McpServerConnection:{module:"mcpRuntime",kind:"class"},createDefaultTransport:{module:"mcpRuntime",kind:"function"},StdioTransport:{module:"mcpClient",kind:"class"},loadMcpConfig:{module:"mcpConfig",kind:"function"},addMcpServerConfig:{module:"mcpConfig",kind:"function"},updateMcpServerConfig:{module:"mcpConfig",kind:"function"},removeMcpServerConfig:{module:"mcpConfig",kind:"function"},validateMcpServerConfig:{module:"mcpServers",kind:"function"},getMcpToolExposure:{module:"mcpServers",kind:"function"},signInMcpServer:{module:"mcpOAuth",kind:"function"},McpOAuthCredentialStore:{module:"mcpOAuth",kind:"class"},McpSignInCancelledError:{module:"mcpOAuth",kind:"class"},resolveConfigValueOrThrow:{module:"configValues",kind:"function"},resolveHeadersOrThrow:{module:"configValues",kind:"function"},getConfigValueEnvVarNames:{module:"configValues",kind:"function"},isCommandConfigValue:{module:"configValues",kind:"function"}};function k(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function l(a){return a instanceof Error?a.message:String(a)}async function m(a){return await import((0,i.pathToFileURL)(a).href)}let u=new Set(["node","import","module-sync","node-addons","default"]);async function n(a){let b=Object.fromEntries(Object.entries(s).map(([b,c])=>[b,(0,h.join)(a,c)]));try{b.mcpClient=function(a){let b=(0,i.pathToFileURL)((0,h.join)(a,s.mcpRuntime)).href,c=(0,g.findPackageJSON)(r,b);if(!c)throw Error(`cannot resolve ${r}`);let d=function(a){if(!k(a))return;let{exports:b}=a;return void 0===b?"string"==typeof a.main?a.main:"index.js":function a(b){if("string"==typeof b||null===b)return b;for(let c of Array.isArray(b)?b:k(b)?Object.entries(b).filter(([a])=>u.has(a)).map(([,a])=>a):[]){let b=a(c);if(void 0!==b)return b}}(k(b)&&"."in b?b["."]:b)??void 0}(JSON.parse((0,f.readFileSync)(c,"utf8")));if(!d)throw Error(`${c} declares no import entry`);return(0,h.join)(c,"..",d)}(a)}catch(a){return`${r}: ${l(a)}`}let c={};for(let[a,d]of Object.entries(b))try{c[a]=await m(d)}catch(a){return`cannot load ${d}: ${l(a)}`}return c}async function o(a={}){var b;let c,{environment:d=process.env,cwd:j=process.cwd()}=a;if(d.PI_PACKAGE_DIR)return{ok:!1,reason:`PI_PACKAGE_DIR is set; MCP support loads only from the ${q} that Pi Web runs`};try{c=(0,f.realpathSync)((0,e.getPackageDir)());let a=function(a){let b=(0,g.findPackageJSON)(q,(0,i.pathToFileURL)((0,h.join)(a,"package.json")).href);if(!b)throw Error(`cannot resolve ${q} from ${a}`);return(0,f.realpathSync)((0,h.join)(b,".."))}(j);if(b=c,"win32"===process.platform?b.toLowerCase()!==a.toLowerCase():b!==a)return{ok:!1,reason:`${q} at ${c} is not the package Pi Web resolves (${a})`}}catch(a){return{ok:!1,reason:`cannot locate ${q}: ${l(a)}`}}let k=await n(c);if("string"==typeof k)return{ok:!1,reason:k};if(k.mcpExtension.createMcpExtension!==e.createMcpExtension)return{ok:!1,reason:`${s.mcpExtension} loaded as a second copy of ${q}`};let m=function(a){let b={};for(let[c,{module:d,kind:e}]of Object.entries(t)){let f=a[d][c];if("class"===e?!("function"==typeof f&&/^class[\s{]/.test(Function.prototype.toString.call(f))):"function"!=typeof f){let a="mcpClient"===d?r:s[d];return`${a} does not export ${c} as a ${e}`}b[c]=f}return b}(k);if("string"==typeof m)return{ok:!1,reason:m};let p={packageDir:c,...m};try{if(!(p.createDefaultTransport({name:"pi-web-probe",config:{command:"pi-web-probe"},source:"pi-web"},p.packageDir,void 0)instanceof p.StdioTransport))return{ok:!1,reason:`${r} resolved to another copy than ${s.mcpRuntime} uses`}}catch(a){return{ok:!1,reason:`${s.mcpRuntime}: ${l(a)}`}}return{ok:!0,...p}}let v=Symbol.for("pi-web.piSdkInternals");function p(){let a=globalThis;return a[v]??=o().catch(a=>({ok:!1,reason:l(a)}))}d()}catch(a){d(a)}})},76609:(a,b,c)=>{c.d(b,{U2:()=>i,dj:()=>f,qu:()=>h});var d=c(77598);function e(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function f(a,b=0){return Array.isArray(a)||e(a)?b>=64?"<too deep>":Array.isArray(a)?`[${a.map(a=>f(a,b+1)).join(",")}]`:`{${Object.keys(a).sort().map(c=>`${JSON.stringify(c)}:${f(a[c],b+1)}`).join(",")}}`:JSON.stringify(a)??"null"}let g=Symbol.for("pi-web:mcp-config-key-secret");function h(a){let b=globalThis,c=b[g]??=(0,d.randomBytes)(32);return(0,d.createHmac)("sha256",c).update(f(a)).digest("base64url")}function i(a,b){return h(e(b)?b:a)}},85825:(a,b,c)=>{c.d(b,{lW:()=>d,vN:()=>e,vR:()=>f});let d=["enabled","exposure","toolExposure"];function e(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)&&void 0===a.command&&void 0===a.url&&void 0===a.type}function f(a,b,c){return c?Object.keys(b).some(a=>!d.includes(a))?`server "${a}": an override can only set ${d.join(", ")}`:void 0:`server "${a}" needs "command" or "url", or a global server to override`}},99999:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{nx:()=>D});var e=c(73024),f=c(76760),g=c(75430),h=c(44088),i=c(76609),j=c(11784),k=c(85825),l=c(66479),m=c(23757),n=c(82536),o=c(72498),p=a([g,m,o]);[g,m,o]=p.then?(await p)():p;let w=new Set(["tools/list"]);function q(a){return"object"==typeof a&&null!==a&&!Array.isArray(a)}function r(a){return a instanceof Error?a.message:String(a)}let x=Symbol.for("pi-web:mcp-config-errors-logged");function s(a){let b=globalThis,c=b[x]??=new Set;c.has(a)||(c.size>=200&&c.delete(c.values().next().value),c.add(a),console.warn(`[pi-web] MCP config: ${a}`))}let y=e.constants.O_RDONLY|(e.constants.O_NONBLOCK||0)|(e.constants.O_NOFOLLOW||0);function t(a){return a instanceof Error?a.name:void 0}let z={connecting:"connecting",ready:"connected",failed:"failed","needs-auth":"needs-auth",disconnected:"disconnected"};class A{constructor(a,b,c,d){this.configKey=a,this.scope=b,this.target=c,this.started=!1,this.settled=!1,this.waited=!1,this.released=!1,this.state="connecting",this.startedListeners=new Set,this.settledListeners=new Set,this.declaresTools=(d.exposure??"codemode")==="direct"||Object.values(d.toolExposure??{}).includes("direct")}markStarted(){if(!this.started){for(let a of(this.started=!0,this.startedListeners))a();this.startedListeners.clear()}}update(a,b={}){if(this.state=a,this.error=b.error,this.stderr=b.stderr,"connecting"!==a&&!this.settled){for(let a of(this.settled=!0,this.markStarted(),this.settledListeners))a();this.settledListeners.clear()}}whenStarted(){return this.started?Promise.resolve():new Promise(a=>this.startedListeners.add(a))}whenSettled(){return this.settled?Promise.resolve():new Promise(a=>this.settledListeners.add(a))}}let B=/is already registered by extension "(.+)"$/;function u(a){try{return a.sessionManager?.getSessionId()??""}catch{return""}}function v(a){let b;return{promise:new Promise(c=>{b=setTimeout(c,a),b.unref?.()}),cancel:()=>clearTimeout(b)}}class C{constructor(a,b){this.pi=a,this.options=b,this.active=!1,this.disposed=!1,this.attempts=new Map,this.abandoned=new Map,this.problems=new Map,this.problemReports=new Map,this.queue=Promise.resolve(),this.runActive=!1,this.preparing=0,this.isCommandValue=a=>this.options.internals.isCommandConfigValue?.(a)??a.startsWith("!"),a.on("session_start",(b,c)=>{if(this.disposed)return;this.ctx=c;let d=a.getCommands().filter(h.zT);this.active=d.some(h.Ll),this.reportActivity(c,this.active?void 0:d[0]?.sourceInfo?.path)}),a.on("before_agent_start",()=>{this.clearIdle(),this.sync()}),a.on("agent_start",()=>{this.runActive=!0,this.clearIdle()}),a.on("agent_end",()=>{this.runActive=!1,this.armIdle()}),a.on("session_shutdown",()=>{this.dispose()})}attemptFor(a){let b=this.attempts.get(a.name);return b&&!b.released&&b.configKey===(0,i.dj)(a.config)?b:void 0}refuseAbandoned(a){let b=`${a.name}\0${(0,i.dj)(a.config)}`,c=this.abandoned.get(b);return!!c&&(c>1?this.abandoned.set(b,c-1):this.abandoned.delete(b),console.warn(`[pi-web] MCP server "${a.name}" was unregistered before its connection opened; its transport is refused`),!0)}transportFailed(a,b,c){a.current=void 0;let d=(0,m.fR)(b.config,[],{isCommandConfigValue:this.isCommandValue});this.update(a,"failed",{error:(0,m.lL)(r(c),d)})}watch(a,b,c,d){let e;a.markStarted(),a.current=c,this.update(a,"connecting");let f=a=>(e??=(0,m.fR)(b.config,[c],{isCommandConfigValue:this.isCommandValue}))(a),g=a=>void 0===a?{}:{stderr:(0,m.zE)(a,f)};!function(a,b,c){var d;let e,f,g,h,i,j,k,l,m,n,o=!1,p=!1,r=!1,s=a=>{let c;"McpOAuthAuthorizationRequiredError"===(c=t(a))||b&&"McpAuthRequiredError"===c?p=!0:void 0===m&&"McpConnectionClosedError"!==t(a)&&(m=a)},u=()=>{let b="string"==typeof a.stderr?a.stderr.trim():"";return b?{stderr:b}:{}};if(d=a=>{"ready"===a?(o=!0,c({type:"ready"})):c({type:"failed",authRequired:p,...void 0===m?{}:{error:m},...u()})},f=!1,g=!1,h=0,i=new Set,j=a=>{f||(f=!0,d(a))},k=()=>{setImmediate(()=>{f||!g||void 0===e||i.size>0||e&&0===h||j("ready")})},l=a.send.bind(a),a.send=a=>(q(a)&&"string"==typeof a.method&&(void 0!==a.id&&w.has(a.method)?(i.add(a.id),h+=1):void 0===a.id&&"notifications/initialized"===a.method&&(g=!0,k())),l(a)),a.onMessage(a=>{if(q(a)&&void 0===a.method&&void 0!==a.id){if(void 0===e&&q(a.result)&&q(a.result.capabilities)){let{capabilities:b}=a.result;e=!!b.tools,k();return}i.delete(a.id)&&k()}}),a.onClose(()=>j("closed")),"function"==typeof a.start){let b=a.start;a.start=()=>b.call(a).catch(a=>{throw s(a),a})}let v=a.send;if(a.send=b=>(q(b)&&"initialize"===b.method&&void 0!==b.id&&(n=b.id),v.call(a,b).catch(a=>{throw s(a),a})),"function"==typeof a.close){let b=a.close;a.close=()=>(r=!0,b.call(a))}a.onMessage(a=>{void 0===m&&void 0!==n&&q(a)&&a.id===n&&q(a.error)&&"string"==typeof a.error.message&&(m=a.error.message)}),a.onClose(()=>{o&&c({type:"closed",dropped:!r,authRequired:p,...u()})})}(c,d,b=>{if(a.current===c)if("ready"===b.type)this.update(a,"ready");else if("failed"===b.type)if(b.authRequired)this.update(a,"needs-auth");else{let c=void 0===b.error?"The connection closed before the server was ready":r(b.error);this.update(a,"failed",{error:(0,m.lL)(c,f),...g(b.stderr)})}else b.authRequired?this.update(a,"needs-auth"):b.dropped&&this.update(a,"disconnected",g(b.stderr))})}sync(){let a=this.enqueue(async()=>{if(!this.active||!this.ctx)return;let a=this.desiredServers(this.ctx);for(let[b,c]of[...this.attempts]){let d=a.get(b);d&&(0,i.dj)(d.config)===c.configKey||await this.unregister(b)}for(let[b,c]of a)this.attempts.has(b)||this.register(b,c);this.reportProblems()});return a.then(()=>this.armIdle()),a}async prepareForPrompt(a,b){this.clearIdle(),this.runActive=!1,this.preparing+=1;try{await this.waitForServers(a,b)}finally{this.preparing-=1,this.armIdle()}}async waitForServers(a,b){let c=a.aborted?Promise.resolve():new Promise(b=>a.addEventListener("abort",()=>b(),{once:!0}));if(await Promise.race([this.sync(),c]),a.aborted||!b)return;let d=[...this.attempts.values()].filter(a=>a.declaresTools&&!a.settled&&!a.waited);if(0===d.length)return;let e=v(this.options.promptWaitMs),f=await Promise.race([Promise.all(d.map(a=>a.whenSettled())).then(()=>!1),e.promise.then(()=>!0),c.then(()=>!1)]);if(e.cancel(),f)for(let a of d)a.waited=!0}serverStates(){let a=[...this.problems.values()].map(a=>a.status);for(let[b,c]of this.attempts)a.push({name:b,scope:c.scope,state:c.state,...c.error?{error:c.error}:{},...c.stderr?{stderr:c.stderr}:{}});return a.sort((a,b)=>a.name.localeCompare(b.name)||a.scope.localeCompare(b.scope))}release(){return this.enqueue(async()=>{for(let a of[...this.attempts.keys()])await this.unregister(a)})}dispose(){this.disposed=!0,this.active=!1,this.clearIdle(),this.letGoOfAll(),this.reportActivity(void 0,void 0)}entryConfigKey(a,b){return(0,i.U2)(b,this.options.internals.validateMcpServerConfig?.(a,b))}projectEntryConfigKey(a,b,c){return q(b)&&(0,k.vN)(b)&&void 0===(0,k.vR)(a,b,void 0!==c)?this.entryConfigKey(a,{...c,...b}):this.entryConfigKey(a,b)}write(a,b){let c=this.ctx;if(!c)return;let d={origin:"session",state:b.state,sessionId:u(c),cwd:c.cwd,updatedAt:Date.now(),...b.error?{error:b.error}:{},...b.stderr?{stderr:b.stderr}:{},...b.conflict?{conflict:b.conflict}:{}};return(0,l.kY)(a,a.configKey,d),d}update(a,b,c={}){a.update(b,c),a.released||(a.recorded=this.write(a.target,{state:z[b],...c}))}letGo(a){a.released=!0;let{target:b,recorded:c}=a;c&&("connecting"===a.state?(0,l.My)(b,b.configKey,c):"ready"===a.state&&(0,l.vU)(b,b.configKey,c,{...c,closedAt:Date.now()}))}letGoOfAll(){for(let a of this.attempts.values())this.letGo(a);for(let{target:a,status:b}of this.problemReports.values())(0,l.My)(a,a.configKey,b);this.problemReports.clear()}reportProblems(){let a=new Set;for(let{target:b,report:c}of this.problems.values()){let d=(0,l.wf)(b);a.add(d);let e=[b.configKey,c.state,c.conflict??"",c.error??""].join("\0"),f=this.problemReports.get(d);if(f?.signature===e&&(0,l.Wu)(b,b.configKey,f.status))continue;let g=this.write(b,c);g&&this.problemReports.set(d,{signature:e,target:b,status:g})}for(let b of[...this.problemReports.keys()])a.has(b)||this.problemReports.delete(b)}reportActivity(a,b){if(this.inactiveReport&&(0,l.jQ)(this.inactiveReport.sessionId,this.inactiveReport.info),this.inactiveReport=void 0,!a)return;let c=u(a);if(!b)return void(0,l.jQ)(c);let d={owner:b,cwd:a.cwd,updatedAt:Date.now()};(0,l.Te)(c,d),this.inactiveReport={sessionId:c,info:d}}enqueue(a){let b=this.queue.then(a);return this.queue=b.catch(a=>{console.error("[pi-web] MCP host operation failed:",r(a))}),this.queue}desiredServers(a){let b;this.problems=new Map;let c=new Map,d=this.options.mayReadProjectConfig(a.cwd);try{b=this.options.internals.loadMcpConfig({agentDir:this.options.agentDir,cwd:a.cwd,projectTrusted:d})}catch(a){s(`cannot read mcp.json: ${r(a)}`)}let h=(0,f.join)(a.cwd,g.CONFIG_DIR_NAME,"mcp.json");if(!d){let c=function(a){let b,c=(0,f.join)(a,g.CONFIG_DIR_NAME,"mcp.json");try{if((0,n.TU)(c))return[];let d=(0,e.realpathSync)(c);if(!(0,n.o4)(d,(0,n.qy)(new Set([a]))))return[];b=(0,e.openSync)(d,y);let f=(0,e.fstatSync)(b);if(!f.isFile()||f.size>1048576)return[];let g=Buffer.alloc(f.size+1),h=0;for(;h<g.length;){let a=(0,e.readSync)(b,g,h,g.length-h,null);if(0===a)break;h+=a}if(h>f.size)return[];let i=JSON.parse(g.toString("utf8",0,h));return q(i)&&q(i.mcpServers)?Object.entries(i.mcpServers):[]}catch{return[]}finally{void 0!==b&&(0,e.closeSync)(b)}}(a.cwd),d=new Map((b?.servers??[]).map(a=>[a.name,a.config]));for(let[a,b]of c.slice(0,100))try{this.problems.set(`project\0${a}`,{status:{name:a,scope:"project",state:"not-trusted"},target:{scope:"project",sourcePath:h,name:a,configKey:this.projectEntryConfigKey(a,b,d.get(a))},report:{state:"not-trusted"}})}catch(b){s(`${h}: server "${a}" is not reported: ${r(b)}`)}c.length>100&&s(`${h}: ${c.length-100} more servers of this untrusted project are not reported`)}if(!b)return c;let k=[(0,f.join)(this.options.agentDir,"mcp.json"),h];for(let a of b.errors.slice(0,20))s((0,j.y)(a,k));for(let a of(b.errors.length>20&&s(`${b.errors.length-20} more errors in mcp.json are not logged`),b.servers)){if(!1===a.config.enabled)continue;let b=a.override,d="project"===a.scope||void 0!==b?"project":"global";try{c.set(a.name,{config:function(a,b){if(b)return a;let c=a=>"codemode"===a?"deferred":a,d=a.toolExposure?Object.fromEntries(Object.entries(a.toolExposure).map(([a,b])=>[a,c(b)])):void 0;return{...a,exposure:c(a.exposure??"codemode"),...d?{toolExposure:d}:{}}}(a.config,this.options.codemodeAvailable()),scope:d,target:{scope:d,sourcePath:b??a.source,name:a.name,configKey:(0,i.qu)(a.config)}})}catch(b){s(`${a.source}: server "${a.name}" is not connected: ${r(b)}`)}}return c}register(a,b){let{config:c,scope:d,target:e}=b,f=new A((0,i.dj)(c),d,e,c);this.attempts.set(a,f);try{this.pi.registerMcpServer(a,c)}catch(h){this.attempts.delete(a);let b=r(h),f=this.registeredOwner(a)??B.exec(b)?.[1],g=(0,m.fR)(c,[],{isCommandConfigValue:this.isCommandValue});this.problems.set(`${d}\0${a}`,{status:{name:a,scope:d,state:"not-registered",error:b,...f?{conflict:f}:{}},target:e,report:f?{state:"conflict",conflict:f}:{state:"failed",error:(0,m.lL)(b,g)}})}}registeredOwner(a){try{return this.pi.getMcpServers?.().find(b=>b.name===a)?.extensionPath}catch{return}}async unregister(a){let b=this.attempts.get(a);if(b&&!b.started){let a=v(this.options.replaceWaitMs);await Promise.race([b.whenStarted(),a.promise]),a.cancel()}if(this.attempts.delete(a),b&&!b.started){let c=`${a}\0${b.configKey}`;this.abandoned.set(c,(this.abandoned.get(c)??0)+1)}b&&this.letGo(b);try{this.pi.unregisterMcpServer(a)}catch(b){console.error(`[pi-web] cannot unregister MCP server "${a}":`,r(b))}}clearIdle(){clearTimeout(this.idleTimer),this.idleTimer=void 0}armIdle(){this.clearIdle(),this.runActive||this.preparing>0||this.options.idleMs<=0||0===this.attempts.size||(this.idleTimer=setTimeout(()=>{this.idleTimer=void 0,(!this.ctx||this.ctx.isIdle())&&this.release()},this.options.idleMs),this.idleTimer.unref?.())}}class D{constructor(a){this.options={idleMs:function(a=process.env.PI_WEB_MCP_IDLE_MS){if(void 0!==a&&""!==a.trim()){let b=Number(a);if(Number.isFinite(b)&&b>=0&&b<=0x7fffffff)return b;console.warn(`[pi-web] invalid PI_WEB_MCP_IDLE_MS "${a}", falling back to 10 minutes`)}return 6e5}(),promptWaitMs:1e4,replaceWaitMs:5e3,...a,mayReadProjectConfig:a.mayReadProjectConfig??(b=>(0,o.n)(b,a.agentDir))}}extension(){return{name:"pi-web-mcp-host",hidden:!0,factory:a=>{this.current?.dispose(),this.current=new C(a,this.options)}}}wrapTransportFactory(a){return(b,c,d)=>{let e,f=this.current,g=f?.attemptFor(b);if(!g&&f?.refuseAbandoned(b))throw Error(`MCP server "${b.name}" was removed before it connected, so Pi Web did not start it`);try{e=a(b,c,d)}catch(a){throw f&&g&&f.transportFailed(g,b,a),a}return f&&g&&f.watch(g,b,e,void 0!==d),e}}dispose(){this.current?.dispose()}prepareForPrompt(a,b={}){return this.current?.prepareForPrompt(a,b.wait??!0)??Promise.resolve()}serverStates(){return this.current?.serverStates()??[]}release(){return this.current?.release()??Promise.resolve()}}d()}catch(a){d(a)}})}};