@baique/pi-web-sky 0.1.54 → 0.1.56

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 (509) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +14 -10
  3. package/.next/build-manifest.json +4 -4
  4. package/.next/next-server.js.nft.json +1 -1
  5. package/.next/prerender-manifest.json +6 -6
  6. package/.next/react-loadable-manifest.json +3 -3
  7. package/.next/required-server-files.js +6 -6
  8. package/.next/required-server-files.json +6 -6
  9. package/.next/routes-manifest.json +28 -0
  10. package/.next/server/app/_global-error/page.js +2 -2
  11. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/_global-error.html +1 -1
  13. package/.next/server/app/_global-error.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/.next/server/app/_not-found/page.js +1 -1
  18. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/.next/server/app/_not-found.html +1 -1
  20. package/.next/server/app/_not-found.rsc +4 -3
  21. package/.next/server/app/_not-found.segments/_full.segment.rsc +4 -3
  22. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -3
  23. package/.next/server/app/_not-found.segments/_tree.segment.rsc +3 -2
  24. package/.next/server/app/api/agent/[id]/bash-output/route.js +2 -2
  25. package/.next/server/app/api/agent/[id]/bash-output/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/agent/[id]/events/route.js +2 -2
  27. package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
  28. package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +1 -1
  29. package/.next/server/app/api/agent/[id]/route.js +1 -1
  30. package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
  31. package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/agent/new/route.js +1 -1
  33. package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
  34. package/.next/server/app/api/agent/new/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/agent/running/route.js +1 -1
  36. package/.next/server/app/api/agent/running/route.js.nft.json +1 -1
  37. package/.next/server/app/api/agent/running/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/app-update/route.js +1 -1
  39. package/.next/server/app/api/app-update/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/auth/all-providers/route.js +1 -1
  41. package/.next/server/app/api/auth/all-providers/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  43. package/.next/server/app/api/auth/api-key/[provider]/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/auth/login/[provider]/route.js +1 -1
  45. package/.next/server/app/api/auth/login/[provider]/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  47. package/.next/server/app/api/auth/logout/[provider]/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/auth/providers/route.js +1 -1
  49. package/.next/server/app/api/auth/providers/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/board-assets/[...path]/route.js +2 -2
  51. package/.next/server/app/api/board-assets/[...path]/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/board-assets/route.js +2 -2
  53. package/.next/server/app/api/board-assets/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/boards/[id]/add-session/route.js +1 -0
  55. package/.next/server/app/api/boards/[id]/add-session/route.js.nft.json +1 -0
  56. package/.next/server/app/api/boards/[id]/add-session/route_client-reference-manifest.js +1 -0
  57. package/.next/server/app/api/boards/[id]/reconcile/route.js +1 -1
  58. package/.next/server/app/api/boards/[id]/reconcile/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/api/boards/[id]/route.js +1 -1
  60. package/.next/server/app/api/boards/[id]/route_client-reference-manifest.js +1 -1
  61. package/.next/server/app/api/boards/reorder/route.js +2 -2
  62. package/.next/server/app/api/boards/reorder/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/boards/route.js +2 -2
  64. package/.next/server/app/api/boards/route_client-reference-manifest.js +1 -1
  65. package/.next/server/app/api/cwd/browse/route.js +1 -1
  66. package/.next/server/app/api/cwd/browse/route_client-reference-manifest.js +1 -1
  67. package/.next/server/app/api/cwd/validate/route.js +2 -2
  68. package/.next/server/app/api/cwd/validate/route_client-reference-manifest.js +1 -1
  69. package/.next/server/app/api/default-cwd/route.js +2 -2
  70. package/.next/server/app/api/default-cwd/route_client-reference-manifest.js +1 -1
  71. package/.next/server/app/api/file-index/route.js +2 -2
  72. package/.next/server/app/api/file-index/route_client-reference-manifest.js +1 -1
  73. package/.next/server/app/api/files/[...path]/route.js +3 -3
  74. package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/git/diff/route.js +1 -1
  76. package/.next/server/app/api/git/diff/route_client-reference-manifest.js +1 -1
  77. package/.next/server/app/api/git/status/route.js +1 -1
  78. package/.next/server/app/api/git/status/route_client-reference-manifest.js +1 -1
  79. package/.next/server/app/api/home/route.js +1 -1
  80. package/.next/server/app/api/home/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/mcp/route.js +2 -2
  82. package/.next/server/app/api/mcp/route_client-reference-manifest.js +1 -1
  83. package/.next/server/app/api/models/route.js +2 -2
  84. package/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  85. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  86. package/.next/server/app/api/models-config/catalog/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/models-config/discover/route.js +1 -1
  88. package/.next/server/app/api/models-config/discover/route_client-reference-manifest.js +1 -1
  89. package/.next/server/app/api/models-config/route.js +1 -1
  90. package/.next/server/app/api/models-config/route_client-reference-manifest.js +1 -1
  91. package/.next/server/app/api/models-config/test/route.js +1 -1
  92. package/.next/server/app/api/models-config/test/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/plugins/route.js +2 -2
  94. package/.next/server/app/api/plugins/route_client-reference-manifest.js +1 -1
  95. package/.next/server/app/api/project-trust/route.js +1 -1
  96. package/.next/server/app/api/project-trust/route.js.nft.json +1 -1
  97. package/.next/server/app/api/project-trust/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/quota/route.js +1 -1
  99. package/.next/server/app/api/quota/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/search/route.js +2 -2
  101. package/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/sessions/[id]/auto-name/route.js +2 -2
  103. package/.next/server/app/api/sessions/[id]/auto-name/route.js.nft.json +1 -1
  104. package/.next/server/app/api/sessions/[id]/auto-name/route_client-reference-manifest.js +1 -1
  105. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  106. package/.next/server/app/api/sessions/[id]/context/route.js.nft.json +1 -1
  107. package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +1 -1
  108. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +2 -2
  109. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/sessions/[id]/export/route.js +3 -3
  111. package/.next/server/app/api/sessions/[id]/export/route_client-reference-manifest.js +1 -1
  112. package/.next/server/app/api/sessions/[id]/minimap/route.js +1 -1
  113. package/.next/server/app/api/sessions/[id]/minimap/route.js.nft.json +1 -1
  114. package/.next/server/app/api/sessions/[id]/minimap/route_client-reference-manifest.js +1 -1
  115. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  116. package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  117. package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -1
  118. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  119. package/.next/server/app/api/sessions/[id]/state/route.js.nft.json +1 -1
  120. package/.next/server/app/api/sessions/[id]/state/route_client-reference-manifest.js +1 -1
  121. package/.next/server/app/api/sessions/[id]/todos/route.js +1 -1
  122. package/.next/server/app/api/sessions/[id]/todos/route.js.nft.json +1 -1
  123. package/.next/server/app/api/sessions/[id]/todos/route_client-reference-manifest.js +1 -1
  124. package/.next/server/app/api/sessions/route.js +1 -1
  125. package/.next/server/app/api/sessions/route.js.nft.json +1 -1
  126. package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  127. package/.next/server/app/api/sessions/summary/route.js +2 -2
  128. package/.next/server/app/api/sessions/summary/route_client-reference-manifest.js +1 -1
  129. package/.next/server/app/api/skills/check/route.js +1 -1
  130. package/.next/server/app/api/skills/check/route_client-reference-manifest.js +1 -1
  131. package/.next/server/app/api/skills/install/route.js +2 -2
  132. package/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -1
  133. package/.next/server/app/api/skills/route.js +1 -1
  134. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  135. package/.next/server/app/api/skills/search/route.js +1 -1
  136. package/.next/server/app/api/skills/search/route_client-reference-manifest.js +1 -1
  137. package/.next/server/app/api/skills/update/route.js +1 -1
  138. package/.next/server/app/api/skills/update/route_client-reference-manifest.js +1 -1
  139. package/.next/server/app/api/subagents/[id]/route.js +1 -0
  140. package/.next/server/app/api/subagents/[id]/route.js.nft.json +1 -0
  141. package/.next/server/app/api/subagents/[id]/route_client-reference-manifest.js +1 -0
  142. package/.next/server/app/api/subagents/profiles/route.js +30 -0
  143. package/.next/server/app/api/subagents/profiles/route.js.nft.json +1 -0
  144. package/.next/server/app/api/subagents/profiles/route_client-reference-manifest.js +1 -0
  145. package/.next/server/app/api/subagents/settings/route.js +1 -0
  146. package/.next/server/app/api/subagents/settings/route.js.nft.json +1 -0
  147. package/.next/server/app/api/subagents/settings/route_client-reference-manifest.js +1 -0
  148. package/.next/server/app/api/task-card-questions/[id]/answer/route.js +2 -2
  149. package/.next/server/app/api/task-card-questions/[id]/answer/route_client-reference-manifest.js +1 -1
  150. package/.next/server/app/api/task-card-questions/route.js +2 -2
  151. package/.next/server/app/api/task-card-questions/route_client-reference-manifest.js +1 -1
  152. package/.next/server/app/api/task-cards/[id]/route.js +1 -1
  153. package/.next/server/app/api/task-cards/[id]/route_client-reference-manifest.js +1 -1
  154. package/.next/server/app/api/task-cards/route.js +1 -1
  155. package/.next/server/app/api/task-cards/route_client-reference-manifest.js +1 -1
  156. package/.next/server/app/api/task-cards/unbind/route.js +3 -3
  157. package/.next/server/app/api/task-cards/unbind/route_client-reference-manifest.js +1 -1
  158. package/.next/server/app/api/task-scheduler/status/route.js +1 -1
  159. package/.next/server/app/api/task-scheduler/status/route.js.nft.json +1 -1
  160. package/.next/server/app/api/task-scheduler/status/route_client-reference-manifest.js +1 -1
  161. package/.next/server/app/api/tasks/[id]/assign-session/route.js +12 -12
  162. package/.next/server/app/api/tasks/[id]/assign-session/route_client-reference-manifest.js +1 -1
  163. package/.next/server/app/api/tasks/[id]/board/route.js +1 -1
  164. package/.next/server/app/api/tasks/[id]/board/route_client-reference-manifest.js +1 -1
  165. package/.next/server/app/api/tasks/[id]/route.js +1 -1
  166. package/.next/server/app/api/tasks/[id]/route.js.nft.json +1 -1
  167. package/.next/server/app/api/tasks/[id]/route_client-reference-manifest.js +1 -1
  168. package/.next/server/app/api/tasks/reorder/route.js +12 -12
  169. package/.next/server/app/api/tasks/reorder/route_client-reference-manifest.js +1 -1
  170. package/.next/server/app/api/tasks/route.js +12 -12
  171. package/.next/server/app/api/tasks/route_client-reference-manifest.js +1 -1
  172. package/.next/server/app/api/terminal/[id]/events/route.js +3 -3
  173. package/.next/server/app/api/terminal/[id]/events/route_client-reference-manifest.js +1 -1
  174. package/.next/server/app/api/terminal/[id]/route.js +2 -2
  175. package/.next/server/app/api/terminal/[id]/route_client-reference-manifest.js +1 -1
  176. package/.next/server/app/api/terminal/route.js +2 -2
  177. package/.next/server/app/api/terminal/route_client-reference-manifest.js +1 -1
  178. package/.next/server/app/api/worktrees/route.js +2 -2
  179. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  180. package/.next/server/app/api/yjs-version/route.js +1 -1
  181. package/.next/server/app/api/yjs-version/route_client-reference-manifest.js +1 -1
  182. package/.next/server/app/favicon.ico/route.js +1 -1
  183. package/.next/server/app/index.html +1 -1
  184. package/.next/server/app/index.rsc +6 -5
  185. package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -5
  186. package/.next/server/app/index.segments/_full.segment.rsc +6 -5
  187. package/.next/server/app/index.segments/_tree.segment.rsc +3 -2
  188. package/.next/server/app/manifest.webmanifest/route.js +2 -2
  189. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  190. package/.next/server/app/page.js +175 -8
  191. package/.next/server/app/page_client-reference-manifest.js +1 -1
  192. package/.next/server/app-paths-manifest.json +14 -10
  193. package/.next/server/chunks/1937.js +1 -1
  194. package/.next/server/chunks/2430.js +4 -4
  195. package/.next/server/chunks/3500.js +1 -1
  196. package/.next/server/chunks/402.js +13 -3
  197. package/.next/server/chunks/426.js +14 -0
  198. package/.next/server/chunks/4457.js +13 -13
  199. package/.next/server/chunks/542.js +23 -4
  200. package/.next/server/chunks/5794.js +2 -2
  201. package/.next/server/chunks/5940.js +1 -1
  202. package/.next/server/chunks/6429.js +15 -2
  203. package/.next/server/chunks/6525.js +12 -2
  204. package/.next/server/chunks/6583.js +1 -1
  205. package/.next/server/chunks/7048.js +6 -0
  206. package/.next/server/instrumentation.js +1 -1
  207. package/.next/server/middleware-build-manifest.js +1 -1
  208. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  209. package/.next/server/middleware.js +3 -3
  210. package/.next/server/next-font-manifest.js +1 -1
  211. package/.next/server/next-font-manifest.json +1 -1
  212. package/.next/server/pages/404.html +1 -1
  213. package/.next/server/pages/500.html +1 -1
  214. package/.next/server/server-reference-manifest.json +1 -1
  215. package/.next/static/chunks/752.adce8bc3ebbaf4b6.js +1 -0
  216. package/.next/static/chunks/8088.0cad1ff2e09fd8ff.js +1 -0
  217. package/.next/static/chunks/app/_global-error/page-ad6e695deb9de65c.js +1 -0
  218. package/.next/static/chunks/app/_not-found/page-63a39396532d2582.js +1 -0
  219. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-ad6e695deb9de65c.js +1 -0
  220. package/.next/static/chunks/app/api/agent/[id]/events/route-ad6e695deb9de65c.js +1 -0
  221. package/.next/static/chunks/app/api/agent/[id]/route-ad6e695deb9de65c.js +1 -0
  222. package/.next/static/chunks/app/api/agent/new/route-ad6e695deb9de65c.js +1 -0
  223. package/.next/static/chunks/app/api/agent/running/route-ad6e695deb9de65c.js +1 -0
  224. package/.next/static/chunks/app/api/app-update/route-ad6e695deb9de65c.js +1 -0
  225. package/.next/static/chunks/app/api/auth/all-providers/route-ad6e695deb9de65c.js +1 -0
  226. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-ad6e695deb9de65c.js +1 -0
  227. package/.next/static/chunks/app/api/auth/login/[provider]/route-ad6e695deb9de65c.js +1 -0
  228. package/.next/static/chunks/app/api/auth/logout/[provider]/route-ad6e695deb9de65c.js +1 -0
  229. package/.next/static/chunks/app/api/auth/providers/route-ad6e695deb9de65c.js +1 -0
  230. package/.next/static/chunks/app/api/board-assets/[...path]/route-ad6e695deb9de65c.js +1 -0
  231. package/.next/static/chunks/app/api/board-assets/route-ad6e695deb9de65c.js +1 -0
  232. package/.next/static/chunks/app/api/boards/[id]/add-session/route-ad6e695deb9de65c.js +1 -0
  233. package/.next/static/chunks/app/api/boards/[id]/reconcile/route-ad6e695deb9de65c.js +1 -0
  234. package/.next/static/chunks/app/api/boards/[id]/route-ad6e695deb9de65c.js +1 -0
  235. package/.next/static/chunks/app/api/boards/reorder/route-ad6e695deb9de65c.js +1 -0
  236. package/.next/static/chunks/app/api/boards/route-ad6e695deb9de65c.js +1 -0
  237. package/.next/static/chunks/app/api/cwd/browse/route-ad6e695deb9de65c.js +1 -0
  238. package/.next/static/chunks/app/api/cwd/validate/route-ad6e695deb9de65c.js +1 -0
  239. package/.next/static/chunks/app/api/default-cwd/route-ad6e695deb9de65c.js +1 -0
  240. package/.next/static/chunks/app/api/file-index/route-ad6e695deb9de65c.js +1 -0
  241. package/.next/static/chunks/app/api/files/[...path]/route-ad6e695deb9de65c.js +1 -0
  242. package/.next/static/chunks/app/api/git/diff/route-ad6e695deb9de65c.js +1 -0
  243. package/.next/static/chunks/app/api/git/status/route-ad6e695deb9de65c.js +1 -0
  244. package/.next/static/chunks/app/api/home/route-ad6e695deb9de65c.js +1 -0
  245. package/.next/static/chunks/app/api/mcp/route-ad6e695deb9de65c.js +1 -0
  246. package/.next/static/chunks/app/api/models/route-ad6e695deb9de65c.js +1 -0
  247. package/.next/static/chunks/app/api/models-config/catalog/route-ad6e695deb9de65c.js +1 -0
  248. package/.next/static/chunks/app/api/models-config/discover/route-ad6e695deb9de65c.js +1 -0
  249. package/.next/static/chunks/app/api/models-config/route-ad6e695deb9de65c.js +1 -0
  250. package/.next/static/chunks/app/api/models-config/test/route-ad6e695deb9de65c.js +1 -0
  251. package/.next/static/chunks/app/api/plugins/route-ad6e695deb9de65c.js +1 -0
  252. package/.next/static/chunks/app/api/project-trust/route-ad6e695deb9de65c.js +1 -0
  253. package/.next/static/chunks/app/api/quota/route-ad6e695deb9de65c.js +1 -0
  254. package/.next/static/chunks/app/api/search/route-ad6e695deb9de65c.js +1 -0
  255. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-ad6e695deb9de65c.js +1 -0
  256. package/.next/static/chunks/app/api/sessions/[id]/context/route-ad6e695deb9de65c.js +1 -0
  257. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-ad6e695deb9de65c.js +1 -0
  258. package/.next/static/chunks/app/api/sessions/[id]/export/route-ad6e695deb9de65c.js +1 -0
  259. package/.next/static/chunks/app/api/sessions/[id]/minimap/route-ad6e695deb9de65c.js +1 -0
  260. package/.next/static/chunks/app/api/sessions/[id]/route-ad6e695deb9de65c.js +1 -0
  261. package/.next/static/chunks/app/api/sessions/[id]/state/route-ad6e695deb9de65c.js +1 -0
  262. package/.next/static/chunks/app/api/sessions/[id]/todos/route-ad6e695deb9de65c.js +1 -0
  263. package/.next/static/chunks/app/api/sessions/route-ad6e695deb9de65c.js +1 -0
  264. package/.next/static/chunks/app/api/sessions/summary/route-ad6e695deb9de65c.js +1 -0
  265. package/.next/static/chunks/app/api/skills/check/route-ad6e695deb9de65c.js +1 -0
  266. package/.next/static/chunks/app/api/skills/install/route-ad6e695deb9de65c.js +1 -0
  267. package/.next/static/chunks/app/api/skills/route-ad6e695deb9de65c.js +1 -0
  268. package/.next/static/chunks/app/api/skills/search/route-ad6e695deb9de65c.js +1 -0
  269. package/.next/static/chunks/app/api/skills/update/route-ad6e695deb9de65c.js +1 -0
  270. package/.next/static/chunks/app/api/subagents/[id]/route-ad6e695deb9de65c.js +1 -0
  271. package/.next/static/chunks/app/api/subagents/profiles/route-ad6e695deb9de65c.js +1 -0
  272. package/.next/static/chunks/app/api/subagents/settings/route-ad6e695deb9de65c.js +1 -0
  273. package/.next/static/chunks/app/api/task-card-questions/[id]/answer/route-ad6e695deb9de65c.js +1 -0
  274. package/.next/static/chunks/app/api/task-card-questions/route-ad6e695deb9de65c.js +1 -0
  275. package/.next/static/chunks/app/api/task-cards/[id]/route-ad6e695deb9de65c.js +1 -0
  276. package/.next/static/chunks/app/api/task-cards/route-ad6e695deb9de65c.js +1 -0
  277. package/.next/static/chunks/app/api/task-cards/unbind/route-ad6e695deb9de65c.js +1 -0
  278. package/.next/static/chunks/app/api/task-scheduler/status/route-ad6e695deb9de65c.js +1 -0
  279. package/.next/static/chunks/app/api/tasks/[id]/assign-session/route-ad6e695deb9de65c.js +1 -0
  280. package/.next/static/chunks/app/api/tasks/[id]/board/route-ad6e695deb9de65c.js +1 -0
  281. package/.next/static/chunks/app/api/tasks/[id]/route-ad6e695deb9de65c.js +1 -0
  282. package/.next/static/chunks/app/api/tasks/reorder/route-ad6e695deb9de65c.js +1 -0
  283. package/.next/static/chunks/app/api/tasks/route-ad6e695deb9de65c.js +1 -0
  284. package/.next/static/chunks/app/api/terminal/[id]/events/route-ad6e695deb9de65c.js +1 -0
  285. package/.next/static/chunks/app/api/terminal/[id]/route-ad6e695deb9de65c.js +1 -0
  286. package/.next/static/chunks/app/api/terminal/route-ad6e695deb9de65c.js +1 -0
  287. package/.next/static/chunks/app/api/worktrees/route-ad6e695deb9de65c.js +1 -0
  288. package/.next/static/chunks/app/api/yjs-version/route-ad6e695deb9de65c.js +1 -0
  289. package/.next/static/chunks/app/layout-87087b955e0c9507.js +1 -0
  290. package/.next/static/chunks/app/manifest.webmanifest/route-ad6e695deb9de65c.js +1 -0
  291. package/.next/static/chunks/app/page-efca6bf51a5f8ccb.js +256 -0
  292. package/.next/static/chunks/main-app-1f89e7ad7ae1ff87.js +1 -0
  293. package/.next/static/chunks/next/dist/client/components/builtin/app-error-ad6e695deb9de65c.js +1 -0
  294. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-ad6e695deb9de65c.js +1 -0
  295. package/.next/static/chunks/next/dist/client/components/builtin/global-error-d3784ab2e32f3c6e.js +1 -0
  296. package/.next/static/chunks/next/dist/client/components/builtin/not-found-ad6e695deb9de65c.js +1 -0
  297. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-ad6e695deb9de65c.js +1 -0
  298. package/.next/static/chunks/{webpack-3df5ae3897959c33.js → webpack-4de8e8dd9f2f3173.js} +1 -1
  299. package/.next/static/css/bb9361c7f832a89d.css +1 -0
  300. package/.next/static/css/c6d32b6031181be7.css +1 -0
  301. package/.next/static/k8ZFqwz7d-bnK0ZiUVgCc/_buildManifest.js +1 -0
  302. package/.next/trace +7 -8
  303. package/.next/trace-build +1 -1
  304. package/.next/types/app/api/agent/[id]/bash-output/route.ts +1 -1
  305. package/.next/types/app/api/agent/[id]/events/route.ts +1 -1
  306. package/.next/types/app/api/agent/[id]/route.ts +1 -1
  307. package/.next/types/app/api/agent/new/route.ts +1 -1
  308. package/.next/types/app/api/agent/running/route.ts +1 -1
  309. package/.next/types/app/api/app-update/route.ts +1 -1
  310. package/.next/types/app/api/auth/all-providers/route.ts +1 -1
  311. package/.next/types/app/api/auth/api-key/[provider]/route.ts +1 -1
  312. package/.next/types/app/api/auth/login/[provider]/route.ts +1 -1
  313. package/.next/types/app/api/auth/logout/[provider]/route.ts +1 -1
  314. package/.next/types/app/api/auth/providers/route.ts +1 -1
  315. package/.next/types/app/api/board-assets/[...path]/route.ts +1 -1
  316. package/.next/types/app/api/board-assets/route.ts +1 -1
  317. package/.next/types/app/api/boards/[id]/add-session/route.ts +353 -0
  318. package/.next/types/app/api/boards/[id]/reconcile/route.ts +1 -1
  319. package/.next/types/app/api/boards/[id]/route.ts +1 -1
  320. package/.next/types/app/api/boards/reorder/route.ts +1 -1
  321. package/.next/types/app/api/boards/route.ts +1 -1
  322. package/.next/types/app/api/cwd/browse/route.ts +1 -1
  323. package/.next/types/app/api/cwd/validate/route.ts +1 -1
  324. package/.next/types/app/api/default-cwd/route.ts +1 -1
  325. package/.next/types/app/api/file-index/route.ts +1 -1
  326. package/.next/types/app/api/files/[...path]/route.ts +1 -1
  327. package/.next/types/app/api/git/diff/route.ts +1 -1
  328. package/.next/types/app/api/git/status/route.ts +1 -1
  329. package/.next/types/app/api/home/route.ts +1 -1
  330. package/.next/types/app/api/mcp/route.ts +1 -1
  331. package/.next/types/app/api/models/route.ts +1 -1
  332. package/.next/types/app/api/models-config/catalog/route.ts +1 -1
  333. package/.next/types/app/api/models-config/discover/route.ts +1 -1
  334. package/.next/types/app/api/models-config/route.ts +1 -1
  335. package/.next/types/app/api/models-config/test/route.ts +1 -1
  336. package/.next/types/app/api/plugins/route.ts +1 -1
  337. package/.next/types/app/api/project-trust/route.ts +1 -1
  338. package/.next/types/app/api/quota/route.ts +1 -1
  339. package/.next/types/app/api/search/route.ts +1 -1
  340. package/.next/types/app/api/sessions/[id]/auto-name/route.ts +1 -1
  341. package/.next/types/app/api/sessions/[id]/context/route.ts +1 -1
  342. package/.next/types/app/api/sessions/[id]/entries/[entryId]/thinking/route.ts +1 -1
  343. package/.next/types/app/api/sessions/[id]/export/route.ts +1 -1
  344. package/.next/types/app/api/sessions/[id]/minimap/route.ts +1 -1
  345. package/.next/types/app/api/sessions/[id]/route.ts +1 -1
  346. package/.next/types/app/api/sessions/[id]/state/route.ts +1 -1
  347. package/.next/types/app/api/sessions/[id]/todos/route.ts +1 -1
  348. package/.next/types/app/api/sessions/route.ts +1 -1
  349. package/.next/types/app/api/sessions/summary/route.ts +1 -1
  350. package/.next/types/app/api/skills/check/route.ts +1 -1
  351. package/.next/types/app/api/skills/install/route.ts +1 -1
  352. package/.next/types/app/api/skills/route.ts +1 -1
  353. package/.next/types/app/api/skills/search/route.ts +1 -1
  354. package/.next/types/app/api/skills/update/route.ts +1 -1
  355. package/.next/types/app/api/subagents/[id]/route.ts +353 -0
  356. package/.next/types/app/api/subagents/profiles/route.ts +353 -0
  357. package/.next/types/app/api/subagents/settings/route.ts +353 -0
  358. package/.next/types/app/api/task-card-questions/[id]/answer/route.ts +1 -1
  359. package/.next/types/app/api/task-card-questions/route.ts +1 -1
  360. package/.next/types/app/api/task-cards/[id]/route.ts +1 -1
  361. package/.next/types/app/api/task-cards/route.ts +1 -1
  362. package/.next/types/app/api/task-cards/unbind/route.ts +1 -1
  363. package/.next/types/app/api/task-scheduler/status/route.ts +1 -1
  364. package/.next/types/app/api/tasks/[id]/assign-session/route.ts +1 -1
  365. package/.next/types/app/api/tasks/[id]/board/route.ts +1 -1
  366. package/.next/types/app/api/tasks/[id]/route.ts +1 -1
  367. package/.next/types/app/api/tasks/reorder/route.ts +1 -1
  368. package/.next/types/app/api/tasks/route.ts +1 -1
  369. package/.next/types/app/api/terminal/[id]/events/route.ts +1 -1
  370. package/.next/types/app/api/terminal/[id]/route.ts +1 -1
  371. package/.next/types/app/api/terminal/route.ts +1 -1
  372. package/.next/types/app/api/worktrees/route.ts +1 -1
  373. package/.next/types/app/api/yjs-version/route.ts +1 -1
  374. package/.next/types/app/layout.ts +1 -1
  375. package/.next/types/app/page.ts +1 -1
  376. package/.next/types/routes.d.ts +5 -1
  377. package/.next/types/validator.ts +36 -0
  378. package/lib/api-types.ts +10 -0
  379. package/lib/board-events.rename.test.mjs +39 -0
  380. package/lib/board-events.ts +17 -0
  381. package/lib/board-reconcile.test.mjs +20 -0
  382. package/lib/board-reconcile.ts +54 -0
  383. package/lib/chat-lazy-load.test.mjs +0 -62
  384. package/lib/chat-lazy-load.ts +0 -13
  385. package/lib/chat-only.ts +23 -0
  386. package/lib/draft-stash.ts +4 -5
  387. package/lib/file-types.ts +16 -1
  388. package/lib/i18n/messages/en.ts +91 -0
  389. package/lib/i18n/messages/zh-CN.ts +91 -0
  390. package/lib/id.test.mjs +38 -0
  391. package/lib/id.ts +17 -0
  392. package/lib/message-text.ts +24 -0
  393. package/lib/models-cache.ts +1 -1
  394. package/lib/pi-types.ts +19 -1
  395. package/lib/pin-store.ts +85 -0
  396. package/lib/powershell-settings.ts +106 -0
  397. package/lib/quoted-selection.ts +4 -0
  398. package/lib/rpc-manager.ts +208 -22
  399. package/lib/session-family.test.mjs +49 -0
  400. package/lib/session-family.ts +80 -0
  401. package/lib/session-index-scanner.ts +39 -0
  402. package/lib/session-time-group.test.mjs +38 -0
  403. package/lib/session-time-group.ts +55 -0
  404. package/lib/settings-navigation.ts +124 -0
  405. package/lib/subagent-extension.test.mjs +424 -0
  406. package/lib/subagent-extension.ts +309 -0
  407. package/lib/subagent-input.test.mjs +63 -0
  408. package/lib/subagent-input.ts +71 -0
  409. package/lib/subagent-isolation.test.mjs +51 -0
  410. package/lib/subagent-profile-precedence.ts +20 -0
  411. package/lib/subagent-prompt.test.mjs +64 -0
  412. package/lib/subagent-prompt.ts +31 -0
  413. package/lib/subagent-queue.test.mjs +35 -0
  414. package/lib/subagent-queue.ts +74 -0
  415. package/lib/subagent-runtime.test.mjs +150 -0
  416. package/lib/subagent-runtime.ts +587 -0
  417. package/lib/subagent-settings.test.mjs +50 -0
  418. package/lib/subagent-settings.ts +93 -0
  419. package/lib/subagents.test.mjs +601 -0
  420. package/lib/subagents.ts +602 -0
  421. package/lib/tool-presets.ts +4 -0
  422. package/lib/types.ts +19 -0
  423. package/package.json +1 -1
  424. package/.next/static/chunks/752.3119700876725f3b.js +0 -1
  425. package/.next/static/chunks/7975.95edcabc69eee4eb.js +0 -1
  426. package/.next/static/chunks/app/_global-error/page-2d5f6296c7e693c6.js +0 -1
  427. package/.next/static/chunks/app/_not-found/page-af4fe23994cb3d66.js +0 -1
  428. package/.next/static/chunks/app/api/agent/[id]/bash-output/route-2d5f6296c7e693c6.js +0 -1
  429. package/.next/static/chunks/app/api/agent/[id]/events/route-2d5f6296c7e693c6.js +0 -1
  430. package/.next/static/chunks/app/api/agent/[id]/route-2d5f6296c7e693c6.js +0 -1
  431. package/.next/static/chunks/app/api/agent/new/route-2d5f6296c7e693c6.js +0 -1
  432. package/.next/static/chunks/app/api/agent/running/route-2d5f6296c7e693c6.js +0 -1
  433. package/.next/static/chunks/app/api/app-update/route-2d5f6296c7e693c6.js +0 -1
  434. package/.next/static/chunks/app/api/auth/all-providers/route-2d5f6296c7e693c6.js +0 -1
  435. package/.next/static/chunks/app/api/auth/api-key/[provider]/route-2d5f6296c7e693c6.js +0 -1
  436. package/.next/static/chunks/app/api/auth/login/[provider]/route-2d5f6296c7e693c6.js +0 -1
  437. package/.next/static/chunks/app/api/auth/logout/[provider]/route-2d5f6296c7e693c6.js +0 -1
  438. package/.next/static/chunks/app/api/auth/providers/route-2d5f6296c7e693c6.js +0 -1
  439. package/.next/static/chunks/app/api/board-assets/[...path]/route-2d5f6296c7e693c6.js +0 -1
  440. package/.next/static/chunks/app/api/board-assets/route-2d5f6296c7e693c6.js +0 -1
  441. package/.next/static/chunks/app/api/boards/[id]/reconcile/route-2d5f6296c7e693c6.js +0 -1
  442. package/.next/static/chunks/app/api/boards/[id]/route-2d5f6296c7e693c6.js +0 -1
  443. package/.next/static/chunks/app/api/boards/reorder/route-2d5f6296c7e693c6.js +0 -1
  444. package/.next/static/chunks/app/api/boards/route-2d5f6296c7e693c6.js +0 -1
  445. package/.next/static/chunks/app/api/cwd/browse/route-2d5f6296c7e693c6.js +0 -1
  446. package/.next/static/chunks/app/api/cwd/validate/route-2d5f6296c7e693c6.js +0 -1
  447. package/.next/static/chunks/app/api/default-cwd/route-2d5f6296c7e693c6.js +0 -1
  448. package/.next/static/chunks/app/api/file-index/route-2d5f6296c7e693c6.js +0 -1
  449. package/.next/static/chunks/app/api/files/[...path]/route-2d5f6296c7e693c6.js +0 -1
  450. package/.next/static/chunks/app/api/git/diff/route-2d5f6296c7e693c6.js +0 -1
  451. package/.next/static/chunks/app/api/git/status/route-2d5f6296c7e693c6.js +0 -1
  452. package/.next/static/chunks/app/api/home/route-2d5f6296c7e693c6.js +0 -1
  453. package/.next/static/chunks/app/api/mcp/route-2d5f6296c7e693c6.js +0 -1
  454. package/.next/static/chunks/app/api/models/route-2d5f6296c7e693c6.js +0 -1
  455. package/.next/static/chunks/app/api/models-config/catalog/route-2d5f6296c7e693c6.js +0 -1
  456. package/.next/static/chunks/app/api/models-config/discover/route-2d5f6296c7e693c6.js +0 -1
  457. package/.next/static/chunks/app/api/models-config/route-2d5f6296c7e693c6.js +0 -1
  458. package/.next/static/chunks/app/api/models-config/test/route-2d5f6296c7e693c6.js +0 -1
  459. package/.next/static/chunks/app/api/plugins/route-2d5f6296c7e693c6.js +0 -1
  460. package/.next/static/chunks/app/api/project-trust/route-2d5f6296c7e693c6.js +0 -1
  461. package/.next/static/chunks/app/api/quota/route-2d5f6296c7e693c6.js +0 -1
  462. package/.next/static/chunks/app/api/search/route-2d5f6296c7e693c6.js +0 -1
  463. package/.next/static/chunks/app/api/sessions/[id]/auto-name/route-2d5f6296c7e693c6.js +0 -1
  464. package/.next/static/chunks/app/api/sessions/[id]/context/route-2d5f6296c7e693c6.js +0 -1
  465. package/.next/static/chunks/app/api/sessions/[id]/entries/[entryId]/thinking/route-2d5f6296c7e693c6.js +0 -1
  466. package/.next/static/chunks/app/api/sessions/[id]/export/route-2d5f6296c7e693c6.js +0 -1
  467. package/.next/static/chunks/app/api/sessions/[id]/minimap/route-2d5f6296c7e693c6.js +0 -1
  468. package/.next/static/chunks/app/api/sessions/[id]/route-2d5f6296c7e693c6.js +0 -1
  469. package/.next/static/chunks/app/api/sessions/[id]/state/route-2d5f6296c7e693c6.js +0 -1
  470. package/.next/static/chunks/app/api/sessions/[id]/todos/route-2d5f6296c7e693c6.js +0 -1
  471. package/.next/static/chunks/app/api/sessions/route-2d5f6296c7e693c6.js +0 -1
  472. package/.next/static/chunks/app/api/sessions/summary/route-2d5f6296c7e693c6.js +0 -1
  473. package/.next/static/chunks/app/api/skills/check/route-2d5f6296c7e693c6.js +0 -1
  474. package/.next/static/chunks/app/api/skills/install/route-2d5f6296c7e693c6.js +0 -1
  475. package/.next/static/chunks/app/api/skills/route-2d5f6296c7e693c6.js +0 -1
  476. package/.next/static/chunks/app/api/skills/search/route-2d5f6296c7e693c6.js +0 -1
  477. package/.next/static/chunks/app/api/skills/update/route-2d5f6296c7e693c6.js +0 -1
  478. package/.next/static/chunks/app/api/task-card-questions/[id]/answer/route-2d5f6296c7e693c6.js +0 -1
  479. package/.next/static/chunks/app/api/task-card-questions/route-2d5f6296c7e693c6.js +0 -1
  480. package/.next/static/chunks/app/api/task-cards/[id]/route-2d5f6296c7e693c6.js +0 -1
  481. package/.next/static/chunks/app/api/task-cards/route-2d5f6296c7e693c6.js +0 -1
  482. package/.next/static/chunks/app/api/task-cards/unbind/route-2d5f6296c7e693c6.js +0 -1
  483. package/.next/static/chunks/app/api/task-scheduler/status/route-2d5f6296c7e693c6.js +0 -1
  484. package/.next/static/chunks/app/api/tasks/[id]/assign-session/route-2d5f6296c7e693c6.js +0 -1
  485. package/.next/static/chunks/app/api/tasks/[id]/board/route-2d5f6296c7e693c6.js +0 -1
  486. package/.next/static/chunks/app/api/tasks/[id]/route-2d5f6296c7e693c6.js +0 -1
  487. package/.next/static/chunks/app/api/tasks/reorder/route-2d5f6296c7e693c6.js +0 -1
  488. package/.next/static/chunks/app/api/tasks/route-2d5f6296c7e693c6.js +0 -1
  489. package/.next/static/chunks/app/api/terminal/[id]/events/route-2d5f6296c7e693c6.js +0 -1
  490. package/.next/static/chunks/app/api/terminal/[id]/route-2d5f6296c7e693c6.js +0 -1
  491. package/.next/static/chunks/app/api/terminal/route-2d5f6296c7e693c6.js +0 -1
  492. package/.next/static/chunks/app/api/worktrees/route-2d5f6296c7e693c6.js +0 -1
  493. package/.next/static/chunks/app/api/yjs-version/route-2d5f6296c7e693c6.js +0 -1
  494. package/.next/static/chunks/app/layout-636e9e756d0734c7.js +0 -1
  495. package/.next/static/chunks/app/manifest.webmanifest/route-2d5f6296c7e693c6.js +0 -1
  496. package/.next/static/chunks/app/page-44daed9dcf9134eb.js +0 -89
  497. package/.next/static/chunks/main-app-b3e8a8d15d83e1f0.js +0 -1
  498. package/.next/static/chunks/next/dist/client/components/builtin/app-error-2d5f6296c7e693c6.js +0 -1
  499. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-2d5f6296c7e693c6.js +0 -1
  500. package/.next/static/chunks/next/dist/client/components/builtin/global-error-00a4badaccb388e6.js +0 -1
  501. package/.next/static/chunks/next/dist/client/components/builtin/not-found-2d5f6296c7e693c6.js +0 -1
  502. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-2d5f6296c7e693c6.js +0 -1
  503. package/.next/static/css/4a609fb185e7cff1.css +0 -1
  504. package/.next/static/h-hr7x0pqNUx3TyuarqWJ/_buildManifest.js +0 -1
  505. package/lib/extension-command.test.mjs +0 -63
  506. package/lib/extension-command.ts +0 -81
  507. package/lib/subagent-widget.test.mjs +0 -87
  508. package/lib/subagent-widget.ts +0 -109
  509. /package/.next/static/{h-hr7x0pqNUx3TyuarqWJ → k8ZFqwz7d-bnK0ZiUVgCc}/_ssgManifest.js +0 -0
