@tasselx/pi-web 1.2.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 (309) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +9 -8
  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 +6 -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 +2 -2
  20. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  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 -1
  42. package/.next/server/app/api/cwd/validate/route.js +1 -1
  43. package/.next/server/app/api/default-cwd/route.js +1 -1
  44. package/.next/server/app/api/file-index/route.js +1 -1
  45. package/.next/server/app/api/files/[...path]/route.js +1 -1
  46. package/.next/server/app/api/git/diff/route.js +2 -2
  47. package/.next/server/app/api/git/status/route.js +1 -1
  48. package/.next/server/app/api/home/route.js +1 -1
  49. package/.next/server/app/api/mcp/route.js +2 -2
  50. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  51. package/.next/server/app/api/mcp/sign-in/[flowId]/route.js +1 -1
  52. package/.next/server/app/api/mcp/sign-in/route.js +1 -1
  53. package/.next/server/app/api/mcp/sign-in/route.js.nft.json +1 -1
  54. package/.next/server/app/api/mcp/test/route.js +1 -1
  55. package/.next/server/app/api/mcp/test/route.js.nft.json +1 -1
  56. package/.next/server/app/api/models/default/route.js +1 -1
  57. package/.next/server/app/api/models/enabled/route.js +1 -1
  58. package/.next/server/app/api/models/refresh/route.js +1 -1
  59. package/.next/server/app/api/models/route.js +1 -1
  60. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  61. package/.next/server/app/api/models-config/discover/route.js +1 -1
  62. package/.next/server/app/api/models-config/route.js +1 -1
  63. package/.next/server/app/api/models-config/test/route.js +1 -1
  64. package/.next/server/app/api/open-in-explorer/route.js +1 -1
  65. package/.next/server/app/api/plugins/check/route.js +1 -1
  66. package/.next/server/app/api/plugins/route.js +1 -1
  67. package/.next/server/app/api/plugins/route.js.nft.json +1 -1
  68. package/.next/server/app/api/project-trust/route.js +1 -1
  69. package/.next/server/app/api/project-trust/route.js.nft.json +1 -1
  70. package/.next/server/app/api/provider-usage/query/route.js +1 -1
  71. package/.next/server/app/api/push/config/route.js +1 -1
  72. package/.next/server/app/api/push/subscribe/route.js +1 -1
  73. package/.next/server/app/api/sessions/[id]/auto-name/route.js +2 -2
  74. package/.next/server/app/api/sessions/[id]/auto-name/route.js.nft.json +1 -1
  75. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  76. package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
  77. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  78. package/.next/server/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route.js +1 -1
  79. package/.next/server/app/api/sessions/[id]/export/route.js +2 -2
  80. package/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  81. package/.next/server/app/api/sessions/[id]/fork/route.js.nft.json +1 -1
  82. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  83. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  84. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  85. package/.next/server/app/api/sessions/[id]/state/route.js.nft.json +1 -1
  86. package/.next/server/app/api/sessions/delete/route.js +1 -1
  87. package/.next/server/app/api/sessions/delete/route.js.nft.json +1 -1
  88. package/.next/server/app/api/sessions/route.js +1 -1
  89. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  90. package/.next/server/app/api/sessions/search/route.js +1 -1
  91. package/.next/server/app/api/sessions/stats/route.js +1 -1
  92. package/.next/server/app/api/sessions/stats/route.js.nft.json +1 -1
  93. package/.next/server/app/api/sessions/ui-state/route.js +1 -1
  94. package/.next/server/app/api/skills/check/route.js +1 -1
  95. package/.next/server/app/api/skills/content/route.js +1 -1
  96. package/.next/server/app/api/skills/install/route.js +1 -1
  97. package/.next/server/app/api/skills/route.js +2 -2
  98. package/.next/server/app/api/skills/search/route.js +1 -1
  99. package/.next/server/app/api/skills/update/route.js +1 -1
  100. package/.next/server/app/api/sleep-inhibit/route.js +1 -0
  101. package/.next/server/app/api/sleep-inhibit/route.js.nft.json +1 -0
  102. package/.next/server/app/api/sleep-inhibit/route_client-reference-manifest.js +1 -0
  103. package/.next/server/app/api/subagents/[id]/route.js +1 -1
  104. package/.next/server/app/api/subagents/[id]/route.js.nft.json +1 -1
  105. package/.next/server/app/api/subagents/profiles/route.js +1 -1
  106. package/.next/server/app/api/subagents/settings/route.js +1 -1
  107. package/.next/server/app/api/terminal/[id]/events/route.js +2 -2
  108. package/.next/server/app/api/terminal/[id]/route.js +1 -1
  109. package/.next/server/app/api/terminal/route.js +1 -1
  110. package/.next/server/app/api/tools/settings/route.js +1 -1
  111. package/.next/server/app/api/web-auth/route.js +1 -1
  112. package/.next/server/app/api/worktrees/route.js +1 -1
  113. package/.next/server/app/favicon.ico/route.js +1 -1
  114. package/.next/server/app/index.html +1 -1
  115. package/.next/server/app/index.rsc +5 -5
  116. package/.next/server/app/index.segments/__PAGE__.segment.rsc +5 -5
  117. package/.next/server/app/index.segments/_full.segment.rsc +5 -5
  118. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  119. package/.next/server/app/login/page.js +1 -1
  120. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  121. package/.next/server/app/login.html +1 -1
  122. package/.next/server/app/login.rsc +3 -3
  123. package/.next/server/app/login.segments/_full.segment.rsc +3 -3
  124. package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  125. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +3 -3
  126. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  127. package/.next/server/app/page.js +134 -82
  128. package/.next/server/app/page_client-reference-manifest.js +1 -1
  129. package/.next/server/app-paths-manifest.json +9 -8
  130. package/.next/server/chunks/2243.js +1 -1
  131. package/.next/server/chunks/2650.js +1 -0
  132. package/.next/server/chunks/3379.js +1 -1
  133. package/.next/server/chunks/4315.js +2 -2
  134. package/.next/server/chunks/6216.js +6 -0
  135. package/.next/server/chunks/6429.js +2 -2
  136. package/.next/server/chunks/7979.js +1 -1
  137. package/.next/server/middleware-build-manifest.js +1 -1
  138. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  139. package/.next/server/pages/404.html +1 -1
  140. package/.next/server/pages/500.html +1 -1
  141. package/.next/static/chunks/1278-acbd0cb712f7f8f0.js +1 -0
  142. package/.next/static/chunks/7379.f16ffe41e8afa0ef.js +3 -0
  143. package/.next/static/chunks/app/_global-error/page-a509ce75fed6d8b0.js +1 -0
  144. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-a509ce75fed6d8b0.js +1 -0
  145. package/.next/static/chunks/app/api/agent/[id]/events/route-a509ce75fed6d8b0.js +1 -0
  146. package/.next/static/chunks/app/api/agent/[id]/lease/route-a509ce75fed6d8b0.js +1 -0
  147. package/.next/static/chunks/app/api/agent/[id]/route-a509ce75fed6d8b0.js +1 -0
  148. package/.next/static/chunks/app/api/agent/new/route-a509ce75fed6d8b0.js +1 -0
  149. package/.next/static/chunks/app/api/agent/running/route-a509ce75fed6d8b0.js +1 -0
  150. package/.next/static/chunks/app/api/app-update/route-a509ce75fed6d8b0.js +1 -0
  151. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-a509ce75fed6d8b0.js +1 -0
  152. package/.next/static/chunks/app/api/auth/login/[provider]/route-a509ce75fed6d8b0.js +1 -0
  153. package/.next/static/chunks/app/api/auth/logout/[provider]/route-a509ce75fed6d8b0.js +1 -0
  154. package/.next/static/chunks/app/api/auth/providers/route-a509ce75fed6d8b0.js +1 -0
  155. package/.next/static/chunks/app/api/cache-miss-notices/route-a509ce75fed6d8b0.js +1 -0
  156. package/.next/static/chunks/app/api/cwd/browse/route-a509ce75fed6d8b0.js +1 -0
  157. package/.next/static/chunks/app/api/cwd/pick/route-a509ce75fed6d8b0.js +1 -0
  158. package/.next/static/chunks/app/api/cwd/validate/route-a509ce75fed6d8b0.js +1 -0
  159. package/.next/static/chunks/app/api/default-cwd/route-a509ce75fed6d8b0.js +1 -0
  160. package/.next/static/chunks/app/api/file-index/route-a509ce75fed6d8b0.js +1 -0
  161. package/.next/static/chunks/app/api/files/[...path]/route-a509ce75fed6d8b0.js +1 -0
  162. package/.next/static/chunks/app/api/git/diff/route-a509ce75fed6d8b0.js +1 -0
  163. package/.next/static/chunks/app/api/git/status/route-a509ce75fed6d8b0.js +1 -0
  164. package/.next/static/chunks/app/api/home/route-a509ce75fed6d8b0.js +1 -0
  165. package/.next/static/chunks/app/api/mcp/route-a509ce75fed6d8b0.js +1 -0
  166. package/.next/static/chunks/app/api/mcp/sign-in/[flowId]/route-a509ce75fed6d8b0.js +1 -0
  167. package/.next/static/chunks/app/api/mcp/sign-in/route-a509ce75fed6d8b0.js +1 -0
  168. package/.next/static/chunks/app/api/mcp/test/route-a509ce75fed6d8b0.js +1 -0
  169. package/.next/static/chunks/app/api/models/default/route-a509ce75fed6d8b0.js +1 -0
  170. package/.next/static/chunks/app/api/models/enabled/route-a509ce75fed6d8b0.js +1 -0
  171. package/.next/static/chunks/app/api/models/refresh/route-a509ce75fed6d8b0.js +1 -0
  172. package/.next/static/chunks/app/api/models/route-a509ce75fed6d8b0.js +1 -0
  173. package/.next/static/chunks/app/api/models-config/catalog/route-a509ce75fed6d8b0.js +1 -0
  174. package/.next/static/chunks/app/api/models-config/discover/route-a509ce75fed6d8b0.js +1 -0
  175. package/.next/static/chunks/app/api/models-config/route-a509ce75fed6d8b0.js +1 -0
  176. package/.next/static/chunks/app/api/models-config/test/route-a509ce75fed6d8b0.js +1 -0
  177. package/.next/static/chunks/app/api/open-in-explorer/route-a509ce75fed6d8b0.js +1 -0
  178. package/.next/static/chunks/app/api/plugins/check/route-a509ce75fed6d8b0.js +1 -0
  179. package/.next/static/chunks/app/api/plugins/route-a509ce75fed6d8b0.js +1 -0
  180. package/.next/static/chunks/app/api/project-trust/route-a509ce75fed6d8b0.js +1 -0
  181. package/.next/static/chunks/app/api/provider-usage/query/route-a509ce75fed6d8b0.js +1 -0
  182. package/.next/static/chunks/app/api/push/config/route-a509ce75fed6d8b0.js +1 -0
  183. package/.next/static/chunks/app/api/push/subscribe/route-a509ce75fed6d8b0.js +1 -0
  184. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-a509ce75fed6d8b0.js +1 -0
  185. package/.next/static/chunks/app/api/sessions/[id]/context/route-a509ce75fed6d8b0.js +1 -0
  186. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-a509ce75fed6d8b0.js +1 -0
  187. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-a509ce75fed6d8b0.js +1 -0
  188. package/.next/static/chunks/app/api/sessions/[id]/export/route-a509ce75fed6d8b0.js +1 -0
  189. package/.next/static/chunks/app/api/sessions/[id]/fork/route-a509ce75fed6d8b0.js +1 -0
  190. package/.next/static/chunks/app/api/sessions/[id]/route-a509ce75fed6d8b0.js +1 -0
  191. package/.next/static/chunks/app/api/sessions/[id]/state/route-a509ce75fed6d8b0.js +1 -0
  192. package/.next/static/chunks/app/api/sessions/delete/route-a509ce75fed6d8b0.js +1 -0
  193. package/.next/static/chunks/app/api/sessions/route-a509ce75fed6d8b0.js +1 -0
  194. package/.next/static/chunks/app/api/sessions/search/route-a509ce75fed6d8b0.js +1 -0
  195. package/.next/static/chunks/app/api/sessions/stats/route-a509ce75fed6d8b0.js +1 -0
  196. package/.next/static/chunks/app/api/sessions/ui-state/route-a509ce75fed6d8b0.js +1 -0
  197. package/.next/static/chunks/app/api/skills/check/route-a509ce75fed6d8b0.js +1 -0
  198. package/.next/static/chunks/app/api/skills/content/route-a509ce75fed6d8b0.js +1 -0
  199. package/.next/static/chunks/app/api/skills/install/route-a509ce75fed6d8b0.js +1 -0
  200. package/.next/static/chunks/app/api/skills/route-a509ce75fed6d8b0.js +1 -0
  201. package/.next/static/chunks/app/api/skills/search/route-a509ce75fed6d8b0.js +1 -0
  202. package/.next/static/chunks/app/api/skills/update/route-a509ce75fed6d8b0.js +1 -0
  203. package/.next/static/chunks/app/api/sleep-inhibit/route-a509ce75fed6d8b0.js +1 -0
  204. package/.next/static/chunks/app/api/subagents/[id]/route-a509ce75fed6d8b0.js +1 -0
  205. package/.next/static/chunks/app/api/subagents/profiles/route-a509ce75fed6d8b0.js +1 -0
  206. package/.next/static/chunks/app/api/subagents/settings/route-a509ce75fed6d8b0.js +1 -0
  207. package/.next/static/chunks/app/api/terminal/[id]/events/route-a509ce75fed6d8b0.js +1 -0
  208. package/.next/static/chunks/app/api/terminal/[id]/route-a509ce75fed6d8b0.js +1 -0
  209. package/.next/static/chunks/app/api/terminal/route-a509ce75fed6d8b0.js +1 -0
  210. package/.next/static/chunks/app/api/tools/settings/route-a509ce75fed6d8b0.js +1 -0
  211. package/.next/static/chunks/app/api/web-auth/route-a509ce75fed6d8b0.js +1 -0
  212. package/.next/static/chunks/app/api/worktrees/route-a509ce75fed6d8b0.js +1 -0
  213. package/.next/static/chunks/app/{layout-e538e5d308a97d51.js → layout-fba9ec844c19ded5.js} +1 -1
  214. package/.next/static/chunks/app/manifest.webmanifest/route-a509ce75fed6d8b0.js +1 -0
  215. package/.next/static/chunks/app/page-020b7792f47e61a6.js +338 -0
  216. package/.next/static/chunks/next/dist/client/components/builtin/app-error-a509ce75fed6d8b0.js +1 -0
  217. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-a509ce75fed6d8b0.js +1 -0
  218. package/.next/static/chunks/next/dist/client/components/builtin/not-found-a509ce75fed6d8b0.js +1 -0
  219. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-a509ce75fed6d8b0.js +1 -0
  220. package/.next/static/chunks/{webpack-b3e6fd1801874f85.js → webpack-10ae3428600991e0.js} +1 -1
  221. package/.next/static/css/dc78b381ecea7676.css +1 -0
  222. package/.next/static/d8QChh2wYaULqtNavrBMx/_buildManifest.js +1 -0
  223. package/.next/trace +59 -58
  224. package/.next/trace-build +1 -1
  225. package/.next/types/app/api/sleep-inhibit/route.ts +355 -0
  226. package/.next/types/routes.d.ts +2 -1
  227. package/.next/types/validator.ts +10 -0
  228. package/package.json +1 -1
  229. package/.next/server/chunks/4698.js +0 -1
  230. package/.next/static/-g1KUgp8qZzNmZ5_sTyxp/_buildManifest.js +0 -1
  231. package/.next/static/chunks/1278-d56768cd20f66ed4.js +0 -1
  232. package/.next/static/chunks/7379.49eae68e886f95ce.js +0 -3
  233. package/.next/static/chunks/app/_global-error/page-5d60af35a4bb1818.js +0 -1
  234. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-5d60af35a4bb1818.js +0 -1
  235. package/.next/static/chunks/app/api/agent/[id]/events/route-5d60af35a4bb1818.js +0 -1
  236. package/.next/static/chunks/app/api/agent/[id]/lease/route-5d60af35a4bb1818.js +0 -1
  237. package/.next/static/chunks/app/api/agent/[id]/route-5d60af35a4bb1818.js +0 -1
  238. package/.next/static/chunks/app/api/agent/new/route-5d60af35a4bb1818.js +0 -1
  239. package/.next/static/chunks/app/api/agent/running/route-5d60af35a4bb1818.js +0 -1
  240. package/.next/static/chunks/app/api/app-update/route-5d60af35a4bb1818.js +0 -1
  241. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-5d60af35a4bb1818.js +0 -1
  242. package/.next/static/chunks/app/api/auth/login/[provider]/route-5d60af35a4bb1818.js +0 -1
  243. package/.next/static/chunks/app/api/auth/logout/[provider]/route-5d60af35a4bb1818.js +0 -1
  244. package/.next/static/chunks/app/api/auth/providers/route-5d60af35a4bb1818.js +0 -1
  245. package/.next/static/chunks/app/api/cache-miss-notices/route-5d60af35a4bb1818.js +0 -1
  246. package/.next/static/chunks/app/api/cwd/browse/route-5d60af35a4bb1818.js +0 -1
  247. package/.next/static/chunks/app/api/cwd/pick/route-5d60af35a4bb1818.js +0 -1
  248. package/.next/static/chunks/app/api/cwd/validate/route-5d60af35a4bb1818.js +0 -1
  249. package/.next/static/chunks/app/api/default-cwd/route-5d60af35a4bb1818.js +0 -1
  250. package/.next/static/chunks/app/api/file-index/route-5d60af35a4bb1818.js +0 -1
  251. package/.next/static/chunks/app/api/files/[...path]/route-5d60af35a4bb1818.js +0 -1
  252. package/.next/static/chunks/app/api/git/diff/route-5d60af35a4bb1818.js +0 -1
  253. package/.next/static/chunks/app/api/git/status/route-5d60af35a4bb1818.js +0 -1
  254. package/.next/static/chunks/app/api/home/route-5d60af35a4bb1818.js +0 -1
  255. package/.next/static/chunks/app/api/mcp/route-5d60af35a4bb1818.js +0 -1
  256. package/.next/static/chunks/app/api/mcp/sign-in/[flowId]/route-5d60af35a4bb1818.js +0 -1
  257. package/.next/static/chunks/app/api/mcp/sign-in/route-5d60af35a4bb1818.js +0 -1
  258. package/.next/static/chunks/app/api/mcp/test/route-5d60af35a4bb1818.js +0 -1
  259. package/.next/static/chunks/app/api/models/default/route-5d60af35a4bb1818.js +0 -1
  260. package/.next/static/chunks/app/api/models/enabled/route-5d60af35a4bb1818.js +0 -1
  261. package/.next/static/chunks/app/api/models/refresh/route-5d60af35a4bb1818.js +0 -1
  262. package/.next/static/chunks/app/api/models/route-5d60af35a4bb1818.js +0 -1
  263. package/.next/static/chunks/app/api/models-config/catalog/route-5d60af35a4bb1818.js +0 -1
  264. package/.next/static/chunks/app/api/models-config/discover/route-5d60af35a4bb1818.js +0 -1
  265. package/.next/static/chunks/app/api/models-config/route-5d60af35a4bb1818.js +0 -1
  266. package/.next/static/chunks/app/api/models-config/test/route-5d60af35a4bb1818.js +0 -1
  267. package/.next/static/chunks/app/api/open-in-explorer/route-5d60af35a4bb1818.js +0 -1
  268. package/.next/static/chunks/app/api/plugins/check/route-5d60af35a4bb1818.js +0 -1
  269. package/.next/static/chunks/app/api/plugins/route-5d60af35a4bb1818.js +0 -1
  270. package/.next/static/chunks/app/api/project-trust/route-5d60af35a4bb1818.js +0 -1
  271. package/.next/static/chunks/app/api/provider-usage/query/route-5d60af35a4bb1818.js +0 -1
  272. package/.next/static/chunks/app/api/push/config/route-5d60af35a4bb1818.js +0 -1
  273. package/.next/static/chunks/app/api/push/subscribe/route-5d60af35a4bb1818.js +0 -1
  274. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-5d60af35a4bb1818.js +0 -1
  275. package/.next/static/chunks/app/api/sessions/[id]/context/route-5d60af35a4bb1818.js +0 -1
  276. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-5d60af35a4bb1818.js +0 -1
  277. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route-5d60af35a4bb1818.js +0 -1
  278. package/.next/static/chunks/app/api/sessions/[id]/export/route-5d60af35a4bb1818.js +0 -1
  279. package/.next/static/chunks/app/api/sessions/[id]/fork/route-5d60af35a4bb1818.js +0 -1
  280. package/.next/static/chunks/app/api/sessions/[id]/route-5d60af35a4bb1818.js +0 -1
  281. package/.next/static/chunks/app/api/sessions/[id]/state/route-5d60af35a4bb1818.js +0 -1
  282. package/.next/static/chunks/app/api/sessions/delete/route-5d60af35a4bb1818.js +0 -1
  283. package/.next/static/chunks/app/api/sessions/route-5d60af35a4bb1818.js +0 -1
  284. package/.next/static/chunks/app/api/sessions/search/route-5d60af35a4bb1818.js +0 -1
  285. package/.next/static/chunks/app/api/sessions/stats/route-5d60af35a4bb1818.js +0 -1
  286. package/.next/static/chunks/app/api/sessions/ui-state/route-5d60af35a4bb1818.js +0 -1
  287. package/.next/static/chunks/app/api/skills/check/route-5d60af35a4bb1818.js +0 -1
  288. package/.next/static/chunks/app/api/skills/content/route-5d60af35a4bb1818.js +0 -1
  289. package/.next/static/chunks/app/api/skills/install/route-5d60af35a4bb1818.js +0 -1
  290. package/.next/static/chunks/app/api/skills/route-5d60af35a4bb1818.js +0 -1
  291. package/.next/static/chunks/app/api/skills/search/route-5d60af35a4bb1818.js +0 -1
  292. package/.next/static/chunks/app/api/skills/update/route-5d60af35a4bb1818.js +0 -1
  293. package/.next/static/chunks/app/api/subagents/[id]/route-5d60af35a4bb1818.js +0 -1
  294. package/.next/static/chunks/app/api/subagents/profiles/route-5d60af35a4bb1818.js +0 -1
  295. package/.next/static/chunks/app/api/subagents/settings/route-5d60af35a4bb1818.js +0 -1
  296. package/.next/static/chunks/app/api/terminal/[id]/events/route-5d60af35a4bb1818.js +0 -1
  297. package/.next/static/chunks/app/api/terminal/[id]/route-5d60af35a4bb1818.js +0 -1
  298. package/.next/static/chunks/app/api/terminal/route-5d60af35a4bb1818.js +0 -1
  299. package/.next/static/chunks/app/api/tools/settings/route-5d60af35a4bb1818.js +0 -1
  300. package/.next/static/chunks/app/api/web-auth/route-5d60af35a4bb1818.js +0 -1
  301. package/.next/static/chunks/app/api/worktrees/route-5d60af35a4bb1818.js +0 -1
  302. package/.next/static/chunks/app/manifest.webmanifest/route-5d60af35a4bb1818.js +0 -1
  303. package/.next/static/chunks/app/page-ae6a7d3a5517d7e9.js +0 -286
  304. package/.next/static/chunks/next/dist/client/components/builtin/app-error-5d60af35a4bb1818.js +0 -1
  305. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-5d60af35a4bb1818.js +0 -1
  306. package/.next/static/chunks/next/dist/client/components/builtin/not-found-5d60af35a4bb1818.js +0 -1
  307. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-5d60af35a4bb1818.js +0 -1
  308. package/.next/static/css/992381f1f993c50d.css +0 -1
  309. /package/.next/static/{-g1KUgp8qZzNmZ5_sTyxp → d8QChh2wYaULqtNavrBMx}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";exports.id=2650,exports.ids=[2650],exports.modules={2650:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{B6:()=>C,Db:()=>z,Lx:()=>G,M7:()=>A,Vq:()=>w,W3:()=>s,cu:()=>m,kE:()=>t,n7:()=>B,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 C="PI_WEB_DISABLE_MCP";function m(a=process.env){let b=a[C]?.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 D=Symbol.for("pi-web.codemodeSandbox");function p(){let a=globalThis;return a[D]??=o().then(a=>(a.available||console.warn(`[pi-web] Code mode is off: ${a.reason}`),a))}let E=Symbol("not settled");async function q(){let a=globalThis[D];if(!a)return{checked:!1};let b=await Promise.race([a,Promise.resolve(E)]);return b===E?{checked:!1}:{checked:!0,...b}}let F=Symbol.for("pi-web.mcpOffWarned");async function r(){let a=function(a,b=process.env){return m(b)?{available:!1,reason:`${C} is set`}:a.ok?{available:!0,internals:a}:{available:!1,reason:a.reason}}(await (0,i.U)()),b=globalThis;return a.available||m()||b[F]===a.reason||(b[F]=a.reason,console.warn(`[pi-web] MCP is off: ${a.reason}`)),a}let G=["codemode","tool-search","mcp"];function s(a){return"string"==typeof a&&G.includes(a)}function t(a,b,c){let d=`builtin:${b}`;return[...a.filter(a=>(/^[!+-]/.test(a)?a.slice(1):a)!==d),`${c?"+":"-"}${d}`]}function u(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 v(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:[...G]}),i=await h.resolve(async()=>"skip"),j={};for(let a of G){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 w(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=u(g.global),i=c?u(g.project,k.T):void 0,j=await v({agentDir:b,cwd:d,projectTrusted:c},{global:h,project:i},g);if(void 0===i)return j;let l=await v({agentDir:b,cwd:d,projectTrusted:!1},{global:h},g);for(let a of G)j[a].global=l[a];return j}let H=()=>{};function x(a,b){return{name:a,factory:b,replaceable:!0,builtin:!0}}function y(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=[x("tool-search",c("tool-search",(0,f.createToolSearchExtension)())),x("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:()=>{}}):H))];return d&&e.push(d.extension()),{extensions:e,mcpHost:d}}async function z(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 w({agentDir:a.agentDir,cwd:a.cwd,projectTrusted:a.projectTrusted()})).codemode.enabled&&await c(b)}}}async function A(a){return y(await r(),{agentDir:a.agentDir,codemodeAvailable:()=>a.codemode,...a.mcpHost?{mcpHost:a.mcpHost}:{},gate:(b,c)=>async d=>{(await w({agentDir:a.agentDir,cwd:a.cwd,projectTrusted:a.projectTrusted()}))[b].enabled&&await c(d)}})}async function B(a){let[b,c]=await Promise.all([p(),r()]),{extensions:d,mcpHost:e}=y(c,{agentDir:a.agentDir,codemodeAvailable:()=>b.available,...a.mcpHost?{mcpHost:a.mcpHost}:{}});return{extensions:[x("codemode",b.available?(0,f.createCodemodeExtension)():H),...d],mcpHost:e}}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)}})}};