@@ -0,0 +1,93 @@
1
+ import { existsSync, mkdirSync, readFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { getAgentDir } from "@earendil-works/pi-coding-agent";
4
+ import { writePrivateFileAtomicSync } from "./atomic-file";
5
+
6
+ export interface SubagentSettings {
7
+ builtInEnabled: boolean;
8
+ maxConcurrent: number;
9
+ }
10
+
11
+ type StoredSubagentSettings = Record<string, unknown> & {
12
+ version?: unknown;
13
+ builtInEnabled?: unknown;
14
+ maxConcurrent?: unknown;
15
+ };
16
+
17
+ export const DEFAULT_SUBAGENT_MAX_CONCURRENT = 10;
18
+ export const MAX_SUBAGENT_MAX_CONCURRENT = 32;
19
+
20
+ function readMaxConcurrent(value: unknown): number {
21
+ return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= MAX_SUBAGENT_MAX_CONCURRENT
22
+ ? value
23
+ : DEFAULT_SUBAGENT_MAX_CONCURRENT;
24
+ }
25
+
26
+ function settingsValue(builtInEnabled: boolean, maxConcurrent: number): SubagentSettings {
27
+ return Object.defineProperty({ builtInEnabled }, "maxConcurrent", {
28
+ value: maxConcurrent,
29
+ enumerable: false,
30
+ configurable: true,
31
+ }) as SubagentSettings;
32
+ }
33
+
34
+ export function getSubagentSettingsPath(agentDir = getAgentDir()): string {
35
+ return join(agentDir, "agents", "settings.json");
36
+ }
37
+
38
+ function readStoredSettings(settingsPath: string): StoredSubagentSettings {
39
+ if (!existsSync(settingsPath)) return {};
40
+ const parsed: unknown = JSON.parse(readFileSync(settingsPath, "utf8"));
41
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
42
+ throw new Error("Invalid subagent settings: expected an object");
43
+ }
44
+ return parsed as StoredSubagentSettings;
45
+ }
46
+
47
+ export function readSubagentSettings(
48
+ settingsPath = getSubagentSettingsPath(),
49
+ ): SubagentSettings {
50
+ const stored = readStoredSettings(settingsPath);
51
+ return settingsValue(stored.builtInEnabled === true, readMaxConcurrent(stored.maxConcurrent));
52
+ }
53
+
54
+ export function isBuiltInSubagentsEnabled(
55
+ settingsPath = getSubagentSettingsPath(),
56
+ ): boolean {
57
+ try {
58
+ return readSubagentSettings(settingsPath).builtInEnabled;
59
+ } catch {
60
+ return false;
61
+ }
62
+ }
63
+
64
+ export function writeBuiltInSubagentsEnabled(
65
+ enabled: boolean,
66
+ settingsPath = getSubagentSettingsPath(),
67
+ ): SubagentSettings {
68
+ const stored = readStoredSettings(settingsPath);
69
+ mkdirSync(dirname(settingsPath), { recursive: true });
70
+ writePrivateFileAtomicSync(settingsPath, JSON.stringify({
71
+ ...stored,
72
+ version: 1,
73
+ builtInEnabled: enabled,
74
+ }, null, 2));
75
+ return readSubagentSettings(settingsPath);
76
+ }
77
+
78
+ export function writeSubagentMaxConcurrent(
79
+ maxConcurrent: number,
80
+ settingsPath = getSubagentSettingsPath(),
81
+ ): SubagentSettings {
82
+ if (!Number.isInteger(maxConcurrent) || maxConcurrent < 1 || maxConcurrent > MAX_SUBAGENT_MAX_CONCURRENT) {
83
+ throw new Error(`maxConcurrent must be an integer between 1 and ${MAX_SUBAGENT_MAX_CONCURRENT}`);
84
+ }
85
+ const stored = readStoredSettings(settingsPath);
86
+ mkdirSync(dirname(settingsPath), { recursive: true });
87
+ writePrivateFileAtomicSync(settingsPath, JSON.stringify({
88
+ ...stored,
89
+ version: 1,
90
+ maxConcurrent,
91
+ }, null, 2));
92
+ return readSubagentSettings(settingsPath);
93
+ }
@@ -0,0 +1,601 @@
1
+ import assert from "node:assert/strict";
2
+ import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import test, { after } from "node:test";
6
+ import { createJiti } from "jiti";
7
+
8
+ const originalAgentDir = process.env.PI_CODING_AGENT_DIR;
9
+ const testAgentDir = await mkdtemp(join(tmpdir(), "pi-web-subagents-global-"));
10
+ process.env.PI_CODING_AGENT_DIR = testAgentDir;
11
+
12
+ const {
13
+ deleteSubagentProfile,
14
+ deleteProjectSubagentProfile,
15
+ listSubagentProfileSources,
16
+ listSubagentProfiles,
17
+ readSubagentRun,
18
+ readSubagentSessionResources,
19
+ resolveSubagentProfile,
20
+ saveSubagentProfile,
21
+ saveProjectSubagentProfile,
22
+ SUBAGENT_META_TYPE,
23
+ SUBAGENT_STATUS_TYPE,
24
+ SUBAGENT_RESULT_TYPE,
25
+ withSubagentExtensionTools,
26
+ selectSubagentExtensionTools,
27
+ } = await createJiti(import.meta.url).import("./subagents.ts");
28
+ const { isSubagentProfileOverridden } = await createJiti(import.meta.url).import("./subagent-profile-precedence.ts");
29
+
30
+ after(async () => {
31
+ if (originalAgentDir === undefined) delete process.env.PI_CODING_AGENT_DIR;
32
+ else process.env.PI_CODING_AGENT_DIR = originalAgentDir;
33
+ await rm(testAgentDir, { recursive: true, force: true });
34
+ });
35
+
36
+ function profile(overrides = {}) {
37
+ return {
38
+ name: "test-agent",
39
+ displayName: " Test agent ",
40
+ description: " Test description ",
41
+ systemPrompt: " Test prompt. ",
42
+ tools: ["read", "read", "unknown-tool"],
43
+ loadSkills: false,
44
+ loadExtensions: false,
45
+ model: " provider/model ",
46
+ thinking: "high",
47
+ maxTurns: 4.9,
48
+ inheritContext: false,
49
+ runInBackground: false,
50
+ enabled: true,
51
+ ...overrides,
52
+ };
53
+ }
54
+
55
+ test("built-in profile IDs use lowercase kebab-case and read-only profiles cannot execute shell commands", () => {
56
+ const profiles = listSubagentProfiles(testAgentDir);
57
+ for (const builtin of profiles.filter((item) => item.scope === "builtin")) {
58
+ assert.match(builtin.name, /^[a-z0-9]+(?:-[a-z0-9]+)*$/);
59
+ }
60
+ for (const name of ["explore", "plan"]) {
61
+ const builtin = profiles.find((item) => item.name === name);
62
+ assert.deepEqual(builtin.tools, ["read", "grep", "find", "ls"]);
63
+ assert.equal(builtin.tools.includes("bash"), false);
64
+ }
65
+ });
66
+
67
+ test("override detection follows scope precedence case-insensitively", () => {
68
+ const builtin = { name: "Reviewer", scope: "builtin" };
69
+ const global = { name: "reviewer", scope: "global" };
70
+ const workspace = { name: "REVIEWER", scope: "workspace" };
71
+ const project = { name: "Reviewer", scope: "project" };
72
+ const unrelated = { name: "other", scope: "builtin" };
73
+ const profiles = [builtin, global, workspace, project, unrelated];
74
+
75
+ assert.equal(isSubagentProfileOverridden(builtin, profiles), true);
76
+ assert.equal(isSubagentProfileOverridden(global, profiles), true);
77
+ assert.equal(isSubagentProfileOverridden(workspace, profiles), true);
78
+ assert.equal(isSubagentProfileOverridden(project, profiles), false);
79
+ assert.equal(isSubagentProfileOverridden(unrelated, profiles), false);
80
+ });
81
+
82
+ test("project profiles override built-ins and round-trip their runtime settings", async () => {
83
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
84
+ try {
85
+ saveProjectSubagentProfile(cwd, {
86
+ name: "Explore",
87
+ displayName: "Repository scout",
88
+ description: "Inspect this repository",
89
+ systemPrompt: "Read carefully and report findings.",
90
+ tools: ["read", "grep"],
91
+ loadSkills: true,
92
+ loadExtensions: true,
93
+ model: "anthropic/test-model",
94
+ thinking: "high",
95
+ maxTurns: 8,
96
+ inheritContext: true,
97
+ runInBackground: true,
98
+ enabled: true,
99
+ });
100
+
101
+ const profile = listSubagentProfiles(cwd).find((item) => item.name === "Explore");
102
+ assert.equal(profile.scope, "project");
103
+ assert.equal(profile.displayName, "Repository scout");
104
+ assert.deepEqual(profile.tools, ["read", "grep"]);
105
+ assert.equal(profile.loadSkills, true);
106
+ assert.equal(profile.loadExtensions, true);
107
+ assert.equal(profile.thinking, "high");
108
+ assert.equal(profile.maxTurns, 8);
109
+ assert.equal(profile.inheritContext, true);
110
+ assert.equal(profile.runInBackground, true);
111
+
112
+ const source = await readFile(join(cwd, ".pi", "agents", "Explore.md"), "utf8");
113
+ assert.match(source, /max_turns: 8/);
114
+ assert.match(source, /load_skills: true/);
115
+ assert.match(source, /load_extensions: true/);
116
+ assert.match(source, /Read carefully and report findings\./);
117
+ } finally {
118
+ await rm(cwd, { recursive: true, force: true });
119
+ }
120
+ });
121
+
122
+ test("tintinweb extension selectors stay scoped to the selected extension tools", async () => {
123
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
124
+ try {
125
+ await mkdir(join(cwd, ".pi", "agents"), { recursive: true });
126
+ await writeFile(
127
+ join(cwd, ".pi", "agents", "legacy.md"),
128
+ "---\ndescription: Legacy\ntools: read, ext:mcp/search, write\ndisallowed_tools: write\n---\nInspect only.\n",
129
+ );
130
+ const profile = listSubagentProfiles(cwd).find((item) => item.name === "legacy");
131
+ assert.deepEqual(profile.tools, ["read"]);
132
+ assert.deepEqual(profile.extensionTools, ["ext:mcp/search"]);
133
+ assert.equal(profile.loadSkills, false);
134
+ assert.equal(profile.loadExtensions, true);
135
+ const extensions = [
136
+ { path: "/tmp/mcp/index.ts", sourceInfo: { source: "mcp" }, tools: new Map([["search", {}], ["admin", {}]]) },
137
+ { path: "/tmp/other/index.ts", sourceInfo: { source: "other" }, tools: new Map([["search", {}]]) },
138
+ ];
139
+ assert.deepEqual(selectSubagentExtensionTools(extensions, profile.extensionTools), ["search"]);
140
+ } finally {
141
+ await rm(cwd, { recursive: true, force: true });
142
+ }
143
+ });
144
+
145
+ test("reads tintinweb profile aliases and frontmatter identity", async () => {
146
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-tintin-"));
147
+ try {
148
+ await mkdir(join(cwd, ".pi", "agents"), { recursive: true });
149
+ await writeFile(join(cwd, ".pi", "agents", "review.md"), `---
150
+ name: security-review
151
+ color: cyan
152
+ skills: true
153
+ extensions: false
154
+ prompt_mode: replace
155
+ isolation: worktree
156
+ persist_session: false
157
+ disallowed_tools: bash
158
+ ---
159
+ Review securely.
160
+ `);
161
+ const profile = resolveSubagentProfile(cwd, "security-review");
162
+ assert.equal(profile.name, "security-review");
163
+ assert.equal(profile.loadSkills, true);
164
+ assert.equal(profile.loadExtensions, false);
165
+ assert.equal(profile.promptMode, "replace");
166
+ assert.equal(profile.color, "cyan");
167
+ assert.equal(profile.isolation, "worktree");
168
+ assert.equal(profile.persistSession, false);
169
+ assert.equal(profile.tools.includes("bash"), false);
170
+ } finally {
171
+ await rm(cwd, { recursive: true, force: true });
172
+ }
173
+ });
174
+
175
+ test("persisted subagent metadata reconstructs the final run", () => {
176
+ const entries = [
177
+ {
178
+ type: "custom",
179
+ customType: SUBAGENT_META_TYPE,
180
+ id: "meta",
181
+ parentId: null,
182
+ timestamp: "2026-01-01T00:00:00.000Z",
183
+ data: {
184
+ version: 1,
185
+ parentSessionId: "parent",
186
+ parentSessionPath: "/tmp/parent.jsonl",
187
+ parentToolCallId: "tool-call",
188
+ profile: "Explore",
189
+ description: "Find the parser",
190
+ task: "Locate parser code",
191
+ runInBackground: true,
192
+ createdAt: "2026-01-01T00:00:00.000Z",
193
+ },
194
+ },
195
+ {
196
+ type: "custom",
197
+ customType: SUBAGENT_RESULT_TYPE,
198
+ id: "result",
199
+ parentId: "meta",
200
+ timestamp: "2026-01-01T00:01:00.000Z",
201
+ data: {
202
+ version: 1,
203
+ status: "completed",
204
+ completedAt: "2026-01-01T00:01:00.000Z",
205
+ result: "Located it.",
206
+ },
207
+ },
208
+ ];
209
+
210
+ assert.deepEqual(readSubagentRun(entries, "child", "/tmp/child.jsonl"), {
211
+ sessionId: "child",
212
+ sessionPath: "/tmp/child.jsonl",
213
+ parentSessionId: "parent",
214
+ parentToolCallId: "tool-call",
215
+ profile: "Explore",
216
+ description: "Find the parser",
217
+ task: "Locate parser code",
218
+ runInBackground: true,
219
+ status: "completed",
220
+ createdAt: "2026-01-01T00:00:00.000Z",
221
+ completedAt: "2026-01-01T00:01:00.000Z",
222
+ result: "Located it.",
223
+ });
224
+ });
225
+
226
+ test("persisted subagent resources restore the exact isolated prompt and tools", () => {
227
+ const entries = [{
228
+ type: "custom",
229
+ customType: SUBAGENT_META_TYPE,
230
+ id: "meta",
231
+ parentId: null,
232
+ timestamp: "2026-01-01T00:00:00.000Z",
233
+ data: {
234
+ version: 1,
235
+ parentSessionId: "parent",
236
+ parentSessionPath: "/tmp/parent.jsonl",
237
+ profile: "reviewer",
238
+ resourceSnapshot: {
239
+ version: 1,
240
+ appendSystemPrompt: ["Review carefully.", "Inherited parent context."],
241
+ tools: ["read", "grep", "web_search", "read"],
242
+ loadSkills: true,
243
+ loadExtensions: true,
244
+ },
245
+ },
246
+ }];
247
+
248
+ assert.deepEqual(readSubagentSessionResources(entries), {
249
+ appendSystemPrompt: ["Review carefully.", "Inherited parent context."],
250
+ tools: ["read", "grep", "web_search"],
251
+ loadSkills: true,
252
+ loadExtensions: true,
253
+ });
254
+ });
255
+
256
+ test("legacy subagent resource snapshots keep skills and extensions disabled", () => {
257
+ const entries = [{
258
+ type: "custom",
259
+ customType: SUBAGENT_META_TYPE,
260
+ data: {
261
+ version: 1,
262
+ parentSessionId: "parent",
263
+ parentSessionPath: "/tmp/parent.jsonl",
264
+ resourceSnapshot: {
265
+ version: 1,
266
+ appendSystemPrompt: ["Stay focused."],
267
+ tools: ["read"],
268
+ },
269
+ },
270
+ }];
271
+
272
+ assert.deepEqual(readSubagentSessionResources(entries), {
273
+ appendSystemPrompt: ["Stay focused."],
274
+ tools: ["read"],
275
+ loadSkills: false,
276
+ loadExtensions: false,
277
+ });
278
+ });
279
+
280
+ test("extension tools are merged while subagent control tools stay excluded", () => {
281
+ assert.deepEqual(
282
+ withSubagentExtensionTools(
283
+ ["read"],
284
+ ["web_search", "Agent", "get_subagent_result", "steer_subagent", "web_search"],
285
+ ),
286
+ ["read", "web_search"],
287
+ );
288
+ });
289
+
290
+ test("an empty tool selection round-trips without restoring default tools", async () => {
291
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
292
+ try {
293
+ const saved = saveProjectSubagentProfile(cwd, profile({ tools: [] }));
294
+ const loaded = listSubagentProfiles(cwd).find((item) => item.name === saved.name);
295
+ const source = await readFile(join(cwd, ".pi", "agents", `${saved.name}.md`), "utf8");
296
+
297
+ assert.deepEqual(saved.tools, []);
298
+ assert.deepEqual(loaded.tools, []);
299
+ assert.match(source, /tools: none/);
300
+ } finally {
301
+ await rm(cwd, { recursive: true, force: true });
302
+ }
303
+ });
304
+
305
+ test("saved profiles normalize runtime values and reject invalid settings", async () => {
306
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
307
+ try {
308
+ const saved = saveProjectSubagentProfile(cwd, profile());
309
+ assert.equal(saved.displayName, "Test agent");
310
+ assert.equal(saved.description, "Test description");
311
+ assert.equal(saved.systemPrompt, "Test prompt.");
312
+ assert.deepEqual(saved.tools, ["read"]);
313
+ assert.equal(saved.model, "provider/model");
314
+ assert.equal(saved.maxTurns, 4);
315
+ assert.equal(saved.loadSkills, false);
316
+ assert.equal(saved.loadExtensions, false);
317
+
318
+ assert.throws(
319
+ () => saveProjectSubagentProfile(cwd, profile({ name: "../escape" })),
320
+ /Agent name may contain only/,
321
+ );
322
+ assert.throws(
323
+ () => saveProjectSubagentProfile(cwd, profile({ thinking: "extreme" })),
324
+ /Invalid thinking level/,
325
+ );
326
+ assert.throws(
327
+ () => saveProjectSubagentProfile(cwd, profile({ maxTurns: Number.POSITIVE_INFINITY })),
328
+ /Max turns must be a non-negative number/,
329
+ );
330
+ assert.throws(
331
+ () => saveProjectSubagentProfile(cwd, profile({ maxTurns: -1 })),
332
+ /Max turns must be a non-negative number/,
333
+ );
334
+ } finally {
335
+ await rm(cwd, { recursive: true, force: true });
336
+ }
337
+ });
338
+
339
+ test("project profiles override workspace profiles and deletion restores the workspace version", async () => {
340
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
341
+ try {
342
+ await mkdir(join(cwd, ".agents", "agents"), { recursive: true });
343
+ await writeFile(
344
+ join(cwd, ".agents", "agents", "test-agent.md"),
345
+ "---\ndescription: Workspace version\ntools: read\n---\nWorkspace prompt.\n",
346
+ );
347
+ saveProjectSubagentProfile(cwd, profile({ description: "Project version" }));
348
+ assert.equal(resolveSubagentProfile(cwd, "TEST-AGENT").description, "Project version");
349
+
350
+ deleteProjectSubagentProfile(cwd, "test-agent");
351
+ const restored = resolveSubagentProfile(cwd, "test-agent");
352
+ assert.equal(restored.scope, "workspace");
353
+ assert.equal(restored.description, "Workspace version");
354
+ } finally {
355
+ await rm(cwd, { recursive: true, force: true });
356
+ }
357
+ });
358
+
359
+ test("global and project sources with the same name stay visible while project wins at runtime", async () => {
360
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
361
+ try {
362
+ saveSubagentProfile(cwd, "global", profile({ description: "Global version" }));
363
+ saveSubagentProfile(cwd, "project", profile({ description: "Project version" }));
364
+
365
+ const sources = listSubagentProfileSources(cwd)
366
+ .filter((item) => item.name === "test-agent")
367
+ .sort((a, b) => a.scope.localeCompare(b.scope));
368
+ assert.deepEqual(sources.map((item) => item.scope), ["global", "project"]);
369
+ assert.deepEqual(sources.map((item) => item.description), ["Global version", "Project version"]);
370
+
371
+ const effective = resolveSubagentProfile(cwd, "test-agent");
372
+ assert.equal(effective.scope, "project");
373
+ assert.equal(effective.description, "Project version");
374
+ } finally {
375
+ deleteSubagentProfile(cwd, "global", "test-agent");
376
+ await rm(cwd, { recursive: true, force: true });
377
+ }
378
+ });
379
+
380
+ test("global profiles round-trip and deleting an override restores the built-in", async () => {
381
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
382
+ try {
383
+ const saved = saveSubagentProfile(cwd, "global", profile({
384
+ name: "Explore",
385
+ displayName: "Global explorer",
386
+ description: "Global override",
387
+ tools: ["read", "grep"],
388
+ }));
389
+ assert.equal(saved.scope, "global");
390
+ assert.equal(saved.filePath, join(testAgentDir, "agents", "Explore.md"));
391
+ assert.equal(resolveSubagentProfile(cwd, "Explore").scope, "global");
392
+ assert.equal(resolveSubagentProfile(cwd, "Explore").description, "Global override");
393
+
394
+ deleteSubagentProfile(cwd, "global", "Explore");
395
+ const restored = resolveSubagentProfile(cwd, "Explore");
396
+ assert.equal(restored.scope, "builtin");
397
+ assert.equal(restored.displayName, "Explore");
398
+ } finally {
399
+ deleteSubagentProfile(cwd, "global", "Explore");
400
+ await rm(cwd, { recursive: true, force: true });
401
+ }
402
+ });
403
+
404
+ test("disabled profiles cannot be resolved for execution", async () => {
405
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
406
+ try {
407
+ saveSubagentProfile(cwd, "global", profile({ description: "Global version" }));
408
+ saveProjectSubagentProfile(cwd, profile({ enabled: false }));
409
+ const sources = listSubagentProfileSources(cwd).filter((item) => item.name === "test-agent");
410
+ const globalProfile = sources.find((item) => item.scope === "global");
411
+ const projectProfile = sources.find((item) => item.scope === "project");
412
+
413
+ assert.equal(isSubagentProfileOverridden(globalProfile, sources), true);
414
+ assert.equal(isSubagentProfileOverridden(projectProfile, sources), false);
415
+ assert.equal(resolveSubagentProfile(cwd, "test-agent"), undefined);
416
+ assert.equal(listSubagentProfiles(cwd).find((item) => item.name === "test-agent").enabled, false);
417
+ } finally {
418
+ deleteSubagentProfile(cwd, "global", "test-agent");
419
+ await rm(cwd, { recursive: true, force: true });
420
+ }
421
+ });
422
+
423
+ test("persisted runs distinguish interrupted, failed, aborted, and latest results", () => {
424
+ const meta = {
425
+ type: "custom",
426
+ customType: SUBAGENT_META_TYPE,
427
+ id: "meta",
428
+ parentId: null,
429
+ timestamp: "2026-01-01T00:00:00.000Z",
430
+ data: {
431
+ version: 1,
432
+ parentSessionId: "parent",
433
+ parentSessionPath: "/tmp/parent.jsonl",
434
+ parentToolCallId: "tool-call",
435
+ profile: "Explore",
436
+ description: "Inspect",
437
+ task: "Inspect files",
438
+ runInBackground: false,
439
+ createdAt: "2026-01-01T00:00:00.000Z",
440
+ },
441
+ };
442
+ assert.equal(readSubagentRun([meta], "child", "/tmp/child.jsonl").status, "interrupted");
443
+
444
+ const failed = {
445
+ ...meta,
446
+ id: "failed",
447
+ customType: SUBAGENT_RESULT_TYPE,
448
+ data: { version: 1, status: "failed", completedAt: "2026-01-01T00:01:00.000Z", error: "boom" },
449
+ };
450
+ const aborted = {
451
+ ...failed,
452
+ id: "aborted",
453
+ data: { version: 1, status: "aborted", completedAt: "2026-01-01T00:02:00.000Z" },
454
+ };
455
+ assert.equal(readSubagentRun([meta, failed], "child", "/tmp/child.jsonl").status, "failed");
456
+ assert.equal(readSubagentRun([meta, failed], "child", "/tmp/child.jsonl").error, "boom");
457
+ assert.equal(readSubagentRun([meta, failed, aborted], "child", "/tmp/child.jsonl").status, "aborted");
458
+ const resumed = { ...failed, id: "resumed", customType: SUBAGENT_STATUS_TYPE, data: { version: 1, status: "queued" } };
459
+ assert.equal(readSubagentRun([meta, failed, resumed], "child", "/tmp/child.jsonl").status, "queued");
460
+ assert.equal(readSubagentRun([{ ...meta, data: { version: 2 } }], "child", "/tmp/child.jsonl"), null);
461
+ });
462
+
463
+ test("project profile directories cannot escape cwd through symbolic links", async (t) => {
464
+ const base = await mkdtemp(join(tmpdir(), "pi-web-subagent-boundary-"));
465
+ t.after(() => rm(base, { recursive: true, force: true }));
466
+ const cwd = join(base, "project");
467
+ const outside = join(base, "outside");
468
+ await mkdir(join(cwd, ".agents"), { recursive: true });
469
+ await mkdir(join(cwd, ".pi"), { recursive: true });
470
+ await mkdir(outside);
471
+ await writeFile(join(outside, "secret.md"), "---\ndescription: Secret\n---\nprivate\n");
472
+
473
+ try {
474
+ await symlink(outside, join(cwd, ".agents", "agents"), process.platform === "win32" ? "junction" : "dir");
475
+ await symlink(outside, join(cwd, ".pi", "agents"), process.platform === "win32" ? "junction" : "dir");
476
+ } catch (error) {
477
+ if (error?.code === "EPERM") {
478
+ t.skip("Creating symbolic links requires additional privileges on this platform");
479
+ return;
480
+ }
481
+ throw error;
482
+ }
483
+
484
+ assert.equal(listSubagentProfileSources(cwd).some((item) => item.name === "secret"), false);
485
+ assert.equal(listSubagentProfiles(cwd).some((item) => item.name === "secret"), false);
486
+ assert.throws(
487
+ () => saveProjectSubagentProfile(cwd, profile({ name: "escaped" })),
488
+ /outside the project root/,
489
+ );
490
+ assert.throws(
491
+ () => deleteProjectSubagentProfile(cwd, "secret"),
492
+ /outside the project root/,
493
+ );
494
+ assert.match(await readFile(join(outside, "secret.md"), "utf8"), /private/);
495
+ });
496
+
497
+ test("a save keeps frontmatter keys this app does not manage", async () => {
498
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
499
+ try {
500
+ await mkdir(join(cwd, ".pi", "agents"), { recursive: true });
501
+ const file = join(cwd, ".pi", "agents", "orchestrator.md");
502
+ await writeFile(
503
+ file,
504
+ [
505
+ "---",
506
+ "name: orchestrator",
507
+ "description: Hands out work",
508
+ "display_name: orchestrator",
509
+ "tools: read, bash, edit, write, grep, find, ls, ext:pi-advisor-flow/ask_advisor",
510
+ "skills: false",
511
+ "extensions: pi-advisor-flow",
512
+ "exclude_extensions: pi-advisor-flow",
513
+ "allowed_subagents: thinker, executor",
514
+ "disallowed_tools: write",
515
+ "enabled: true",
516
+ "inherit_context: false",
517
+ "run_in_background: false",
518
+ "---",
519
+ "Dispatch the work.",
520
+ ].join("\n"),
521
+ );
522
+
523
+ saveProjectSubagentProfile(cwd, profile({ name: "orchestrator", tools: ["read", "bash"] }));
524
+ const source = await readFile(file, "utf8");
525
+
526
+ assert.match(source, /^name: orchestrator$/m);
527
+ assert.match(source, /allowed_subagents: thinker, executor/);
528
+ assert.match(source, /exclude_extensions: pi-advisor-flow/);
529
+ assert.match(source, /disallowed_tools: write/);
530
+ assert.match(source, /skills: false/);
531
+ assert.match(source, /extensions: pi-advisor-flow/);
532
+ assert.match(source, /tools: read, bash, ext:pi-advisor-flow\/ask_advisor/);
533
+ assert.match(source, /Test prompt\./);
534
+
535
+ const loaded = listSubagentProfiles(cwd).find((item) => item.name === "orchestrator");
536
+ assert.deepEqual(loaded.tools, ["read", "bash"]);
537
+ } finally {
538
+ await rm(cwd, { recursive: true, force: true });
539
+ }
540
+ });
541
+
542
+ test("a save refuses to overwrite malformed existing frontmatter", async () => {
543
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
544
+ try {
545
+ await mkdir(join(cwd, ".pi", "agents"), { recursive: true });
546
+ const file = join(cwd, ".pi", "agents", "malformed.md");
547
+ const source = "---\nallowed_subagents: [executor\n---\nKeep this file intact.\n";
548
+ await writeFile(file, source);
549
+
550
+ assert.throws(
551
+ () => saveProjectSubagentProfile(cwd, profile({ name: "malformed" })),
552
+ /existing frontmatter is invalid/,
553
+ );
554
+ assert.equal(await readFile(file, "utf8"), source);
555
+ } finally {
556
+ await rm(cwd, { recursive: true, force: true });
557
+ }
558
+ });
559
+
560
+ test("the pi-subagents flag aliases are seeded, kept in step, and never overwrite a whitelist", async () => {
561
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
562
+ try {
563
+ const file = join(cwd, ".pi", "agents", "fresh.md");
564
+ saveProjectSubagentProfile(cwd, profile({ name: "fresh", loadSkills: true, loadExtensions: true }));
565
+ const seeded = await readFile(file, "utf8");
566
+ assert.match(seeded, /load_skills: true/);
567
+ assert.match(seeded, /skills: true/);
568
+ assert.match(seeded, /load_extensions: true/);
569
+ assert.match(seeded, /extensions: true/);
570
+
571
+ saveProjectSubagentProfile(cwd, profile({ name: "fresh", loadSkills: false, loadExtensions: false }));
572
+ const flipped = await readFile(file, "utf8");
573
+ assert.match(flipped, /skills: false/);
574
+ assert.match(flipped, /extensions: false/);
575
+
576
+ await mkdir(join(cwd, ".pi", "agents"), { recursive: true });
577
+ const scoped = join(cwd, ".pi", "agents", "scoped.md");
578
+ await writeFile(scoped, "---\ndescription: Scoped\nextensions: pi-advisor-flow\n---\nOnly the advisor.\n");
579
+ saveProjectSubagentProfile(cwd, profile({ name: "scoped", loadExtensions: true }));
580
+ assert.match(await readFile(scoped, "utf8"), /extensions: pi-advisor-flow/);
581
+ } finally {
582
+ await rm(cwd, { recursive: true, force: true });
583
+ }
584
+ });
585
+
586
+ test("profile flags fall back to the pi-subagents spellings", async () => {
587
+ const cwd = await mkdtemp(join(tmpdir(), "pi-web-subagents-"));
588
+ try {
589
+ await mkdir(join(cwd, ".pi", "agents"), { recursive: true });
590
+ await writeFile(
591
+ join(cwd, ".pi", "agents", "legacy-flags.md"),
592
+ "---\ndescription: Legacy flags\nskills: false\nextensions: pi-advisor-flow\n---\nScoped.\n",
593
+ );
594
+
595
+ const loaded = listSubagentProfiles(cwd).find((item) => item.name === "legacy-flags");
596
+ assert.equal(loaded.loadSkills, false);
597
+ assert.equal(loaded.loadExtensions, true);
598
+ } finally {
599
+ await rm(cwd, { recursive: true, force: true });
600
+ }
601
+ });