@pi-harness/pi-harness 0.1.27 → 0.1.28

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 (238) hide show
  1. package/apps/web/dist/assets/{index-syVb8F3A.js → index-1vaEg8Vr.js} +1 -1
  2. package/apps/web/dist/index.html +1 -1
  3. package/apps/web/package.json +6 -6
  4. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/agent-teams.json +1 -1
  5. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/anchored-standard.json +1 -1
  6. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/annotation.json +1 -1
  7. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/archify.json +1 -1
  8. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/at-file.json +1 -1
  9. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/auto-mode.json +1 -1
  10. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/better-sidebar.json +1 -1
  11. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/browser-fetch.json +1 -1
  12. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/browser-session.json +1 -1
  13. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/canvas-draw.json +1 -1
  14. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/change-verifier.json +1 -1
  15. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/cleaner.json +1 -1
  16. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/cli-notifier.json +1 -1
  17. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/code2skill.json +1 -1
  18. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/colleague-skill.json +1 -1
  19. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/context-doctor.json +1 -1
  20. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/context.json +1 -1
  21. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/cost-meter.json +1 -1
  22. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/dependency-checker.json +1 -1
  23. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/docker-sandbox.json +1 -1
  24. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/fail-logger.json +1 -1
  25. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/genui.json +1 -1
  26. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/git-time-capsule.json +1 -1
  27. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/graph-memory.json +1 -1
  28. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/history-compressor.json +1 -1
  29. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/hol-guard.json +1 -1
  30. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/i18n-pair.json +1 -1
  31. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/image-compressor.json +1 -1
  32. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/llm-verifier.json +1 -1
  33. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/mcp-client.json +1 -1
  34. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/mcp-panel.json +1 -1
  35. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/memory.json +1 -1
  36. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/mirage-bridge.json +1 -1
  37. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/mock-server.json +1 -1
  38. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/modlens.json +1 -1
  39. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/module-search.json +1 -1
  40. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/obsidian-sync.json +1 -1
  41. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/openpets.json +1 -1
  42. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/plan-execute.json +1 -1
  43. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/plugin-check.json +1 -1
  44. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/plugin-dev.json +1 -1
  45. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/plugin-finder.json +1 -1
  46. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/plugin-radar.json +1 -1
  47. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/plugin-stars.json +1 -1
  48. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/prompt-guard.json +1 -1
  49. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/prompt-library.json +1 -1
  50. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/readme-gen.json +1 -1
  51. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/recall-unread.json +1 -1
  52. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/reverse-skill.json +1 -1
  53. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/reviewer-bot.json +1 -1
  54. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/runtime-doctor.json +1 -1
  55. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/secure-audit.json +1 -1
  56. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/session-bookmarks.json +1 -1
  57. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/session-bridge.json +1 -1
  58. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/session-compare.json +1 -1
  59. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/session-export.json +1 -1
  60. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/session-insights.json +1 -1
  61. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/session-search.json +1 -1
  62. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/skill-catalog.json +1 -1
  63. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/skill-guard.json +1 -1
  64. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/sql-lens.json +1 -1
  65. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/synapse.json +1 -1
  66. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/tab-manager.json +1 -1
  67. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/taskboard.json +1 -1
  68. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/telemetry-blocker.json +1 -1
  69. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/test-harness.json +1 -1
  70. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/theme-studio.json +1 -1
  71. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/token-guard.json +1 -1
  72. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/turn-rewind.json +1 -1
  73. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/undo-savepoint.json +1 -1
  74. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/vision-toolkit.json +1 -1
  75. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/web-research.json +1 -1
  76. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/workspace-navigator.json +1 -1
  77. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/workspace-search.json +1 -1
  78. package/node_modules/@pi-harness/api-gateway/dist/marketplace-entries/official/yaml-validator.json +1 -1
  79. package/node_modules/@pi-harness/api-gateway/package.json +1 -1
  80. package/node_modules/@pi-harness/cli/package.json +1 -1
  81. package/node_modules/@pi-harness/host-webserver/package.json +1 -1
  82. package/node_modules/@pi-harness/web-app/package.json +1 -1
  83. package/package.json +6 -6
  84. package/packages/api-gateway/dist/marketplace-entries/official/agent-teams.json +1 -1
  85. package/packages/api-gateway/dist/marketplace-entries/official/anchored-standard.json +1 -1
  86. package/packages/api-gateway/dist/marketplace-entries/official/annotation.json +1 -1
  87. package/packages/api-gateway/dist/marketplace-entries/official/archify.json +1 -1
  88. package/packages/api-gateway/dist/marketplace-entries/official/at-file.json +1 -1
  89. package/packages/api-gateway/dist/marketplace-entries/official/auto-mode.json +1 -1
  90. package/packages/api-gateway/dist/marketplace-entries/official/better-sidebar.json +1 -1
  91. package/packages/api-gateway/dist/marketplace-entries/official/browser-fetch.json +1 -1
  92. package/packages/api-gateway/dist/marketplace-entries/official/browser-session.json +1 -1
  93. package/packages/api-gateway/dist/marketplace-entries/official/canvas-draw.json +1 -1
  94. package/packages/api-gateway/dist/marketplace-entries/official/change-verifier.json +1 -1
  95. package/packages/api-gateway/dist/marketplace-entries/official/cleaner.json +1 -1
  96. package/packages/api-gateway/dist/marketplace-entries/official/cli-notifier.json +1 -1
  97. package/packages/api-gateway/dist/marketplace-entries/official/code2skill.json +1 -1
  98. package/packages/api-gateway/dist/marketplace-entries/official/colleague-skill.json +1 -1
  99. package/packages/api-gateway/dist/marketplace-entries/official/context-doctor.json +1 -1
  100. package/packages/api-gateway/dist/marketplace-entries/official/context.json +1 -1
  101. package/packages/api-gateway/dist/marketplace-entries/official/cost-meter.json +1 -1
  102. package/packages/api-gateway/dist/marketplace-entries/official/dependency-checker.json +1 -1
  103. package/packages/api-gateway/dist/marketplace-entries/official/docker-sandbox.json +1 -1
  104. package/packages/api-gateway/dist/marketplace-entries/official/fail-logger.json +1 -1
  105. package/packages/api-gateway/dist/marketplace-entries/official/genui.json +1 -1
  106. package/packages/api-gateway/dist/marketplace-entries/official/git-time-capsule.json +1 -1
  107. package/packages/api-gateway/dist/marketplace-entries/official/graph-memory.json +1 -1
  108. package/packages/api-gateway/dist/marketplace-entries/official/history-compressor.json +1 -1
  109. package/packages/api-gateway/dist/marketplace-entries/official/hol-guard.json +1 -1
  110. package/packages/api-gateway/dist/marketplace-entries/official/i18n-pair.json +1 -1
  111. package/packages/api-gateway/dist/marketplace-entries/official/image-compressor.json +1 -1
  112. package/packages/api-gateway/dist/marketplace-entries/official/llm-verifier.json +1 -1
  113. package/packages/api-gateway/dist/marketplace-entries/official/mcp-client.json +1 -1
  114. package/packages/api-gateway/dist/marketplace-entries/official/mcp-panel.json +1 -1
  115. package/packages/api-gateway/dist/marketplace-entries/official/memory.json +1 -1
  116. package/packages/api-gateway/dist/marketplace-entries/official/mirage-bridge.json +1 -1
  117. package/packages/api-gateway/dist/marketplace-entries/official/mock-server.json +1 -1
  118. package/packages/api-gateway/dist/marketplace-entries/official/modlens.json +1 -1
  119. package/packages/api-gateway/dist/marketplace-entries/official/module-search.json +1 -1
  120. package/packages/api-gateway/dist/marketplace-entries/official/obsidian-sync.json +1 -1
  121. package/packages/api-gateway/dist/marketplace-entries/official/openpets.json +1 -1
  122. package/packages/api-gateway/dist/marketplace-entries/official/plan-execute.json +1 -1
  123. package/packages/api-gateway/dist/marketplace-entries/official/plugin-check.json +1 -1
  124. package/packages/api-gateway/dist/marketplace-entries/official/plugin-dev.json +1 -1
  125. package/packages/api-gateway/dist/marketplace-entries/official/plugin-finder.json +1 -1
  126. package/packages/api-gateway/dist/marketplace-entries/official/plugin-radar.json +1 -1
  127. package/packages/api-gateway/dist/marketplace-entries/official/plugin-stars.json +1 -1
  128. package/packages/api-gateway/dist/marketplace-entries/official/prompt-guard.json +1 -1
  129. package/packages/api-gateway/dist/marketplace-entries/official/prompt-library.json +1 -1
  130. package/packages/api-gateway/dist/marketplace-entries/official/readme-gen.json +1 -1
  131. package/packages/api-gateway/dist/marketplace-entries/official/recall-unread.json +1 -1
  132. package/packages/api-gateway/dist/marketplace-entries/official/reverse-skill.json +1 -1
  133. package/packages/api-gateway/dist/marketplace-entries/official/reviewer-bot.json +1 -1
  134. package/packages/api-gateway/dist/marketplace-entries/official/runtime-doctor.json +1 -1
  135. package/packages/api-gateway/dist/marketplace-entries/official/secure-audit.json +1 -1
  136. package/packages/api-gateway/dist/marketplace-entries/official/session-bookmarks.json +1 -1
  137. package/packages/api-gateway/dist/marketplace-entries/official/session-bridge.json +1 -1
  138. package/packages/api-gateway/dist/marketplace-entries/official/session-compare.json +1 -1
  139. package/packages/api-gateway/dist/marketplace-entries/official/session-export.json +1 -1
  140. package/packages/api-gateway/dist/marketplace-entries/official/session-insights.json +1 -1
  141. package/packages/api-gateway/dist/marketplace-entries/official/session-search.json +1 -1
  142. package/packages/api-gateway/dist/marketplace-entries/official/skill-catalog.json +1 -1
  143. package/packages/api-gateway/dist/marketplace-entries/official/skill-guard.json +1 -1
  144. package/packages/api-gateway/dist/marketplace-entries/official/sql-lens.json +1 -1
  145. package/packages/api-gateway/dist/marketplace-entries/official/synapse.json +1 -1
  146. package/packages/api-gateway/dist/marketplace-entries/official/tab-manager.json +1 -1
  147. package/packages/api-gateway/dist/marketplace-entries/official/taskboard.json +1 -1
  148. package/packages/api-gateway/dist/marketplace-entries/official/telemetry-blocker.json +1 -1
  149. package/packages/api-gateway/dist/marketplace-entries/official/test-harness.json +1 -1
  150. package/packages/api-gateway/dist/marketplace-entries/official/theme-studio.json +1 -1
  151. package/packages/api-gateway/dist/marketplace-entries/official/token-guard.json +1 -1
  152. package/packages/api-gateway/dist/marketplace-entries/official/turn-rewind.json +1 -1
  153. package/packages/api-gateway/dist/marketplace-entries/official/undo-savepoint.json +1 -1
  154. package/packages/api-gateway/dist/marketplace-entries/official/vision-toolkit.json +1 -1
  155. package/packages/api-gateway/dist/marketplace-entries/official/web-research.json +1 -1
  156. package/packages/api-gateway/dist/marketplace-entries/official/workspace-navigator.json +1 -1
  157. package/packages/api-gateway/dist/marketplace-entries/official/workspace-search.json +1 -1
  158. package/packages/api-gateway/dist/marketplace-entries/official/yaml-validator.json +1 -1
  159. package/packages/api-gateway/package.json +1 -1
  160. package/packages/api-gateway/src/marketplace-entries/official/agent-teams.json +1 -1
  161. package/packages/api-gateway/src/marketplace-entries/official/anchored-standard.json +1 -1
  162. package/packages/api-gateway/src/marketplace-entries/official/annotation.json +1 -1
  163. package/packages/api-gateway/src/marketplace-entries/official/archify.json +1 -1
  164. package/packages/api-gateway/src/marketplace-entries/official/at-file.json +1 -1
  165. package/packages/api-gateway/src/marketplace-entries/official/auto-mode.json +1 -1
  166. package/packages/api-gateway/src/marketplace-entries/official/better-sidebar.json +1 -1
  167. package/packages/api-gateway/src/marketplace-entries/official/browser-fetch.json +1 -1
  168. package/packages/api-gateway/src/marketplace-entries/official/browser-session.json +1 -1
  169. package/packages/api-gateway/src/marketplace-entries/official/canvas-draw.json +1 -1
  170. package/packages/api-gateway/src/marketplace-entries/official/change-verifier.json +1 -1
  171. package/packages/api-gateway/src/marketplace-entries/official/cleaner.json +1 -1
  172. package/packages/api-gateway/src/marketplace-entries/official/cli-notifier.json +1 -1
  173. package/packages/api-gateway/src/marketplace-entries/official/code2skill.json +1 -1
  174. package/packages/api-gateway/src/marketplace-entries/official/colleague-skill.json +1 -1
  175. package/packages/api-gateway/src/marketplace-entries/official/context-doctor.json +1 -1
  176. package/packages/api-gateway/src/marketplace-entries/official/context.json +1 -1
  177. package/packages/api-gateway/src/marketplace-entries/official/cost-meter.json +1 -1
  178. package/packages/api-gateway/src/marketplace-entries/official/dependency-checker.json +1 -1
  179. package/packages/api-gateway/src/marketplace-entries/official/docker-sandbox.json +1 -1
  180. package/packages/api-gateway/src/marketplace-entries/official/fail-logger.json +1 -1
  181. package/packages/api-gateway/src/marketplace-entries/official/genui.json +1 -1
  182. package/packages/api-gateway/src/marketplace-entries/official/git-time-capsule.json +1 -1
  183. package/packages/api-gateway/src/marketplace-entries/official/graph-memory.json +1 -1
  184. package/packages/api-gateway/src/marketplace-entries/official/history-compressor.json +1 -1
  185. package/packages/api-gateway/src/marketplace-entries/official/hol-guard.json +1 -1
  186. package/packages/api-gateway/src/marketplace-entries/official/i18n-pair.json +1 -1
  187. package/packages/api-gateway/src/marketplace-entries/official/image-compressor.json +1 -1
  188. package/packages/api-gateway/src/marketplace-entries/official/llm-verifier.json +1 -1
  189. package/packages/api-gateway/src/marketplace-entries/official/mcp-client.json +1 -1
  190. package/packages/api-gateway/src/marketplace-entries/official/mcp-panel.json +1 -1
  191. package/packages/api-gateway/src/marketplace-entries/official/memory.json +1 -1
  192. package/packages/api-gateway/src/marketplace-entries/official/mirage-bridge.json +1 -1
  193. package/packages/api-gateway/src/marketplace-entries/official/mock-server.json +1 -1
  194. package/packages/api-gateway/src/marketplace-entries/official/modlens.json +1 -1
  195. package/packages/api-gateway/src/marketplace-entries/official/module-search.json +1 -1
  196. package/packages/api-gateway/src/marketplace-entries/official/obsidian-sync.json +1 -1
  197. package/packages/api-gateway/src/marketplace-entries/official/openpets.json +1 -1
  198. package/packages/api-gateway/src/marketplace-entries/official/plan-execute.json +1 -1
  199. package/packages/api-gateway/src/marketplace-entries/official/plugin-check.json +1 -1
  200. package/packages/api-gateway/src/marketplace-entries/official/plugin-dev.json +1 -1
  201. package/packages/api-gateway/src/marketplace-entries/official/plugin-finder.json +1 -1
  202. package/packages/api-gateway/src/marketplace-entries/official/plugin-radar.json +1 -1
  203. package/packages/api-gateway/src/marketplace-entries/official/plugin-stars.json +1 -1
  204. package/packages/api-gateway/src/marketplace-entries/official/prompt-guard.json +1 -1
  205. package/packages/api-gateway/src/marketplace-entries/official/prompt-library.json +1 -1
  206. package/packages/api-gateway/src/marketplace-entries/official/readme-gen.json +1 -1
  207. package/packages/api-gateway/src/marketplace-entries/official/recall-unread.json +1 -1
  208. package/packages/api-gateway/src/marketplace-entries/official/reverse-skill.json +1 -1
  209. package/packages/api-gateway/src/marketplace-entries/official/reviewer-bot.json +1 -1
  210. package/packages/api-gateway/src/marketplace-entries/official/runtime-doctor.json +1 -1
  211. package/packages/api-gateway/src/marketplace-entries/official/secure-audit.json +1 -1
  212. package/packages/api-gateway/src/marketplace-entries/official/session-bookmarks.json +1 -1
  213. package/packages/api-gateway/src/marketplace-entries/official/session-bridge.json +1 -1
  214. package/packages/api-gateway/src/marketplace-entries/official/session-compare.json +1 -1
  215. package/packages/api-gateway/src/marketplace-entries/official/session-export.json +1 -1
  216. package/packages/api-gateway/src/marketplace-entries/official/session-insights.json +1 -1
  217. package/packages/api-gateway/src/marketplace-entries/official/session-search.json +1 -1
  218. package/packages/api-gateway/src/marketplace-entries/official/skill-catalog.json +1 -1
  219. package/packages/api-gateway/src/marketplace-entries/official/skill-guard.json +1 -1
  220. package/packages/api-gateway/src/marketplace-entries/official/sql-lens.json +1 -1
  221. package/packages/api-gateway/src/marketplace-entries/official/synapse.json +1 -1
  222. package/packages/api-gateway/src/marketplace-entries/official/tab-manager.json +1 -1
  223. package/packages/api-gateway/src/marketplace-entries/official/taskboard.json +1 -1
  224. package/packages/api-gateway/src/marketplace-entries/official/telemetry-blocker.json +1 -1
  225. package/packages/api-gateway/src/marketplace-entries/official/test-harness.json +1 -1
  226. package/packages/api-gateway/src/marketplace-entries/official/theme-studio.json +1 -1
  227. package/packages/api-gateway/src/marketplace-entries/official/token-guard.json +1 -1
  228. package/packages/api-gateway/src/marketplace-entries/official/turn-rewind.json +1 -1
  229. package/packages/api-gateway/src/marketplace-entries/official/undo-savepoint.json +1 -1
  230. package/packages/api-gateway/src/marketplace-entries/official/vision-toolkit.json +1 -1
  231. package/packages/api-gateway/src/marketplace-entries/official/web-research.json +1 -1
  232. package/packages/api-gateway/src/marketplace-entries/official/workspace-navigator.json +1 -1
  233. package/packages/api-gateway/src/marketplace-entries/official/workspace-search.json +1 -1
  234. package/packages/api-gateway/src/marketplace-entries/official/yaml-validator.json +1 -1
  235. package/packages/api-gateway/test/release-package.test.ts +8 -0
  236. package/packages/bundle-web-app/package.json +1 -1
  237. package/packages/cli/package.json +1 -1
  238. package/packages/host-webserver/package.json +1 -1
@@ -22,4 +22,4 @@ import{i as e,n as t,r as n,t as r}from"./react-vendor-BxoMtjVy.js";import{n as
22
22
  `||t===`\r`)||!On.test(t)?t:`�`;return r}function Pn(e,t,n){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=t&&e<=n?e:void 0}function Fn(e,t){return[...e].slice(0,t).join(``)}function In(e){let t=kn(e,Cn);if(t===void 0||!An(t,Cn))return;let n=Mn(t.targetId,512,!1),r=Nn(t.title,4096),i=Mn(t.url,8192);return n===void 0||r===void 0||i===void 0?void 0:{targetId:n,title:r,url:i}}function Ln(e){let t=kn(e,Dn);if(t===void 0||!An(t,Dn)||t.mimeType!==`image/png`)return;let n=Pn(t.bytes,0,8388608);return n===void 0?void 0:{bytes:n,mimeType:`image/png`}}function Rn(e){let t=kn(e,Tn);if(t===void 0||!An(t,Tn))return;let n=Pn(t.tabs,1,U.tabs),r=Pn(t.textPreviewCharacters,1,U.textPreviewCharacters),i=Pn(t.errorCharacters,1,U.errorCharacters);return n===void 0||r===void 0||i===void 0?void 0:{tabs:n,textPreviewCharacters:r,errorCharacters:i}}function zn(e,t){if(e===null)return null;let n=kn(e,En);if(n===void 0||![...Object.keys(n)].every(e=>En.has(e)))return;let r=Mn(n.targetId,512,!1),i=Nn(n.title,4096),a=Mn(n.url,8192);if(r===void 0||i===void 0||a===void 0||n.status!==void 0&&Mn(n.status,64,!1)===void 0||n.truncated!==void 0&&typeof n.truncated!=`boolean`||n.previewTruncated!==void 0&&typeof n.previewTruncated!=`boolean`||n.clicked!==void 0&&typeof n.clicked!=`boolean`)return;let o=n.text===void 0?void 0:Nn(n.text,131072,!0);if(n.text!==void 0&&o===void 0)return;let s=n.screenshot===void 0?void 0:Ln(n.screenshot);if(n.screenshot!==void 0&&s===void 0)return;let c=o===void 0?void 0:Fn(o,t.textPreviewCharacters);return{targetId:r,title:Fn(i,4096),url:Fn(a,8192),...n.status===void 0?{}:{status:Fn(n.status,64)},truncated:n.truncated===!0,previewTruncated:n.previewTruncated===!0||o!==void 0&&o.length>t.textPreviewCharacters,...c===void 0?{}:{text:c},clicked:n.clicked===!0,...s===void 0?{}:{screenshot:s}}}function Bn(){return{endpoint:``,connected:!1,error:`Panel data unavailable`,tabs:[],inventory:{total:0,shown:0,truncated:!1},limits:U,latest:null,malformed:!0}}function Vn(e){let t=kn(e,Sn);if(t===void 0||!An(t,Sn)||typeof t.connected!=`boolean`)return Bn();let n=Mn(t.endpoint,2048,!1),r=t.error===null?null:Mn(t.error,U.errorCharacters,!0),i=Rn(t.limits),a=jn(t.tabs,xn),o=kn(t.inventory,wn);if(n===void 0||r===void 0||i===void 0||a===void 0||o===void 0||!An(o,wn))return Bn();let s=[];for(let e of a){let t=In(e);if(t===void 0)return Bn();s.push(t)}let c=Pn(o.total,s.length,xn),l=Pn(o.shown,0,i.tabs);if(c===void 0||l===void 0||l!==s.length||s.length>i.tabs||typeof o.truncated!=`boolean`||c<l)return Bn();let u=zn(t.latest,i);if(u===void 0)return Bn();let d=s.slice(0,bn);return{endpoint:n,connected:t.connected,error:r,tabs:d,inventory:{total:c,shown:d.length,truncated:o.truncated||c>l||s.length>d.length},limits:i,latest:u,malformed:!1}}var Hn=12,Un=255,Wn=2e3,Gn=500,W={capsules:256,directoryEntries:4096,displayLimit:20},Kn=new Set([`capsules`,`inventory`,`lastCleanup`,`lastRemoved`,`limits`]),qn=new Set([`name`,`bytes`]),Jn=new Set([`total`,`shown`,`truncated`,`displayLimit`]),Yn=new Set([`status`,`at`,`requestedKeep`,`removed`,`kept`,`error`]),Xn=new Set([`capsules`,`directoryEntries`]),Zn=/[\p{Cc}\p{Cf}\p{Cs}\u2028\u2029]/u;function Qn(e,t){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>typeof e!=`string`||!t.has(e)))return;let i=Object.create(null);for(let[e,t]of Object.entries(r)){if(!(`value`in t))return;i[e]=t.value}return i}catch{return}}function $n(e,t){let n=Object.keys(e);return n.length===t.size&&n.every(e=>t.has(e))}function er(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function tr(e,t){if(!(typeof e!=`string`||e.length===0||e!==e.trim()||Zn.test(e))&&!([...e].length>t||new TextEncoder().encode(e).byteLength>t))return e}function nr(e){if(typeof e!=`string`||e.length>64)return;let t=Date.parse(e);if(Number.isFinite(t))try{return new Date(t).toISOString()===e?e:void 0}catch{return}}function rr(e){let t=tr(e,Un);return t?.endsWith(`.patch`)===!0&&!t.includes(`/`)&&!t.includes(`\\`)?t:void 0}function ir(e){let t=Qn(e,qn);if(t===void 0||!$n(t,qn))return;let n=rr(t.name),r=er(t.bytes,2**53-1);return n===void 0||r===void 0?void 0:{name:n,bytes:r}}function ar(e){try{if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype)return;let t=Object.getOwnPropertyDescriptor(e,`length`),n=t!==void 0&&`value`in t?t.value:void 0;if(!Number.isSafeInteger(n)||n<0||n>W.displayLimit)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>e!==`length`&&(typeof e!=`string`||!/^\d+$/u.test(e)||Number(e)>=n||String(Number(e))!==e))||Object.values(r).some(e=>!(`value`in e)))return;let i=[];for(let e=0;e<n;e+=1){let t=r[String(e)],n=ir(t!==void 0&&`value`in t?t.value:void 0);if(n===void 0)return;i.push(n)}return new Set(i.map(e=>e.name)).size===i.length?i:void 0}catch{return}}function or(e,t){let n=Qn(e,Jn);if(n===void 0||!$n(n,Jn))return;let r=er(n.total,W.capsules),i=er(n.shown,W.displayLimit);if(!(r===void 0||i===void 0||i!==t||i>r||n.displayLimit!==W.displayLimit||typeof n.truncated!=`boolean`||n.truncated!==r>i))return{total:r,shown:i,truncated:n.truncated,displayLimit:W.displayLimit}}function sr(e){let t=Qn(e,Yn);if(t===void 0)return;let n=t.status,r=nr(t.at),i=er(t.requestedKeep,W.capsules),a=er(t.removed,W.capsules);if(n!==`running`&&n!==`completed`&&n!==`failed`&&n!==`cancelled`||r===void 0||i===void 0||a===void 0)return;let o=new Set([`status`,`at`,`requestedKeep`,`removed`]);if(n===`running`&&$n(t,o))return{status:n,at:r,requestedKeep:i,removed:a,kept:null,error:null};if(n===`completed`&&$n(t,new Set([...o,`kept`]))){let e=er(t.kept,W.capsules);return e===void 0?void 0:{status:n,at:r,requestedKeep:i,removed:a,kept:e,error:null}}if((n===`failed`||n===`cancelled`)&&$n(t,new Set([...o,`error`]))){let e=tr(t.error,Wn);return e===void 0?void 0:{status:n,at:r,requestedKeep:i,removed:a,kept:null,error:[...e].slice(0,Gn).join(``)}}}function cr(e){let t=Qn(e,Xn);return t!==void 0&&$n(t,Xn)&&t.capsules===W.capsules&&t.directoryEntries===W.directoryEntries}function lr(){return{capsules:[],totalBytes:null,inventory:null,lastCleanup:null,malformed:!0,limits:{capsules:W.capsules,directoryEntries:W.directoryEntries}}}function ur(e){let t=Qn(e,Kn);if(t===void 0||!$n(t,Kn)||!cr(t.limits))return lr();let n=ar(t.capsules);if(n===void 0)return lr();let r=or(t.inventory,n.length),i=er(t.lastRemoved,W.capsules);if(r===void 0||i===void 0)return lr();let a=t.lastCleanup===null?null:sr(t.lastCleanup);if(a===void 0||(a===null?i!==0:a.removed!==i))return lr();let o=n.slice(0,Hn),s=o.reduce((e,t)=>e+t.bytes,0);return Number.isSafeInteger(s)?{capsules:o,totalBytes:s,inventory:{total:r.total,shown:o.length,truncated:r.truncated||n.length>o.length,displayLimit:r.displayLimit},lastCleanup:a,malformed:!1,limits:{capsules:W.capsules,directoryEntries:W.directoryEntries}}:lr()}var dr=(e,t)=>{let n=e.trim().toLowerCase();return!n||t.some(e=>e?.toLowerCase().includes(n))};function fr(e){if(e.get(`page`)===`plugins`)return e.get(`plugin`)?.trim()||void 0}function pr(e,t){return t?{packageLabel:`${e.name} · v${t.version}`,description:t.description,tags:[...t.capabilities,...t.hooks.map(e=>`hook:${e}`)]}:{packageLabel:e.name,description:e.enabled?`由当前运行时加载并启用,能力与 hook 已注册。`:`由当前运行时加载但已停用。`,tags:[`loader`,e.state===`active`?`active`:`state:${e.state}`]}}function mr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function hr(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0}function gr(e){if(mr(e)&&!(typeof e.sessionId!=`string`||e.sessionId.trim()===``||e.sessionId.length>512||!hr(e.cost)||!hr(e.sessionCost)||!Number.isSafeInteger(e.tokens)||e.tokens<0||!Number.isSafeInteger(e.messages)||e.messages<0||typeof e.recordedAt!=`string`||!Number.isFinite(Date.parse(e.recordedAt))))return{sessionId:e.sessionId,utcDate:new Date(e.recordedAt).toISOString().slice(0,10),dailyCost:e.cost,sessionCost:e.sessionCost,tokens:e.tokens,messages:e.messages}}function _r(e){let t=mr(e)?e:{};return{dayBasis:`UTC`,entryLimit:Number.isSafeInteger(t.entryLimit)&&t.entryLimit>=1&&t.entryLimit<=2e3?t.entryLimit:null,lastError:typeof t.lastError==`string`&&t.lastError.trim()!==``?t.lastError.slice(0,2048):null,entries:(Array.isArray(t.entries)?t.entries.slice(0,20):[]).map(gr).filter(e=>e!==void 0).slice(0,5)}}var G={declarations:2e3,manifestCharacters:1024,itemCharacters:256,conflictConstraints:64,visibleItems:20,visibleConflicts:6,visibleConstraints:8};function vr(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(e=>typeof e!=`string`))return;let r=Object.create(null);for(let[e,t]of Object.entries(n)){if(!(`value`in t))return;r[e]=t.value}return r}catch{return}}function yr(e,t){try{if(!Array.isArray(e))return;let n=Object.getOwnPropertyDescriptor(e,`length`);if(n===void 0||!(`value`in n)||!Number.isSafeInteger(n.value)||n.value<0)return;let r=Math.min(n.value,t),i=[];for(let t=0;t<r;t+=1){let n=Object.getOwnPropertyDescriptor(e,String(t));if(n===void 0||!(`value`in n))return;i.push(n.value)}return{values:i,altered:n.value>t}}catch{return}}function br(e,t){let n=new Set(t);return Object.keys(e).every(e=>n.has(e))}function xr(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function Sr(e,t){if(typeof e!=`string`)return{value:void 0,altered:!0};let n=e.replaceAll(/[\p{Cc}\p{Cf}\p{Cs}]+/gu,` `).trim(),r=[...n],i=r.length>t?r.slice(0,t).join(``):n;return{value:i===``?void 0:i,altered:i!==e}}function Cr(e){let t=yr(e,G.declarations);if(t===void 0)return{values:[],altered:!0};let n=[],r=t.altered;for(let e of t.values){let t=Sr(e,G.itemCharacters);r||=t.altered,t.value===void 0?r=!0:n.push(t.value)}return{values:n,altered:r}}function wr(e){let t=yr(e,G.declarations);if(t===void 0)return{values:[],altered:!0};let n=[],r=t.altered;for(let e of t.values){let t=vr(e);if(t===void 0){r=!0;continue}let i=Sr(t.name,G.itemCharacters),a=yr(t.constraints,G.conflictConstraints);if(i.value===void 0||a===void 0){r=!0;continue}let o=[];r||=i.altered||a.altered||!br(t,[`name`,`constraints`]);for(let e of a.values){let t=Sr(e,G.itemCharacters);r||=t.altered,t.value===void 0?r=!0:o.push(t.value)}if(o.length===0){r=!0;continue}o.length>G.visibleConstraints&&(r=!0),n.push({name:i.value,constraints:o.slice(0,G.visibleConstraints)})}return{values:n,altered:r}}function Tr(e){return new Set(e).size===e.length}function Er(e){let t=vr(e),n=t===void 0?void 0:vr(t.report),r=n??{},i=Sr(r.manifest,G.manifestCharacters),a=Cr(r.missing),o=Cr(r.optionalMissing),s=Cr(r.invalid),c=wr(r.conflicts),l=wr(r.unresolved),u=xr(r.declared,G.declarations),d=xr(r.installed,G.declarations),f=a.values.length+o.values.length+s.values.length,p=Tr([...a.values,...o.values])&&Tr([...c.values.map(e=>e.name),...l.values.map(e=>e.name)]),m=!1;u!==void 0&&d!==void 0&&d<=u&&c.values.length<=u&&l.values.length<=u&&(r.ecosystem===`npm`?m=d+f===u:r.ecosystem===`python`&&(m=o.values.length===0&&d+a.values.length===u&&u+s.values.length<=G.declarations));let h=a.values.length+o.values.length+(r.ecosystem===`python`?0:s.values.length),g=m&&u!==void 0?u:Math.min(G.declarations,Math.max(h,c.values.length,l.values.length)),_=m&&d!==void 0?d:0,v=t===void 0||n===void 0||!br(t,[`report`])||!br(r,[`manifest`,`ecosystem`,`declared`,`installed`,`scanLimit`,`missing`,`optionalMissing`,`invalid`,`conflicts`,`unresolved`]);return{manifest:i.value??`package.json`,ecosystem:r.ecosystem===`python`?`python`:`npm`,declared:g,installed:_,scanLimit:G.declarations,missingCount:a.values.length,optionalMissingCount:o.values.length,invalidCount:s.values.length,conflictCount:c.values.length,unresolvedCount:l.values.length,missing:a.values.slice(0,G.visibleItems),optionalMissing:o.values.slice(0,G.visibleItems),invalid:s.values.slice(0,G.visibleItems),conflicts:c.values.slice(0,G.visibleConflicts),unresolved:l.values.slice(0,G.visibleConflicts),truncated:v||i.altered||r.ecosystem!==`npm`&&r.ecosystem!==`python`||!m||r.scanLimit!==G.declarations||!p||a.altered||o.altered||s.altered||c.altered||l.altered||a.values.length>G.visibleItems||o.values.length>G.visibleItems||s.values.length>G.visibleItems||c.values.length>G.visibleConflicts||l.values.length>G.visibleConflicts}}var Dr={image:`alpine:3.20`,pull:`never`,network:`none`,rootFilesystem:`read-only`,workspace:`read-only`,memory:`512m`,cpus:1,pids:256,timeoutMs:12e4},Or=new Set([`latest`,`defaults`]),kr=new Set([`image`,`command`,`write`,`exitCode`,`status`,`output`]),Ar=new Set(Object.keys(Dr)),jr=128,Mr=4096,Nr=16384,Pr=12e3,Fr=16,Ir=256,Lr=4e3,Rr=/[\p{Cc}\p{Cf}\p{Cs}\u2028\u2029]/u;function zr(e,t){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>typeof e!=`string`||!t.has(e)))return;let i=Object.create(null);for(let[e,t]of Object.entries(r)){if(!(`value`in t))return;i[e]=t.value}return i}catch{return}}function Br(e,t){let n=Object.keys(e);return n.length===t.size&&n.every(e=>t.has(e))}function Vr(e,t){try{if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype)return;let n=Object.getOwnPropertyDescriptors(e),r=n.length,i=r!==void 0&&`value`in r?r.value:void 0;if(!Number.isSafeInteger(i)||i<0||i>t||Reflect.ownKeys(n).some(e=>e!==`length`&&(typeof e!=`string`||!/^\d+$/u.test(e)||Number(e)>=i||String(Number(e))!==e))||Object.values(n).some(e=>!(`value`in e)))return;let a=[];for(let e=0;e<i;e+=1){let t=n[String(e)];if(t===void 0||!(`value`in t))return;a.push(t.value)}return a}catch{return}}function Hr(e,t,n=!1,r=!1){if(!(typeof e!=`string`||!n&&e.length===0)){for(let t of e)if(Rr.test(t)&&!(r&&(t===` `||t===`
23
23
  `||t===`\r`)))return;if(!([...e].length>t||new TextEncoder().encode(e).byteLength>t))return e}}function Ur(e,t,n){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=t&&e<=n?e:void 0}function Wr(e,t){return[...e].slice(0,t).join(``)}function Gr(e){let t=zr(e,kr);if(t===void 0||!Br(t,kr))return;let n=Hr(t.image,Mr),r=Vr(t.command,jr),i=Hr(t.output,Pr,!0,!0),a=Ur(t.exitCode,-2147483648,2147483647);if(n===void 0||r===void 0||r.length===0||i===void 0||a===void 0||typeof t.write!=`boolean`||t.status!==`completed`&&t.status!==`failed`&&t.status!==`timed_out`)return;let o=[];for(let e of r){let t=Hr(e,Nr,!1,!0);if(t===void 0||t.length===0)return;o.push(t)}return{image:Wr(n,512),command:o.slice(0,Fr).map(e=>Wr(e,Ir)),commandCount:o.length,write:t.write,exitCode:a,status:t.status,output:Wr(i,Lr),truncated:n.length>512||o.length>Fr||o.some(e=>e.length>Ir)||i.length>Lr}}function Kr(e){let t=zr(e,Ar);if(!(t===void 0||!Br(t,Ar))){for(let[e,n]of Object.entries(Dr))if(t[e]!==n)return;return{...Dr}}}function qr(){return{latest:null,defaults:{...Dr},malformed:!0}}function Jr(e){let t=zr(e,Or);if(t===void 0||!Br(t,Or))return qr();let n=Kr(t.defaults);if(n===void 0)return qr();if(t.latest===null)return{latest:null,defaults:n,malformed:!1};let r=Gr(t.latest);return r===void 0?qr():{latest:r,defaults:n,malformed:!1}}var Yr=50,Xr=64,Zr=2048;function Qr(e){if(typeof e!=`object`||!e)return!1;try{return!Array.isArray(e)}catch{return!1}}function $r(e,t){if(!(typeof e!=`object`||!e))try{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}catch{return}}function ei(e,t){return Qr(e)?$r(e,t):void 0}function ti(e){try{if(!Array.isArray(e))return}catch{return}let t=$r(e,`length`);return typeof t==`number`&&Number.isSafeInteger(t)&&t>=0?t:void 0}function ni(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function ri(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0?e:t}function ii(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0&&e<=Yr?e:Yr}function ai(e){if(!Qr(e))return;let t=ei(e,`source`),n=ei(e,`message`);if(typeof t!=`string`||typeof n!=`string`)return;let r=ei(e,`time`),i=typeof r==`string`&&r.length<=64&&Number.isFinite(Date.parse(r))?new Date(r).toISOString():null,a=(t.trim()||`runtime`).replaceAll(`\0`,`�`),o=(n.trim()||`未知错误`).replaceAll(`\0`,`�`);return{value:{time:i,source:a.slice(0,Xr),message:o.slice(0,Zr),occurrences:ri(ei(e,`occurrences`),1)},truncated:a.length>Xr||o.length>Zr||t.includes(`\0`)||n.includes(`\0`)}}function oi(e){let t=Qr(e)?e:{},n=ei(t,`failures`),r=ti(n)??0,i=Math.min(r,Yr),a=[],o=r>Yr;for(let e=0;e<i;e+=1){let t=ai($r(n,String(e)));if(t===void 0){o=!0;continue}a.push(t.value),t.truncated&&(o=!0)}let s=ni(ei(t,`total`),a.length);return{total:s,observed:Math.max(s,ni(ei(t,`observed`),s)),dropped:ni(ei(t,`dropped`),0),capacity:ii(ei(t,`capacity`)),failures:a,truncated:o}}var K={blocks:12,title:256,label:256,value:4e3,totalText:16384},si=2e3,ci=new Set([`text`,`badge`,`progress`]),li=new Set([`neutral`,`info`,`success`,`warning`,`danger`]);function ui(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function di(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function fi(e){if(!ui(e)||typeof e.type!=`string`||!ci.has(e.type)||typeof e.label!=`string`||e.label.trim()===``||typeof e.tone!=`string`||!li.has(e.tone))return;let t=e.type,n=e.tone;if(t===`progress`)return typeof e.value!=`number`||!Number.isFinite(e.value)||e.value<0||e.value>100?void 0:{type:t,label:e.label.slice(0,K.label),value:e.value,tone:n};if(typeof e.value==`string`)return{type:t,label:e.label.slice(0,K.label),value:e.value.slice(0,si),tone:n}}function pi(e){if(!ui(e)||typeof e.title!=`string`||e.title.trim()===``||!Array.isArray(e.blocks))return null;let t=e.blocks.slice(0,K.blocks).map(fi).filter(e=>e!==void 0),n=typeof e.renderedAt==`string`&&Number.isFinite(Date.parse(e.renderedAt))?new Date(e.renderedAt).toISOString():null;return{title:e.title.slice(0,K.title),renderedAt:n,blocks:t,truncated:e.title.length>K.title||e.blocks.length>K.blocks||t.length!==Math.min(e.blocks.length,K.blocks)||e.blocks.some(e=>ui(e)&&(typeof e.label==`string`&&e.label.length>K.label||typeof e.value==`string`&&e.value.length>si))}}function mi(e){let t=ui(e)?e:{},n=ui(t.limits)?t.limits:{};return{rendered:di(t.rendered,0),latest:pi(t.latest),limits:{blocks:di(n.blocks,K.blocks)||K.blocks,title:di(n.title,K.title)||K.title,label:di(n.label,K.label)||K.label,value:di(n.value,K.value)||K.value,totalText:di(n.totalText,K.totalText)||K.totalText}}}var q={timeoutMs:15e3,capsuleBytes:8388608,inventory:256,directoryEntries:4096,displayLimit:20},hi=2e3;function gi(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(e=>typeof e!=`string`))return;let r=Object.create(null);for(let[e,t]of Object.entries(n)){if(!(`value`in t))return;r[e]=t.value}return r}catch{return}}function _i(e,t){try{if(!Array.isArray(e))return;let n=Object.getOwnPropertyDescriptor(e,`length`);if(n===void 0||!(`value`in n)||!Number.isSafeInteger(n.value)||n.value<0)return;let r=Math.min(n.value,t),i=[];for(let t=0;t<r;t+=1){let n=Object.getOwnPropertyDescriptor(e,String(t));if(n===void 0||!(`value`in n))return;i.push(n.value)}return{values:i,altered:n.value>t}}catch{return}}function vi(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function yi(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function bi(e,t){let n=new Set(t);return Object.keys(e).every(e=>n.has(e))}function xi(e){if(typeof e==`string`&&!(e.length===0||e.length>255||e!==e.trim()||new TextEncoder().encode(e).byteLength>255||!e.endsWith(`.patch`)||/[/\\\p{Cc}\p{Cf}\p{Cs}]/u.test(e)))return e}function Si(e){if(typeof e!=`string`)return null;let t=e.replaceAll(/[\p{Cc}\p{Cf}]+/gu,` `).trim().slice(0,hi);return t===``?null:t}function Ci(e){if(typeof e==`string`)try{return new Date(e).toISOString()===e?e:void 0}catch{return}}function wi(e){let t=gi(e);if(t===void 0||t.action!==`capture`&&t.action!==`restore`||t.status!==`completed`&&t.status!==`failed`&&t.status!==`cancelled`)return null;let n=Ci(t.at);if(n===void 0)return null;let r=t.name===void 0?null:xi(t.name);if(t.name!==void 0&&r===void 0||t.status===`completed`&&r===null)return null;let i=Si(t.error),a=yi(t.bytes,q.capsuleBytes),o=yi(t.files,q.capsuleBytes);return t.status===`completed`&&(a===void 0||a===0||o===void 0||o===0)||t.action===`restore`&&t.status===`completed`&&t.restored!==!0||(t.status===`failed`||t.status===`cancelled`)&&i===null||t.status===`completed`&&i!==null?null:{action:t.action,status:t.status,at:n,name:r??null,bytes:a??0,files:o??0,error:i}}function Ti(e){return e.status===`completed`?bi(e,[`action`,`status`,`at`,`name`,`bytes`,`files`,...e.action===`restore`?[`restored`]:[]]):bi(e,[`action`,`status`,`at`,`error`])}function Ei(e){let t=gi(e);if(t===void 0)return;let n=xi(t.name),r=yi(t.bytes,q.capsuleBytes);if(n!==void 0&&r!==void 0&&r!==0)return{name:n,bytes:r}}function Di(e){let t=gi(e),n=t??{},r=_i(n.capsules,q.displayLimit),i=r?.values??[],a=i.map(e=>{let t=gi(e);return{value:Ei(e),contractValid:t!==void 0&&bi(t,[`name`,`bytes`])}}),o=a.map(e=>e.value).filter(e=>e!==void 0),s=gi(n.inventory)??{},c=gi(n.limits)??{},l=gi(n.latest),u=wi(n.latest),d=vi(s.total,o.length),f=vi(s.shown,o.length),p=d>=o.length&&d<=q.inventory&&f===o.length&&s.truncated!==void 0&&typeof s.truncated==`boolean`&&s.displayLimit===q.displayLimit&&bi(s,[`total`,`shown`,`truncated`,`displayLimit`]),m=c.capsuleBytes===q.capsuleBytes&&c.inventory===q.inventory&&c.directoryEntries===q.directoryEntries&&bi(c,[`capsuleBytes`,`inventory`,`directoryEntries`]),h=typeof n.timeoutMs==`number`&&Number.isSafeInteger(n.timeoutMs)&&n.timeoutMs>=100&&n.timeoutMs<=6e4?n.timeoutMs:void 0,g=h!==void 0,_=t===void 0||r===void 0||r.altered||a.some(e=>!e.contractValid)||o.length!==i.length||n.latest!==null&&(l===void 0||u===null||!Ti(l))||typeof l?.error==`string`&&l.error!==u?.error||!p||!m||!g||!bi(n,[`latest`,`capsules`,`inventory`,`timeoutMs`,`limits`]);return{latest:u,capsules:o,inventory:{total:p?d:Math.max(o.length,Math.min(q.inventory,d)),shown:o.length,truncated:s.truncated===!0||_,displayLimit:q.displayLimit},timeoutMs:h??q.timeoutMs,limits:{capsuleBytes:q.capsuleBytes,inventory:q.inventory,directoryEntries:q.directoryEntries},truncated:_}}var Oi=new Set([`USED_SKILL`,`SOLVED_BY`,`REQUIRES`,`PATCHES`,`CONFLICTS_WITH`,`RELATED_TO`]),ki={nodes:2e3,relations:5e3,fileBytes:4194304,searchResults:50},Ai=8;function ji(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Mi(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function Ni(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0?e:t}function Pi(e,t){return typeof e==`string`&&e.trim()!==``?e.trim().slice(0,t):void 0}function Fi(e){return typeof e==`string`&&Number.isFinite(Date.parse(e))?new Date(e).toISOString():null}function Ii(e){if(!ji(e)||typeof e.id!=`string`||e.kind!==`task`&&e.kind!==`skill`&&e.kind!==`event`)return;let t=Pi(e.label,160),n=Pi(e.summary,2e3);if(t!==void 0&&n!==void 0)return{id:e.id.slice(0,160),kind:e.kind,label:t,summary:n,source:Pi(e.source,512)??null,updatedAt:Fi(e.updatedAt)}}function Li(e){if(!ji(e)||typeof e.relation!=`string`||!Oi.has(e.relation))return;let t=e.relation,n=Pi(e.fromLabel??e.from,160),r=Pi(e.toLabel??e.to,160);if(n!==void 0&&r!==void 0)return{id:Pi(e.id,160)??`relation`,relation:t,fromLabel:n,toLabel:r,createdAt:Fi(e.createdAt)}}function Ri(e){let t=ji(e)?e:{},n=Array.isArray(t.recent)?t.recent:[],r=n.slice(0,Ai),i=r.map(Ii).filter(e=>e!==void 0),a=Array.isArray(t.recentRelations)?t.recentRelations:[],o=a.slice(0,Ai),s=o.map(Li).filter(e=>e!==void 0),c=ji(t.kinds)?t.kinds:{},l=ji(t.limits)?t.limits:{},u=ji(t.lastSearch)?t.lastSearch:void 0,d=u!==void 0&&Array.isArray(u.nodes)?Math.min(u.nodes.length,ki.searchResults):0,f=u===void 0?void 0:Pi(u.query,160),p=r.some(e=>ji(e)&&[e.label,e.summary,e.source].some((e,t)=>typeof e==`string`&&e.length>[160,2e3,512][t])),m=n.length>Ai||i.length!==r.length||a.length>Ai||s.length!==o.length||p||u!==void 0&&typeof u.query==`string`&&u.query.length>160||u!==void 0&&Array.isArray(u.nodes)&&u.nodes.length>ki.searchResults;return{nodes:Mi(t.nodes,i.length),relations:Mi(t.relations,s.length),kinds:{task:Mi(c.task,0),skill:Mi(c.skill,0),event:Mi(c.event,0)},recent:i,recentRelations:s,lastSearch:u===void 0||f===void 0?null:{query:f,total:Mi(u.total,d),shown:d},limits:{nodes:Ni(l.nodes,ki.nodes),relations:Ni(l.relations,ki.relations),fileBytes:Ni(l.fileBytes,ki.fileBytes),searchResults:Ni(l.searchResults,ki.searchResults)},truncated:m}}var zi=50,Bi=2e3,Vi=500,J={fileBytes:4194304,depth:128,keysPerFile:5e4,flattenedKeyLength:2048,pathLength:4096,panelKeysPerSide:100},Hi=new Set([`status`,`report`,`limits`]),Ui=new Set([`state`,`at`,`error`]),Wi=new Set([`base`,`target`,`baseKeys`,`targetKeys`,`missing`,`extra`,`missingTotal`,`extraTotal`,`truncated`]),Gi=new Set(Object.keys(J)),Ki=/[\p{Cc}\p{Cf}\p{Cs}]/u;function qi(e,t){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>typeof e!=`string`||!t.has(e)))return;let i=Object.create(null);for(let[e,t]of Object.entries(r)){if(!(`value`in t))return;i[e]=t.value}return i}catch{return}}function Ji(e,t){let n=Object.keys(e);return n.length===t.size&&n.every(e=>t.has(e))}function Yi(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function Xi(e,t,n=!1){if(!(typeof e!=`string`||!n&&e.length===0||e!==e.trim()||Ki.test(e))&&!([...e].length>t||new TextEncoder().encode(e).byteLength>t))return e}function Zi(e){if(typeof e!=`string`||e.length>64)return;let t=Date.parse(e);if(Number.isFinite(t))try{return new Date(t).toISOString()===e?e:void 0}catch{return}}function Qi(e){try{if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype)return;let t=Object.getOwnPropertyDescriptor(e,`length`),n=t!==void 0&&`value`in t?t.value:void 0;if(!Number.isSafeInteger(n)||n<0||n>J.panelKeysPerSide)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>e!==`length`&&(typeof e!=`string`||!/^\d+$/u.test(e)))||Object.values(r).some(e=>!(`value`in e)))return;let i=[];for(let e=0;e<n;e+=1){let t=r[String(e)],n=Xi(t!==void 0&&`value`in t?t.value:void 0,J.flattenedKeyLength,!0);if(n===void 0)return;i.push(n)}return i}catch{return}}function $i(e){let t=qi(e,Ui);if(t===void 0)return;if(t.state===`idle`&&Ji(t,new Set([`state`])))return{state:`idle`,at:null,error:null};if(t.state===`running`&&Ji(t,new Set([`state`])))return{state:`running`,at:null,error:null};let n=Zi(t.at);if(t.state===`completed`&&n!==void 0&&Ji(t,new Set([`state`,`at`])))return{state:`completed`,at:n,error:null};if((t.state===`failed`||t.state===`cancelled`)&&n!==void 0&&Ji(t,Ui)){let e=Xi(t.error,Bi);if(e!==void 0)return{state:t.state,at:n,error:[...e].slice(0,Vi).join(``)}}}function ea(e){let t=qi(e,Wi);if(t===void 0||!Ji(t,Wi))return;let n=Xi(t.base,J.pathLength),r=Xi(t.target,J.pathLength),i=Yi(t.baseKeys,J.keysPerFile),a=Yi(t.targetKeys,J.keysPerFile),o=Qi(t.missing),s=Qi(t.extra),c=Yi(t.missingTotal,J.keysPerFile),l=Yi(t.extraTotal,J.keysPerFile);if(n===void 0||r===void 0||i===void 0||a===void 0||o===void 0||s===void 0||c===void 0||l===void 0||typeof t.truncated!=`boolean`)return;let u=Math.min(c,J.panelKeysPerSide),d=Math.min(l,J.panelKeysPerSide),f=u<c||d<l;if(!(o.length!==u||s.length!==d||t.truncated!==f||c>i||l>a||i-c!==a-l||new Set(o).size!==o.length||new Set(s).size!==s.length||o.some(e=>s.includes(e))))return{base:n,target:r,baseKeys:i,targetKeys:a,missing:o.slice(0,zi),extra:s.slice(0,zi),missingTotal:c,extraTotal:l,truncated:f||o.length>zi||s.length>zi}}function ta(e){let t=qi(e,Gi);return t!==void 0&&Ji(t,Gi)&&Object.entries(J).every(([e,n])=>t[e]===n)}function na(){return{status:{state:`unknown`,at:null,error:null},report:null,malformed:!0,limits:{...J}}}function ra(e){let t=qi(e,Hi);if(t===void 0||!Ji(t,Hi)||!ta(t.limits))return na();let n=$i(t.status);if(n===void 0)return na();let r=t.report===null?null:ea(t.report);return r===void 0||n.state===`idle`&&r!==null||n.state===`completed`&&r===null?na():{status:n,report:r,malformed:!1,limits:{...J}}}var ia=12,aa=8,oa=8,sa=12,ca={responseBytes:1048576,commandArgs:32,argumentBytes:4096,toolArgumentsBytes:65536,toolArgumentDepth:32,requestTimeoutMs:3e4,panelItems:20,inventoryItems:1e3,paginationPages:100,stderrBytes:8192,managedServers:128},la=new Set([`running`,`stopping`,`stopped`]);function ua(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.trunc(e):t}function da(e,t){return typeof e==`number`&&Number.isFinite(e)&&e>=t?Math.trunc(e):t}function fa(e,t){return typeof e==`string`&&e.length>0?e.slice(0,t):void 0}function pa(e){let t=L(e);if(t===void 0)return;let n=fa(t.name,512);if(n===void 0)return;let r=fa(t.description,500);return{name:n,...r===void 0?{}:{description:r}}}function ma(e){let t=L(e);if(t===void 0)return;let n=fa(t.uri,4096);if(n===void 0)return;let r=fa(t.name,512),i=fa(t.mimeType,256);return{uri:n,...r===void 0?{}:{name:r},...i===void 0?{}:{mimeType:i}}}function ha(e){let t=L(e);if(t===void 0)return;let n=fa(t.name,512);if(n===void 0)return;let r=fa(t.description,500);return{name:n,...r===void 0?{}:{description:r}}}function ga(e){let t=L(e);if(t===void 0)return;let n=fa(t.id,64);if(n!==void 0)return{id:n,status:typeof t.status==`string`&&la.has(t.status)?t.status:`unknown`,startedAt:typeof t.startedAt==`number`&&Number.isFinite(t.startedAt)&&t.startedAt>=0?Math.trunc(t.startedAt):0}}function _a(e,t,n){let r=vt(e,t+2)??[],i=r.map(n).filter(e=>e!==void 0).slice(0,t);return{values:i,clipped:r.length>t||r.length!==i.length,rawLength:r.length}}function va(e,t,n){let r=L(e)??{},i=da(r.total,t);return{total:i,shown:t,truncated:r.truncated===!0||n||i>t}}function ya(e){let t=L(e)??{},n=_a(t.tools,ia,pa),r=_a(t.resources,aa,ma),i=_a(t.prompts,oa,ha),a=_a(t.servers,sa,ga),o=L(t.inventory)??{},s=L(t.limits)??{};return{server:t.server===null?null:fa(t.server,4096)??null,tools:n.values,resources:r.values,prompts:i.values,lastCall:t.lastCall===null?null:fa(t.lastCall,512)??null,servers:a.values,inventory:{tools:va(o.tools,n.values.length,n.clipped),resources:va(o.resources,r.values.length,r.clipped),prompts:va(o.prompts,i.values.length,i.clipped),servers:va(o.servers,a.values.length,a.clipped)},limits:{responseBytes:ua(s.responseBytes,ca.responseBytes),commandArgs:ua(s.commandArgs,ca.commandArgs),argumentBytes:ua(s.argumentBytes,ca.argumentBytes),toolArgumentsBytes:ua(s.toolArgumentsBytes,ca.toolArgumentsBytes),toolArgumentDepth:ua(s.toolArgumentDepth,ca.toolArgumentDepth),requestTimeoutMs:ua(s.requestTimeoutMs,ca.requestTimeoutMs),panelItems:ua(s.panelItems,ca.panelItems),inventoryItems:ua(s.inventoryItems,ca.inventoryItems),paginationPages:ua(s.paginationPages,ca.paginationPages),stderrBytes:ua(s.stderrBytes,ca.stderrBytes),managedServers:ua(s.managedServers,ca.managedServers)}}}var ba={nameCharacters:128,recoveryEntries:1e4,persistenceErrorCharacters:2e3},xa=new Set([`idle`,`focused`,`happy`,`concerned`]),Sa=new Set([`session_start`,`agent_start`,`agent_end`,`tool_execution_end`,`feed`,`play`,`set_mood`]);function Ca(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function wa(e,t=0){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:t}function Ta(e,t){return typeof e==`string`?e.slice(0,t):``}function Ea(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function Da(e){let t=L(e)??{},n=L(t.limits)??{},r={nameCharacters:Ca(n.nameCharacters,ba.nameCharacters),recoveryEntries:Ca(n.recoveryEntries,ba.recoveryEntries),persistenceErrorCharacters:Ca(n.persistenceErrorCharacters,ba.persistenceErrorCharacters)},i=L(t.recovery)??{},a=wa(i.sessionEntries),o=Math.min(a,r.recoveryEntries,wa(i.scanned)),s=L(t.persistence)??{},c=wa(s.attempts),l=Ta(t.name,r.nameCharacters),u=typeof t.mood==`string`&&xa.has(t.mood)?t.mood:`idle`,d=typeof t.lastEvent==`string`&&Sa.has(t.lastEvent)?t.lastEvent:`session_start`,f=typeof t.energy==`number`&&Number.isSafeInteger(t.energy)&&t.energy>=0&&t.energy<=100?t.energy:80;return{name:l||`Pi`,mood:u,energy:f,interactions:wa(t.interactions),lastEvent:d,updatedAt:Ea(t.updatedAt),recovery:{sessionEntries:a,scanned:o,truncated:i.truncated===!0||a>o,restored:i.restored===!0},persistence:{attempts:c,failures:Math.min(c,wa(s.failures)),lastError:Ta(s.lastError,r.persistenceErrorCharacters)||null},limits:r}}var Oa={directoryEntries:4096,sessionBytes:4194304,sessions:100,allowedSessions:500,readConcurrency:8,contentParts:1e3,previewCharacters:500,panelItems:50,toolItems:100,queryCharacters:120,sessionIdCharacters:256,sessionNameCharacters:256,sessionPathCharacters:4096,statusErrorCharacters:2e3};function ka(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Aa(e,t,n=t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=n?e:t}function ja(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function Ma(e,t,n=``){return typeof e==`string`&&e.replaceAll(`\0`,`�`).slice(0,t)||n}function Na(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function Pa(e,t){if(!ka(e))return{state:`idle`,at:null,error:null};let n=e.state===`running`||e.state===`completed`||e.state===`failed`||e.state===`cancelled`?e.state:`idle`,r=Na(e.at);return(n===`completed`||n===`failed`||n===`cancelled`)&&r===null?{state:`idle`,at:null,error:null}:{state:n,at:r,error:(n===`failed`||n===`cancelled`)&&Ma(e.error,t)||null}}function Fa(e){let t=ka(e)?e:{},n=ka(t.limits)?t.limits:{},r=Aa(n.allowedSessions,Oa.allowedSessions),i={directoryEntries:Aa(n.directoryEntries,Oa.directoryEntries),sessionBytes:Aa(n.sessionBytes,Oa.sessionBytes),sessions:Aa(n.sessions,Math.min(Oa.sessions,r),r),allowedSessions:r,readConcurrency:Aa(n.readConcurrency,Oa.readConcurrency),contentParts:Aa(n.contentParts,Oa.contentParts),previewCharacters:Aa(n.previewCharacters,Oa.previewCharacters),panelItems:Aa(n.panelItems,Oa.panelItems),toolItems:Aa(n.toolItems,Oa.toolItems),queryCharacters:Aa(n.queryCharacters,Oa.queryCharacters),sessionIdCharacters:Aa(n.sessionIdCharacters,Oa.sessionIdCharacters),sessionNameCharacters:Aa(n.sessionNameCharacters,Oa.sessionNameCharacters),sessionPathCharacters:Aa(n.sessionPathCharacters,Oa.sessionPathCharacters),statusErrorCharacters:Aa(n.statusErrorCharacters,Oa.statusErrorCharacters)},a=(Array.isArray(t.items)?t.items:[]).slice(0,i.panelItems).map(e=>{let t=ka(e)?e:{},n=Ma(t.id,i.sessionIdCharacters,`unknown`);return{id:n,path:Ma(t.path,i.sessionPathCharacters),cwd:Ma(t.cwd,i.sessionPathCharacters),name:Ma(t.name,i.sessionNameCharacters,n),modified:Na(t.modified),messageCount:ja(t.messageCount,i.sessionBytes),message:Ma(t.message,i.previewCharacters)}}),o=ka(t.inventory)?t.inventory:{};return{scans:ja(t.scans,2**53-1),total:ja(t.total,i.sessions),items:a,status:Pa(t.status,i.statusErrorCharacters),inventory:{available:ja(o.available,i.directoryEntries),candidates:ja(o.candidates,i.directoryEntries),scanned:ja(o.scanned,i.sessions),unread:ja(o.unread,i.sessions),shown:ja(o.shown,i.panelItems),truncated:o.truncated===!0,discoveryTruncated:o.discoveryTruncated===!0,scanTruncated:o.scanTruncated===!0,displayTruncated:o.displayTruncated===!0},limits:i}}var Ia={candidates:50,displayCandidates:8,scannedEntries:4096,contentParts:1e3,previewCharacters:500,entryIdCharacters:200,editorTextCharacters:4096,errorCharacters:2e3};function Y(e,t){if(typeof e!=`object`||!e)return;let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}function La(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function Ra(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function za(e,t,n=``){return typeof e==`string`&&e.slice(0,t).replaceAll(`\0`,`�`)||n}function Ba(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function Va(e,t){return{entryId:za(Y(e,`entryId`),t.entryIdCharacters,`unknown`),text:za(Y(e,`text`),t.previewCharacters,`未命名轮次`)}}function Ha(e,t){let n=Y(e,`entryId`),r=Y(e,`text`);if(typeof n!=`string`||typeof r!=`string`)return;let i={entryId:za(n,t.entryIdCharacters),text:za(r,t.previewCharacters)};return i.entryId===``||i.text===``?void 0:i}function Ua(e,t){let n=Y(e,`status`),r=n===`queued`||n===`running`||n===`completed`||n===`failed`||n===`cancelled`?n:void 0;return r===void 0?null:{status:r,target:Va(Y(e,`target`),t),cancelled:Y(e,`cancelled`)===!0,summarized:Y(e,`summarized`)===!0,editorText:za(Y(e,`editorText`),t.editorTextCharacters)||null,error:(r===`failed`||r===`cancelled`)&&za(Y(e,`error`),t.errorCharacters)||null,requestedAt:Ba(Y(e,`requestedAt`)),startedAt:Ba(Y(e,`startedAt`)),finishedAt:Ba(Y(e,`finishedAt`))}}function Wa(e){let t=Y(e,`limits`),n={candidates:La(Y(t,`candidates`),Ia.candidates),displayCandidates:Ia.displayCandidates,scannedEntries:La(Y(t,`scannedEntries`),Ia.scannedEntries),contentParts:La(Y(t,`contentParts`),Ia.contentParts),previewCharacters:La(Y(t,`previewCharacters`),Ia.previewCharacters),entryIdCharacters:La(Y(t,`entryIdCharacters`),Ia.entryIdCharacters),editorTextCharacters:La(Y(t,`editorTextCharacters`),Ia.editorTextCharacters),errorCharacters:La(Y(t,`errorCharacters`),Ia.errorCharacters)},r=Y(e,`candidates`),i=[];if(Array.isArray(r)){let e=Math.max(0,r.length-Math.min(n.candidates,n.displayCandidates));for(let t=e;t<r.length;t+=1){let e=Object.getOwnPropertyDescriptor(r,String(t));if(e===void 0||!(`value`in e))continue;let a=Ha(e.value,n);a!==void 0&&i.push(a)}}let a=Y(e,`inventory`),o=Array.isArray(r)&&r.length>i.length,s=Y(a,`scanTruncated`)===!0,c=Y(a,`candidateTruncated`)===!0;return{candidates:i,inventory:{scannedEntries:Ra(Y(a,`scannedEntries`),n.scannedEntries),shown:Ra(Y(a,`shown`),n.candidates),truncated:Y(a,`truncated`)===!0||s||c||o,scanTruncated:s,candidateTruncated:c,displayTruncated:o},latest:Ua(Y(e,`latest`),n),limits:n}}var Ga={scannedMessages:1e4,jsonDepth:64,jsonNodesPerMessage:1e4,jsonNodesPerAudit:1e5,errorCharacters:2e3,recommendationCharacters:500,displayRecommendations:4,warnPercent:75,maxMessageBytes:65536,messageCount:4294967295};function X(e,t){if(!(typeof e!=`object`||!e))try{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}catch{return}}function Ka(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function qa(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function Ja(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:null}function Ya(e,t){return typeof e==`string`?e.slice(0,t).replaceAll(`\0`,`�`):``}function Xa(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function Za(e){let t=X(e,`length`);return typeof t==`number`&&Number.isSafeInteger(t)&&t>=0?t:0}function Qa(e,t){let n=X(e,`status`),r=n===`idle`||n===`queued`||n===`running`||n===`completed`||n===`failed`||n===`cancelled`?n:`unknown`;return{status:r,error:(r===`failed`||r===`cancelled`)&&Ya(X(e,`error`),t)||null,requestedAt:Xa(X(e,`requestedAt`)),startedAt:Xa(X(e,`startedAt`)),finishedAt:Xa(X(e,`finishedAt`))}}function $a(e){let t=X(e,`limits`),n={scannedMessages:Ka(X(t,`scannedMessages`),Ga.scannedMessages),jsonDepth:Ka(X(t,`jsonDepth`),Ga.jsonDepth),jsonNodesPerMessage:Ka(X(t,`jsonNodesPerMessage`),Ga.jsonNodesPerMessage),jsonNodesPerAudit:Ka(X(t,`jsonNodesPerAudit`),Ga.jsonNodesPerAudit),errorCharacters:Ka(X(t,`errorCharacters`),Ga.errorCharacters),recommendationCharacters:Ga.recommendationCharacters,displayRecommendations:Ga.displayRecommendations},r=X(e,`status`),i=r===`ok`||r===`warning`?r:`unknown`,a=X(e,`usagePercent`),o=typeof a==`number`&&Number.isFinite(a)&&a>=0?a:null,s=qa(X(e,`messageCount`),Ga.messageCount),c=qa(X(e,`scannedMessages`),Math.min(s,n.scannedMessages)),l=qa(X(e,`oversizedMessages`),c),u=qa(X(e,`uninspectableMessages`),l),d=qa(X(e,`toolErrors`),c),f=X(e,`warnPercent`),p=typeof f==`number`&&Number.isFinite(f)&&f>=1&&f<=100?f:Ga.warnPercent,m=Ka(X(e,`maxMessageBytes`),1048576),h=m===1048576&&X(e,`maxMessageBytes`)!==1048576?Ga.maxMessageBytes:m,g=X(e,`recommendations`),_=[],v=!1;if(Array.isArray(g)){let e=Za(g);for(let t=0;t<Math.min(e,n.displayRecommendations);t+=1){let e=Ya(X(g,String(t)),n.recommendationCharacters);if(e===``){v=!0;continue}_.push(e)}v||=e>_.length}return{status:i,usagePercent:o,tokens:Ja(X(e,`tokens`)),contextWindow:Ja(X(e,`contextWindow`)),messageCount:s,scannedMessages:c,messagesTruncated:X(e,`messagesTruncated`)===!0||s>c,oversizedMessages:l,uninspectableMessages:u,toolErrors:d,warnPercent:p,maxMessageBytes:h,recommendations:_,recommendationsTruncated:v,compaction:Qa(X(e,`compaction`),n.errorCharacters),limits:n}}var eo={scannedMessages:1e4,retainedEvents:50,displayedEvents:6,eventTypeCharacters:128},to=4294967295,no=864e13;function Z(e,t){if(!(typeof e!=`object`||!e))try{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}catch{return}}function ro(e,t=to){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function io(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:null}function ao(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:null}function oo(e){if(typeof e!=`string`)return`unknown`;let t=e.trim().replaceAll(`\0`,`�`);return t===``?`unknown`:t.slice(0,eo.eventTypeCharacters)}function so(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=no?e:null}function co(e){return Array.isArray(e)?ro(Z(e,`length`),to):0}function lo(e,t){let n={user:ro(Z(e,`user`),t),assistant:ro(Z(e,`assistant`),t),toolResult:ro(Z(e,`toolResult`),t),system:ro(Z(e,`system`),t),other:ro(Z(e,`other`),t)};return Object.values(n).reduce((e,t)=>e+t,0)===t?n:{user:0,assistant:0,toolResult:0,system:0,other:t}}function uo(e){let t;try{t=co(e)}catch{return{events:[],truncated:!1}}let n=Math.min(t,eo.retainedEvents),r=[];for(let i=0;i<Math.min(n,eo.displayedEvents);i+=1){let n=t-i-1,a=Z(e,String(n));r.push({type:oo(Z(a,`type`)),at:so(Z(a,`at`))})}return{events:r,truncated:t>r.length}}function fo(e){let t=ro(Z(e,`messages`)),n=ro(Z(e,`scannedMessages`),Math.min(t,eo.scannedMessages)),r=uo(Z(e,`recentEvents`));return{tokens:io(Z(e,`tokens`)),contextWindow:io(Z(e,`contextWindow`)),percent:ao(Z(e,`percent`)),messages:t,scannedMessages:n,messagesTruncated:Z(e,`messagesTruncated`)===!0||t>n,events:ro(Z(e,`events`)),compactions:ro(Z(e,`compactions`)),composition:lo(Z(e,`composition`),n),recentEvents:r.events,recentEventsTruncated:r.truncated,limits:eo}}var po={maxPercent:90,maxRunTokens:1e7,errorCharacters:2e3,streamingUpdateInterval:32,maxCount:4294967295};function mo(e,t){if(!(typeof e!=`object`||!e))try{let n=Object.getOwnPropertyDescriptor(e,t);return n!==void 0&&`value`in n?n.value:void 0}catch{return}}function ho(e,t=po.maxCount){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:null}function go(e){return typeof e!=`string`||e===``?null:e.replaceAll(`\0`,`�`).slice(0,po.errorCharacters)}function _o(e){let t=mo(e,`maxPercent`),n=typeof t==`number`&&Number.isFinite(t)&&t>=1&&t<=100?t:po.maxPercent,r=ho(mo(e,`maxRunTokens`),po.maxRunTokens)??0,i=mo(e,`percent`),a=typeof i==`number`&&Number.isFinite(i)&&i>=0?i:null,o=ho(mo(e,`tokens`)),s=ho(mo(e,`contextWindow`)),c=s!==null&&s>0?s:null,l=ho(mo(e,`runTokens`)),u=r>0&&l!==null&&l>=r;return{maxPercent:n,maxRunTokens:r,percent:a,tokens:o,contextWindow:c,runTokens:l,runExceeded:u,exceeded:a!==null&&a>=n||u,aborts:ho(mo(e,`aborts`))??0,lastError:go(mo(e,`lastError`)),limits:{maxRunTokens:po.maxRunTokens,errorCharacters:po.errorCharacters,streamingUpdateInterval:po.streamingUpdateInterval}}}var vo={packageBytes:262144,packageCharacters:262144,messages:100,messageCharacters:16e3,totalMessageCharacters:64e3,contentParts:1e3,attachments:100,attachmentMarkerCharacters:256,sessionIdCharacters:256,cwdCharacters:4096,modelFieldCharacters:256,previewTextCharacters:1e3,previewListItems:8,duplicateScanEntries:1e4,operationErrorCharacters:2e3};function yo(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function bo(e,t){return typeof e==`string`?e.slice(0,t):``}function xo(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function So(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:null}function Co(e,t,n){let r=L(e)??{},i=e=>(vt(e,n)??[]).slice(0,n).map(e=>bo(e,t)).filter(e=>e!==``);return{goal:bo(r.goal,t),currentState:bo(r.currentState,t),decisions:i(r.decisions),keyFiles:i(r.keyFiles),nextStep:bo(r.nextStep,t)}}function wo(e,t){let n=L(e);if(n===void 0)return null;let r=bo(n.sessionId,t.sessionIdCharacters),i=bo(n.cwd,t.cwdCharacters);if(r===``||i===``)return null;let a,o=L(n.model);if(o!==void 0){let e=bo(o.provider,t.modelFieldCharacters),n=bo(o.modelId,t.modelFieldCharacters);e!==``&&n!==``&&(a={provider:e,modelId:n})}return{sessionId:r,cwd:i,...a===void 0?{}:{model:a}}}function To(e,t){let n=L(e);if(n===void 0)return{state:`idle`,operation:null,at:null,error:null};let r=n.state===`idle`||n.state===`running`||n.state===`completed`||n.state===`failed`||n.state===`cancelled`?n.state:`idle`,i=n.operation===`export`||n.operation===`preview`||n.operation===`import`?n.operation:null,a=xo(n.at);return r!==`idle`&&i===null||(r===`completed`||r===`failed`||r===`cancelled`)&&a===null?{state:`idle`,operation:null,at:null,error:null}:{state:r,operation:i,at:a,error:(r===`failed`||r===`cancelled`)&&bo(n.error,t)||null}}function Eo(e){let t=L(e)??{},n=L(t.limits)??{},r=Object.fromEntries(Object.entries(vo).map(([e,t])=>[e,yo(n[e],t)])),i=L(t.latest),a=i?.direction===`export`||i?.direction===`import`?i.direction:void 0,o=bo(i?.sessionId,r.sessionIdCharacters),s=So(i?.messages,r.messages),c=So(i?.attachments,r.attachments),l=xo(i?.at),u=a===void 0||o===``||s===null||c===null||l===null?null:{direction:a,sessionId:o,messages:s,attachments:c,at:l},d=L(t.latestPreview),f=d!==void 0&&L(d.preview)!==void 0?d:void 0,p=wo(f?.source,r),m=f===void 0?t.currentPreview:f.preview;return{latest:u,source:f===void 0?null:p,preview:Co(m,r.previewTextCharacters,r.previewListItems),previewAt:f===void 0?null:xo(f.at),status:To(t.status,r.operationErrorCharacters),formatVersion:1,limits:r}}var Do={queryCharacters:120,skillBytes:131072,skills:50,panelReports:20,nameCharacters:64,sourceCharacters:128,pathCharacters:4096,statusErrorCharacters:2e3,findingsPerSkill:6,findingCodeCharacters:64,findingMessageCharacters:256,score:28};function Oo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ko(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=t?e:t}function Ao(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:0}function jo(e,t,n=``){return typeof e==`string`&&e.replaceAll(`\0`,`�`).slice(0,t)||n}function Mo(e){if(typeof e!=`string`||e.length>64)return null;try{return new Date(e).toISOString()===e?e:null}catch{return null}}function No(e,t){if(!Oo(e))return{state:`idle`,at:null,error:null};let n=e.state===`running`||e.state===`completed`||e.state===`failed`||e.state===`cancelled`?e.state:`idle`,r=Mo(e.at);return(n===`completed`||n===`failed`||n===`cancelled`)&&r===null?{state:`idle`,at:null,error:null}:{state:n,at:r,error:(n===`failed`||n===`cancelled`)&&jo(e.error,t)||null}}function Po(e){let t=Oo(e)?e:{},n=Oo(t.limits)?t.limits:{},r=Object.fromEntries(Object.entries(Do).map(([e,t])=>[e,ko(n[e],t)])),i=(Array.isArray(t.reports)?t.reports:[]).slice(0,r.panelReports).map(e=>{let t=Oo(e)?e:{},n=t.risk===`safe`||t.risk===`review`||t.risk===`blocked`?t.risk:`review`,i=(Array.isArray(t.findings)?t.findings:[]).slice(0,r.findingsPerSkill).map(e=>{let t=Oo(e)?e:{};return{code:jo(t.code,r.findingCodeCharacters,`finding`),severity:t.severity===`high`?`high`:`medium`,message:jo(t.message,r.findingMessageCharacters)}});return{name:jo(t.name,r.nameCharacters,`unknown`),risk:n,score:Ao(t.score,r.score),findings:i,path:jo(t.path,r.pathCharacters),source:jo(t.source,r.sourceCharacters,`unknown`),scannedBytes:Ao(t.scannedBytes,r.skillBytes)}}),a=Oo(t.inventory)?t.inventory:{};return{scans:Ao(t.scans,2**53-1),total:Ao(t.total,r.skills),blocked:Ao(t.blocked,r.skills),review:Ao(t.review,r.skills),reports:i,status:No(t.status,r.statusErrorCharacters),inventory:{available:Ao(a.available,2**53-1),scanned:Ao(a.scanned,r.skills),shown:Ao(a.shown,r.panelReports),truncated:a.truncated===!0,scanTruncated:a.scanTruncated===!0,displayTruncated:a.displayTruncated===!0},limits:r}}var Fo=12,Io=32,Lo=512,Ro=16384,zo=2e3,Bo=500,Vo={timeoutMs:5e3},Ho={queryLength:65536,databaseBytes:268435456,rows:100,columns:128,stringLength:16384,resultBytes:1048576,blobPreviewBytes:256,panelRows:20},Uo=new Set([`status`,`timeoutMs`,`latest`,`limits`]),Wo=new Set([`state`,`at`,`error`]),Go=new Set([`database`,`query`,`columns`,`rows`,`truncated`,`scannedRows`,`rowInventory`]),Ko=new Set([`scanned`,`returned`,`shown`,`truncated`,`displayLimit`]),qo=new Set([`type`,`bytes`,`previewBase64`,`truncated`]),Jo=new Set(Object.keys(Ho)),Yo=/[\p{Cc}\p{Cf}\p{Cs}\u2028\u2029]/u;function Xo(e,t){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>typeof e!=`string`||!t.has(e)))return;let i=Object.create(null);for(let[e,t]of Object.entries(r)){if(!(`value`in t))return;i[e]=t.value}return i}catch{return}}function Zo(e,t){let n=Object.keys(e);return n.length===t.size&&n.every(e=>t.has(e))}function Qo(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function $o(e,t,n=!1,r=!1){if(!(typeof e!=`string`||!n&&e.length===0)){for(let t of e)if(Yo.test(t)&&!(r&&(t===` `||t===`
24
24
  `||t===`\r`)))return;if(!([...e].length>t||new TextEncoder().encode(e).byteLength>t))return e}}function es(e){if(typeof e!=`string`||e.length>64)return;let t=Date.parse(e);if(Number.isFinite(t))try{return new Date(t).toISOString()===e?e:void 0}catch{return}}function ts(e,t){try{if(!Array.isArray(e)||Object.getPrototypeOf(e)!==Array.prototype)return;let n=Object.getOwnPropertyDescriptor(e,`length`),r=n!==void 0&&`value`in n?n.value:void 0;if(!Number.isSafeInteger(r)||r<0||r>t)return;let i=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(i).some(e=>e!==`length`&&(typeof e!=`string`||!/^\d+$/u.test(e)||Number(e)>=r||String(Number(e))!==e))||Object.values(i).some(e=>!(`value`in e)))return;let a=[];for(let e=0;e<r;e+=1){let t=i[String(e)];if(t===void 0||!(`value`in t))return;a.push(t.value)}return a}catch{return}}function ns(e){let t=Xo(e,Wo);if(t===void 0)return;if(t.state===`idle`&&Zo(t,new Set([`state`])))return{state:`idle`,at:null,error:null};if(t.state===`running`&&Zo(t,new Set([`state`])))return{state:`running`,at:null,error:null};let n=es(t.at);if(t.state===`completed`&&n!==void 0&&Zo(t,new Set([`state`,`at`])))return{state:`completed`,at:n,error:null};if((t.state===`failed`||t.state===`cancelled`)&&n!==void 0&&Zo(t,Wo)){let e=$o(t.error,zo);if(e!==void 0)return{state:t.state,at:n,error:[...e].slice(0,Bo).join(``)}}}function rs(e){if(e===null)return null;if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e==`string`)return $o(e,Ro,!0,!0);let t=Xo(e,qo);if(t===void 0||!Zo(t,qo)||t.type!==`blob`||typeof t.truncated!=`boolean`||typeof t.previewBase64!=`string`||t.previewBase64.length>344||!/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u.test(t.previewBase64))return;let n=Qo(t.bytes,2**53-1);return n===void 0?void 0:{type:`blob`,bytes:n,previewBase64:t.previewBase64,truncated:t.truncated}}function is(e){let t=Xo(e,Go);if(t===void 0||!Zo(t,Go))return;let n=$o(t.database,4096),r=$o(t.query,Ho.queryLength),i=ts(t.columns,Ho.columns),a=ts(t.rows,Ho.panelRows),o=Qo(t.scannedRows,2**53-1),s=Xo(t.rowInventory,Ko);if(n===void 0||r===void 0||i===void 0||a===void 0||o===void 0||s===void 0||!Zo(s,Ko)||typeof t.truncated!=`boolean`)return;let c=[];for(let e of i){let t=$o(e,Lo);if(t===void 0)return;c.push(t)}if(c.length===0||new Set(c).size!==c.length)return;let l=Qo(s.scanned,2**53-1),u=Qo(s.returned,Ho.rows),d=Qo(s.shown,Ho.panelRows);if(l===void 0||u===void 0||d===void 0||l!==o||d!==a.length||d!==Math.min(u,Ho.panelRows)||u>l||s.displayLimit!==Ho.panelRows||typeof s.truncated!=`boolean`)return;let f=[];for(let e of a){let t=Xo(e,new Set(c));if(t===void 0||Object.keys(t).length!==c.length)return;let n=Object.create(null);for(let e of c){let r=rs(t[e]);if(r===void 0)return;n[e]=r}f.push(n)}let p=f.slice(0,Fo);return{database:n,query:r,columns:c.slice(0,Io),rows:p,rowInventory:{scanned:l,returned:u,shown:p.length,truncated:t.truncated||s.truncated||f.length!==u||f.length>p.length||c.length>Io,displayLimit:Ho.panelRows}}}function as(e){let t=Xo(e,Jo);return t!==void 0&&Zo(t,Jo)&&Object.entries(Ho).every(([e,n])=>t[e]===n)}function os(){return{status:{state:`unknown`,at:null,error:null},timeoutMs:Vo.timeoutMs,latest:null,malformed:!0,limits:{...Ho}}}function ss(e){let t=Xo(e,Uo);if(t===void 0||!Zo(t,Uo))return os();let n=Qo(t.timeoutMs,3e4);if(n===void 0||n<100||!as(t.limits))return os();let r=ns(t.status);if(r===void 0)return os();let i=t.latest===null?null:is(t.latest);return i===void 0||r.state===`idle`&&i!==null||r.state===`completed`&&i===null?os():{status:r,timeoutMs:n,latest:i,malformed:!1,limits:{...Ho}}}var cs={members:64,tasks:256,messages:1e3,messageCharacters:4e3,mailboxReadMessages:25,agentTextBytes:32768,stateBytes:8388608,stateScanEntries:1e4,panelMembers:12,panelTasks:20,panelMessages:5},ls=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/u,us=new Set([`todo`,`blocked`,`in_progress`,`done`]),ds=new Set([`idle`,`working`]),fs=200,ps=200,ms=200,hs=20,gs=20,_s=20;function vs(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ys(e,t,n=0){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:n}function bs(e,t){return typeof e==`string`?e.replaceAll(/\p{Cc}/gu,`�`).slice(0,t):``}function xs(e){return typeof e==`string`&&ls.test(e)?e:void 0}function Ss(e){if(!vs(e))return;let t=xs(e.id),n=bs(e.name,fs);if(t!==void 0&&n!==``)return{id:t,name:n,role:bs(e.role,ps)||`协作成员`,status:typeof e.status==`string`&&ds.has(e.status)?e.status:`idle`}}function Cs(e){if(!vs(e))return;let t=xs(e.id),n=bs(e.title,ms),r=e.assignee===`unassigned`?`unassigned`:xs(e.assignee);if(t!==void 0&&n!==``&&r!==void 0)return{id:t,title:n,assignee:r,status:typeof e.status==`string`&&us.has(e.status)?e.status:`todo`,dependsOn:(Array.isArray(e.dependsOn)?e.dependsOn.slice(0,hs):[]).map(xs).filter(e=>e!==void 0)}}function ws(e){if(!vs(e))return;let t=xs(e.id),n=xs(e.from),r=xs(e.to),i=bs(e.body,cs.messageCharacters);if(t===void 0||n===void 0||r===void 0||i===``||typeof e.timestamp!=`string`)return;let a;try{a=new Date(e.timestamp).toISOString()}catch{return}if(a===e.timestamp)return{id:t,from:n,to:r,body:i,timestamp:a,read:e.read===!0}}function Ts(e,t){return Array.isArray(e)?e.slice(0,t).map(xs).filter(e=>e!==void 0):[]}function Es(e){if(!vs(e))return!1;if(!Array.isArray(e.dependsOn))return e.dependsOn!==void 0;let t=e.dependsOn.slice(0,hs);return e.dependsOn.length>t.length||t.some(e=>xs(e)===void 0)}function Ds(e,t,n,r){let i=vs(e)?e:{},a=Math.max(t,ys(i.total,n,t));return{total:a,shown:t,truncated:i.truncated===!0||r||a>t}}function Os(e){let t=vs(e)?e:{},n=Array.isArray(t.members)?t.members:[],r=Array.isArray(t.tasks)?t.tasks:[],i=Array.isArray(t.messages)?t.messages:[],a=n.slice(0,cs.panelMembers),o=r.slice(0,cs.panelTasks),s=i.slice(0,cs.panelMessages),c=a.map(Ss).filter(e=>e!==void 0),l=o.map(Cs).filter(e=>e!==void 0),u=s.map(ws).filter(e=>e!==void 0),d=Ts(t.readyTasks,gs),f=Array.isArray(t.dependencyCycle)?Ts(t.dependencyCycle,_s):null,p=t.members!==void 0&&!Array.isArray(t.members)||n.length>a.length||c.length!==a.length,m=t.tasks!==void 0&&!Array.isArray(t.tasks)||r.length>o.length||l.length!==o.length||o.some(Es)||t.readyTasks!==void 0&&!Array.isArray(t.readyTasks)||Array.isArray(t.readyTasks)&&t.readyTasks.length>d.length||t.dependencyCycle!==void 0&&t.dependencyCycle!==null&&!Array.isArray(t.dependencyCycle)||Array.isArray(t.dependencyCycle)&&t.dependencyCycle.length>(f?.length??0),h=t.messages!==void 0&&!Array.isArray(t.messages)||i.length>s.length||u.length!==s.length,g=p||m||h,_=vs(t.inventory)?t.inventory:{},v=Ds(_.members,c.length,cs.members,p),y=Ds(_.tasks,l.length,cs.tasks,m),b=vs(_.tasks)?_.tasks:{},x=Math.max(d.length,ys(b.ready,y.total,d.length)),S=vs(_.messages)?_.messages:{},C=Ds(S,u.length,cs.messages,h),w=u.filter(e=>!e.read).length,T=ys(S.unread,C.total,w),E=vs(t.history)?t.history:{},ee=ys(E.available,2**53-1),D=ys(E.scanned,ee);return{members:c,tasks:l,messages:u,readyTasks:d,dependencyCycle:f,inventory:{members:v,tasks:{...y,ready:x},messages:{...C,unread:T}},history:{available:ee,scanned:D,truncated:E.truncated===!0,restored:E.restored===!0},limits:cs,truncated:g}}var ks=[`png`,`jpeg`,`jpg`,`gif`,`webp`],As=new Set(ks),js=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),Ms=2e3,Ns={imageBytes:10485760,pathCharacters:4096,promptCharacters:4e3,evidenceBytes:524288,agentTextBytes:131072,timeoutMs:18e4,cacheEntries:64},Ps=1e3,Fs=3e5;function Is(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(e=>typeof e!=`string`))return;let r=Object.create(null);for(let[e,t]of Object.entries(n)){if(!(`value`in t))return;r[e]=t.value}return r}catch{return}}function Ls(e,t){if(typeof e!=`string`)return{value:void 0,altered:!0};let n=e.slice(0,t*2+1).replaceAll(/[\p{Cc}\p{Cf}]+/gu,` `).trim().slice(0,t);return{value:n===``?void 0:n,altered:n!==e}}function Rs(e){if(typeof e==`string`)try{return new Date(e).toISOString()===e?e:void 0}catch{return}}function zs(e,t=[]){let n=Is(e);if(n===void 0)return{image:null,altered:e!==null};let r=n.mode===`native`||n.mode===`evidence`?n.mode:void 0,i=Ls(n.path,Ns.pathCharacters),a=typeof n.mimeType==`string`&&js.has(n.mimeType)?n.mimeType:void 0,o=typeof n.bytes==`number`&&Number.isSafeInteger(n.bytes)&&n.bytes>=0&&n.bytes<=Ns.imageBytes?n.bytes:void 0,s=typeof n.cached==`boolean`&&!(r===`native`&&n.cached)?n.cached:void 0,c=Rs(n.at),l=new Set([`mode`,`path`,`mimeType`,`bytes`,`cached`,`at`,...t]),u=i.altered||Object.keys(n).some(e=>!l.has(e));return r===void 0||i.value===void 0||a===void 0||o===void 0||s===void 0||c===void 0?{image:null,altered:!0}:{image:{mode:r,path:i.value,mimeType:a,bytes:o,cached:s,at:c},altered:u}}function Bs(e){let t=Is(e);if(t===void 0)return{status:{state:`idle`},altered:!0};if(t.state===`idle`)return{status:{state:`idle`},altered:Object.keys(t).some(e=>e!==`state`)};if(t.state===`completed`){let e=zs(t,[`state`]);return e.image===null?{status:{state:`idle`},altered:!0}:{status:{state:`completed`,...e.image},altered:e.altered}}if(t.state!==`running`&&t.state!==`failed`&&t.state!==`cancelled`)return{status:{state:`idle`},altered:!0};let n=t.mode===`native`||t.mode===`evidence`?t.mode:void 0,r=Ls(t.path,Ns.pathCharacters),i=Rs(t.at);if(n===void 0||r.value===void 0||i===void 0)return{status:{state:`idle`},altered:!0};if(t.state===`running`){let e=r.altered||Object.keys(t).some(e=>!new Set([`state`,`mode`,`path`,`at`]).has(e));return{status:{state:`running`,mode:n,path:r.value,at:i},altered:e}}let a=Ls(t.error,Ms);if(a.value===void 0)return{status:{state:`idle`},altered:!0};let o=r.altered||a.altered||Object.keys(t).some(e=>!new Set([`state`,`mode`,`path`,`at`,`error`]).has(e));return{status:{state:t.state,mode:n,path:r.value,at:i,error:a.value},altered:o}}function Vs(e){try{if(!Array.isArray(e))return!1;let t=Object.getOwnPropertyDescriptor(e,`length`);if(t===void 0||!(`value`in t)||t.value!==ks.length)return!1;let n=new Set;for(let t=0;t<ks.length;t+=1){let r=Object.getOwnPropertyDescriptor(e,String(t));if(r===void 0||!(`value`in r)||typeof r.value!=`string`||!As.has(r.value))return!1;n.add(r.value)}return n.size===ks.length}catch{return!1}}function Hs(e){let t=Is(e);if(t===void 0)return{attached:!1,image:null,status:{state:`idle`},supportedTypes:[...ks],limits:{...Ns},truncated:!0};let n=zs(t.image),r=Bs(t.status),i=r.status.state!==`completed`||n.image!==null&&r.status.mode===n.image.mode&&r.status.path===n.image.path&&r.status.mimeType===n.image.mimeType&&r.status.bytes===n.image.bytes&&r.status.cached===n.image.cached&&r.status.at===n.image.at,a=Is(t.limits),o=a!==void 0&&typeof a.timeoutMs==`number`&&Number.isSafeInteger(a.timeoutMs)&&a.timeoutMs>=Ps&&a.timeoutMs<=Fs?a.timeoutMs:Ns.timeoutMs,s=[`imageBytes`,`pathCharacters`,`promptCharacters`,`evidenceBytes`,`agentTextBytes`,`cacheEntries`],c=a===void 0||s.some(e=>a[e]!==Ns[e])||Object.keys(a).some(e=>![...s,`timeoutMs`].includes(e))||o!==a.timeoutMs,l=n.image!==null,u=new Set([`attached`,`image`,`status`,`supportedTypes`,`limits`]),d=n.altered||r.altered||!i||c||!Vs(t.supportedTypes)||t.attached!==l||Object.keys(t).some(e=>!u.has(e));return{attached:l,image:n.image,status:r.status,supportedTypes:[...ks],limits:{...Ns,timeoutMs:o},truncated:d}}var Us=[`png`,`jpeg`,`jpg`,`gif`,`webp`],Ws=new Set(Us),Gs=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),Q={imageBytes:20971520,headerBytes:262144,pathCharacters:4096,assets:100,imageCandidates:256,scannedEntries:4096,scannedDirectories:512,depth:16,issues:20,issueCharacters:500,agentTextBytes:16384};function Ks(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(e=>typeof e!=`string`))return;let r=Object.create(null);for(let[e,t]of Object.entries(n)){if(!(`value`in t))return;r[e]=t.value}return r}catch{return}}function qs(e,t){try{if(!Array.isArray(e))return;let n=Object.getOwnPropertyDescriptor(e,`length`);if(n===void 0||!(`value`in n)||!Number.isSafeInteger(n.value)||n.value<0)return;let r=Math.min(n.value,t),i=[];for(let t=0;t<r;t+=1){let n=Object.getOwnPropertyDescriptor(e,String(t));if(n===void 0||!(`value`in n))return;i.push(n.value)}return{values:i,altered:n.value>t}}catch{return}}function Js(e,t){if(typeof e!=`string`)return{value:void 0,altered:!0};let n=e.slice(0,t*2+1).replaceAll(/[\p{Cc}\p{Cf}]+/gu,` `).trim().slice(0,t);return{value:n===``?void 0:n,altered:n!==e}}function Ys(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function Xs(e){if(typeof e==`string`)try{return new Date(e).toISOString()===e?e:void 0}catch{return}}function Zs(e,t){let n=new Set(t);return Object.keys(e).every(e=>n.has(e))}function Qs(e){let t=Ks(e);if(t===void 0)return{asset:void 0,altered:!0};let n=Js(t.path,Q.pathCharacters),r=typeof t.mimeType==`string`&&Gs.has(t.mimeType)?t.mimeType:void 0,i=Ys(t.bytes,Q.imageBytes),a=r===`image/png`?2147483647:r===`image/webp`?16777216:65535,o=t.width===null?null:Ys(t.width,a),s=t.height===null?null:Ys(t.height,a),c=typeof t.headerTruncated==`boolean`?t.headerTruncated:void 0,l=typeof o==`number`&&o>0&&typeof s==`number`&&s>0||o===null&&s===null&&c===!0&&r===`image/jpeg`,u=n.altered||!Zs(t,[`path`,`mimeType`,`bytes`,`width`,`height`,`headerTruncated`]);return n.value===void 0||r===void 0||i===void 0||c===void 0||!l?{asset:void 0,altered:!0}:{asset:{path:n.value,mimeType:r,bytes:i,width:o,height:s,headerTruncated:c},altered:u}}function $s(e){let t=Ks(e);if(t===void 0)return{issue:void 0,altered:!0};let n=Js(t.path,Q.pathCharacters),r=Js(t.reason,Q.issueCharacters),i=n.altered||r.altered||!Zs(t,[`path`,`reason`]);return n.value===void 0||r.value===void 0?{issue:void 0,altered:!0}:{issue:{path:n.value,reason:r.value},altered:i}}function ec(e){if(e===null)return{report:null,altered:!1};let t=Ks(e);if(t===void 0)return{report:null,altered:!0};let n=qs(t.assets,Q.assets),r=qs(t.issues,Q.issues);if(n===void 0||r===void 0)return{report:null,altered:!0};let i=[],a=[],o=n.altered||r.altered;for(let e of n.values){let t=Qs(e);o||=t.altered,t.asset!==void 0&&i.push(t.asset)}for(let e of r.values){let t=$s(e);o||=t.altered,t.issue!==void 0&&a.push(t.issue)}let s=Ys(t.inspectedCandidates,Q.imageCandidates),c=Ys(t.scannedEntries,Q.scannedEntries),l=Ys(t.scannedDirectories,Q.scannedDirectories),u=typeof t.truncated==`boolean`?t.truncated:void 0,d=typeof t.issuesTruncated==`boolean`?t.issuesTruncated:void 0,f=s!==void 0&&c!==void 0&&l!==void 0&&s<=c&&i.length<=s&&a.length<=c&&(d===!0||i.length+a.length<=c);return o||=!Zs(t,[`assets`,`issues`,`inspectedCandidates`,`scannedEntries`,`scannedDirectories`,`truncated`,`issuesTruncated`]),!f||u===void 0||d===void 0?{report:null,altered:!0}:{report:{assets:i,issues:a,inspectedCandidates:s,scannedEntries:c,scannedDirectories:l,truncated:u,issuesTruncated:d},altered:o}}function tc(e){let t=Ks(e);if(t===void 0)return{status:{state:`idle`},altered:!0};if(t.state===`idle`)return{status:{state:`idle`},altered:!Zs(t,[`state`])};let n=t.operation===`catalog`||t.operation===`info`?t.operation:void 0,r=Xs(t.at),i=t.path===void 0?{value:void 0,altered:!1}:Js(t.path,Q.pathCharacters),a=n===`catalog`?t.path===void 0:i.value!==void 0;if(n===void 0||r===void 0||!a)return{status:{state:`idle`},altered:!0};let o=i.value;if(t.state===`running`)return{status:{state:`running`,operation:n,...o===void 0?{}:{path:o},at:r},altered:i.altered||!Zs(t,[`state`,`operation`,...n===`info`?[`path`]:[],`at`])};if(t.state===`completed`){let e=Ys(t.count,Q.assets);return e===void 0||typeof t.truncated!=`boolean`?{status:{state:`idle`},altered:!0}:{status:{state:`completed`,operation:n,...o===void 0?{}:{path:o},count:e,truncated:t.truncated,at:r},altered:i.altered||!Zs(t,[`state`,`operation`,...n===`info`?[`path`]:[],`count`,`truncated`,`at`])}}if(t.state===`failed`||t.state===`cancelled`){let e=Js(t.error,Q.issueCharacters);return e.value===void 0?{status:{state:`idle`},altered:!0}:{status:{state:t.state,operation:n,...o===void 0?{}:{path:o},error:e.value,at:r},altered:i.altered||e.altered||!Zs(t,[`state`,`operation`,...n===`info`?[`path`]:[],`error`,`at`])}}return{status:{state:`idle`},altered:!0}}function nc(e){let t=qs(e,Us.length);return t===void 0||t.altered||t.values.some(e=>typeof e!=`string`)?!1:new Set(t.values).size===Us.length&&t.values.every(e=>Ws.has(e))}function rc(e){let t=Ks(e);return t===void 0||!Zs(t,Object.keys(Q))?!1:Object.entries(Q).every(([e,n])=>t[e]===n)}function ic(e){let t=Ks(e);if(t===void 0)return{status:{state:`idle`},report:null,supportedTypes:[...Us],limits:{...Q},truncated:!0};let n=tc(t.status),r=ec(t.report),i=n.status.state!==`completed`||r.report!==null&&n.status.count===r.report.assets.length&&n.status.truncated===r.report.truncated&&(n.status.operation===`catalog`||n.status.path===r.report.assets[0]?.path&&n.status.count===1),a=n.altered||r.altered||!i||!nc(t.supportedTypes)||!rc(t.limits)||!Zs(t,[`status`,`report`,`supportedTypes`,`limits`]);return{status:n.status,report:r.report,supportedTypes:[...Us],limits:{...Q},truncated:a}}var ac={nameCharacters:256,pathCharacters:512,scripts:256,plugins:256,errorCharacters:2e3},oc=1048576,sc=new Set([`generated`,`name`,`scripts`,`plugins`,`lastWrite`,`status`]),cc=new Set([`path`,`bytes`,`overwritten`]),lc=new Set([`state`,`operation`,`at`,`error`]);function uc(e,t){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return;let r=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(r).some(e=>typeof e!=`string`||!t.has(e)))return;let i=Object.create(null);for(let[e,t]of Object.entries(r)){if(!(`value`in t))return;i[e]=t.value}return i}catch{return}}function dc(e,t){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0&&e<=t?e:void 0}function fc(e){if(typeof e!=`string`||e.length>64)return;let t=Date.parse(e);if(Number.isFinite(t))try{return new Date(t).toISOString()===e?e:void 0}catch{return}}function pc(e){if(!(typeof e!=`string`||e.length===0||[...e].length>ac.nameCharacters)&&!(new TextEncoder().encode(e).byteLength>512||/[\p{Cc}\p{Cf}\p{Cs}]/u.test(e)))return e}function mc(e){if(typeof e!=`string`||e===``||e!==e.trim()||[...e].length>ac.pathCharacters||new TextEncoder().encode(e).byteLength>ac.pathCharacters||/[\\\p{Cc}\p{Cf}\p{Cs}]/u.test(e))return;let t=e.split(`/`);if(t.some(e=>e===``||e===`.`||e===`..`||e!==e.trim()))return;let n=t.at(-1);return n!==void 0&&/^README(?:[._-][^/]*)?\.md$/iu.test(n)?e:void 0}function hc(e){let t=uc(e,lc);if(t===void 0)return;let n=t.state,r=t.operation,i=t.at,a=t.error,o=Object.hasOwn(t,`operation`),s=Object.hasOwn(t,`at`),c=Object.hasOwn(t,`error`);if(n===`idle`&&!o&&!s&&!c)return{state:n,operation:null,at:null,error:null};if(n===`running`&&(r===`report`||r===`write`)&&!s&&!c)return{state:n,operation:r,at:null,error:null};let l=fc(i);if(n===`completed`&&(r===`report`||r===`write`)&&l!==void 0&&!c)return{state:n,operation:r,at:l,error:null};if((n===`failed`||n===`cancelled`)&&(r===`report`||r===`write`)&&l!==void 0&&typeof a==`string`&&a.length>0&&a.length<=ac.errorCharacters&&!/[\p{Cc}\p{Cf}\p{Cs}]/u.test(a))return{state:n,operation:r,at:l,error:a}}function gc(){return{generated:null,lastWrite:null,status:{state:`unknown`,operation:null,at:null,error:null},malformed:!0,limits:{...ac}}}function _c(e){let t=uc(e,sc);if(t===void 0||typeof t.generated!=`boolean`)return gc();let n=hc(t.status);if(n===void 0)return gc();let r=null;if(t.generated){let e=pc(t.name),n=dc(t.scripts,ac.scripts),i=dc(t.plugins,ac.plugins);if(e===void 0||n===void 0||i===void 0)return gc();r={name:e,scripts:n,plugins:i}}else if(Object.hasOwn(t,`name`)||Object.hasOwn(t,`scripts`)||Object.hasOwn(t,`plugins`))return gc();let i=null;if(t.lastWrite!==null){let e=uc(t.lastWrite,cc),n=mc(e?.path),r=dc(e?.bytes,oc),a=e?.overwritten;if(e===void 0||n===void 0||r===void 0||typeof a!=`boolean`)return gc();i={path:n,bytes:r,overwritten:a}}return!t.generated&&i!==null||n.state===`idle`&&(t.generated||i!==null)||n.state===`completed`&&(!t.generated||n.operation===`write`&&i===null)?gc():{generated:r,lastWrite:i,status:n,malformed:!1,limits:{...ac}}}var $=(e,t=`—`)=>{if(e==null||e===``)return t;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return String(e);try{return JSON.stringify(e)}catch{return t}},vc=[`button:not([disabled])`,`a[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`summary`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function yc(e,t,n=!1,r){let i=(0,o.useRef)(null),a=(0,o.useRef)(t),s=(0,o.useRef)(n);return a.current=t,s.current=n,(0,o.useEffect)(()=>{if(!e)return;let t=document.activeElement,n=t instanceof HTMLElement&&t!==document.body&&t!==document.documentElement?t:void 0,o=()=>Array.from(i.current?.querySelectorAll(vc)??[]).filter(e=>!e.hidden&&e.getAttribute(`aria-hidden`)!==`true`&&e.getClientRects().length>0),c=window.requestAnimationFrame(()=>{let e=i.current;!e||e.contains(document.activeElement)||(e.querySelector(`[data-dialog-initial-focus]`)??o()[0])?.focus()}),l=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopImmediatePropagation(),s.current||a.current();return}if(e.key!==`Tab`)return;let t=o();if(!t.length){e.preventDefault(),i.current?.focus();return}let n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())};return window.addEventListener(`keydown`,l,!0),()=>{window.cancelAnimationFrame(c),window.removeEventListener(`keydown`,l,!0);let e=n?.isConnected?n:r?document.querySelector(r):void 0;e&&window.requestAnimationFrame(()=>e.focus())}},[e,r]),i}var bc=(e,t)=>e?.cwd??(typeof t?.sessionFile==`string`?t.sessionFile:`未选择工作区`),xc=e=>{let t=$(e.type,``);return t===`file_diff`?`文件差异`:t===`file`?`文件详情`:$(e.summary??e.message??e.toolName??e.type??e.event,`未命名事件`)},Sc=e=>[[`context`,`上下文`],[`agent-teams`,`协作`],[`modlens`,`视觉`],[`token-guard`,`预算`],[`git-time-capsule`,`版本控制`],[`dependency-checker`,`工程诊断`],[`at-file`,`文件上下文`],[`test-harness`,`测试`],[`session-insights`,`会话统计`],[`session-compare`,`会话对比`],[`secure-audit`,`安全审计`],[`readme-gen`,`文档生成`],[`i18n-pair`,`国际化`],[`cleaner`,`清理`],[`sql-lens`,`数据库`],[`docker-sandbox`,`沙箱`],[`mcp-client`,`工具协议`],[`mcp-panel`,`MCP 控制台`],[`browser-fetch`,`网页抓取`],[`web-research`,`联网研究`],[`browser-session`,`浏览器会话`],[`yaml-validator`,`配置校验`],[`mock-server`,`接口模拟`],[`cli-notifier`,`桌面通知`],[`obsidian-sync`,`知识库`],[`context-doctor`,`上下文诊断`],[`history-compressor`,`历史压缩`],[`reviewer-bot`,`代码审查`],[`auto-mode`,`安全执行`],[`plan-execute`,`计划执行`],[`plugin-finder`,`插件发现`],[`taskboard`,`任务看板`],[`synapse`,`会话地图`],[`hol-guard`,`安全防护`],[`plugin-radar`,`生态雷达`],[`plugin-stars`,`排行榜`],[`plugin-check`,`插件体检`],[`annotation`,`批注上下文`],[`cost-meter`,`成本账本`],[`undo-savepoint`,`恢复保存点`],[`skill-catalog`,`技能目录`],[`graph-memory`,`知识图谱`],[`memory`,`跨会话记忆`],[`canvas-draw`,`流程图`],[`image-compressor`,`图片压缩`],[`workspace-search`,`工作区检索`],[`prompt-guard`,`提示词防护`],[`code2skill`,`技能打包`],[`tab-manager`,`会话标签`],[`genui`,`结构化界面`],[`anchored-standard`,`轨迹锚定`],[`telemetry-blocker`,`遥测拦截`],[`change-verifier`,`变更门禁`],[`plugin-dev`,`插件开发`],[`openpets`,`桌面伙伴`],[`vision-toolkit`,`视觉素材`],[`session-bridge`,`会话交接`],[`skill-guard`,`Skill 安全`],[`recall-unread`,`会话召回`],[`turn-rewind`,`会话回退`],[`session-export`,`会话导出`],[`session-search`,`会话搜索`],[`session-bookmarks`,`会话书签`],[`llm-verifier`,`模型校验`],[`module-search`,`模块检索`],[`workspace-navigator`,`工作区导航`],[`better-sidebar`,`侧栏概览`],[`archify`,`架构地图`],[`mirage-bridge`,`Mirage 虚拟终端`],[`theme-studio`,`主题`],[`reverse-skill`,`技能隔离`],[`colleague-skill`,`角色交接`],[`prompt-library`,`提示词库`],[`model`,`模型`],[`tool`,`工具`],[`session`,`会话`],[`resource`,`资源`],[`web`,`界面`],[`gateway`,`界面`]].find(([t])=>e.includes(t))?.[1]??`运行时`,Cc=e=>{let t=new Map([[`@pi-harness/core/plugins/context`,`Context insights`],[`@pi-harness/core/plugins/agent-teams`,`Agent Teams`],[`@pi-harness/core/plugins/modlens`,`ModLens vision bridge`],[`@pi-harness/core/plugins/token-guard`,`Token Guard`],[`@pi-harness/core/plugins/git-time-capsule`,`Git Time Capsule`],[`@pi-harness/core/plugins/dependency-checker`,`Dependency Checker`],[`@pi-harness/core/plugins/at-file`,`@file context`],[`@pi-harness/core/plugins/fail-logger`,`Failure Logger`],[`@pi-harness/core/plugins/test-harness`,`Test Harness`],[`@pi-harness/core/plugins/session-insights`,`Session Insights`],[`@pi-harness/core/plugins/session-compare`,`Session Compare`],[`@pi-harness/core/plugins/secure-audit`,`Secure Audit`],[`@pi-harness/core/plugins/readme-gen`,`README Generator`],[`@pi-harness/core/plugins/i18n-pair`,`I18n Pair`],[`@pi-harness/core/plugins/cleaner`,`Harness Cleaner`],[`@pi-harness/core/plugins/sql-lens`,`SQL Lens`],[`@pi-harness/core/plugins/docker-sandbox`,`Docker Sandbox`],[`@pi-harness/core/plugins/mcp-client`,`MCP Client`],[`@pi-harness/core/plugins/mcp-panel`,`MCP Console`],[`@pi-harness/core/plugins/browser-fetch`,`Browser Fetch`],[`@pi-harness/core/plugins/web-research`,`Web Research`],[`@pi-harness/core/plugins/browser-session`,`Browser Session`],[`@pi-harness/core/plugins/yaml-validator`,`YAML Validator`],[`@pi-harness/core/plugins/mock-server`,`Mock Server`],[`@pi-harness/core/plugins/cli-notifier`,`CLI Notifier`],[`@pi-harness/core/plugins/obsidian-sync`,`Obsidian Sync`],[`@pi-harness/core/plugins/context-doctor`,`Context Doctor`],[`@pi-harness/core/plugins/history-compressor`,`History Compressor`],[`@pi-harness/core/plugins/reviewer-bot`,`Reviewer Bot`],[`@pi-harness/core/plugins/auto-mode`,`Auto Mode`],[`@pi-harness/core/plugins/plan-execute`,`Plan Execute`],[`@pi-harness/core/plugins/plugin-finder`,`Plugin Finder`],[`@pi-harness/core/plugins/taskboard`,`Taskboard`],[`@pi-harness/core/plugins/synapse`,`Synapse`],[`@pi-harness/core/plugins/hol-guard`,`HOL Guard`],[`@pi-harness/core/plugins/plugin-radar`,`Plugin Radar`],[`@pi-harness/core/plugins/plugin-check`,`Plugin Check`],[`@pi-harness/core/plugins/annotation`,`Annotations`],[`@pi-harness/core/plugins/cost-meter`,`Cost Meter`],[`@pi-harness/core/plugins/undo-savepoint`,`Undo Savepoints`],[`@pi-harness/core/plugins/skill-catalog`,`Skills Catalog`],[`@pi-harness/core/plugins/memory`,`Memory`],[`@pi-harness/core/plugins/graph-memory`,`Graph Memory`],[`@pi-harness/core/plugins/canvas-draw`,`Canvas Draw`],[`@pi-harness/core/plugins/image-compressor`,`Image Compressor`],[`@pi-harness/core/plugins/workspace-search`,`Workspace Search`],[`@pi-harness/core/plugins/prompt-guard`,`Prompt Guard`],[`@pi-harness/core/plugins/code2skill`,`Code2Skill`],[`@pi-harness/core/plugins/tab-manager`,`Session Tabs`],[`@pi-harness/core/plugins/genui`,`GenUI`],[`@pi-harness/core/plugins/anchored-standard`,`Anchored Standard`],[`@pi-harness/core/plugins/telemetry-blocker`,`Telemetry Blocker`],[`@pi-harness/core/plugins/change-verifier`,`Change Verifier`],[`@pi-harness/core/plugins/plugin-dev`,`Plugin Dev`],[`@pi-harness/core/plugins/openpets`,`OpenPets`],[`@pi-harness/core/plugins/vision-toolkit`,`Vision Toolkit`],[`@pi-harness/core/plugins/plugin-stars`,`Plugin Stars`],[`@pi-harness/core/plugins/session-bridge`,`Session Bridge`],[`@pi-harness/core/plugins/skill-guard`,`Skill Guard`],[`@pi-harness/core/plugins/recall-unread`,`Recall Unread`],[`@pi-harness/core/plugins/turn-rewind`,`Turn Rewind`],[`@pi-harness/core/plugins/session-export`,`Session Export`],[`@pi-harness/core/plugins/session-search`,`Session Search`],[`@pi-harness/core/plugins/session-bookmarks`,`Session Bookmarks`],[`@pi-harness/core/plugins/llm-verifier`,`LLM Verifier`],[`@pi-harness/core/plugins/module-search`,`Module Search`],[`@pi-harness/core/plugins/workspace-navigator`,`Workspace Navigator`],[`@pi-harness/core/plugins/better-sidebar`,`Better Sidebar`],[`@pi-harness/core/plugins/archify`,`Architecture Map`],[`@pi-harness/core/plugins/mirage-bridge`,`Mirage Bridge`],[`@pi-harness/core/plugins/theme-studio`,`Theme Studio`],[`@pi-harness/core/plugins/reverse-skill`,`Reverse Skill Firewall`],[`@pi-harness/core/plugins/colleague-skill`,`Colleague Skill`],[`@pi-harness/core/plugins/prompt-library`,`Prompt Library`],[`@pi-harness/core/plugins/runtime-doctor`,`Runtime Doctor`]]).get(e);if(t!==void 0)return t;let n=e.match(/^@[^/]+\/cordis-plugin-(.+)$/i);return n?`官方 · ${n[1]}`:e.toLowerCase().includes(`cordis`)?e.replace(/cordis/gi,`runtime`):e},wc=()=>{if(typeof window>`u`)return{page:`session`,view:`chat`,marketplaceQuery:``,marketplaceCapability:``,marketplaceCategory:``,marketplacePlugin:void 0,installedPlugin:void 0,marketplacePage:0};let e=new URLSearchParams(window.location.search),t=e.get(`page`),n=e.get(`view`),r=e.get(`settings`),i=t===`plugins`||t===`marketplace`?t:`session`,a=n===`trajectory`||n===`files`?n:`chat`,o=r===`providers`||r===`toml`||r===`general`?r:void 0,s=Number.parseInt(e.get(`marketplacePage`)??`0`,10);return{page:i,view:a,settings:o,sessionPath:e.get(`session`)??void 0,marketplaceQuery:e.get(`marketplaceQuery`)??``,marketplaceCapability:e.get(`capability`)??``,marketplaceCategory:e.get(`category`)??``,marketplacePlugin:Qe(e),installedPlugin:fr(e),marketplacePage:Number.isFinite(s)&&s>=0?s:0}};function Tc(e){let t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=n-864e5,i=new Map;for(let t of e){let e=t.modified??t.created,a=typeof e==`number`?e:typeof e==`string`?Date.parse(e):NaN,o=Number.isFinite(a)&&a>=n?`今天`:Number.isFinite(a)&&a>=r?`昨天`:`更早`;i.set(o,[...i.get(o)??[],t])}return[`今天`,`昨天`,`更早`].flatMap(e=>{let t=i.get(e);return t?.length?[[e,t]]:[]})}function Ec({status:e,workspaces:t,onCreate:n,onStarter:r,onToml:i}){return(0,j.jsxs)(`div`,{className:`new-session-screen`,children:[(0,j.jsx)(`div`,{className:`welcome-kicker`,children:`PI AGENT HARNESS · REAL RUNTIME`}),(0,j.jsxs)(`div`,{className:`welcome-heading`,children:[(0,j.jsx)(`span`,{className:`pi-mark large`,"aria-hidden":`true`,children:(0,j.jsx)(`img`,{src:`/icons/svg/mark-white.svg`,alt:``})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:`开始一个工作会话`}),(0,j.jsx)(`p`,{children:`连接当前工作区,直接让 Pi agent 读取、修改并验证代码。`})]})]}),(0,j.jsx)(`div`,{className:`workspace-picker`,children:t.length?t.map(t=>(0,j.jsxs)(`button`,{className:`workspace-row`,onClick:()=>n(t),type:`button`,children:[(0,j.jsx)(`span`,{className:`workspace-status ${t.current?`live`:`offline`}`,children:t.current?`已连接`:`工作区`}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`code`,{children:t.path}),(0,j.jsx)(`small`,{children:t.current&&e?`${t.branch} · ${e.model}`:t.branch})]}),(0,j.jsx)(`span`,{className:`workspace-arrow`,children:`↗`})]},t.path)):(0,j.jsxs)(`div`,{className:`workspace-row is-empty`,children:[(0,j.jsx)(`span`,{className:`workspace-status offline`,children:`加载中`}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`code`,{children:e?.cwd??`加载工作区…`}),(0,j.jsx)(`small`,{children:`正在读取 git worktree`})]})]})}),(0,j.jsxs)(`div`,{className:`effective-config`,children:[(0,j.jsx)(`span`,{className:`config-label`,children:`当前运行时`}),(0,j.jsx)(`span`,{children:e?.model??`由运行时提供`}),(0,j.jsx)(`span`,{children:e?`${e.messages} 条消息`:`—`}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),i()},children:`改配置 ⌘,`})]}),(0,j.jsx)(`div`,{className:`starter-grid`,children:[[`定位问题`,`分析当前仓库并给出根因`],[`修复并测试`,`实现修复并运行相关测试`],[`审查改动`,`只读检查未提交变更`],[`解释代码`,`解释当前文件的关键逻辑`]].map(([e,t])=>(0,j.jsxs)(`button`,{className:`starter-card`,onClick:()=>r(t),type:`button`,children:[(0,j.jsx)(`strong`,{children:e}),(0,j.jsx)(`small`,{children:t})]},e))})]})}function Dc({workspaces:e,onSelect:t,onPickDirectory:n,onClose:r,error:i}){let a=yc(!0,r);return(0,j.jsx)(`div`,{className:`workspace-chooser`,onClick:r,children:(0,j.jsxs)(`div`,{"aria-label":`选择工作区`,"aria-modal":`true`,className:`workspace-chooser-dialog`,onClick:e=>e.stopPropagation(),ref:a,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`div`,{className:`workspace-chooser-heading`,children:[(0,j.jsx)(`strong`,{children:`新建会话`}),(0,j.jsx)(`button`,{"aria-label":`关闭工作区选择`,onClick:r,type:`button`,children:`×`})]}),(0,j.jsx)(`small`,{children:`选择这个会话要使用的工作区`}),i?(0,j.jsx)(`div`,{className:`workspace-chooser-error`,role:`alert`,children:i}):null,(0,j.jsxs)(`button`,{className:`workspace-pick-directory`,"data-dialog-initial-focus":!0,onClick:()=>void n(),type:`button`,children:[(0,j.jsx)(`span`,{children:`打开目录`}),(0,j.jsx)(`small`,{children:`从 Finder 选择一个新的工作目录`})]}),(0,j.jsx)(`div`,{className:`workspace-chooser-divider`,children:(0,j.jsx)(`span`,{children:`或选择已有 worktree`})}),e.length?e.map(e=>(0,j.jsxs)(`button`,{className:`workspace-chooser-row`,onClick:()=>t(e),type:`button`,children:[(0,j.jsx)(`span`,{className:`workspace-status ${e.current?`live`:`offline`}`,children:e.current?`当前`:`worktree`}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:e.name}),(0,j.jsx)(`code`,{children:e.path})]}),(0,j.jsx)(`small`,{children:e.branch})]},e.path)):(0,j.jsx)(`span`,{className:`workspace-chooser-empty`,children:`正在读取 git worktree…`})]})})}function Oc({kind:e,name:t,count:n,value:r,busy:i,onChange:a,onClose:o,onConfirm:s}){let c=e===`delete`||e===`batch-delete`,l=e===`rename`?`重命名会话`:e===`archive`?`归档会话`:c?`删除会话`:`会话操作`,u=e===`rename`?`给这个会话一个容易识别的名称。`:e===`archive`?`归档后会从默认列表隐藏,之后仍可在会话工具中恢复。`:`将永久删除${n&&n>1?` ${n} 个会话`:`这个会话`}及其本地记录,此操作不可撤销。`,d=yc(!0,o,i,`.session-menu`);return(0,j.jsx)(`div`,{className:`session-dialog-backdrop`,onClick:()=>{i||o()},children:(0,j.jsxs)(`div`,{"aria-label":l,"aria-modal":`true`,className:`session-dialog`,onClick:e=>e.stopPropagation(),ref:d,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`header`,{className:`session-dialog-header`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:l}),(0,j.jsx)(`small`,{children:u})]}),(0,j.jsx)(`button`,{"aria-label":`关闭`,disabled:i,onClick:o,type:`button`,children:`×`})]}),e===`rename`&&(0,j.jsxs)(`label`,{className:`session-dialog-field`,children:[(0,j.jsx)(`span`,{children:`名称`}),(0,j.jsx)(`input`,{"data-dialog-initial-focus":!0,disabled:i,onChange:e=>a(e.target.value),onKeyDown:e=>e.key===`Enter`&&!i&&s(),value:r})]}),t&&e!==`rename`&&(0,j.jsx)(`div`,{className:`session-dialog-target`,children:t}),(0,j.jsxs)(`footer`,{className:`session-dialog-actions`,children:[(0,j.jsx)(`button`,{"data-dialog-initial-focus":e===`rename`?void 0:``,disabled:i,onClick:o,type:`button`,children:`取消`}),(0,j.jsx)(`button`,{className:c?`danger`:`primary`,disabled:i||e===`rename`&&!r.trim(),onClick:s,type:`button`,children:i?`处理中…`:e===`rename`?`保存名称`:e===`archive`?`归档`:`永久删除`})]})]})})}function kc({title:e,description:t,target:n,confirmLabel:r,busy:i,onClose:a,onConfirm:o}){let s=yc(!0,a,i);return(0,j.jsx)(`div`,{className:`session-dialog-backdrop`,onClick:()=>{i||a()},children:(0,j.jsxs)(`div`,{"aria-label":e,"aria-modal":`true`,className:`session-dialog`,onClick:e=>e.stopPropagation(),ref:s,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`header`,{className:`session-dialog-header`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:e}),(0,j.jsx)(`small`,{children:t})]}),(0,j.jsx)(`button`,{"aria-label":`关闭`,disabled:i,onClick:a,type:`button`,children:`×`})]}),n&&(0,j.jsx)(`div`,{className:`session-dialog-target`,children:n}),(0,j.jsxs)(`footer`,{className:`session-dialog-actions`,children:[(0,j.jsx)(`button`,{"data-dialog-initial-focus":!0,disabled:i,onClick:a,type:`button`,children:`取消`}),(0,j.jsx)(`button`,{className:`danger`,disabled:i,onClick:o,type:`button`,children:i?`处理中…`:r})]})]})})}function Ac({busy:e,position:t,onRename:n,onFork:r,onArchive:i,onDelete:a}){return(0,je.createPortal)((0,j.jsxs)(`div`,{className:`session-row-menu-popover`,"data-session-popover":!0,onClick:e=>e.stopPropagation(),role:`menu`,style:t,children:[(0,j.jsx)(`button`,{autoFocus:!0,disabled:e,onClick:n,role:`menuitem`,type:`button`,children:`重命名`}),(0,j.jsx)(`button`,{disabled:e,onClick:r,role:`menuitem`,type:`button`,children:`复制会话`}),(0,j.jsx)(`button`,{disabled:e,onClick:i,role:`menuitem`,type:`button`,children:`归档会话`}),(0,j.jsx)(`button`,{className:`danger`,disabled:e,onClick:a,role:`menuitem`,type:`button`,children:`删除会话`})]}),document.body)}var jc=(e,t,n,r)=>{let i=e.getBoundingClientRect(),a=window.innerWidth-i.right-8>=t?i.right+8:Math.max(8,i.left-t-8),o=r===`below`?i.bottom+6:i.top-4;return{left:Math.round(a),top:Math.round(Math.min(Math.max(8,o),Math.max(8,window.innerHeight-n-8)))}};function Mc({message:e}){let t=/No API key found for everyapi/i.test(e),n=t||/No API key found|authentication|未配置认证/i.test(e);return(0,j.jsxs)(`div`,{className:`action-error`,role:`alert`,children:[(0,j.jsxs)(`div`,{className:`action-error-summary`,children:[(0,j.jsx)(`strong`,{children:t?`EveryAPI 认证未注入当前进程`:n?`模型尚未配置认证`:`发送失败`}),(0,j.jsx)(`span`,{children:t?`请用 everyapi use pi-harness 启动,或设置 EVERYAPI_RELAY_KEY 后重启。`:n?`请在设置 → 提供商中配置 API key,然后重试。`:`运行时没有接受这次请求,请重试或查看错误详情。`})]}),(0,j.jsxs)(`details`,{children:[(0,j.jsx)(`summary`,{children:`查看原始错误`}),(0,j.jsx)(`code`,{children:e})]})]})}function Nc({text:e}){let t=Xe(e);return(0,j.jsxs)(`div`,{className:`user-bubble`,children:[(0,j.jsx)(`span`,{children:t.question}),t.count>0?(0,j.jsxs)(`span`,{className:`ml-2 inline-flex rounded-md bg-[#edf3fe] px-1.5 py-0.5 text-[10px] text-[#315fb8]`,children:[`批注 ×`,t.count]}):null]})}function Pc({event:e,onClose:t,onCopy:n}){if(!e)return(0,j.jsxs)(`aside`,{className:`details-panel`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`事件详情`}),(0,j.jsx)(`button`,{"aria-label":`关闭事件详情`,onClick:t,type:`button`,children:`×`})]}),(0,j.jsx)(`div`,{className:`details-body`,children:(0,j.jsx)(`div`,{className:`empty-state`,children:`选择轨迹中的事件查看原始数据。`})})]});let r=e.output??e.result??e.message,i=e.type===`file`||e.type===`file_diff`,a=i?[[`来源`,`/api/files`],[`文件`,$(e.path)]]:[[`来源`,$(e.type??e.source,`event`)],[`产生者`,$(e.by??e.source)],[`耗时`,$(e.duration??e.dur)],[`时间`,$(e.timestamp??e.ts??e.time)]];return(0,j.jsxs)(`aside`,{className:`details-panel`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:xc(e)}),(0,j.jsx)(`button`,{"aria-label":i?`关闭文件差异`:`关闭事件详情`,onClick:t,type:`button`,children:`×`})]}),(0,j.jsxs)(`div`,{className:`details-body`,children:[(0,j.jsx)(`div`,{className:`detail-stats ${i?`is-file`:``}`,children:a.map(([e,t])=>(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`small`,{children:e}),(0,j.jsx)(`b`,{children:t})]},e))}),r!==void 0&&(0,j.jsxs)(`div`,{className:`detail-section`,children:[(0,j.jsx)(`small`,{children:`输出`}),(0,j.jsx)(`pre`,{className:`tool-output`,children:typeof r==`string`?r:JSON.stringify(r,null,2)})]}),(0,j.jsxs)(`div`,{className:`detail-section`,children:[(0,j.jsx)(`small`,{children:i?`数据来源`:`经过的插件`}),(0,j.jsx)(`div`,{className:`detail-plugin`,children:i?`Git workspace · /api/files`:`Runtime loader · event`})]}),(0,j.jsxs)(`div`,{className:`detail-actions`,children:[(0,j.jsx)(`button`,{onClick:n,type:`button`,children:`复制 JSON`}),(0,j.jsx)(`button`,{disabled:!0,title:`当前 API 未提供重放接口`,type:`button`,children:`重放`})]}),(0,j.jsxs)(`details`,{className:`raw-json`,children:[(0,j.jsx)(`summary`,{children:`原始 JSON`}),(0,j.jsx)(`pre`,{className:`raw-json-body`,children:JSON.stringify(e,null,2)})]})]})]})}function Fc({events:e,onSelect:t}){let[n,r]=(0,o.useState)(`all`),i=(0,o.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let n=$(e.type,`event`);t.set(n,(t.get(n)??0)+1)}),t},[e]),a=e.filter(e=>n===`all`||$(e.type,`event`)===n);return(0,j.jsxs)(`section`,{className:`view-panel trajectory-view`,children:[(0,j.jsxs)(`div`,{className:`trajectory-summary`,children:[(0,j.jsx)(`span`,{children:`按轮次`}),(0,j.jsxs)(`b`,{children:[e.length,` 个事件`]}),(0,j.jsx)(`div`,{className:`timeline`,children:e.length?e.map((e,t)=>(0,j.jsx)(`span`,{className:`timeline-turn`,children:(0,j.jsx)(`i`,{className:`timeline-strip`,title:xc(e)})},t)):(0,j.jsx)(`span`,{className:`timeline-empty`,children:`等待真实事件…`})})]}),(0,j.jsxs)(`div`,{className:`source-filters`,children:[(0,j.jsxs)(`button`,{className:`filter ${n===`all`?`active`:``}`,onClick:()=>r(`all`),type:`button`,children:[`全部 `,e.length]}),[...i].map(([e,t])=>(0,j.jsxs)(`button`,{className:`filter ${n===e?`active`:``}`,onClick:()=>r(e),type:`button`,children:[e,` `,t]},e))]}),(0,j.jsxs)(`div`,{className:`event-table`,children:[(0,j.jsxs)(`div`,{className:`event-head`,children:[(0,j.jsx)(`span`,{children:`时间`}),(0,j.jsx)(`span`,{children:`来源`}),(0,j.jsx)(`span`,{children:`事件`}),(0,j.jsx)(`span`,{children:`产生者`}),(0,j.jsx)(`span`,{children:`耗时`})]}),a.map((e,n)=>(0,j.jsxs)(`button`,{className:`event-row`,onClick:()=>t(e),type:`button`,children:[(0,j.jsx)(`span`,{children:$(e.timestamp??e.ts??e.time)}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`i`,{className:`event-dot`}),$(e.type,`event`)]}),(0,j.jsx)(`strong`,{children:xc(e)}),(0,j.jsx)(`span`,{children:$(e.by??e.source)}),(0,j.jsx)(`span`,{children:$(e.duration??e.dur)})]},n)),!a.length&&(0,j.jsx)(`div`,{className:`empty-state`,children:`暂无轨迹事件。`})]})]})}function Ic({files:e,api:t,onDiff:n,onRefresh:r}){let i=e.filter(e=>e.status.includes(`A`)||e.status===`??`).length,a=e.filter(e=>e.status.includes(`D`)).length,[s,c]=(0,o.useState)(``),[l,u]=(0,o.useState)(!1),[d,f]=(0,o.useState)(),[p,m]=(0,o.useState)(``),[h,g]=(0,o.useState)(!1),_=()=>{let n=s.trim();!n||l||(u(!0),m(``),t.commitFiles(e.map(e=>e.path),n).then(()=>{c(``),r()}).catch(e=>m(e instanceof Error?e.message:String(e))).finally(()=>u(!1)))},v=()=>{!e.length||l||(g(!1),u(!0),m(``),t.revertFiles(e.map(e=>e.path)).then(r).catch(e=>m(e instanceof Error?e.message:String(e))).finally(()=>u(!1)))},y=e=>{l||d||(f(e),m(``),n(e).catch(e=>m(e instanceof Error?e.message:String(e))).finally(()=>f(void 0)))};return(0,j.jsxs)(`section`,{className:`view-panel files-view`,children:[(0,j.jsxs)(`div`,{className:`files-content`,children:[(0,j.jsxs)(`div`,{className:`files-title`,children:[(0,j.jsx)(`strong`,{children:`本次会话改动`}),(0,j.jsx)(`span`,{children:`由 /api/files 提供`})]}),(0,j.jsx)(`div`,{className:`file-summary`,children:`${e.length} 个文件 · ${i} 个新增 · ${a} 个删除`}),(0,j.jsx)(`div`,{className:`file-list`,children:e.length?e.map(e=>(0,j.jsxs)(`div`,{className:`file-row`,children:[(0,j.jsx)(`b`,{className:`file-kind ${e.label===`untracked`?`new`:``}`,children:e.label}),(0,j.jsx)(`code`,{children:e.path}),(0,j.jsx)(`span`,{className:e.status.includes(`D`)?`del`:`add`,children:e.status}),(0,j.jsx)(`button`,{"aria-label":`${d===e.path?`正在读取`:`查看`}${e.path}的差异`,className:`diff-button`,disabled:l||d!==void 0,onClick:()=>y(e.path),type:`button`,children:d===e.path?`读取中…`:`查看差异`})]},e.path)):(0,j.jsx)(`div`,{className:`empty-state`,children:`工作区没有未提交改动。`})}),e.length>0&&(0,j.jsxs)(`div`,{className:`file-actions`,children:[(0,j.jsx)(`input`,{"aria-label":`提交说明`,onChange:e=>c(e.target.value),placeholder:`提交说明`,value:s}),(0,j.jsx)(`button`,{className:`primary`,disabled:l||!s.trim(),onClick:_,type:`button`,children:l?`处理中…`:`提交这些改动`}),(0,j.jsx)(`button`,{disabled:l,onClick:()=>g(!0),type:`button`,children:`全部撤销`})]}),p&&(0,j.jsx)(`p`,{className:`files-error`,children:p})]}),h&&(0,j.jsx)(kc,{busy:l,confirmLabel:`确认撤销`,description:`这会丢弃当前工作区的全部未提交改动,此操作不可恢复。`,onClose:()=>g(!1),onConfirm:v,target:`${e.length} 个文件`,title:`撤销全部改动`})]})}function Lc(e){if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)??$(e)}catch{return $(e)}}function Rc(e){try{if(typeof e!=`object`||!e||Array.isArray(e))return;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=Object.getOwnPropertyDescriptors(e);if(Reflect.ownKeys(n).some(e=>typeof e!=`string`))return;let r=Object.create(null);for(let[e,t]of Object.entries(n)){if(!(`value`in t))return;r[e]=t.value}return r}catch{return}}function zc({panel:e,inline:t=!1}){let n=Rc(e.data),r=n?Object.entries(n):[[`内容`,e.data]],i=n&&Array.isArray(n.items)?n.items:[],a=n&&Array.isArray(n.entries)?n.entries:[],o=n&&Array.isArray(n.capabilities)?n.capabilities:[];return(0,j.jsxs)(`div`,{className:`plugin-panel-card ${t?`pt-1`:`rounded-[10px] border border-[#e3e7ee] bg-white p-4 shadow-[0_8px_24px_rgba(27,39,64,0.04)]`}`,children:[(0,j.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,j.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-[#edf3fe] font-mono text-[15px] text-[#3565c5]`,children:e.icon??`◈`}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`strong`,{className:`block text-[13px] font-semibold text-[#20252b]`,children:e.title}),(0,j.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-[#687381]`,children:e.description??e.pluginId.replace(/cordis/gi,`runtime`)})]})]}),e.error?(0,j.jsx)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[12px] text-[#b42318]`,children:e.error}):e.id===`console-logger-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:`最近日志`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[20px] font-semibold text-[#20252b]`,children:$(n?.total??0)})]}),(0,j.jsx)(`div`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3]`,children:i.length?i.map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-2 border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:$(n.level??`log`)}),(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:$(n.source??`runtime`)}),(0,j.jsx)(`span`,{className:`block whitespace-pre-wrap break-words text-[11px] leading-4 text-[#65707b]`,children:Lc(n.args??``)})]})]},`${$(n.time??`log`)}-${t}`)}):(0,j.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[#687381]`,children:`暂无日志输出。`})})]}):e.id===`plugin-group-panel`?(0,j.jsx)(`div`,{className:`mt-3 max-h-64 overflow-auto rounded-lg border border-[#edf0f3]`,children:a.length?a.map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n.enabled===!1?`bg-[#a0a8b2]`:`bg-[#22c55e]`}`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[#30343b]`,children:$(n.name??`plugin`)}),(0,j.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:$(n.state??`unknown`)})]},`${$(n.id??`plugin`)}-${t}`)}):(0,j.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[#687381]`,children:`暂无插件条目。`})}):e.id===`timer-service-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:`服务状态`}),(0,j.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] font-semibold ${n?.registered===!0?`bg-[#e8f8ee] text-[#14733f]`:`bg-[#fff4e5] text-[#8a5a00]`}`,children:n?.registered===!0?`已注册`:`未注册`})]}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o.map((e,t)=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:$(e)},`${$(e)}-${t}`))})]}):e.id===`agent-teams-panel`?(()=>{let e=Os(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-4`,children:[[`成员`,e.inventory.members.total],[`任务`,e.inventory.tasks.total],[`未读消息`,e.inventory.messages.unread],[`可执行任务`,e.inventory.tasks.ready]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:$(t)})]},$(e)))}),e.dependencyCycle!==null&&e.dependencyCycle.length>1?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[11px] text-[#b42318]`,children:[`依赖循环:`,e.dependencyCycle.join(` → `)]}):null,(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.members.length>0?e.members.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[#edf0f3] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 rounded-full ${e.status===`working`?`bg-[#22c55e]`:`bg-[#a0a8b2]`}`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-semibold text-[#30343b]`,children:e.name}),(0,j.jsx)(`span`,{className:`truncate text-[10px] text-[#687381]`,children:e.role}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#3565c5]`,children:e.status})]},e.id)):(0,j.jsx)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-3 text-[12px] text-[#687381]`,children:`暂无协作角色。`})}),(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.tasks.length>0?e.tasks.map(e=>(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[#edf0f3] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate text-[11px] text-[#30343b]`,children:e.title}),e.dependsOn.length>0?(0,j.jsxs)(`span`,{className:`mt-0.5 block truncate font-mono text-[9px] text-[#687381]`,children:[`依赖:`,e.dependsOn.join(`, `)]}):null]}),(0,j.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:e.assignee}),(0,j.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] ${e.status===`blocked`?`bg-[#fff4e5] text-[#8a5a00]`:e.status===`done`?`bg-[#e8f8ee] text-[#14733f]`:`bg-[#edf3fe] text-[#3565c5]`}`,children:e.status})]},e.id)):(0,j.jsx)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-3 text-[12px] text-[#687381]`,children:`还没有任务。可让 Agent 使用 team_task 创建。`})}),(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`会话内邮箱备注`}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:[e.inventory.messages.shown,` / `,e.inventory.messages.total]})]}),e.messages.length>0?[...e.messages].reverse().map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${e.read?`border-[#edf0f3] bg-white`:`border-[#cfe0ff] bg-[#f4f8ff]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[e.from,` → `,e.to]}),(0,j.jsx)(`span`,{className:`ml-auto`,children:e.read?`已读`:`未读`})]}),(0,j.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-[#30343b]`,children:e.body})]},e.id)):(0,j.jsx)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-3 text-[12px] text-[#687381]`,children:`暂无邮箱备注。`})]}),e.truncated||e.inventory.members.truncated||e.inventory.tasks.truncated||e.inventory.messages.truncated?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#8a6200]`,children:`面板按固定安全上限展示;完整计数保留在上方。`}):null,(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`这是当前 Pi 会话的协作账本,不会启动其他 Agent、创建进程或向外部发送消息。`})]})})():e.id===`modlens-panel`?(()=>{let t=Hs(e.data),n=t.status.state===`running`?`正在读取视觉内容`:t.status.state===`failed`?`视觉检查失败`:t.status.state===`cancelled`?`视觉检查已取消`:t.status.state===`completed`?`视觉检查完成`:`等待图片`,r=t.status.state===`idle`?t.image?.mode:t.status.mode,i=t.status.state===`idle`?t.image?.path:t.status.path,a=t.status.state===`failed`?`border-[#f4caca] bg-[#fff5f5]`:t.status.state===`cancelled`?`border-[#f1d7a8] bg-[#fff9ed]`:t.status.state===`running`?`border-[#c9d9f7] bg-[#f4f8ff]`:t.attached?`border-[#b9e6c9] bg-[#f0fbf4]`:`border-[#e3e7ee] bg-[#f6f8fa]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${a}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:n}),(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[9px] text-[#3565c5]`,children:r===`native`?`原生直传`:r===`evidence`?`ModLens 证据`:`vision_inspect`})]}),i===void 0?null:(0,j.jsx)(`p`,{className:`mt-2 truncate font-mono text-[10px] text-[#65707b]`,children:i}),t.image===null?t.status.state===`idle`?(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`让 Agent 调用 vision_inspect,并提供工作区内的图片路径。`}):null:(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[10px] text-[#687381]`,children:[(0,j.jsx)(`span`,{children:t.image.mimeType}),(0,j.jsxs)(`span`,{children:[t.image.bytes.toLocaleString(),` bytes`]}),t.image.cached?(0,j.jsx)(`span`,{className:`font-semibold text-[#14733f]`,children:`缓存命中`}):null]}),t.status.state===`failed`||t.status.state===`cancelled`?(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4 text-[#9b2c24]`,children:t.status.error}):null]}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.supportedTypes.map(e=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:e},e))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[9px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`image:`,Math.round(t.limits.imageBytes/1048576),`MiB`]}),(0,j.jsxs)(`span`,{children:[`evidence:`,Math.round(t.limits.evidenceBytes/1024),`KiB`]}),(0,j.jsxs)(`span`,{children:[`timeout:`,Math.round(t.limits.timeoutMs/1e3),`s`]}),(0,j.jsxs)(`span`,{children:[`cache:`,t.limits.cacheEntries]})]}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#8a6200]`,children:`异常面板数据已按固定安全边界丢弃或截断。`}):null,(0,j.jsx)(`p`,{className:`rounded-lg border border-[#dce5f5] bg-[#f7f9fd] px-3 py-2 text-[10px] leading-4 text-[#566273]`,children:`纯文本模型会启动外部 ModLens 引擎,可能使用网络和 provider 配额并产生费用。视觉证据是不可信数据,不构成指令或用户授权。`})]})})():e.id===`vision-toolkit-panel`?(()=>{let t=ic(e.data),n=t.report,r=t.status.state===`running`?t.status.operation===`catalog`?`正在盘点视觉素材`:`正在读取图片元数据`:t.status.state===`failed`?`视觉素材检查失败`:t.status.state===`cancelled`?`视觉素材检查已取消`:t.status.state===`completed`?`视觉素材检查完成`:`等待检查`,i=t.status.state===`failed`?`border-[#f4caca] bg-[#fff5f5]`:t.status.state===`cancelled`?`border-[#f1d7a8] bg-[#fff9ed]`:t.status.state===`running`?`border-[#c9d9f7] bg-[#f4f8ff]`:t.status.state===`completed`?`border-[#b9e6c9] bg-[#f0fbf4]`:`border-[#e3e7ee] bg-[#f6f8fa]`,a=n?.assets.slice(0,20)??[],o=n?.issues.slice(0,10)??[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${i}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:r}),(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[9px] text-[#3565c5]`,children:t.status.state===`idle`?`vision_catalog`:t.status.operation===`catalog`?`catalog`:`image info`})]}),t.status.state!==`idle`&&t.status.path!==void 0?(0,j.jsx)(`p`,{className:`mt-2 truncate font-mono text-[10px] text-[#65707b]`,children:t.status.path}):null,t.status.state===`failed`||t.status.state===`cancelled`?(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4 text-[#9b2c24]`,children:t.status.error}):null]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[[`已扫描`,n?.scannedEntries??0],[`候选图片`,n?.inspectedCandidates??0],[`有效素材`,n?.assets.length??0],[`问题`,n?.issues.length??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:e}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[16px] text-[#30343b]`,children:t})]},e))}),a.length>0?(0,j.jsx)(`div`,{className:`max-h-52 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd]`,children:a.map((e,t)=>(0,j.jsxs)(`div`,{className:`border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[10px] text-[#30343b]`,title:e.path,children:e.path}),(0,j.jsx)(`span`,{className:`shrink-0 font-mono text-[9px] text-[#3565c5]`,children:e.width===null?`?×?`:`${e.width}×${e.height}`})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 text-[9px] text-[#687381]`,children:[(0,j.jsx)(`span`,{children:e.mimeType}),(0,j.jsxs)(`span`,{children:[e.bytes.toLocaleString(),` B`]}),e.headerTruncated?(0,j.jsx)(`span`,{className:`text-[#8a6200]`,children:`仅扫描前 256 KiB`}):null]})]},`${e.path}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:n===null?`让 Agent 调用 vision_catalog 盘点工作区图片,或调用 vision_image_info 检查单张图片。`:`未发现有效的受支持图片。`}),o.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f1d7a8] bg-[#fff9ed] px-3 py-3`,children:[(0,j.jsxs)(`p`,{className:`text-[10px] font-semibold text-[#8a6200]`,children:[`图片问题(显示 `,o.length,` 条)`]}),(0,j.jsx)(`div`,{className:`mt-2 grid gap-1.5`,children:o.map((e,t)=>(0,j.jsxs)(`p`,{className:`break-words font-mono text-[9px] leading-4 text-[#6f5730]`,children:[e.path,`: `,e.reason]},`${e.path}-${t}`))})]}):null,(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.supportedTypes.map(e=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[9px] text-[#3565c5]`,children:e},e)),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#e3e7ee] bg-[#f6f8fa] px-2 py-1 font-mono text-[9px] text-[#687381]`,children:[`file≤`,Math.round(t.limits.imageBytes/1048576),`MiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#e3e7ee] bg-[#f6f8fa] px-2 py-1 font-mono text-[9px] text-[#687381]`,children:[`assets≤`,t.limits.assets]})]}),t.truncated||n?.truncated===!0||n?.issuesTruncated===!0||n!==null&&(n.assets.length>a.length||n.issues.length>o.length)?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#8a6200]`,children:`面板或扫描结果已按固定安全上限截断;计数与警告会保留可见。`}):null,(0,j.jsx)(`p`,{className:`rounded-lg border border-[#dce5f5] bg-[#f7f9fd] px-3 py-2 text-[10px] leading-4 text-[#566273]`,children:`仅在当前 workspace 内本地读取图片头部,不上传图片、不调用外部视觉服务;这里展示的是元数据,不是完整图像解码结果。`})]})})():e.id===`at-file-panel`?(()=>{let t=At(e.data);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`最近附加`}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:`file_context`})]}),t.lastFile===null?(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`还没有附加文件。可使用 @file 或让 Agent 调用 file_context。`}):(0,j.jsxs)(`p`,{className:`mt-2 min-w-0 whitespace-normal break-all text-[11px] leading-4 text-[#65707b]`,children:[t.lastFile.path,` · `,t.lastFile.bytes,` bytes`]})]}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[#687381]`,children:[(0,j.jsx)(`span`,{children:`单文件上限`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[t.maxBytes,` bytes`]})]}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#8a6200]`,children:`面板数据不完整或已按固定安全上限调整。`}):null]})})():e.id===`git-time-capsule-panel`?(()=>{let e=Di(n),t=e.latest,r=t?.status===`completed`?`已完成`:t?.status===`cancelled`?`已取消`:`失败`,i=t?.status===`completed`?`border-[#b9e6c9] bg-[#f0fbf4] text-[#147a43]`:t?.status===`cancelled`?`border-[#f1ddb1] bg-[#fff9eb] text-[#996515]`:`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${t===null?`border-[#e3e7ee] bg-[#f6f8fa]`:i}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:t?.action===`restore`?`最近撤销`:`最近捕获`}),t===null?(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:`git_snapshot`}):(0,j.jsx)(`span`,{className:`rounded-full border border-current px-2 py-0.5 text-[9px] font-semibold`,children:r})]}),t===null?(0,j.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-[#687381]`,children:`当前没有撤销胶囊。先产生 unstaged tracked 改动,再让 Agent 调用 git_snapshot。`}):(0,j.jsxs)(`div`,{className:`mt-2 grid gap-1 text-[11px] text-[#65707b]`,children:[t.name===null?null:(0,j.jsx)(`p`,{className:`truncate font-mono text-[10px] text-[#30343b]`,children:t.name}),(0,j.jsxs)(`p`,{children:[t.files,` 个文件 · `,t.bytes,` bytes · `,(0,j.jsx)(`time`,{dateTime:t.at,children:t.at.replace(`T`,` `)})]}),t.error===null?null:(0,j.jsx)(`p`,{className:`break-words text-[#b42318]`,children:t.error})]})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`最近胶囊`}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[#3565c5]`,children:[e.inventory.shown,` / `,e.inventory.total]})]}),e.capsules.length>0?(0,j.jsx)(`div`,{className:`mt-2 max-h-44 overflow-y-auto border-l-2 border-[#cbd8ef] pl-3`,children:e.capsules.map(e=>(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 border-b border-[#eef1f5] py-1.5 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[10px] text-[#30343b]`,children:e.name}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-[#687381]`,children:[e.bytes,` B`]})]},e.name))}):(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`尚未保存 tracked diff。`}),e.inventory.truncated||e.truncated?(0,j.jsxs)(`p`,{className:`mt-2 text-[10px] text-[#996515]`,children:[`列表已按安全上限截断,仅展示最近 `,e.inventory.displayLimit,` 条有效记录。`]}):null]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md bg-[#f6f8fa] px-2 py-1.5`,children:[`Git 超时:`,e.timeoutMs,` ms`]}),(0,j.jsxs)(`span`,{className:`rounded-md bg-[#f6f8fa] px-2 py-1.5`,children:[`单胶囊:`,e.limits.capsuleBytes,` B`]})]}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`git_snapshot 捕获当前 unstaged tracked 改动;git_restore 会反向应用该 patch。staged 与未跟踪文件不包含在内,恢复必须传入 confirm=true。`})]})})():e.id===`dependency-checker-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=Er(n),t=e.missingCount>0||e.invalidCount>0||e.conflictCount>0,r=e.unresolvedCount>0||e.truncated;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[#65707b]`,children:e.manifest}),(0,j.jsx)(`strong`,{className:`shrink-0 font-mono uppercase text-[#315fb8]`,children:e.ecosystem})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-5`,children:[[`声明`,e.declared],[`已安装`,e.installed],[`问题`,e.missingCount+e.invalidCount],[`可选缺席`,e.optionalMissingCount],[`未决`,e.unresolvedCount]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:$(t)})]},$(e)))}),(0,j.jsx)(`div`,{className:`min-w-0 break-words rounded-lg border px-3 py-3 text-[11px] [overflow-wrap:anywhere] ${t?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:r?`border-[#f3dfab] bg-[#fffaf0] text-[#8a6200]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:e.missingCount||e.invalidCount?`缺失 ${e.missingCount}、无效 ${e.invalidCount}:${[...e.missing,...e.invalid].join(`, `)}`:e.conflictCount?`本地安装存在 ${e.conflictCount} 组声明约束冲突。`:e.unresolvedCount?`${e.unresolvedCount} 组声明约束无法离线判定。`:e.truncated?`报告不完整,无法确认依赖状态。`:`依赖声明与本地安装一致。`}),e.optionalMissingCount>0?(0,j.jsxs)(`div`,{className:`min-w-0 break-words rounded-lg border border-[#f3dfab] bg-[#fffaf0] px-3 py-2 text-[10px] text-[#8a6200] [overflow-wrap:anywhere]`,children:[`可选依赖未安装(`,e.optionalMissingCount,`):`,e.optionalMissing.join(`, `)]}):null,e.conflicts.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f3dfab] bg-[#fffaf0] px-3 py-3 text-[11px] text-[#8a6200]`,children:[(0,j.jsx)(`strong`,{children:`版本冲突`}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 pl-4`,children:e.conflicts.map((e,t)=>(0,j.jsxs)(`li`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[(0,j.jsx)(`code`,{children:e.name}),`:`,e.constraints.join(` · `)||`—`]},`${e.name}-${t}`))})]}):null,e.unresolved.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f3dfab] bg-[#fffaf0] px-3 py-3 text-[11px] text-[#8a6200]`,children:[(0,j.jsx)(`strong`,{children:`未决约束`}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 pl-4`,children:e.unresolved.map((e,t)=>(0,j.jsxs)(`li`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[(0,j.jsx)(`code`,{children:e.name}),`:`,e.constraints.join(` · `)||`—`]},`${e.name}-${t}`))})]}):null,(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`本地只读扫描 · 上限 `,e.scanLimit,` 项`]}),e.truncated?(0,j.jsx)(`span`,{children:`面板明细已截断`}):null]})]})})()}):e.id===`token-guard-panel`?(()=>{let e=_o(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${e.exceeded?`border-[#f4caca] bg-[#fff5f5]`:`border-[#e3eaf8] bg-[#f6f8ff]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`上下文预算`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#315fb8]`,children:[e.percent===null?`—`:e.percent,`% / `,e.maxPercent,`%`]})]}),(0,j.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-[#dfe8fb]`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full ${e.exceeded?`bg-[#d64545]`:`bg-[#5d8bea]`}`,style:{width:`${Math.min(100,e.percent??0)}%`}})}),(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#5d6d82]`,children:[e.tokens===null?`上下文 token 未知`:`${e.tokens.toLocaleString()} / ${e.contextWindow?.toLocaleString()??`—`} tokens`,` · 已请求停止 ${e.aborts} 次`]})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${e.runExceeded?`border-[#f4caca] bg-[#fff5f5]`:`border-[#e3eaf8] bg-[#f6f8ff]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`单次任务`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#315fb8]`,children:[e.runTokens===null?`—`:e.runTokens.toLocaleString(),` / `,e.maxRunTokens===0?`—`:e.maxRunTokens.toLocaleString()]})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#5d6d82]`,children:e.maxRunTokens>0?`按 agent_start 后新增的已结算 token 熔断。`:`未启用绝对 Token 上限。`})]})]}),e.lastError===null?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[10px] leading-4 text-[#b42318]`,children:[`保护器错误:`,e.lastError]})]})})():e.id===`test-harness-panel`?(()=>{let t=Gt(e.data),n=t.latest,r=n?.status===`passed`?`验证通过`:n?.status===`failed`?`验证失败`:n?.status===`timed-out`?`验证超时`:n?.status===`cancelled`?`验证已取消`:`等待验证`,i=n?.status===`passed`?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:n?.status===`failed`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:n?.status===`timed-out`||n?.status===`cancelled`?`border-[#f1d7a8] bg-[#fff9ed] text-[#8a6200]`:`border-[#e3e7ee] bg-[#f6f8fa] text-[#687381]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border px-3 py-3 ${i}`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`break-all font-mono text-[11px] font-semibold text-[#30343b]`,children:n?.command??`npm run test`}),(0,j.jsx)(`span`,{className:`rounded-full border border-current px-2 py-0.5 text-[9px] font-semibold`,children:r})]}),n===null?(0,j.jsx)(`p`,{className:`mt-2 text-[11px] leading-4 text-[#687381]`,children:`还没有执行验证脚本。可让 Agent 调用 run_project_tests。`}):(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[10px] text-[#65707b]`,children:[(0,j.jsxs)(`span`,{children:[`exit `,n.exitCode??`—`]}),n.signal===null?null:(0,j.jsx)(`span`,{children:n.signal}),(0,j.jsxs)(`span`,{children:[n.durationMs,` ms`]}),(0,j.jsxs)(`span`,{children:[n.outputBytes.toLocaleString(),` output bytes`]})]})]}),n!==null&&n.output!==``?(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[#e3e7ee] bg-[#111318] p-3`,children:[(0,j.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center justify-between gap-2 text-[9px] text-[#9ba6b2]`,children:[(0,j.jsx)(`span`,{className:`font-semibold uppercase tracking-[0.08em]`,children:`输出末尾`}),(0,j.jsxs)(`span`,{children:[`最多 `,t.limits.outputBytes,` bytes`]})]}),(0,j.jsx)(`pre`,{className:`max-h-52 min-w-0 overflow-auto whitespace-pre-wrap break-all font-mono text-[10px] leading-4 text-[#e6edf3]`,children:n.output})]}):null,n?.outputTruncated||n?.outputSanitized?(0,j.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#8a6200]`,children:[n.outputTruncated?`输出只保留最后 12 KiB。`:``,n.outputSanitized?`终端控制字符已清理。`:``]}):null,(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.allowedScripts.map(e=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:e},e))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-1 font-mono text-[9px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`timeout `,t.limits.timeoutMs,` ms`]}),(0,j.jsxs)(`span`,{children:[`output `,t.limits.outputBytes,` bytes`]})]}),t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#8a6200]`,children:`面板数据不完整或已按固定安全上限调整。`}):null,(0,j.jsx)(`p`,{className:`rounded-lg border border-[#f1d7a8] bg-[#fff9ed] px-3 py-2 text-[10px] leading-4 text-[#6f5730]`,children:`npm scripts 会执行当前项目定义的代码;仅在可信 workspace 中使用。Test Harness 不是沙箱,也不会把脚本输出当作用户授权。`})]})})():e.id===`session-insights-panel`?(()=>{let t=Qt(e.data),n=t.report;if(n===null)return(0,j.jsx)(`div`,{className:`mt-3 rounded-lg border border-[#f3c4c4] bg-[#fff4f4] px-3 py-3 text-[11px] leading-5 text-[#a23b3b]`,children:`会话统计数据无效,已停止展示指标,避免把损坏数据误报为健康状态。`});let r=n.contextUsage;return(0,j.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[#e3e7ee] bg-white px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[9px] font-semibold uppercase tracking-[0.08em] text-[#7a8490]`,children:`Session`}),(0,j.jsx)(`p`,{className:`mt-1 min-w-0 break-all font-mono text-[10px] leading-4 text-[#3d4650]`,children:n.sessionId})]}),(0,j.jsx)(`div`,{className:`grid min-w-0 grid-cols-1 gap-2 min-[360px]:grid-cols-3`,children:[[`消息`,n.totalMessages.toLocaleString(`en-US`)],[`工具调用 / 结果`,`${n.toolCalls.toLocaleString(`en-US`)} / ${n.toolResults.toLocaleString(`en-US`)}`],[`成本`,`$${n.cost.toFixed(4)}`]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:e}),(0,j.jsx)(`strong`,{className:`mt-1 block break-all text-[16px] font-semibold text-[#30343b]`,children:t})]},e))}),(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`累计 token`}),(0,j.jsx)(`strong`,{className:`break-all font-mono text-[14px] text-[#315fb8]`,children:n.tokens.total.toLocaleString(`en-US`)})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex min-w-0 flex-wrap gap-x-3 gap-y-1 text-[10px] leading-4 text-[#5d6d82]`,children:[(0,j.jsxs)(`span`,{children:[`输入 `,n.tokens.input.toLocaleString(`en-US`)]}),(0,j.jsxs)(`span`,{children:[`输出 `,n.tokens.output.toLocaleString(`en-US`)]}),(0,j.jsxs)(`span`,{children:[`缓存读取 `,n.tokens.cacheRead.toLocaleString(`en-US`)]}),(0,j.jsxs)(`span`,{children:[`缓存写入 `,n.tokens.cacheWrite.toLocaleString(`en-US`)]})]})]}),(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`当前上下文`}),r===null?null:r.percent===null?(0,j.jsx)(`strong`,{className:`text-[11px] font-semibold text-[#8a6200]`,children:`待下一次模型响应`}):(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#315fb8]`,children:[r.percent.toFixed(1),`%`]})]}),r===null?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] leading-4 text-[#687381]`,children:`当前模型未提供上下文窗口。`}):r.tokens===null?(0,j.jsxs)(`p`,{className:`mt-2 text-[10px] leading-4 text-[#687381]`,children:[`压缩后 token 暂不可估算 · 上下文窗口 `,r.contextWindow.toLocaleString(`en-US`)]}):(0,j.jsxs)(`p`,{className:`mt-2 text-[10px] leading-4 text-[#687381]`,children:[r.tokens.toLocaleString(`en-US`),` / `,r.contextWindow.toLocaleString(`en-US`),` tokens`]})]}),(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border px-3 py-3 ${{idle:`border-[#e3e7ee] bg-[#f6f8fa] text-[#687381]`,queued:`border-[#f1d7a8] bg-[#fff9ed] text-[#8a6200]`,running:`border-[#cbdaf6] bg-[#f3f7ff] text-[#315fb8]`,completed:`border-[#bfe4cb] bg-[#f1fbf4] text-[#287a43]`,failed:`border-[#f3c4c4] bg-[#fff4f4] text-[#a23b3b]`,cancelled:`border-[#f1d7a8] bg-[#fff9ed] text-[#8a6200]`,unknown:`border-[#f3c4c4] bg-[#fff4f4] text-[#a23b3b]`}[t.compaction.status]}`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em]`,children:`会话压缩`}),(0,j.jsx)(`strong`,{className:`text-[11px] font-semibold`,children:{idle:`尚未请求压缩`,queued:`等待 Agent 空闲`,running:`正在压缩`,completed:`压缩已完成`,failed:`压缩失败`,cancelled:`压缩已取消`,unknown:`压缩状态数据无效`}[t.compaction.status]})]}),t.compaction.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4`,children:t.compaction.error})]}),t.malformed&&t.compaction.status!==`unknown`?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#a23b3b]`,children:`面板数据不完整或不一致。`}):null]})})():e.id===`session-bridge-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=Eo(n),t=[[`目标`,e.preview.goal],[`当前状态`,e.preview.currentState],[`下一步`,e.preview.nextStep]],r=[[`关键决策`,e.preview.decisions],[`关键文件`,e.preview.keyFiles]];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3 text-[11px] leading-5 text-[#315fb8]`,children:`预览不会创建目标会话,也不会修改源会话。`}),e.status.state===`failed`||e.status.state===`cancelled`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] leading-5 ${e.status.state===`failed`?`border-[#f3c4c4] bg-[#fff4f4] text-[#a23b3b]`:`border-[#f4d8a8] bg-[#fff9ed] text-[#9a6700]`}`,children:[e.status.operation===`import`?`导入`:e.status.operation===`export`?`导出`:`预览`,e.status.state===`failed`?`失败`:`已取消`,e.status.error===null?``:`:${e.status.error}`]}):null,t.map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:e}),(0,j.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap break-words text-[11px] leading-5 text-[#30343b]`,children:t||`暂无`})]},e)),(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:r.map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:$(e)}),t.length>0?(0,j.jsx)(`ul`,{className:`mt-2 grid gap-1 text-[10px] leading-4 text-[#65707b]`,children:t.map((e,t)=>(0,j.jsx)(`li`,{className:`break-words`,children:e},`${e}-${t}`))}):(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[#687381]`,children:`暂无`})]},$(e)))}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`格式 v`,e.formatVersion]}),(0,j.jsxs)(`span`,{children:[`最多 `,e.limits.messages,` 条消息`]}),(0,j.jsxs)(`span`,{children:[`正文 `,e.limits.totalMessageCharacters,` 字符`]}),(0,j.jsxs)(`span`,{children:[`附件标记 `,e.limits.attachments,` 个`]}),e.source===null?null:(0,j.jsxs)(`span`,{className:`max-w-full truncate`,children:[`来源 `,e.source.sessionId]}),e.latest===null?null:(0,j.jsx)(`span`,{children:e.latest.direction===`import`?`最近导入`:`最近导出`})]})]})})()}):e.id===`session-compare-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.left&&typeof n.left==`object`&&n?.right&&typeof n.right==`object`?(()=>{let e=n.left,t=n.right;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[[`左侧会话`,e],[`右侧会话`,t]].map(([e,t])=>{let n=t;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-2 block truncate text-[12px] text-[#30343b]`,children:$(n.name??n.id)}),(0,j.jsx)(`code`,{className:`mt-1 block truncate text-[10px] text-[#315fb8]`,children:$(n.id)}),(0,j.jsxs)(`span`,{className:`mt-1 block text-[10px] text-[#65707b]`,children:[$(n.messageCount,`0`),` 条消息`]})]},$(e))})}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`共享`,n.shared??0],[`右侧新增`,Array.isArray(n.added)?n.added.length:0],[`左侧删除`,Array.isArray(n.removed)?n.removed.length:0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:$(t)})]},$(e)))}),(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${n.changed===!0?`border-[#f4d8a8] bg-[#fff9ed] text-[#9a6700]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:n.changed===!0?`两个会话存在消息差异。`:`两个会话内容一致。`}),Array.isArray(n.added)&&n.added.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:`右侧新增消息`}),(0,j.jsx)(`ul`,{className:`mt-2 grid gap-1 text-[10px] leading-4 text-[#65707b]`,children:n.added.slice(0,4).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{children:[`[`,$(n.role),`] `,$(n.text)]},`${$(n.role)}-${t}`)})})]}):null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`执行 session_compare 后显示两个会话的差异。`})}):e.id===`secure-audit-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-4 gap-2`,children:[[`扫描文件`,n?.scanned??0],[`严重`,n?.critical??0],[`高风险`,n?.high??0],[`总发现`,n?.total??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[16px] font-semibold text-[#30343b]`,children:$(t)})]},$(e)))}),(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${Number(n?.total??0)>0?`border-[#f4d8a8] bg-[#fff9ed] text-[#9a6700]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:Number(n?.total??0)>0?`发现需要人工确认的安全风险。`:`未发现凭据泄露或危险命令。`}),Array.isArray(n?.findings)&&n.findings.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.findings.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=$(n.severity,`medium`);return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[10px] text-[#315fb8]`,children:$(n.path)}),(0,j.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold ${r===`critical`?`text-[#b42318]`:`text-[#9a6700]`}`,children:r})]}),(0,j.jsxs)(`p`,{className:`mt-1 text-[10px] leading-4 text-[#65707b]`,children:[`第 `,$(n.line),` 行 · `,$(n.message)]})]},`${$(n.path)}-${$(n.line)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`运行 security_audit 后显示脱敏结果。`})]}):e.id===`context-doctor-panel`?(()=>{let e=$a(n),t={idle:`尚未请求`,queued:`已排队`,running:`压缩中`,completed:`已完成`,failed:`失败`,cancelled:`已取消`,unknown:`未知`},r=e.compaction.status===`completed`?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:e.compaction.status===`failed`?`border-[#f3c4c4] bg-[#fff4f4] text-[#a23b3b]`:e.compaction.status===`cancelled`?`border-[#f4d8a8] bg-[#fff9ed] text-[#9a6700]`:`border-[#dce5f5] bg-[#f6f8ff] text-[#3565c5]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${e.status===`warning`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:e.status===`ok`?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:`border-[#e3e7ee] bg-[#f6f8fa] text-[#687381]`}`,children:e.status===`warning`?`需要关注上下文风险。`:e.status===`ok`?`上下文状态正常。`:`上下文状态不可用。`}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:[[`占用`,e.usagePercent===null?`—`:`${e.usagePercent}%`],[`超限/不可测`,e.oversizedMessages],[`无法安全检查`,e.uninspectableMessages],[`工具错误`,e.toolErrors]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:e}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:t})]},String(e)))}),e.compaction.status===`idle`||e.compaction.status===`unknown`?null:(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${r}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{children:`最近压缩`}),(0,j.jsx)(`strong`,{children:t[e.compaction.status]})]}),e.compaction.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4`,children:e.compaction.error})]}),e.recommendations.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1 rounded-lg border border-[#e3e7ee] bg-white px-4 py-3 text-[10px] text-[#65707b]`,children:[e.recommendations.map((e,t)=>(0,j.jsx)(`li`,{children:e},`${e}-${t}`)),e.recommendationsTruncated?(0,j.jsx)(`li`,{children:`部分建议因浏览器显示上限被省略。`}):null]}):null,(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{className:`rounded bg-[#f6f8fa] px-2 py-1`,children:[`扫描 `,e.scannedMessages,` / `,e.messageCount,` 条消息`,e.messagesTruncated?`(已截断)`:``]}),(0,j.jsxs)(`span`,{className:`rounded bg-[#f6f8fa] px-2 py-1`,children:[`告警阈值 `,e.warnPercent,`%`]}),(0,j.jsxs)(`span`,{className:`rounded bg-[#f6f8fa] px-2 py-1`,children:[`大消息阈值 `,e.maxMessageBytes,`B`]}),(0,j.jsxs)(`span`,{className:`rounded bg-[#f6f8fa] px-2 py-1`,children:[`结构预算 `,e.limits.jsonNodesPerAudit,` 节点 / 深度 `,e.limits.jsonDepth]})]})]})})():e.id===`history-compressor-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.enabled===!0?`自动压缩已启用`:`自动压缩已停用`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[11px] text-[#3565c5]`,children:[`阈值 `,$(n?.thresholdPercent??`—`),`%`]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`已压缩`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:$(n?.compactions??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`当前占用`}),(0,j.jsxs)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:[$(n?.lastUsagePercent??`—`),`%`]})]})]}),n?.lastError?(0,j.jsxs)(`p`,{className:`text-[11px] text-[#b42318]`,children:[`最近错误:`,$(n.lastError)]}):null]}):e.id===`session-export-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:`最近导出`}),(0,j.jsx)(`code`,{className:`mt-2 block truncate text-[11px] text-[#315fb8]`,children:$(e.path??`pi-session.md`)}),(0,j.jsxs)(`p`,{className:`mt-1 text-[10px] text-[#65707b]`,children:[$(e.messages??0),` 条消息 · `,$(e.bytes??0),` bytes`]})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有导出当前会话。`}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`导出文件只允许写入当前工作区内的 .md 路径,覆盖已有文件需要显式确认。`})]}):e.id===`session-search-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.query?(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[#315fb8]`,children:$(n.query)}),(0,j.jsxs)(`strong`,{className:`ml-3 shrink-0 text-[11px] text-[#3565c5]`,children:[$(n.total??0),` 个会话`]})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`输入查询后显示匹配的历史会话。`}),Array.isArray(n?.items)&&n.items.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.items.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=Array.isArray(n.hits)?n.hits:[];return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:$(n.name??n.id??`未命名会话`)}),(0,j.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] leading-4 text-[#65707b]`,children:r.map(e=>$(typeof e==`object`&&e?e.text??``:e)).join(` | `)})]},`${$(n.id??`session`)}-${t}`)})}):n?.query?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有找到匹配的历史会话。`}):null]}):e.id===`session-bookmarks-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`当前会话的持久化书签`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[11px] text-[#3565c5]`,children:[$(n?.total??0),` 个书签`]})]}),Array.isArray(n?.bookmarks)&&n.bookmarks.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.bookmarks.slice(0,12).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:$(n.label??`未命名书签`)}),(0,j.jsxs)(`code`,{className:`mt-1 block truncate text-[10px] text-[#687381]`,children:[`entry: `,$(n.entryId??`—`)]})]},`${$(n.id??`bookmark`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有标记重要节点。`}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`书签独立保存在 agent 目录,不会改写 Pi 原生会话记录。`})]}):e.id===`llm-verifier-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`校验模型`}),(0,j.jsxs)(`code`,{className:`max-w-[65%] truncate text-[11px] text-[#315fb8]`,children:[$(n?.provider??`—`),`/`,$(n?.model??`—`)]})]}),n?.history&&typeof n.history==`object`?(()=>{let e=n.history,t=e.counts&&typeof e.counts==`object`?e.counts:{};return(0,j.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`累计`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[#30343b]`,children:$(e.total??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f0fbf4] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#14733f]`,children:`通过`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[#14733f]`,children:$(t.pass??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#fff5f5] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#b42318]`,children:`失败`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[#b42318]`,children:$(t.fail??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#fffaf0] px-2 py-2 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#9a6700]`,children:`未知`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[#9a6700]`,children:$(t.unknown??0)})]})]})})():null,n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=$(e.verdict??`unknown`);return(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${t===`pass`?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:t===`fail`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:`border-[#f3dfab] bg-[#fffaf0] text-[#9a6700]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`strong`,{className:`uppercase`,children:t}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[$(e.evidenceChars??0),` chars`]})]}),(0,j.jsx)(`p`,{className:`mt-2 leading-4`,children:$(e.rationale??`没有返回校验理由。`)}),(0,j.jsxs)(`p`,{className:`mt-2 truncate text-[10px] opacity-70`,children:[`声明:`,$(e.claim??`—`)]})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有执行模型校验。`}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`证据按不可信数据处理,输入有长度上限;模型返回非结构化结果时显示 unknown。`})]}):e.id===`module-search-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.matches)?e.matches:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[#315fb8]`,children:$(e.query??``)}),(0,j.jsxs)(`strong`,{className:`ml-3 shrink-0 text-[11px] text-[#3565c5]`,children:[$(t.length),` 个结果`]})]}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.slice(0,10).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsxs)(`code`,{className:`min-w-0 truncate text-[10px] text-[#315fb8]`,children:[$(n.path??`—`),`:`,$(n.line??`—`)]}),(0,j.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase text-[#687381]`,children:$(n.kind??`symbol`)})]}),(0,j.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#65707b]`,children:$(n.name??`未命名符号`)})]},`${$(n.path??`module`)}:${$(n.line??t)}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有找到匹配的模块符号。`}),(0,j.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`扫描 `,$(e.scannedFiles??0),` 个源码文件,跳过依赖和构建目录。`]})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`输入符号名后显示模块检索结果。`})}):e.id===`better-sidebar-panel`?(()=>{let e=Array.isArray(n?.changedFiles)?n.changedFiles:[],t=n?.clean===!0;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[#315fb8]`,children:$(n?.cwd??`当前工作区`)}),(0,j.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 font-mono text-[10px] ${t?`bg-[#eaf8f0] text-[#14733f]`:`bg-[#fff0f0] text-[#b42318]`}`,children:t?`clean`:`${$(n?.changedCount??e.length)} 个变更`})]}),(0,j.jsx)(`p`,{className:`mt-2 font-mono text-[10px] text-[#65707b]`,children:$(n?.summary??`等待工作区扫描`)}),(0,j.jsxs)(`p`,{className:`mt-1 text-[10px] text-[#687381]`,children:[`会话 `,$(n?.sessionId??`—`),` · 目录 `,$(n?.directoryCount??0),` · 文件 `,$(n?.fileCount??0)]})]}),e.length>0?(0,j.jsx)(`div`,{className:`grid gap-1 rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`code`,{className:`truncate py-0.5 text-[10px] text-[#65707b]`,children:[$(n.status??`??`),` `,$(n.path??`未命名`)]},`${$(n.path??`file`)}-${t}`)})}):null,n?.truncated===!0?(0,j.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`目录摘要已截断,执行 sidebar_overview 获取最新概览。`}):null]})})():e.id===`workspace-navigator-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.nodes)?e.nodes:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[#315fb8]`,children:$(e.path??`.`)}),(0,j.jsxs)(`strong`,{className:`ml-3 shrink-0 text-[11px] text-[#3565c5]`,children:[$(t.length),` 个节点`]})]}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-1 rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:t.slice(0,36).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=typeof n.depth==`number`?Math.min(6,Math.max(1,n.depth)):1;return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 truncate py-1 text-[10px] text-[#65707b]`,children:[(0,j.jsxs)(`span`,{className:`shrink-0 text-[#687381]`,children:[`· `.repeat(r-1),n.kind===`directory`?`▾`:`·`]}),(0,j.jsx)(`code`,{className:`truncate`,children:$(n.name??n.path??`未命名`)})]},`${$(n.path??`node`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前目录为空。`}),(0,j.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`目录 `,$(e.directoryCount??0),` 个,文件 `,$(e.fileCount??0),` 个;跳过依赖和构建目录。`]}),n?.git&&typeof n.git==`object`?(()=>{let e=n.git,t=Array.isArray(e.entries)?e.entries:[],r=e.available===!0;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-medium text-[#253044]`,children:`Git 状态`}),(0,j.jsx)(`span`,{className:`text-[10px] ${r?e.clean===!0?`text-[#14733f]`:`text-[#b42318]`:`text-[#687381]`}`,children:r?e.clean===!0?`clean`:`${t.length} 个变更`:`不可用`})]}),r?(0,j.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-[#65707b]`,children:$(e.branch??`detached HEAD`)}):null,t.length>0?(0,j.jsx)(`div`,{className:`mt-2 grid gap-1`,children:t.slice(0,12).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`code`,{className:`truncate text-[10px] text-[#65707b]`,children:[$(n.status??`??`),` `,$(n.path??`未命名`)]},`${$(n.path??`file`)}-${t}`)})}):null]})})():null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`执行 workspace_tree 后显示工作区结构。`})}):e.id===`prompt-library-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[Array.isArray(n?.templates)&&n.templates.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.templates.slice(0,12).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=Array.isArray(n.tags)?n.tags.filter(e=>typeof e==`string`):[];return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`truncate text-[11px] text-[#253044]`,children:$(n.title??`未命名提示词`)}),(0,j.jsx)(`code`,{className:`shrink-0 text-[10px] text-[#687381]`,children:$(n.id??`—`)})]}),(0,j.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[10px] leading-4 text-[#65707b]`,children:$(n.prompt??``)}),r.length>0?(0,j.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:r.slice(0,6).map(e=>(0,j.jsx)(`span`,{className:`rounded bg-[#f6f8ff] px-1.5 py-0.5 text-[9px] text-[#315fb8]`,children:e},e))}):null]},`${$(n.id??`prompt`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有保存的提示词。可让 Agent 调用 prompt_library 保存模板。`}),(0,j.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`共 `,$(n?.total??0),` 个模板,数据跟随当前会话。`]})]}):e.id===`colleague-skill-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=t=>Array.isArray(e[t])?e[t].filter(e=>typeof e==`string`):[],r=t(`constraints`),i=t(`files`),a=t(`acceptance`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`交接给`}),(0,j.jsx)(`strong`,{className:`text-[11px] text-[#315fb8]`,children:$(e.toRole)})]}),(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3 text-[11px] text-[#253044]`,children:$(e.objective)}),e.context?(0,j.jsx)(`p`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2 text-[10px] leading-4 text-[#65707b]`,children:$(e.context)}):null,i.length>0?(0,j.jsx)(`div`,{className:`grid gap-1 rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:i.slice(0,8).map(e=>(0,j.jsx)(`code`,{className:`truncate text-[10px] text-[#65707b]`,children:e},e))}):null,r.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#fffaf0] px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`text-[10px] text-[#9a6700]`,children:`约束`}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 text-[10px] text-[#65707b]`,children:r.slice(0,8).map((e,t)=>(0,j.jsxs)(`li`,{children:[`• `,e]},`${e}-${t}`))})]}):null,a.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f0fbf4] px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`text-[10px] text-[#14733f]`,children:`验收条件`}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 text-[10px] text-[#65707b]`,children:a.slice(0,8).map((e,t)=>(0,j.jsxs)(`li`,{children:[`• `,e]},`${e}-${t}`))})]}):null,(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[#65707b]`,children:[(0,j.jsxs)(`span`,{children:[`约束 `,r.length,` 条`]}),(0,j.jsxs)(`span`,{children:[`验收 `,a.length,` 条`]})]})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`执行 colleague_handoff 后显示角色交接包。`})}):e.id===`reverse-skill-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`复核风险内容`}),(0,j.jsx)(`strong`,{className:`font-mono text-[11px] text-[#3565c5]`,children:n?.allowReviewByDefault===!0?`已允许`:`默认阻断`})]}),n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=$(e.risk??`safe`),r=Array.isArray(e.findings)?e.findings:[];return(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${t===`blocked`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:t===`review`?`border-[#f3dfab] bg-[#fffaf0] text-[#9a6700]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`strong`,{className:`uppercase`,children:t}),(0,j.jsx)(`span`,{className:`font-mono text-[10px]`,children:e.contentIncluded===!0?`可注入`:`已隔离`})]}),(0,j.jsxs)(`p`,{className:`mt-2`,children:[$(e.name??`未命名 Skill`),` · `,$(r.length),` 个风险项`]}),r.length>0?(0,j.jsx)(`p`,{className:`mt-1 text-[10px] opacity-80`,children:r.slice(0,2).map(e=>$(e)).join(`;`)}):null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`执行 skill_inject 后显示隔离结果。`}),(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`安全内容会被包裹为不可信数据;review 风险默认不注入,blocked 内容永不返回原文。`})]}):e.id===`reviewer-bot-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest,t=$(e.status??`pass`),r=Array.isArray(e.findings)?e.findings:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${t===`error`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:t===`warning`?`border-[#f3dfab] bg-[#fffaf0] text-[#9a6700]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:[(0,j.jsx)(`span`,{children:t===`error`?`发现阻断风险`:t===`warning`?`需要关注`:`审查通过`}),(0,j.jsxs)(`strong`,{className:`font-mono`,children:[$(r.length),` findings`]})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`文件`,e.changedFiles??0],[`新增`,e.addedLines??0],[`删除`,e.removedLines??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:$(t)})]},$(e)))}),r.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1 rounded-lg border border-[#e3e7ee] bg-white px-4 py-3 text-[10px] text-[#65707b]`,children:r.slice(0,4).map((e,t)=>(0,j.jsx)(`li`,{children:$(typeof e==`object`&&e?e.message??`finding`:e)},t))}):null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有审查当前改动。可让 Agent 调用 review_changes。`})}):e.id===`auto-mode-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:n?.mode===`confirm`?`确认模式`:`安全模式`}),(0,j.jsxs)(`span`,{className:`font-mono text-[#65707b]`,children:[`超时 `,$(n?.timeoutMs??`—`),` ms`]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`阻断次数`}),(0,j.jsxs)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:[$(n?.blocked??0),` 次`]})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`最近命令`}),(0,j.jsx)(`strong`,{className:`mt-1 block truncate font-mono text-[11px] text-[#30343b]`,children:n?.last&&typeof n.last==`object`?$(n.last.command??`—`):`—`})]})]}),n?.last&&typeof n.last==`object`?(0,j.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:$(n.last.stdout,``)||$(n.last.stderr??`无输出`)}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未执行命令。Agent 可调用 auto_mode_exec。`})]}):e.id===`plan-execute-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`truncate text-[11px] font-medium text-[#30343b]`,children:n?.title?$(n.title):`尚未创建计划`}),(0,j.jsxs)(`span`,{className:`font-mono text-[11px] text-[#3565c5]`,children:[$(n?.completed??0),` / `,$(n?.total??0)]})]}),Array.isArray(n?.steps)&&n.steps.length>0?(0,j.jsx)(`ol`,{className:`grid gap-1.5`,children:n.steps.map((e,t)=>{let n=e&&typeof e==`object`?e:{},r=$(n.status??`pending`);return(0,j.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 rounded-full ${r===`done`?`bg-[#32a35a]`:r===`in_progress`?`bg-[#3565c5]`:r===`skipped`?`bg-[#a0a7b0]`:`bg-[#d7dce2]`}`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate ${r===`done`?`text-[#14733f]`:`text-[#30343b]`}`,children:$(n.title??`步骤`)}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:r})]},$(n.id??t))})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`Agent 可调用 plan_create 创建执行计划。`})]}):e.id===`plugin-stars-panel`?(()=>{let e=_t(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] text-[#b42318]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:`Plugin Stars 面板数据异常`}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:`面板数据不完整或不可信,请重新加载排行榜。`})]});let t=e.latest,r=t?.results??[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`社区排行榜`}),(0,j.jsxs)(`span`,{className:`font-mono text-[#65707b]`,children:[`结果上限 `,e.limit]})]}),t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`Agent 可调用 plugin_stars_search 拉取并筛选社区排行榜。`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[#65707b]`,children:[(0,j.jsxs)(`span`,{children:[`查询:`,t.query||`全部`]}),(0,j.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[`显示 `,e.inventory.shown,`/`,e.inventory.total]})]}),r.length>0?(0,j.jsx)(`ol`,{className:`grid gap-1.5`,children:r.map(e=>(0,j.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`span`,{className:`w-5 shrink-0 text-center font-mono text-[10px] text-[#9a6700]`,children:[`#`,e.rank]}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`a`,{className:`block truncate font-mono text-[11px] text-[#315fb8] hover:underline`,href:e.htmlUrl,rel:`noreferrer`,target:`_blank`,children:e.fullName}),(0,j.jsxs)(`span`,{className:`block truncate text-[10px] text-[#687381]`,children:[`更新于 `,e.updatedAt||`未知`]})]}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-[#8a5a00]`,children:[`★ `,e.stars.toLocaleString()]})]},e.fullName))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有找到匹配的社区插件。`}),(0,j.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`来源:`,t.source||`dsh-plugin-stars`,` · 仅展示公开仓库信息,不会自动安装。`]})]})]})})():e.id===`plugin-finder-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`只读 Registry 搜索`}),(0,j.jsxs)(`span`,{className:`font-mono text-[#65707b]`,children:[`关键词 `,$(n?.keyword??`pi-harness`),` · 上限 `,$(n?.limit??`—`)]})]}),n?.query?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[#65707b]`,children:[(0,j.jsxs)(`span`,{children:[`查询:`,$(n.query)]}),(0,j.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[$(n.total??0),` 个结果`]})]}),Array.isArray(n?.results)&&n.results.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:n.results.slice(0,5).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:$(n.name??`未知插件`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:[`v`,$(n.version??`—`)]})]}),(0,j.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#687381]`,children:$(n.description,``)})]},`${$(n.name??`plugin`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有找到匹配插件。`})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`Agent 可调用 plugin_search 搜索 npm Registry。`})]}):e.id===`memory-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`跨会话记忆`}),(0,j.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[$(n?.count??0),` 条`]})]}),Array.isArray(n?.memories)&&n.memories.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:n.memories.slice(0,5).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate font-mono text-[11px] text-[#30343b]`,children:$(n.key??`未知键`)}),(0,j.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#687381]`,children:$(n.value,``)})]},`${$(n.key??`memory`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未保存记忆。Agent 可调用 memory_set 明确写入。`})]}):e.id===`graph-memory-panel`?(()=>{let e=Ri(n),t=e.kinds,r=e.recent,i=e.recentRelations;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`任务`,t.task??0,`bg-[#3565c5]`],[`技能`,t.skill??0,`bg-[#22a06b]`],[`事件`,t.event??0,`bg-[#d97706]`]].map(([e,t,n])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-[#687381]`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${$(n)}`}),$(e)]}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#30343b]`,children:$(t)})]},$(e)))}),(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`text-[#65707b]`,children:`本地关系图`}),(0,j.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[e.nodes,` 节点 · `,e.relations,` 关系`]})]}),r.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,j.jsxs)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[#687381]`,children:[`最近节点 `,Math.min(r.length,5),` / `,e.nodes]}),r.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.kind===`task`||n.kind===`skill`||n.kind===`event`?n.kind:`unknown`;return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] font-semibold ${r===`task`?`bg-[#edf3fe] text-[#315fb8]`:r===`skill`?`bg-[#eaf8f0] text-[#14733f]`:r===`event`?`bg-[#fff4e5] text-[#a15c00]`:`bg-[#f2f3f5] text-[#65707b]`}`,children:r===`task`?`任务`:r===`skill`?`技能`:r===`event`?`事件`:`未知`}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:$(n.label??`未命名节点`)})]}),(0,j.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] leading-4 text-[#65707b]`,children:$(n.summary,``)}),n.source?(0,j.jsxs)(`p`,{className:`mt-1 truncate font-mono text-[9px] text-[#687381]`,children:[`来源:`,$(n.source)]}):null]},`${$(n.id??`node`)}-${t}`)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未记录图记忆。Agent 可调用 graph_memory_record 创建任务、技能或事件节点。`}),i.length>0?(0,j.jsxs)(`div`,{className:`grid gap-1 rounded-lg border border-[#edf0f3] bg-[#fbfcfd] px-3 py-2`,children:[(0,j.jsxs)(`span`,{className:`text-[9px] uppercase tracking-[0.08em] text-[#687381]`,children:[`最近关系 `,Math.min(i.length,3),` / `,e.relations]}),i.slice(0,3).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-[9px] text-[#65707b]`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:$(n.fromLabel??n.from??`节点`)}),(0,j.jsxs)(`span`,{className:`shrink-0 text-[#3565c5]`,children:[`—`,$(n.relation??`RELATED_TO`),`→`]}),(0,j.jsx)(`span`,{className:`truncate`,children:$(n.toLabel??n.to??`节点`)})]},`${$(n.id??`relation`)}-${t}`)})]}):null,e.lastSearch===null?null:(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,j.jsxs)(`span`,{className:`min-w-0 truncate text-[#65707b]`,children:[`最近搜索:`,e.lastSearch.query]}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[#3565c5]`,children:[e.lastSearch.shown,` / `,e.lastSearch.total]})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[9px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{className:`rounded bg-[#f6f8fa] px-2 py-1`,children:[`节点 ≤ `,e.limits.nodes]}),(0,j.jsxs)(`span`,{className:`rounded bg-[#f6f8fa] px-2 py-1`,children:[`关系 ≤ `,e.limits.relations]}),(0,j.jsxs)(`span`,{className:`rounded bg-[#f6f8fa] px-2 py-1`,children:[`文件 ≤ `,e.limits.fileBytes,` B`]})]}),e.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[#996515]`,children:`面板内容已按安全显示上限截断。`}):null]})})():e.id===`taskboard-panel`?(()=>{let e=n?.counts!==null&&typeof n?.counts==`object`?n.counts:{},t=Array.isArray(n?.recent)?n.recent:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`text-[#65707b]`,children:`当前工作区任务`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[$(n?.total??0),` 个`]})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:[[`待办`,`todo`,`bg-[#edf3fe] text-[#315fb8]`],[`进行中`,`in_progress`,`bg-[#fff4e5] text-[#a15c00]`],[`待验收`,`in_review`,`bg-[#f0edff] text-[#6b4fc3]`],[`已完成`,`done`,`bg-[#eaf8f0] text-[#14733f]`]].map(([t,n,r])=>(0,j.jsx)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-[#687381]`,children:[(0,j.jsx)(`span`,{children:t}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${r}`,children:$(e[n]??0)})]})},n))}),t.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,j.jsxs)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[#687381]`,children:[`最近任务 `,Math.min(t.length,5),` / `,$(n?.total??t.length)]}),t.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=typeof n.status==`string`?n.status:`unknown`,i=typeof n.priority==`string`?n.priority:`medium`,a=r===`backlog`?`待规划`:r===`todo`?`待办`:r===`in_progress`?`进行中`:r===`in_review`?`待验收`:r===`blocked`?`阻塞`:r===`canceled`?`已取消`:r===`done`?`已完成`:`未知`,o=r===`done`?`bg-[#eaf8f0] text-[#14733f]`:r===`blocked`||r===`canceled`?`bg-[#fff5f5] text-[#b42318]`:r===`unknown`?`bg-[#f2f3f5] text-[#65707b]`:`bg-[#edf3fe] text-[#315fb8]`;return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-[#3565c5]`,children:$(n.key??`PIH-?`)}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:$(n.title??`未命名任务`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${o}`,children:a})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[9px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`优先级 `,i]}),n.dueDate?(0,j.jsxs)(`span`,{children:[`截止 `,$(n.dueDate)]}):null]})]},`${$(n.id??`task`)}-${t}`)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未创建任务。Agent 可调用 taskboard_create 创建带稳定编号的任务。`})]})})():e.id===`skill-catalog-panel`?(()=>{let e=Array.isArray(n?.skills)?n.skills:[],t=Array.isArray(n?.mcpServers)?n.mcpServers:[],r=Array.isArray(n?.diagnostics)?n.diagnostics:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`Skills`}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#315fb8]`,children:$(n?.skillCount??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`MCP 服务器`}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#315fb8]`,children:$(n?.mcpCount??0)})]})]}),e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:$(n.name,`未命名技能`)}),(0,j.jsx)(`span`,{className:`rounded bg-[#f2f3f5] px-1.5 py-0.5 text-[9px] text-[#65707b]`,children:$(n.scope,`unknown`)})]}),(0,j.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] text-[#687381]`,children:$(n.description,`无描述`)})]},`${$(n.name??`skill`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前运行时没有加载 Skill。`}),t.length>0?(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold text-[#65707b]`,children:`MCP 状态`}),(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:t.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.status===`running`;return(0,j.jsxs)(`li`,{className:`flex items-center justify-between rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[#65707b]`,children:$(n.id,`未命名服务器`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${r?`bg-[#eaf8f0] text-[#14733f]`:`bg-[#f2f3f5] text-[#65707b]`}`,children:$(n.status,`unknown`)})]},`${$(n.id??`server`)}-${t}`)})})]}):null,r.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#fff0c2] bg-[#fffaf0] px-3 py-2 text-[10px] text-[#8a5a00]`,children:[`资源诊断:`,r.length,` 条警告`]}):null,(0,j.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`只读查看 runtime 已加载的 Skill 与 MCP 状态;配置写入仍由各自插件负责。`})]})})():e.id===`cost-meter-panel`?(()=>{let e=typeof n?.budget==`number`?n.budget:null,t=typeof n?.budgetPercent==`number`?n.budgetPercent:null,r=_r(n),i=t!==null&&t>=100?`text-[#b42318]`:t!==null&&t>=80?`text-[#a15c00]`:`text-[#14733f]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`今日(UTC)`,`$${Number(n?.todayCost??0).toFixed(4)}`],[`当前会话`,`$${Number(n?.sessionCost??0).toFixed(4)}`],[`累计`,`$${Number(n?.lifetimeCost??0).toFixed(4)}`]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[15px] font-semibold text-[#30343b]`,children:$(t)})]},$(e)))}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[#65707b]`,children:`每日预算(UTC)`}),(0,j.jsx)(`strong`,{className:i,children:e===null?`未设置`:`$${e.toFixed(4)} · ${t?.toFixed(2)??`0.00`}%`})]}),e===null?null:(0,j.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-[#dfe8f7]`,children:(0,j.jsx)(`div`,{className:`h-full ${t!==null&&t>=100?`bg-[#d64545]`:`bg-[#4c83e8]`}`,style:{width:`${Math.min(100,t??0)}%`}})})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{className:`rounded bg-[#f6f8fa] px-2 py-1`,children:[r.dayBasis,` 日账本`]}),(0,j.jsxs)(`span`,{className:`rounded bg-[#f6f8fa] px-2 py-1`,children:[`账本上限 `,r.entryLimit??`—`,` 条`]})]}),r.lastError===null?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f0c8c4] bg-[#fff5f4] px-3 py-2 text-[10px] text-[#b42318]`,children:[`最近写入错误:`,r.lastError]}),r.entries.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:r.entries.map((e,t)=>(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[#65707b]`,children:e.sessionId}),(0,j.jsxs)(`strong`,{className:`shrink-0 font-mono text-[#30343b]`,children:[`$`,e.dailyCost.toFixed(4),` 当日增量`]})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[#7a8490]`,children:[(0,j.jsxs)(`span`,{children:[`UTC `,e.utcDate]}),(0,j.jsxs)(`span`,{children:[`会话累计 $`,e.sessionCost.toFixed(4)]}),(0,j.jsxs)(`span`,{children:[e.tokens,` tokens`]}),(0,j.jsxs)(`span`,{children:[e.messages,` 消息`]})]})]},`${e.sessionId}-${e.utcDate}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未记录已完成会话。Agent 可调用 cost_report 的 refresh 操作写入账本。`}),(0,j.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`仅记录运行时报告的实际成本,不内置或猜测模型价格。`})]})})():e.id===`undo-savepoint-panel`?(()=>{let e=Array.isArray(n?.savepoints)?n.savepoints:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`保存点`}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#315fb8]`,children:$(n?.count??e.length)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`跟踪路径`}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#315fb8]`,children:$(Array.isArray(n?.trackedPaths)?n.trackedPaths.length:0)})]})]}),e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:e.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsx)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`code`,{className:`font-mono text-[10px] text-[#3565c5]`,children:$(n.id,`unknown`)}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:$(n.reason,`manual savepoint`)}),(0,j.jsxs)(`span`,{className:`text-[9px] text-[#687381]`,children:[$(n.fileCount,`0`),` 文件`]})]})},`${$(n.id??`savepoint`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未创建保存点。修改配置或插件代码前,让 Agent 调用 undo_savepoint 的 save 操作。`}),(0,j.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`恢复操作要求 confirm=true;敏感文件、二进制文件和依赖目录不会进入保存点。`})]})})():e.id===`annotation-panel`?(()=>{let e=Array.isArray(n?.annotations)?n.annotations:[],t=typeof n?.lastPrompt==`string`?n.lastPrompt:``;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`text-[#65707b]`,children:`待发送批注`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[$(n?.count??0),` 条`]})]}),e.length>0?(0,j.jsx)(`ol`,{className:`grid gap-1.5`,children:e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-2 text-[10px]`,children:[(0,j.jsxs)(`span`,{className:`rounded bg-[#edf3fe] px-1.5 py-0.5 font-mono text-[#315fb8]`,children:[`#`,$(n.id??t+1)]}),(0,j.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-[#30343b]`,children:$(n.quote,``)})]}),n.note?(0,j.jsx)(`p`,{className:`mt-1 pl-8 text-[10px] text-[#687381]`,children:$(n.note)}):null]},`${$(n.id??t)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未收集批注。Agent 可调用 annotation_manage 的 add 操作记录回复片段。`}),t?(0,j.jsxs)(`details`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`summary`,{className:`cursor-pointer text-[#65707b]`,children:`最近生成的提问上下文`}),(0,j.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-auto whitespace-pre-wrap text-[10px] text-[#30343b]`,children:t})]}):null,(0,j.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`批注按编号累积;生成上下文不会改写原会话消息。`})]})})():e.id===`runtime-doctor-panel`?(()=>{let e=$(n?.status??`unknown`),t=Array.isArray(n?.checks)?n.checks:[],r=Array.isArray(n?.recommendations)?n.recommendations:[],i=e===`ok`?`bg-[#eaf8f0] text-[#14733f]`:e===`warning`?`bg-[#fff7e8] text-[#a15c00]`:`bg-[#fff0f0] text-[#b42318]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`运行时边界检查`}),(0,j.jsx)(`span`,{className:`rounded px-2 py-0.5 font-mono text-[10px] uppercase ${i}`,children:e})]}),(0,j.jsx)(`div`,{className:`grid gap-1.5`,children:t.map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=$(n.status??`unknown`),i=r===`ok`?`bg-[#eaf8f0] text-[#14733f]`:r===`warning`?`bg-[#fff7e8] text-[#a15c00]`:`bg-[#fff0f0] text-[#b42318]`;return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r===`ok`?`bg-[#22c55e]`:r===`warning`?`bg-[#e6a21a]`:`bg-[#d64545]`}`}),(0,j.jsx)(`code`,{className:`w-20 shrink-0 text-[#65707b]`,children:$(n.id??`check`)}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[#30343b]`,children:$(n.detail??`—`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono ${i}`,children:r})]},`${$(n.id??`check`)}-${t}`)})}),r.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f3dfab] bg-[#fffaf0] px-3 py-2 text-[10px] text-[#8a6200]`,children:[(0,j.jsx)(`strong`,{children:`建议`}),(0,j.jsx)(`ul`,{className:`mt-1 grid gap-1 pl-4`,children:r.slice(0,5).map((e,t)=>(0,j.jsx)(`li`,{children:$(e)},`${$(e)}-${t}`))})]}):null]})})():e.id===`plugin-check-panel`?(()=>{let e=n?.latest!==null&&typeof n?.latest==`object`?n.latest:void 0,t=e?.checks!==null&&typeof e?.checks==`object`?e.checks:void 0,r=Array.isArray(e?.errors)?e.errors:[],i=Array.isArray(e?.warnings)?e.warnings:[],a=Array.isArray(e?.reports)?e.reports:[],o=Array.isArray(e?.checks)?e.checks:[],s=$(e?.verdict??`—`),c=s===`pass`?`bg-[#eaf8f0] text-[#14733f]`:s===`warn`?`bg-[#fff7e8] text-[#a15c00]`:`bg-[#fff0f0] text-[#b42318]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e?.scanned===void 0?e?.verdict===void 0?o.length>0?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px] text-[#65707b]`,children:[`检查清单:`,o.length,` 项`]}):null:(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f8fafc] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate text-[#65707b]`,children:$(e.repo??`当前插件`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono ${c}`,children:s})]}):(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`text-[#65707b]`,children:`目录扫描`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[$(e.scanned),` 个仓库`]})]}),t?(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`通过`,t.passed??0],[`失败`,t.failed??0],[`警告`,t.warned??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#30343b]`,children:$(t)})]},$(e)))}):null,a.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:a.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=$(n.verdict??`—`);return(0,j.jsxs)(`li`,{className:`flex items-center justify-between rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[#65707b]`,children:$(n.repo??`未知仓库`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${r===`pass`?`bg-[#eaf8f0] text-[#14733f]`:r===`warn`?`bg-[#fff7e8] text-[#a15c00]`:`bg-[#fff0f0] text-[#b42318]`}`,children:r})]},`${$(n.repo??`repo`)}-${t}`)})}):r.length>0||i.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:[...r,...i].slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`strong`,{className:`font-mono text-[#b42318]`,children:$(n.code??`issue`)}),(0,j.jsx)(`p`,{className:`mt-1 text-[#65707b]`,children:$(n.message,``)})]},`${$(n.code??`issue`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未检查插件。Agent 可调用 plugin_check 执行 check、scan 或 schema。`}),(0,j.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`只读检查,不修改、不构建被检仓库。`})]})})():e.id===`plugin-radar-panel`?(()=>{let e=Array.isArray(n?.results)?n.results:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`text-[#65707b]`,children:`GitHub DSH 生态`}),(0,j.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[$(n?.total??0),` 个仓库 · `,Array.isArray(n?.sources)?n.sources.length:0,` 个来源`]})]}),n?.query?(0,j.jsxs)(`div`,{className:`text-[11px] text-[#65707b]`,children:[`查询:`,$(n.query)]}):null,e.length>0?(0,j.jsx)(`ol`,{className:`grid gap-1.5`,children:e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=Array.isArray(n.topics)?n.topics.filter(e=>typeof e==`string`).slice(0,3):[],i=typeof n.url==`string`?n.url:void 0;return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`w-4 shrink-0 text-right font-mono text-[10px] text-[#687381]`,children:t+1}),i?(0,j.jsx)(`a`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[#315fb8] hover:underline`,href:i,rel:`noreferrer`,target:`_blank`,children:$(n.fullName??n.name??`未知仓库`)}):(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[#30343b]`,children:$(n.fullName??n.name??`未知仓库`)}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-[#a15c00]`,children:[`★ `,$(n.stars??0)]})]}),(0,j.jsx)(`p`,{className:`mt-1 truncate pl-6 text-[10px] text-[#65707b]`,children:$(n.description,`暂无描述`)}),(0,j.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-2 pl-6 text-[9px] text-[#687381]`,children:[n.language?(0,j.jsx)(`span`,{children:$(n.language)}):null,n.updatedAt?(0,j.jsxs)(`span`,{className:`font-mono`,children:[`更新 `,$(n.updatedAt)]}):null,r.length>0?(0,j.jsx)(`span`,{className:`truncate`,children:r.map(e=>`#${e}`).join(` `)}):null]})]},`${$(n.fullName??`repo`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未搜索插件。Agent 可调用 plugin_radar_search 从 GitHub 发现 DSH 插件。`}),(0,j.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`只读 GitHub 搜索,按 Star 降序;不会安装、执行或修改第三方仓库。`})]})})():e.id===`hol-guard-panel`?(()=>{let e=Array.isArray(n?.receipts)?n.receipts:[],t=n?.latest!==null&&typeof n?.latest==`object`?n.latest:void 0,r=e=>e===`blocked`?`高风险`:e===`review`?`需复核`:`安全`,i=e=>e===`blocked`?`bg-[#fff0f0] text-[#b42318]`:e===`review`?`bg-[#fff7e8] text-[#a15c00]`:`bg-[#eaf8f0] text-[#14733f]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`高风险`,n?.blocked??0],[`需复核`,n?.review??0],[`安全`,n?.safe??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#30343b]`,children:$(t)})]},$(e)))}),t?(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] px-3 py-2 text-[10px] ${i(t.risk)}`,children:[(0,j.jsxs)(`span`,{children:[`最近一次:`,$(t.source,`unknown`)]}),(0,j.jsxs)(`strong`,{children:[r(t.risk),` · `,$(t.findings&&Array.isArray(t.findings)?t.findings.length:0),` 项`]})]}):null,e.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,j.jsx)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[#687381]`,children:`最近风险摘要`}),e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{},a=Array.isArray(n.findings)?n.findings:[];return(0,j.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${i(n.risk)}`,children:r(n.risk)}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[#65707b]`,children:$(n.source,`unknown`)}),(0,j.jsxs)(`span`,{className:`text-[#687381]`,children:[a.length,` 项`]})]},`${$(n.source)}-${t}`)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未收到工具调用。Agent 可调用 hol_guard_scan 预检命令或文本。`}),(0,j.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`仅保存风险摘要和计数,不保存命令、路径或凭据原文;风险等级仅供审计,HOL Guard 不会阻止任何工具执行。`})]})})():e.id===`synapse-panel`?(()=>{let e=Array.isArray(n?.nodes)?n.nodes:[],t=Array.isArray(n?.edges)?n.edges:[],r=new Map(e.filter(e=>typeof e==`object`&&!!e).map(e=>[$(e.id),e]));return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`会话`,n?.nodes??0],[`分支`,n?.edges??0],[`孤儿`,n?.orphanCount??0]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#30343b]`,children:$(t)})]},$(e)))}),n?.activeSessionId?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#b9d0ff] bg-[#f1f6ff] px-3 py-2 text-[10px] text-[#315fb8]`,children:[`当前会话:`,(0,j.jsx)(`code`,{className:`font-mono`,children:$(n.activeSessionId)})]}):null,e.length>0?(0,j.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,j.jsxs)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[#687381]`,children:[`最近会话 `,Math.min(e.length,8),` / `,e.length]}),e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border px-3 py-2 ${n.active===!0?`border-[#b9d0ff] bg-[#f7faff]`:`border-[#edf0f3] bg-white`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n.active===!0?`bg-[#3565c5]`:`bg-[#c4ccd6]`}`}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:$(n.label??n.sessionId??`未命名会话`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[9px] text-[#687381]`,children:[$(n.messageCount??0),` 条消息`]})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[9px] text-[#687381]`,children:[(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:$(n.cwd??`未知工作区`)}),(0,j.jsxs)(`span`,{children:[$(n.branchCount??0),` 个分支`]})]})]},`${$(n.id??`session`)}-${t}`)})]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前工作区还没有可投影的持久化会话。`}),t.length>0?(0,j.jsxs)(`div`,{className:`grid gap-1 rounded-lg border border-[#edf0f3] bg-[#fbfcfd] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`text-[9px] uppercase tracking-[0.08em] text-[#687381]`,children:`Fork 关系`}),t.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{},i=r.get($(n.from)),a=r.get($(n.to));return(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-[9px] text-[#65707b]`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:$(i?.label??n.from)}),(0,j.jsx)(`span`,{className:`shrink-0 text-[#3565c5]`,children:`→ fork →`}),(0,j.jsx)(`span`,{className:`truncate`,children:$(a?.label??n.to)})]},`${$(n.from)}-${$(n.to)}-${t}`)})]}):null,(0,j.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`数据来源:Pi 原生 JSONL 会话;Agent 可调用 synapse_session_map 刷新。`})]})})():e.id===`archify-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.components)?e.components:[],r=Array.isArray(e.dependencies)?e.dependencies:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`组件`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:$(t.length)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`外部依赖`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:$(r.length)})]})]}),(0,j.jsx)(`div`,{className:`grid gap-1.5`,children:t.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-[#3565c5]`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[#30343b]`,children:$(n.path??`组件`)}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:[$(n.files??0),` files`]})]},`${$(n.path??`component`)}-${t}`)})}),r.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.slice(0,12).map((e,t)=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[#f6f8ff] px-2 py-1 font-mono text-[10px] text-[#315fb8]`,children:$(e)},`${$(e)}-${t}`))}):null,(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:$(e.mermaid,``)}),e.truncated===!0?(0,j.jsx)(`p`,{className:`text-[10px] text-[#8a5a00]`,children:`扫描达到节点上限,架构图可能不完整。`}):null]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`Agent 可调用 architecture_map 生成当前工作区架构图。`})}):e.id===`canvas-draw-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`Mermaid 流程图`}),(0,j.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[$(n?.nodeCount??0),` 节点 · `,$(n?.edgeCount??0),` 连线`]})]}),n?.latest&&typeof n.latest==`object`?(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:$(n.latest.mermaid,``)}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`Agent 可调用 canvas_draw 生成流程图源码。`})]}):e.id===`image-compressor-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`PNG 无损压缩`}),(0,j.jsx)(`span`,{className:`font-mono text-[#65707b]`,children:`上限 32 MiB`})]}),n?.last&&typeof n.last==`object`?(()=>{let e=n.last;return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#b9e6c9] bg-[#f0fbf4] px-3 py-3 text-[11px] text-[#14733f]`,children:[$(e.inputPath??`图片`),` → `,$(e.outputPath??`输出`),`,节省 `,$(e.savedBytes??0),` bytes`]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`Agent 可调用 image_compress,写入前必须 confirm=true。`})]}):e.id===`workspace-search-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`工作区文本检索`}),(0,j.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[$(n?.matchCount??0),` 个匹配`]})]}),n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.matches)?e.matches:[];return t.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1.5`,children:t.slice(0,5).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`strong`,{className:`block truncate font-mono text-[10px] text-[#3565c5]`,children:[$(n.path??`未知文件`),`:`,$(n.line??`?`)]}),(0,j.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-[#65707b]`,children:$(n.text,``)})]},`${$(n.path??`match`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有找到匹配内容。`})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`Agent 可调用 workspace_search 检索当前工作区。`})]}):e.id===`recall-unread-panel`?(()=>{let e=Fa(n),t=e.items.slice(0,8);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.status.state===`failed`||e.status.state===`cancelled`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] leading-5 ${e.status.state===`failed`?`border-[#f3c4c4] bg-[#fff4f4] text-[#a23b3b]`:`border-[#f4d8a8] bg-[#fff9ed] text-[#9a6700]`}`,children:[`扫描`,e.status.state===`failed`?`失败`:`已取消`,e.status.error===null?``:`:${e.status.error}`]}):null,(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`候选`,e.inventory.candidates],[`已扫描`,e.inventory.scanned],[`未回答`,e.total]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#30343b]`,children:$(t)})]},$(e)))}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.map((e,t)=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:e.name}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-[#687381]`,children:[e.messageCount,` 条消息`]})]}),(0,j.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap break-words text-[10px] leading-4 text-[#65707b]`,children:e.message})]},`${e.id}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有以未回答用户消息结束的会话。`}),(0,j.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`已扫描 `,e.inventory.scanned,`/`,e.inventory.available,` 个会话文件,界面显示 `,t.length,`/`,e.inventory.unread,` `,`个;只读扫描,不会修改会话。`,e.inventory.truncated?` 部分结果因发现、扫描或展示上限被截断。`:``]})]})})():e.id===`turn-rewind-panel`?(()=>{let e=Wa(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.latest===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有执行回退操作。`}):(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${{queued:`border-[#dce5f5] bg-[#f6f8ff] text-[#3565c5]`,running:`border-[#dce5f5] bg-[#f6f8ff] text-[#3565c5]`,completed:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`,failed:`border-[#f3c4c4] bg-[#fff4f4] text-[#a23b3b]`,cancelled:`border-[#f4d8a8] bg-[#fff9ed] text-[#9a6700]`}[e.latest.status]}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em]`,children:`最近操作`}),(0,j.jsx)(`span`,{className:`rounded-full bg-white/70 px-2 py-1 text-[10px] font-semibold`,children:{queued:`已排队`,running:`执行中`,completed:`已回退`,failed:`失败`,cancelled:`已取消`}[e.latest.status]})]}),(0,j.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[11px] leading-4 text-[#30343b]`,children:e.latest.target.text}),e.latest.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4`,children:e.latest.error}),e.latest.summarized?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] leading-4`,children:`已请求分支摘要;该选项可能调用模型并产生费用。`}):null]}),(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:`可回退轮次`}),e.candidates.length>0?e.candidates.map((t,n)=>(0,j.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`mt-0.5 font-mono text-[10px] text-[#3565c5]`,children:e.candidates.length-n}),(0,j.jsx)(`span`,{className:`line-clamp-2 min-w-0 flex-1 text-[11px] leading-4 text-[#65707b]`,children:t.text})]},`${t.entryId}-${n}`)):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-3 text-[11px] text-[#687381]`,children:`当前会话还没有可回退的用户轮次。`})]}),(0,j.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`已检查当前分支 `,e.inventory.scannedEntries,` 个条目;后端保留 `,e.inventory.shown,` 个候选,界面显示 `,e.candidates.length,` 个。`,e.inventory.truncated?` 部分结果因扫描、候选或显示上限被截断。`:``]})]})})():e.id===`skill-guard-panel`?(()=>{let e=Po(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.status.state===`failed`||e.status.state===`cancelled`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] leading-5 ${e.status.state===`failed`?`border-[#f3c4c4] bg-[#fff4f4] text-[#a23b3b]`:`border-[#f4d8a8] bg-[#fff9ed] text-[#9a6700]`}`,children:[`扫描`,e.status.state===`failed`?`失败`:`已取消`,e.status.error===null?``:`:${e.status.error}`]}):null,(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`已扫描`,e.total],[`高风险`,e.blocked],[`待复核`,e.review]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:$(t)})]},$(e)))}),(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.reports.length>0?e.reports.slice(0,8).map((e,t)=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`h-2 w-2 rounded-full ${e.risk===`blocked`?`bg-[#d64545]`:e.risk===`review`?`bg-[#e0a11a]`:`bg-[#22a06b]`}`}),(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:e.name}),(0,j.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:e.risk===`blocked`?`高风险`:e.risk===`review`?`复核`:`安全`})]}),e.findings.length>0?(0,j.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#65707b]`,children:e.findings.map(e=>e.code).join(` · `)}):null]},`${e.name}-${t}`)):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`暂无 Skill 扫描结果,可让 Agent 调用 skill_guard_scan。`})}),(0,j.jsxs)(`p`,{className:`text-[10px] text-[#687381]`,children:[`已扫描 `,e.inventory.scanned,`/`,e.inventory.available,` 个入口,面板显示 `,Math.min(e.reports.length,8),` 个;风险等级仅供审计,不会禁用 Skill。`]})]})})():e.id===`prompt-guard-panel`?(()=>{let e=n?.highest&&typeof n.highest==`object`?n.highest:void 0,t=e??(n?.latest&&typeof n.latest==`object`?n.latest:void 0),r=e?.risk??n?.risk;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${r===`blocked`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:r===`review`?`border-[#f3dfab] bg-[#fffaf0] text-[#9a6700]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:[(0,j.jsxs)(`span`,{children:[r===`blocked`?`高风险,需阻断`:r===`review`?`需要人工复核`:`未发现风险`,t&&r!==`safe`&&r!==void 0?(0,j.jsx)(`span`,{className:`ml-2 font-mono text-[10px]`,children:$(t.source,`unknown`)}):null]}),(0,j.jsxs)(`strong`,{className:`font-mono`,children:[$(n?.scans??0),` 次扫描`]})]}),t?(()=>{let e=t,n=Array.isArray(e.findings)?e.findings:[];return n.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1 rounded-lg border border-[#e3e7ee] bg-white px-4 py-3 text-[10px] text-[#65707b]`,children:n.slice(0,4).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`strong`,{className:`font-mono text-[#30343b]`,children:$(n.code??`finding`)}),`:`,$(n.message,``)]},`${$(n.code??`finding`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`已扫描的用户消息和工具输出均未发现风险。`})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未扫描任何内容。用户消息和工具输出会自动扫描,Agent 也可调用 prompt_guard_scan 检查不可信文本。`})]})})():e.id===`code2skill-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`已生成技能`}),(0,j.jsx)(`strong`,{className:`font-mono text-[12px] text-[#315fb8]`,children:$(n?.generated??0)})]}),n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(0,j.jsxs)(`p`,{className:`mt-2 truncate text-[11px] text-[#65707b]`,children:[$(n.latest.slug??`skill`),` ·`,` `,$(Array.isArray(n.latest.files)?n.latest.files.length:0),` `,`个参考文件`]}):(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`还没有生成技能。可让 Agent 调用 skill_pack_create。`})]}),(0,j.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`输出目录:项目 .pi/skills/<name>,包含 SKILL.md 和原始参考文件。`})]}):e.id===`genui-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(()=>{let e=mi(n),t={neutral:`border-[#e3e7ee] bg-[#f6f8fa] text-[#65707b]`,info:`border-[#d9e4f7] bg-[#f6f8ff] text-[#315fb8]`,success:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`,warning:`border-[#f3dfab] bg-[#fffaf0] text-[#9a6700]`,danger:`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`};return e.latest===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有结构化卡片。可让 Agent 调用 genui_render。`}):(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-[11px]`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 break-words text-[#30343b]`,children:e.latest.title}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-[#687381]`,children:[e.rendered,` 次`]})]}),e.latest.blocks.map((e,n)=>e.type===`progress`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${t[e.tone]}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label}),(0,j.jsxs)(`strong`,{className:`shrink-0`,children:[e.value,`%`]})]}),(0,j.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-white/70`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full bg-current`,style:{width:`${e.value}%`}})})]},`${e.label}-${n}`):e.type===`text`?(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 text-[11px] ${t[e.tone]}`,children:[(0,j.jsx)(`strong`,{className:`block text-[10px]`,children:e.label}),(0,j.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words leading-4`,children:e.value})]},`${e.label}-${n}`):(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border px-3 py-2 text-[11px] ${t[e.tone]}`,children:[(0,j.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label}),(0,j.jsx)(`strong`,{className:`min-w-0 break-words text-right`,children:e.value})]},`${e.label}-${n}`)),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`最多 `,e.limits.blocks,` 块`]}),(0,j.jsxs)(`span`,{children:[`总文本上限 `,e.limits.totalText,` 字符`]}),e.latest.renderedAt===null?null:(0,j.jsxs)(`span`,{children:[e.latest.renderedAt.slice(11,19),` UTC`]}),e.latest.truncated?(0,j.jsx)(`span`,{children:`面板明细已截断`}):null]})]})})(),(0,j.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`仅渲染结构化文本、徽标和进度块;HTML 与脚本按普通文本显示。`})]}):e.id===`anchored-standard-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(()=>{let e=Array.isArray(n?.violations)?n.violations:[],t=n?.status===`violated`;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${t?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:[(0,j.jsx)(`span`,{children:t?`轨迹存在违规`:n?.status===`anchored`?`运行已锚定`:`等待 Agent 运行`}),(0,j.jsxs)(`strong`,{className:`font-mono`,children:[$(n?.events??0),` 事件`]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[#65707b]`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`工具调用 `,(0,j.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:$(n?.toolCalls??0)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`违规项 `,(0,j.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:$(e.length)})]})]}),e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-1 rounded-lg border border-[#f4caca] bg-[#fffafa] px-3 py-2 text-[10px] text-[#b42318]`,children:e.slice(0,4).map((e,t)=>(0,j.jsx)(`li`,{children:$(e&&typeof e==`object`?e.message??`违规`:e)},`${$(e)}-${t}`))}):null]})})(),(0,j.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`可让 Agent 调用 trajectory_anchor_check 审计当前执行轨迹。`})]}):e.id===`telemetry-blocker-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#b9e6c9] bg-[#f0fbf4] px-3 py-3 text-[11px] text-[#14733f]`,children:[(0,j.jsx)(`span`,{children:`遥测已关闭`}),(0,j.jsxs)(`strong`,{className:`font-mono`,children:[`拦截 `,$(n?.blocked??0),` 次`]})]}),(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[10px] text-[#65707b]`,children:Array.isArray(n?.names)&&n.names.length>0?`事件名:${n.names.slice(0,8).map(String).join(`、`)}`:`尚未收到遥测事件。`}),(0,j.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`只记录事件名和计数,不保留事件属性,也不会发起网络请求。`})]}):e.id===`plugin-dev-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=Tt(n),t={idle:{label:`等待重载`,style:`border-[#e3e7ee] bg-[#f6f8fa] text-[#65707b]`},queued:{label:`等待当前运行结束`,style:`border-[#d9e4f7] bg-[#f6f8ff] text-[#315fb8]`},running:{label:`正在重载会话资源`,style:`border-[#d9e4f7] bg-[#f6f8ff] text-[#315fb8]`},reloaded:{label:`会话资源已重载`,style:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`},failed:{label:`会话资源重载失败`,style:`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`},cancelled:{label:`会话资源重载已取消`,style:`border-[#f3dfab] bg-[#fffaf0] text-[#9a6700]`}}[e.status];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${t.style}`,children:[(0,j.jsx)(`span`,{children:t.label}),(0,j.jsx)(`strong`,{className:`font-mono`,children:e.status})]}),(0,j.jsx)(`p`,{className:`break-words text-[10px] text-[#687381]`,children:e.reason||`修改本地扩展后调用 plugin_dev_reload`}),e.error===null?null:(0,j.jsx)(`p`,{className:`break-words rounded-lg bg-[#fff5f5] px-3 py-2 text-[10px] text-[#b42318]`,children:e.error}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`原因上限 `,e.limits.reasonCharacters,` 字符`]}),(0,j.jsxs)(`span`,{children:[`错误上限 `,e.limits.errorCharacters,` 字符`]}),e.reloadedAt===null?null:(0,j.jsxs)(`span`,{children:[e.reloadedAt.slice(11,19),` UTC`]})]})]})})()}):e.id===`openpets-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=Da(n),t={idle:`休息`,focused:`专注`,happy:`开心`,concerned:`担心`}[e.mood];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[#e3e7ee] bg-[#f8fafc] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-[#dceaff] text-[20px] text-[#3565c5]`,children:`◉`}),(0,j.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[13px] text-[#30343b]`,children:e.name}),(0,j.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:e.lastEvent})]}),(0,j.jsx)(`span`,{className:`rounded-full bg-[#edf3fe] px-2 py-1 text-[10px] text-[#3565c5]`,children:t})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[#65707b]`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`能量 `,(0,j.jsxs)(`strong`,{className:`ml-1 text-[#30343b]`,children:[e.energy,`%`]})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`互动 `,(0,j.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:e.interactions})]})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`恢复扫描 `,e.recovery.scanned,` / `,e.recovery.sessionEntries]}),(0,j.jsx)(`span`,{children:e.recovery.restored?`已恢复状态`:`使用初始状态`}),(0,j.jsxs)(`span`,{children:[`持久化 `,e.persistence.attempts-e.persistence.failures,` / `,e.persistence.attempts]}),e.updatedAt===null?null:(0,j.jsxs)(`span`,{children:[e.updatedAt.slice(11,19),` UTC`]})]}),e.persistence.lastError===null?null:(0,j.jsx)(`p`,{className:`break-words rounded-lg bg-[#fff5f5] px-3 py-2 text-[10px] text-[#b42318]`,children:e.persistence.lastError}),(0,j.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`根据真实 Pi 会话事件自动反应,也可让 Agent 调用 pet_react 进行互动。`})]})})()}):e.id===`change-verifier-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest,t=e.tests&&typeof e.tests==`object`?e.tests:{},r=e.review&&typeof e.review==`object`?e.review:{},i=$(e.status??`fail`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${i===`pass`?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:i===`warning`?`border-[#f3dfab] bg-[#fffaf0] text-[#9a6700]`:`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`}`,children:[(0,j.jsx)(`span`,{children:i===`pass`?`门禁通过`:i===`warning`?`门禁有警告`:`门禁失败`}),(0,j.jsxs)(`strong`,{className:`font-mono`,children:[$(n.runs??0),` 次`]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[#65707b]`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`测试 exit `,(0,j.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:$(t.exitCode??`—`)})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`审查 `,(0,j.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:$(r.status??`—`)})]})]})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有执行发布门禁。可让 Agent 调用 verify_change_gate。`}),(0,j.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`复用 run_project_tests 和 review_changes,不重复实现测试或审查逻辑。`})]}):e.id===`readme-gen-panel`?(()=>{let e=_c(n);if(e.malformed)return(0,j.jsx)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] leading-5 text-[#b42318]`,children:`README 面板数据无效,暂不展示生成或写入结果。`});let t=e.status.state===`idle`?`等待生成`:e.status.state===`running`?e.status.operation===`write`?`正在写入`:`正在生成`:e.status.state===`completed`?e.status.operation===`write`?`写入已完成`:`草稿已生成`:e.status.state===`failed`?e.status.operation===`write`?`写入失败`:`生成失败`:e.status.operation===`write`?`写入已取消`:`生成已取消`,r=e.status.state===`failed`||e.status.state===`cancelled`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:e.status.state===`completed`?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:`border-[#dce5f5] bg-[#f6f8ff] text-[#315fb8]`;return(0,j.jsxs)(`div`,{className:`mt-3 grid min-w-0 gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3 rounded-lg border px-3 py-2 text-[10px] ${r}`,children:[(0,j.jsx)(`strong`,{className:`font-semibold`,children:t}),e.status.at===null?null:(0,j.jsxs)(`time`,{className:`shrink-0 font-mono`,children:[e.status.at.slice(11,19),` UTC`]})]}),e.generated===null?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] leading-5 text-[#687381]`,children:[`还没有生成 README 草稿。让 Agent 调用 `,(0,j.jsx)(`code`,{className:`font-mono text-[#3565c5]`,children:`readme_report`}),` 先检查内容。`]}):(0,j.jsxs)(`div`,{className:`min-w-0 border-l-2 border-[#7aa2e8] bg-[#f8faff] px-3 py-3`,children:[(0,j.jsx)(`p`,{className:`break-all text-[12px] font-semibold leading-5 text-[#20252b]`,children:e.generated.name}),(0,j.jsxs)(`p`,{className:`mt-1 text-[10px] text-[#687381]`,children:[e.generated.scripts,` 个脚本 · `,e.generated.plugins,` 个运行时插件`]})]}),e.lastWrite===null?null:(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[#dce5f5] bg-white px-3 py-2 text-[#315fb8]`,children:[(0,j.jsx)(`p`,{className:`break-all font-mono text-[10px] leading-4`,children:e.lastWrite.path}),(0,j.jsxs)(`p`,{className:`mt-1 text-[10px] text-[#687381]`,children:[new Intl.NumberFormat(`en-US`).format(e.lastWrite.bytes),` bytes · `,e.lastWrite.overwritten?`已覆盖`:`新文件`]})]}),e.status.error===null?null:(0,j.jsx)(`p`,{className:`break-words rounded-lg bg-[#fff5f5] px-3 py-2 text-[10px] leading-4 text-[#b42318]`,children:e.status.error}),(0,j.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`写入需要 `,(0,j.jsx)(`code`,{className:`font-mono`,children:`confirm=true`}),`;覆盖已有 README 还需要 `,(0,j.jsx)(`code`,{className:`font-mono`,children:`overwrite=true`}),`。`]})]})})():e.id===`sql-lens-panel`?(()=>{let e=ss(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] text-[#b42318]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:`SQL Lens 面板数据异常`}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:`面板数据不完整或不可信,请重新加载后再查询。`})]});let t=e.latest,r=e.status.state===`running`?`查询中`:e.status.state===`completed`?`已完成`:e.status.state===`failed`?`查询失败`:e.status.state===`cancelled`?`已取消`:`等待查询`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px] text-[#687381]`,children:[(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-[#f6f8fa] px-2 py-1 font-semibold text-[#3565c5]`,children:r}),e.status.at===null?null:(0,j.jsx)(`time`,{className:`font-mono`,children:new Date(e.status.at).toLocaleString()})]}),e.status.error===null?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[10px] leading-4 text-[#b42318]`,children:e.status.error}),t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有查询数据库。可让 Agent 调用 sql_readonly。`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,title:t.database,children:t.database}),(0,j.jsxs)(`strong`,{className:`shrink-0 font-mono text-[12px] text-[#3565c5]`,children:[t.rowInventory.returned,` rows`]})]}),(0,j.jsx)(`code`,{className:`mt-2 block max-h-16 overflow-auto whitespace-pre-wrap break-words text-[10px] leading-4 text-[#687381]`,children:t.query})]}),(0,j.jsx)(`pre`,{className:`max-h-56 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:JSON.stringify(t.rows,null,2)}),t.rowInventory.truncated?(0,j.jsxs)(`p`,{className:`text-[10px] text-[#9a6700]`,children:[`面板显示 `,t.rowInventory.shown,` / `,t.rowInventory.returned,` 行;查询共扫描 `,t.rowInventory.scanned,` `,`行,结果已按安全边界截断。`]}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[10px] text-[#3565c5]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`timeout:`,e.timeoutMs,`ms`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`rows:`,e.limits.rows]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`result:`,Math.round(e.limits.resultBytes/1024),`KiB`]})]})]})})():e.id===`theme-studio-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px] text-[#30343b]`,children:$(n?.label??`Light`)}),(0,j.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#65707b]`,children:$(n?.description??``)})]}),(0,j.jsx)(`span`,{className:`shrink-0 rounded-full bg-[#edf3fe] px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:$(n?.theme??`light`)})]}),Array.isArray(n?.presets)?(0,j.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:n.presets.map((e,t)=>{let r=typeof e==`object`&&e?e:{},i=r.id===n.theme;return(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${i?`border-[#9bbcff] bg-[#f6f8ff]`:`border-[#edf0f3] bg-white`}`,children:[(0,j.jsx)(`strong`,{className:`block text-[11px] text-[#30343b]`,children:$(r.label??r.id??`主题`)}),(0,j.jsx)(`span`,{className:`mt-1 block truncate text-[10px] text-[#687381]`,children:$(r.description??``)})]},`${$(r.id??`theme`)}-${t}`)})}):null,(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`可让 Agent 调用 theme_set 切换预设;选择会保存到当前 session,并由 React 根节点应用 token。`})]}):e.id===`mirage-bridge-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${n?.available===!0?`border-[#b9e6c9] bg-[#f0fbf4]`:n?.available===!1?`border-[#f3dfab] bg-[#fffaf0]`:`border-[#e3e7ee] bg-[#f6f8fa]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`官方 Mirage CLI`}),(0,j.jsx)(`strong`,{className:`text-[11px] ${n?.available===!0?`text-[#14733f]`:n?.available===!1?`text-[#9a6700]`:`text-[#687381]`}`,children:n?.available===!0?`已连接`:n?.available===!1?`未检测到`:`未检查`})]}),(0,j.jsx)(`p`,{className:`mt-2 truncate font-mono text-[10px] text-[#65707b]`,children:$(n?.version??n?.executable??`mirage`)}),(0,j.jsxs)(`p`,{className:`mt-1 text-[11px] text-[#65707b]`,children:[`虚拟工作区:`,$(n?.workspaceId??`未配置`)]})]}),n?.lastRun&&typeof n.lastRun==`object`?(()=>{let e=n.lastRun;return(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${e.exitCode===0?`border-[#b9e6c9] bg-[#f0fbf4]`:`border-[#f4caca] bg-[#fff5f5]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[10px] text-[#30343b]`,children:$(e.command??``)}),(0,j.jsxs)(`strong`,{className:`shrink-0 text-[11px] ${e.exitCode===0?`text-[#14733f]`:`text-[#b42318]`}`,children:[`exit `,$(e.exitCode??`—`)]})]}),(0,j.jsxs)(`p`,{className:`mt-1 text-[10px] text-[#65707b]`,children:[`耗时 `,$(e.durationMs??0),` ms`]})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`先调用 mirage_doctor 检查 CLI,再调用 mirage_execute。`}),n?.lastError?(0,j.jsx)(`p`,{className:`text-[10px] leading-4 text-[#9a6700]`,children:$(n.lastError)}):null]}):e.id===`docker-sandbox-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=Jr(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] text-[#b42318]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:`Docker Sandbox 面板数据异常`}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:`面板数据不完整或不可信,请重新加载后再运行。`})]});let t=e.latest,r=t?.status===`completed`&&t.exitCode===0;return(0,j.jsxs)(j.Fragment,{children:[t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有沙箱运行。仅使用本地镜像,默认无网络、工作区只读。`}):(0,j.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${r?`border-[#b9e6c9] bg-[#f0fbf4]`:`border-[#f4caca] bg-[#fff5f5]`}`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:t.image}),(0,j.jsx)(`strong`,{className:`shrink-0 font-mono text-[12px] ${r?`text-[#14733f]`:`text-[#b42318]`}`,children:t.status===`timed_out`?`超时`:`exit ${t.exitCode}`})]}),(0,j.jsx)(`p`,{className:`mt-2 break-all font-mono text-[10px] leading-4 text-[#65707b]`,children:t.command.map(e=>JSON.stringify(e)).join(` `)}),(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsx)(`span`,{children:t.write?`工作区可写(已确认)`:`工作区只读`}),(0,j.jsxs)(`span`,{children:[t.commandCount,` 个 argv 参数`]}),t.truncated?(0,j.jsx)(`span`,{children:`面板明细已截断`}):null]}),t.output?(0,j.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-md bg-white/70 px-2 py-2 text-[10px] leading-4 text-[#4c5663]`,children:t.output}):null]}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[[`image:${e.defaults.image}`,`image`],[`pull:${e.defaults.pull}`,`pull`],[`network:${e.defaults.network}`,`network`],[`rootfs:${e.defaults.rootFilesystem}`,`rootfs`],[`workspace:${e.defaults.workspace}`,`workspace`],[`memory:${e.defaults.memory}`,`memory`],[`cpus:${e.defaults.cpus}`,`cpus`],[`pids:${e.defaults.pids}`,`pids`],[`timeout:${e.defaults.timeoutMs}ms`,`timeout`]].map(([e,t])=>(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:e},t))})]})})()}):e.id===`yaml-validator-panel`?(()=>{let e=sn(n),t=e.latest;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.status.state===`failed`||e.status.state===`cancelled`?(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[11px] text-[#b42318]`,children:[`最近一次校验`,e.status.state===`cancelled`?`已取消`:`失败`,`。`,e.status.error??``]}):null,t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有校验 YAML。可让 Agent 调用 yaml_validate。`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${t.valid?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`}`,children:t.valid?`YAML 语法有效。`:`发现 ${t.errorCount} 个语法错误。`}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`文档`,t.documents],[`错误`,t.errorCount],[`警告`,t.warningCount]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:e}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:t})]},e))}),!t.valid&&t.errors.length>0?(0,j.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-[#f4caca] bg-[#fffafa] p-3 text-[10px] leading-4 text-[#b42318]`,children:t.errors.map(e=>`${e.line??`?`}:${e.column??`?`} ${e.message}`).join(`
25
- `)}):null,t.diagnosticsTruncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[#8a5a00]`,children:`诊断预览已截断,完整计数保留在摘要中。`}):null]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`max:`,Math.round(e.limits.fileBytes/1024),`KiB · read-only`]})]})})():e.id===`browser-session-panel`?(()=>{let e=Vn(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] text-[#b42318]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:`Browser Session 面板数据异常`}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:`面板数据不完整或不可信,请重新连接后再试。`})]});let t=e.tabs,r=e.latest,i=r?.screenshot?`已截图`:r?.clicked===!0?`已点击`:r?.status===`read`||typeof r?.text==`string`?`已读取`:r?.status===`navigated`?`已导航`:void 0;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:e.endpoint||`本地浏览器未连接`}),(0,j.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] font-semibold ${e.connected?`bg-[#e8f8ee] text-[#14733f]`:`bg-[#fff4e5] text-[#8a5a00]`}`,children:e.connected?`已连接`:`未连接`})]}),(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:[`Chrome DevTools Protocol · 显示 `,e.inventory.shown,`/`,e.inventory.total,` 个可调试页面`]}),e.connected?null:(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#b42318]`,children:[`请使用 remote-debugging-port 启动 Chrome。`,e.error??``]})]}),i?(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-2 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[#65707b]`,children:`最近动作`}),(0,j.jsx)(`strong`,{className:`font-mono text-[#315fb8]`,children:i})]}):null,r?.text===void 0?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-[10px] leading-4 text-[#4c5663]`,children:r.text}),r.previewTruncated?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[#8a5a00]`,children:`面板正文预览已截断。`}):null]}),r?.screenshot===void 0?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-2 text-[10px] text-[#315fb8]`,children:[`截图元数据:`,r.screenshot.mimeType,` · `,r.screenshot.bytes.toLocaleString(),` bytes`]}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:e.title}),(0,j.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[#687381]`,children:e.url})]},e.targetId))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有可调试的浏览器页面。`}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`tabs`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`read`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`click`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`screenshot`})]})]})})():e.id===`mcp-client-panel`?(()=>{let e=ya(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:$(e.server??`尚未连接 MCP 服务器`)}),(0,j.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 font-mono text-[10px] text-[#3565c5]`,children:[(0,j.jsxs)(`span`,{children:[e.inventory.tools.total,` 工具`]}),(0,j.jsx)(`span`,{className:`text-[#687381]`,children:`·`}),(0,j.jsxs)(`span`,{children:[e.inventory.resources.total,` 资源`]}),(0,j.jsx)(`span`,{className:`text-[#687381]`,children:`·`}),(0,j.jsxs)(`span`,{children:[e.inventory.prompts.total,` 提示`]})]})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:e.lastCall===null?`使用 mcp_list_tools 发现 stdio 工具。`:`最近调用:${e.lastCall}`})]}),e.tools.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.tools.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,title:e.description,children:e.name},`${e.name}-${t}`))}):null,e.resources.length>0?(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[#687381]`,children:`资源`}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.resources.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#65707b]`,title:e.uri,children:e.name??e.uri},`${e.uri}-${t}`))})]}):null,e.prompts.length>0?(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[#687381]`,children:`提示模板`}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.prompts.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#65707b]`,title:e.description,children:e.name},`${e.name}-${t}`))})]}):null,e.servers.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.servers.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[#30343b]`,children:e.id}),(0,j.jsx)(`span`,{className:e.status===`running`?`text-[#14733f]`:`text-[#687381]`,children:e.status})]},`${e.id}-${t}`))}):null,e.inventory.tools.truncated||e.inventory.resources.truncated||e.inventory.prompts.truncated||e.inventory.servers.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`面板仅显示受限预览;完整清单请使用对应 MCP 列表工具。`}):null,(0,j.jsxs)(`p`,{className:`font-mono text-[9px] text-[#8a94a1]`,children:[`响应上限 `,Math.round(e.limits.responseBytes/1024),` KiB · 请求超时 `,Math.round(e.limits.requestTimeoutMs/1e3),` 秒`]})]})})():e.id===`mcp-panel`?(()=>{let e=Array.isArray(n?.servers)?n.servers:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-2`,children:e.map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.status===`running`;return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[#30343b]`,children:$(n.id,`未命名服务器`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${r?`bg-[#eaf8f0] text-[#14733f]`:`bg-[#fff5f5] text-[#b42318]`}`,children:$(n.status,`unknown`)})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[$(n.toolCount,`0`),` 个桥接工具`]}),(0,j.jsx)(`span`,{children:`·`}),(0,j.jsx)(`span`,{children:$(n.statusSource,`runtime`)})]})]},`${$(n.id??`server`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前没有 MCP 服务器快照。`}),(0,j.jsxs)(`div`,{className:`text-[10px] text-[#687381]`,children:[`只读读取官方 MCP bridge 状态;健康建议通过 mcp_panel 的 health 操作查看。`,n?.writesEnabled===!0?` 已启用 profile patch 写入:${$(n.patchPath)}`:` profile patch 写入未配置,apply 会被拒绝。`]})]})})():e.id===`mock-server-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.running===!0?`运行中`:`未启动`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[11px] text-[#3565c5]`,children:[$(n?.routes??0),` 路由`]})]}),n?.url?(0,j.jsx)(`code`,{className:`rounded-md bg-white px-3 py-2 text-[10px] text-[#65707b]`,children:$(n.url)}):null,n?.lastRequest?(0,j.jsxs)(`p`,{className:`text-[11px] text-[#687381]`,children:[`最近请求:`,$(n.lastRequest)]}):null]}):e.id===`cli-notifier-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.enabled===!0?`已启用`:`已停用`}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:[$(n?.platform??`unknown`),` · `,$(n?.timeoutMs??1e4),`ms`]})]}),Array.isArray(n?.notifications)&&n.notifications.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.notifications.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`text-[#30343b]`,children:$(n.title??`Pi Harness`)}),(0,j.jsx)(`span`,{className:n.delivered===!0?`text-[#14733f]`:`text-[#b42318]`,children:n.delivered===!0?`已送达`:`未送达`})]}),(0,j.jsx)(`span`,{className:`mt-1 block text-[#65707b]`,children:$(n.message,``)}),n.delivered!==!0&&n.reason?(0,j.jsx)(`span`,{className:`mt-1 block break-words text-[#b42318]`,children:$(n.reason)}):null]},`${$(n.time??`notification`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有发送通知。`})]}):e.id===`obsidian-sync-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.configured===!0?`已配置`:`未配置 vault`}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:`Markdown`})]}),n?.vaultPath?(0,j.jsx)(`code`,{className:`truncate rounded-md bg-white px-3 py-2 text-[10px] text-[#65707b]`,children:$(n.vaultPath)}):null,n?.last!==null&&n?.last!==void 0&&typeof n.last==`object`?(0,j.jsxs)(`p`,{className:`text-[11px] text-[#687381]`,children:[`最近写入:`,$(n.last.relativePath??`note.md`)]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有同步笔记。`})]}):e.id===`web-research-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[#315fb8]`,children:n?.keyless===!0?`Firecrawl 匿名模式`:`Firecrawl 已认证`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[#315fb8]`,children:[`最多 `,$(n?.maxResults??8),` 条`]})]}),n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.items)?e.items:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[11px]`,children:[(0,j.jsx)(`strong`,{className:`truncate text-[#30343b]`,children:$(e.query??`网页搜索`)}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[#687381]`,children:[`前 `,Math.min(8,t.length),` / 共 `,t.length]})]}),(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`a`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 transition-colors hover:border-[#bdd0f5] hover:bg-[#fbfdff]`,href:$(n.url,``),rel:`noreferrer`,target:`_blank`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:$(n.title??n.url??`来源`)}),(0,j.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[#3565c5]`,children:$(n.source??n.url,``)}),n.snippet?(0,j.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-[10px] leading-4 text-[#65707b]`,children:$(n.snippet)}):null]},`${$(n.url??`source`)}-${t}`)})})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有联网搜索。可让 Agent 调用 web_search;单页读取使用 read_page。`}),(0,j.jsxs)(`p`,{className:`text-[10px] text-[#687381]`,children:[`搜索词会发送到 Firecrawl;页面读取`,n?.readPageAvailable===!0?`已复用本地 Browser Fetch`:`需要启用 Browser Fetch`,`。`]})]}):e.id===`browser-fetch-panel`?(()=>{let e=yn(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] text-[#b42318]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:`Browser Fetch 面板数据异常`}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:`面板数据不完整或不可信,请重新加载后再抓取。`})]});let t=e.latest;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有抓取网页。默认阻止本地和私有网络目标。`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:$(t.finalUrl||t.url||`page`)}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#14733f]`,children:[`HTTP `,$(t.status||`—`)]})]}),(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:$(t.text,``)}),t.previewTruncated||t.truncated?(0,j.jsxs)(`p`,{className:`text-[10px] text-[#9a6700]`,children:[t.truncated?`响应正文已达到抓取上限;`:``,t.previewTruncated?`面板仅显示有界预览。`:``]}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`max:`,$(Math.round(e.limits.responseBytes/1024)),`KiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`timeout:`,$(e.limits.timeoutMs),`ms`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`redirects:`,$(e.limits.redirects)]}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:`scripts:disabled`}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`private:`,$(e.allowPrivate?`allowed`:`blocked`)]})]})]})})():e.id===`i18n-pair-panel`?(()=>{let e=ra(n),t=e.report,r=t!==null&&t.missingTotal===0&&t.extraTotal===0,i=e.status.state===`unknown`?`数据异常`:e.status.state===`running`?`检查中`:e.status.state===`failed`?`检查失败`:e.status.state===`cancelled`?`已取消`:e.status.state===`completed`?`已完成`:`等待检查`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px] text-[#687381]`,children:[(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-[#f6f8fa] px-2 py-1 font-semibold text-[#3565c5]`,children:i}),e.status.at===null?null:(0,j.jsx)(`time`,{className:`font-mono`,children:new Date(e.status.at).toLocaleString()})]}),e.status.error===null?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[10px] leading-4 text-[#b42318]`,children:e.status.error}),e.malformed?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[10px] leading-4 text-[#b42318]`,children:`面板数据不完整或不可信,未显示语言包统计。`}):null,t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有检查语言包。可让 Agent 调用 i18n_check。`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${r?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`}`,children:r?`语言包键完全一致。`:`缺失 ${t.missingTotal} 个,额外 ${t.extraTotal} 个。`}),(0,j.jsxs)(`div`,{className:`grid gap-2 rounded-lg border border-[#edf0f3] bg-[#fbfcfd] px-3 py-3 font-mono text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[#687381]`,children:`基准`}),(0,j.jsx)(`span`,{className:`truncate text-[#30343b]`,title:t.base,children:t.base})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[#687381]`,children:`目标`}),(0,j.jsx)(`span`,{className:`truncate text-[#30343b]`,title:t.target,children:t.target})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`基准键`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:t.baseKeys})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`目标键`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:t.targetKeys})]})]}),t.missing.length>0||t.extra.length>0?(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[{label:`缺失 · ${t.missingTotal}`,keys:t.missing,tone:`text-[#b42318]`},{label:`额外 · ${t.extraTotal}`,keys:t.extra,tone:`text-[#9a6700]`}].map(e=>(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3`,children:[(0,j.jsx)(`strong`,{className:`text-[10px] ${e.tone}`,children:e.label}),(0,j.jsx)(`ul`,{className:`mt-2 max-h-36 space-y-1 overflow-auto font-mono text-[10px] text-[#30343b]`,children:e.keys.map((e,t)=>(0,j.jsx)(`li`,{className:`truncate`,title:e,children:e},`${e}-${t}`))})]},e.label))}):null,t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[#9a6700]`,children:`面板仅显示有界键列表;完整结果保留在工具调用详情中。`}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[10px] text-[#3565c5]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`file:`,Math.round(e.limits.fileBytes/1048576),`MiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`depth:`,e.limits.depth]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`keys:`,e.limits.keysPerFile]})]})]})})():e.id===`cleaner-panel`?(()=>{let e=ur(n);if(e.malformed||e.inventory===null)return(0,j.jsxs)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] text-[#b42318]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:`Cleaner 面板数据异常`}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:`面板数据不完整或不可信,请重新加载后再执行清理。`})]});let t=e.inventory,r=e.lastCleanup,i=r?.status===`running`?`清理中`:r?.status===`completed`?`已完成`:r?.status===`cancelled`?`已取消`:r?.status===`failed`?`清理失败`:`尚未清理`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`Git 胶囊库存`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#3565c5]`,children:[t.total,` 个`]})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`仅清理 agent 数据目录中的 .patch 胶囊,必须显式 confirm=true。`}),(0,j.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 font-mono text-[10px] text-[#3565c5]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`capsules:`,e.limits.capsules]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`scan:`,e.limits.directoryEntries]})]})]}),r===null?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#fbfcfd] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px]`,children:[(0,j.jsx)(`strong`,{className:r.status===`failed`?`text-[#b42318]`:`text-[#30343b]`,children:i}),r.at===null?null:(0,j.jsx)(`time`,{className:`font-mono text-[#687381]`,children:new Date(r.at).toLocaleString()})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex gap-4 text-[11px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`已删 `,(0,j.jsx)(`strong`,{className:`font-mono text-[#30343b]`,children:r.removed})]}),(0,j.jsxs)(`span`,{children:[`保留 `,(0,j.jsx)(`strong`,{className:`font-mono text-[#30343b]`,children:r.kept??`—`})]}),(0,j.jsxs)(`span`,{children:[`请求保留 `,(0,j.jsx)(`strong`,{className:`font-mono text-[#30343b]`,children:r.requestedKeep})]})]}),r.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4 text-[#b42318]`,children:r.error})]}),e.capsules.length>0?(0,j.jsx)(`div`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd]`,children:e.capsules.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[10px] text-[#30343b]`,title:e.name,children:e.name}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-[#687381]`,children:[e.bytes.toLocaleString(),` B`]})]},`${e.name}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前没有可清理的 Git 胶囊。`}),t.truncated?(0,j.jsxs)(`p`,{className:`text-[10px] text-[#9a6700]`,children:[`面板显示 `,t.shown,` / `,t.total,` 个条目;清理工具仍按完整的有界库存执行。`]}):null]})})():e.id===`fail-logger-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=oi(n);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#fff5f5] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#7f1d1d]`,children:`聚合后的失败记录`}),(0,j.jsx)(`strong`,{className:`font-mono text-[17px] text-[#b42318]`,children:e.total})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3 text-[10px] text-[#8b4a4a]`,children:[(0,j.jsxs)(`span`,{children:[`观测 `,e.observed,` 次`]}),(0,j.jsxs)(`span`,{children:[`容量 `,e.total,` / `,e.capacity]}),e.dropped>0?(0,j.jsxs)(`span`,{children:[`已淘汰 `,e.dropped,` 条旧记录`]}):null,e.truncated?(0,j.jsx)(`span`,{children:`面板明细已截断`}):null]})]}),(0,j.jsx)(`div`,{className:`max-h-56 overflow-auto rounded-lg border border-[#edf0f3]`,children:e.failures.length>0?e.failures.map((e,t)=>(0,j.jsxs)(`div`,{className:`border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#b42318]`,children:e.source}),(0,j.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 font-mono text-[9px] text-[#8a94a0]`,children:[e.occurrences>1?(0,j.jsxs)(`strong`,{className:`text-[#b42318]`,children:[`×`,e.occurrences]}):null,e.time===null?`时间未知`:`${e.time.slice(11,19)} UTC`]})]}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-[11px] leading-4 text-[#65707b]`,children:e.message})]},`${e.time??`failure`}-${t}`)):(0,j.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[#687381]`,children:`暂无失败记录。`})})]})})()}):e.id===`context-insight-panel`?(()=>{let e=fo(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[#5d6d82]`,children:`上下文占用`}),(0,j.jsx)(`strong`,{className:`text-[13px] font-semibold text-[#315fb8]`,children:e.percent===null?`—`:`${e.percent}%`})]}),(0,j.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-[#dfe8fb]`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full bg-[#5d8bea] transition-[width] duration-300`,style:{width:`${Math.min(100,e.percent??0)}%`}})}),(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#5d6d82]`,children:[e.tokens===null?`令牌数未知`:`${e.tokens.toLocaleString()} tokens`,e.contextWindow===null?``:` / ${e.contextWindow.toLocaleString()} 上限`]})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`消息`,e.messages],[`事件`,e.events],[`压缩`,e.compactions]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:$(t)})]},$(e)))}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`消息组成`}),(0,j.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:e.messagesTruncated?`最近 ${e.scannedMessages} / ${e.messages} 条`:`全部 ${e.scannedMessages} 条`})]}),(0,j.jsx)(`div`,{className:`mt-2 grid grid-cols-5 gap-1.5`,children:[[`用户`,e.composition.user],[`助手`,e.composition.assistant],[`工具`,e.composition.toolResult],[`系统`,e.composition.system],[`其他`,e.composition.other]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded bg-[#f6f8fa] px-2 py-1.5 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-0.5 block font-mono text-[13px] text-[#30343b]`,children:$(t)})]},$(e)))})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`最近上下文事件`}),(0,j.jsxs)(`span`,{className:`text-[10px] text-[#687381]`,children:[`显示 `,e.limits.displayedEvents,` / 保留 `,e.limits.retainedEvents,` 条`]})]}),(0,j.jsx)(`div`,{className:`mt-2 max-h-28 overflow-auto`,children:e.recentEvents.length>0?e.recentEvents.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[#f0f2f5] py-1.5 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#5d6d82]`,children:e.type}),(0,j.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:e.at===null?`—`:new Date(e.at).toLocaleTimeString()})]},`${e.type}-${e.at??`unknown`}-${t}`)):(0,j.jsx)(`div`,{className:`py-2 text-[11px] text-[#687381]`,children:`暂无上下文事件。`})}),e.recentEventsTruncated?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[#687381]`,children:`更早事件已按浏览器显示上限省略。`}):null]})]})})():(0,j.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:e}),(0,j.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words text-[12px] leading-5 text-[#30343b]`,children:Lc(t)})]},e))})]})}function Bc({pluginName:e,busy:t,error:n,onCancel:r,onConfirm:i}){let a=yc(!0,r,t);return(0,j.jsx)(`div`,{className:`plugin-confirm-backdrop`,onClick:()=>{t||r()},children:(0,j.jsxs)(`div`,{"aria-label":`确认卸载插件`,"aria-modal":`true`,className:`plugin-confirm-dialog`,onClick:e=>e.stopPropagation(),ref:a,role:`dialog`,tabIndex:-1,children:[(0,j.jsx)(`header`,{children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`卸载插件?`}),(0,j.jsx)(`small`,{children:`将从运行配置中移除,之后可以从插件市场重新安装。`})]})}),(0,j.jsx)(`code`,{children:e}),n&&(0,j.jsx)(`p`,{className:`plugin-confirm-error`,role:`alert`,children:n}),(0,j.jsxs)(`footer`,{children:[(0,j.jsx)(`button`,{"data-dialog-initial-focus":!0,disabled:t,onClick:r,type:`button`,children:`取消`}),(0,j.jsx)(`button`,{className:`danger`,disabled:t,onClick:i,type:`button`,children:t?`卸载中…`:`确认卸载`})]})]})})}function Vc({label:e,categories:t,activeCategory:n,onChange:r}){let i=(0,o.useRef)(null),[a,s]=(0,o.useState)(!1),[c,l]=(0,o.useState)(!1),u=(0,o.useCallback)(()=>{let e=i.current;if(!e)return;let t=Math.max(0,e.scrollWidth-e.clientWidth);s(e.scrollLeft>1),l(e.scrollLeft<t-1)},[]);(0,o.useEffect)(()=>{let e=i.current;if(!e)return;u();let t=typeof ResizeObserver>`u`?void 0:new ResizeObserver(u);return t?.observe(e),window.addEventListener(`resize`,u),()=>{t?.disconnect(),window.removeEventListener(`resize`,u)}},[t,u]);let d=e=>{let t=i.current;t&&t.scrollBy({behavior:`smooth`,left:e*Math.max(180,t.clientWidth*.72)})};return(0,j.jsxs)(`div`,{className:`marketplace-categories-shell ${a?`can-scroll-left`:``} ${c?`can-scroll-right`:``}`,children:[a&&(0,j.jsx)(`button`,{"aria-label":`向左查看更多分类`,className:`marketplace-category-scroll previous`,onClick:()=>d(-1),type:`button`,children:`‹`}),(0,j.jsx)(`nav`,{"aria-label":e,className:`marketplace-categories`,onScroll:u,ref:i,children:t.map(e=>{let t=n===e.id;return(0,j.jsxs)(`button`,{"aria-pressed":t,className:`marketplace-category ${t?`active`:``}`,onClick:()=>r(e.id),type:`button`,children:[(0,j.jsx)(`span`,{children:e.label}),(0,j.jsx)(`span`,{className:t?`font-mono text-[10px] text-[#3565c5]`:`font-mono text-[10px] text-[#687381]`,children:e.count})]},e.id||`all`)})}),c&&(0,j.jsx)(`button`,{"aria-label":`向右查看更多分类`,className:`marketplace-category-scroll next`,onClick:()=>d(1),type:`button`,children:`›`})]})}function Hc({plugins:e,panels:t,catalog:n,onMarketplace:r,onOpenDetail:i,onToml:a,onToggle:s,onUninstall:c}){let l=(0,o.useMemo)(()=>new Map(n.map(e=>[e.packageName,e])),[n]),u=(0,o.useMemo)(()=>new Set(t.map(e=>e.pluginId)),[t]),d=(0,o.useMemo)(()=>e.filter(e=>e.removable||u.has(e.name)),[u,e]),[f,p]=(0,o.useState)(``),[m,h]=(0,o.useState)(``),[g,_]=(0,o.useState)(),[v,y]=(0,o.useState)(``),[b,x]=(0,o.useState)(),S=(0,o.useRef)(null),C=(0,o.useMemo)(()=>{let e=new Map;for(let t of d){let n=l.get(t.name)?.category??t.category??{id:`other`,label:`其他`},r=e.get(n.id);e.set(n.id,{...n,count:(r?.count??0)+1})}return $e([...e.values()].sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label,`zh-CN`)))},[l,d]),w=(0,o.useMemo)(()=>d.filter(e=>{let t=l.get(e.name),n=t?.category??e.category??{id:`other`,label:`其他`};if(m&&n.id!==m)return!1;let r=[e.name,t?.name,Cc(e.name),t?.category.label,...t?.capabilities??[],e.category?.label,Sc(e.name)];return dr(f,r)}),[l,m,d,f]);(0,o.useEffect)(()=>{S.current?.scrollTo({top:0})},[m,f]),(0,o.useEffect)(()=>{m&&!C.some(e=>e.id===m)&&h(``)},[m,C]);let T=async(e,t)=>{y(``),_(e.id);try{return await t(e),!0}catch(e){return y(e instanceof Error?e.message:String(e)),!1}finally{_(void 0)}};return(0,j.jsx)(`section`,{className:`view-panel plugins-view`,children:(0,j.jsxs)(`div`,{className:`plugins-page`,children:[(0,j.jsxs)(`div`,{className:`subnav`,children:[(0,j.jsxs)(`div`,{"aria-label":`插件目录`,className:`segmented`,children:[(0,j.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:`已安装`}),(0,j.jsx)(`button`,{"aria-pressed":`false`,onClick:r,type:`button`,children:`插件市场`})]}),(0,j.jsx)(`span`,{children:`已安装插件`}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),a()},children:`查看运行配置`})]}),(0,j.jsxs)(`div`,{className:`plugins-toolbar`,children:[(0,j.jsx)(`input`,{"aria-label":`搜索已安装插件`,onChange:e=>p(e.target.value),placeholder:`搜索名称、包名或能力…`,type:`search`,value:f}),(0,j.jsxs)(`span`,{"aria-live":`polite`,children:[f.trim()||m?`${w.length} / ${d.length}`:`${d.length}`,` 个插件`]})]}),(0,j.jsx)(Vc,{activeCategory:m,categories:C,label:`已安装插件分类`,onChange:h}),(0,j.jsxs)(`div`,{className:`plugins-scroll`,ref:S,children:[(0,j.jsxs)(`div`,{className:`plugins-list`,children:[w.map(e=>{let t=l.get(e.name),n=t?.category.label??e.category?.label,r=Sc(e.name),a=t?.name??Cc(e.name),o=pr(e,t);return(0,j.jsxs)(`article`,{className:`catalog-card plugin-card`,children:[(0,j.jsxs)(`div`,{className:`plugin-card-head`,children:[(0,j.jsx)(`span`,{className:`plugin-icon`,children:`◈`}),(0,j.jsx)(`div`,{className:`plugin-copy`,children:(0,j.jsxs)(`div`,{className:`plugin-heading`,children:[(0,j.jsxs)(`div`,{className:`plugin-title`,children:[(0,j.jsx)(`strong`,{children:a}),(0,j.jsx)(`span`,{className:`plugin-state ${e.enabled?`active`:``}`,children:e.enabled?`运行中`:`已停用`}),n&&(0,j.jsx)(`span`,{className:`capability`,children:n}),n!==r&&(0,j.jsx)(`span`,{className:`capability`,children:r})]}),(0,j.jsx)(`div`,{className:`plugin-actions`,children:e.removable?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{"aria-label":`${e.enabled?`停用`:`启用`} ${a}`,"aria-pressed":e.enabled,className:`plugin-switch-button`,disabled:g!==void 0,onClick:()=>void T(e,e=>s(e)),type:`button`,children:(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`switch ${e.enabled?`on`:``}`,children:(0,j.jsx)(`i`,{})})}),(0,j.jsx)(`button`,{className:`plugin-uninstall`,disabled:g!==void 0,onClick:()=>{y(``),x(e)},type:`button`,children:`卸载`})]}):(0,j.jsx)(`span`,{className:`switch ${e.enabled?`on`:``}`,children:(0,j.jsx)(`i`,{})})})]})})]}),(0,j.jsxs)(`div`,{className:`plugin-card-body`,children:[(0,j.jsx)(`code`,{className:`plugin-package`,children:o.packageLabel}),(0,j.jsx)(`p`,{className:`plugin-description`,children:o.description}),(0,j.jsx)(`div`,{className:`hook-list`,children:o.tags.map((e,t)=>(0,j.jsx)(`span`,{children:e},`${e}-${t}`))})]}),(0,j.jsxs)(`footer`,{className:`plugin-card-footer`,children:[(0,j.jsx)(`button`,{"aria-label":`查看 ${a} 详情`,className:`plugin-detail-link`,onClick:()=>i(e),type:`button`,children:`查看详情 →`}),u.has(e.name)?(0,j.jsx)(`span`,{children:`实时面板`}):null]})]},e.id)}),d.length?w.length?null:(0,j.jsx)(`div`,{className:`empty-state`,children:`没有匹配当前搜索与分类条件的已安装插件。`}):(0,j.jsx)(`div`,{className:`empty-state`,children:`还没有安装可管理的插件。去插件市场安装一个吧。`})]}),v&&(0,j.jsx)(`p`,{className:`plugin-action-error`,children:v}),t.length>d.length&&(0,j.jsxs)(`section`,{className:`mt-4 border-t border-[#e3e7ee] pt-4`,children:[(0,j.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`其他插件面板`}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[#687381]`,children:`由已启用插件提供的实时状态。`})]}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:`LIVE`})]}),(0,j.jsx)(`div`,{className:`grid gap-3 xl:grid-cols-2`,children:t.filter(e=>!d.some(t=>t.name===e.pluginId)).map(e=>(0,j.jsx)(zc,{panel:e},e.id))})]})]}),b&&(0,j.jsx)(Bc,{busy:g!==void 0,error:v,onCancel:()=>x(void 0),onConfirm:()=>void T(b,c).then(e=>{e&&x(void 0)}),pluginName:l.get(b.name)?.name??Cc(b.name)})]})})}function Uc({plugin:e,panel:t,metadata:n,onBack:r,onToggle:i,onUninstall:a}){let[s,c]=(0,o.useState)(),[l,u]=(0,o.useState)(``),[d,f]=(0,o.useState)(!1),p=n?.name??Cc(e.name),m=async(e,t)=>{u(``),c(e);try{return await t(),!0}catch(e){return u(e instanceof Error?e.message:String(e)),!1}finally{c(void 0)}};return(0,j.jsxs)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),r()},children:`← 已安装插件`}),(0,j.jsx)(`span`,{children:`插件详情`})]}),(0,j.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,j.jsxs)(`header`,{className:`border-b border-[#e3e7ee] pb-7`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded px-2 py-1 font-mono text-[10px] ${e.enabled?`bg-[#e6faed] text-[#14733f]`:`bg-[#eef0f3] text-[#687381]`}`,children:e.enabled?`运行中`:`已停用`}),(0,j.jsx)(`span`,{className:`rounded bg-[#f2edff] px-2 py-1 text-[10px] text-[#6d4bc3]`,children:n?.category.label??e.category?.label??`运行时插件`}),(0,j.jsx)(`span`,{className:`rounded bg-[#e4edfd] px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:Sc(e.name)})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[#687381]`,children:`PLUGIN DETAIL`}),(0,j.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[#20252b]`,children:p}),(0,j.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[#687381]`,children:[e.name,n?` · v${n.version}`:``]})]}),e.removable?(0,j.jsxs)(`div`,{className:`plugin-detail-actions`,children:[(0,j.jsx)(`button`,{className:`plugin-detail-action`,disabled:s!==void 0,onClick:()=>void m(`toggle`,()=>i(e)),type:`button`,children:s===`toggle`?`处理中…`:e.enabled?`停用插件`:`启用插件`}),(0,j.jsx)(`button`,{className:`plugin-detail-action danger`,disabled:s!==void 0,onClick:()=>{u(``),f(!0)},type:`button`,children:`卸载插件`})]}):(0,j.jsx)(`span`,{className:`rounded-full bg-[#eef0f3] px-3 py-1.5 text-[11px] text-[#687381]`,children:`内置组件`})]}),(0,j.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[#59636e]`,children:n?.description??(e.enabled?`由当前运行时加载并启用,能力与 hook 已注册。`:`插件保留在运行配置中,但当前处于停用状态。`)}),l&&(0,j.jsxs)(`p`,{className:`mt-3 text-[12px] text-[#b42318]`,role:`alert`,children:[`操作失败:`,l]})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件能力`}),(0,j.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(n?.capabilities.length?n.capabilities:[Sc(e.name)]).map(e=>(0,j.jsx)(`span`,{className:`rounded-md bg-[#f1f4f9] px-2 py-1 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}),n?.hooks.length?(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`扩展点`}),(0,j.jsx)(`div`,{className:`mt-4 space-y-2`,children:n.hooks.map(e=>(0,j.jsx)(`div`,{className:`rounded-md bg-[#f8f9fb] px-3 py-2 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}):null,(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`实时详情`}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[#687381]`,children:`当前本机会话中的插件运行状态。`})]}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.1em] text-[#687381]`,children:`LIVE`})]}),t?(0,j.jsx)(zc,{inline:!0,panel:t}):(0,j.jsx)(`div`,{className:`empty-state`,children:`这个插件暂未提供实时面板。`})]})]}),(0,j.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件信息`}),(0,j.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`运行状态`}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.state})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`配置标识`}),(0,j.jsx)(`dd`,{className:`max-w-[150px] break-all text-right font-mono text-[#3b424b]`,children:e.id})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`分类`}),(0,j.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.category?.label??`运行时插件`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`管理方式`}),(0,j.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.removable?`可配置`:`随运行时加载`})]}),n?(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`版本`}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:n.version})]}):null]}),n?(0,j.jsx)(`a`,{className:`mt-4 block border-t border-[#eef0f3] pt-4 text-[12px] text-[#3565c5]`,href:n.repository,rel:`noreferrer`,target:`_blank`,children:`查看源码 ↗`}):null]})]})]})]}),d?(0,j.jsx)(Bc,{busy:s===`uninstall`,error:l,onCancel:()=>f(!1),onConfirm:()=>void m(`uninstall`,()=>a(e)).then(e=>{e&&f(!1)}),pluginName:p}):null]})}function Wc({plugins:e,capabilities:t,categories:n,total:r,page:i,hasNext:a,query:s,capabilityFilter:c,categoryFilter:l,onQueryChange:u,onCapabilityChange:d,onCategoryChange:f,onPageChange:p,onOpenDetail:m,onBack:h,onToml:g,installedPackages:_,onInstall:v}){let[y,b]=(0,o.useState)(),[x,S]=(0,o.useState)(``),[C,w]=(0,o.useState)(``),T=(0,o.useMemo)(()=>$e(n),[n]),E=async e=>{S(``),w(``),b(e.id);try{(await v(e)).restartRequired===!0&&w(`已写入 profile,重启 Pi Harness 后生效。`)}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(void 0)}};return(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`subnav`,children:[(0,j.jsxs)(`div`,{"aria-label":`插件目录`,className:`segmented`,children:[(0,j.jsx)(`button`,{"aria-pressed":`false`,onClick:h,type:`button`,children:`已安装`}),(0,j.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:`插件市场`})]}),(0,j.jsx)(`span`,{children:`已审核插件目录`}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),g()},children:`查看运行配置`})]}),(0,j.jsxs)(`div`,{className:`marketplace-toolbar`,children:[(0,j.jsx)(`input`,{className:`marketplace-search`,"aria-label":`搜索插件`,onChange:e=>u(e.target.value),placeholder:`搜索名称、包名、能力…`,value:s}),(0,j.jsxs)(`select`,{className:`marketplace-filter`,"aria-label":`按能力筛选`,onChange:e=>d(e.target.value),value:c,children:[(0,j.jsx)(`option`,{value:``,children:`全部能力`}),t.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))]}),(0,j.jsxs)(`span`,{className:`marketplace-count`,children:[r,` 个已审核条目 · 推荐排序`]})]}),(0,j.jsx)(Vc,{activeCategory:l,categories:T,label:`插件分类`,onChange:f}),(0,j.jsxs)(`div`,{className:`marketplace-scroll`,children:[(0,j.jsxs)(`div`,{className:`marketplace-grid`,children:[e.map(e=>(0,j.jsxs)(`article`,{className:`catalog-card marketplace-card`,children:[(0,j.jsxs)(`header`,{className:`marketplace-card-head`,children:[(0,j.jsx)(`div`,{className:`marketplace-card-mark`,children:`◈`}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,j.jsx)(`strong`,{className:`marketplace-title`,children:e.name}),(0,j.jsx)(`span`,{className:e.status===`verified`?`rounded bg-[#e6faed] px-1.5 py-px font-mono text-[10px] text-[#14733f]`:`rounded bg-[#fff5e7] px-1.5 py-px font-mono text-[10px] text-[#9a6700]`,children:e.status===`verified`?`已验证`:`实验性`}),(0,j.jsx)(`span`,{className:e.source===`official`?`rounded bg-[#e4edfd] px-1.5 py-px font-mono text-[10px] text-[#3565c5]`:`rounded bg-[#fef5e7] px-1.5 py-px font-mono text-[10px] text-[#9a6700]`,children:e.source===`official`?`官方`:`社区`}),(0,j.jsx)(`span`,{className:`rounded bg-[#f2edff] px-1.5 py-px text-[10px] text-[#6d4bc3]`,children:e.category.label})]})})]}),(0,j.jsxs)(`div`,{className:`marketplace-card-body`,children:[(0,j.jsxs)(`code`,{className:`marketplace-package`,children:[Cc(e.packageName),` · v`,e.version]}),(0,j.jsx)(`p`,{className:`marketplace-description`,children:e.description}),(0,j.jsxs)(`div`,{className:`marketplace-tags`,children:[e.capabilities.map(e=>(0,j.jsx)(`span`,{className:`rounded bg-[#f1f4f9] px-1.5 py-px font-mono text-[10px] text-[#61666b]`,children:e},e)),e.hooks.map(e=>(0,j.jsxs)(`span`,{className:`rounded bg-[#f1f4f9] px-1.5 py-px font-mono text-[10px] text-[#61666b]`,children:[`hook:`,e]},`hook:${e}`))]}),e.statistics&&(0,j.jsx)(`div`,{className:`marketplace-statistics mt-3 grid grid-cols-3 divide-x divide-[#e3e7ee] rounded-md border border-[#e3e7ee] bg-[#f8f9fb]`,children:et(e.statistics).map(e=>(0,j.jsxs)(`span`,{className:`min-w-0 px-2 py-1.5`,title:`${e.label} ${e.value}`,children:[(0,j.jsx)(`small`,{className:`block truncate text-[9px] text-[#687381]`,children:e.label}),(0,j.jsx)(`strong`,{className:`mt-0.5 block truncate font-mono text-[10px] font-medium text-[#3b424b]`,children:e.value})]},e.label))})]}),(0,j.jsxs)(`footer`,{className:`marketplace-card-footer`,children:[(0,j.jsxs)(`span`,{children:[e.author,` · `,e.license]}),(0,j.jsx)(`a`,{href:Ze(e.id),onClick:t=>{t.preventDefault(),m(e)},children:`查看详情 →`}),(0,j.jsx)(`a`,{href:e.repository,target:`_blank`,rel:`noreferrer`,children:`查看源码 ↗`}),(0,j.jsx)(`button`,{disabled:_.has(e.packageName)||y!==void 0,onClick:()=>void E(e),type:`button`,children:_.has(e.packageName)?`已安装`:y===e.id?`安装中…`:`安装`})]})]},e.id)),!e.length&&(0,j.jsx)(`div`,{className:`empty-state`,children:`没有匹配的插件。`})]}),C&&(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#3565c5]`,children:C}),x&&(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#b42318]`,children:[`安装失败:`,x]}),(0,j.jsxs)(`div`,{className:`marketplace-pagination`,children:[(0,j.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:i===0,onClick:()=>p(i-1),type:`button`,children:`上一页`}),(0,j.jsxs)(`span`,{children:[`第 `,i+1,` 页`]}),(0,j.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:!a,onClick:()=>p(i+1),type:`button`,children:`下一页`})]}),(0,j.jsxs)(`div`,{className:`marketplace-contribute mt-3 flex items-center gap-2.5 rounded-[10px] border border-dashed border-[#b8ccf5] bg-[#f8f9ff] p-2.5 text-[11.5px] text-[#687381]`,children:[(0,j.jsx)(`strong`,{className:`text-[12px] text-[#0f1115]`,children:`你有一个 Pi Harness 插件?`}),(0,j.jsx)(`span`,{children:`在 entries 目录新增一个元数据文件,附测试和 README 后提交 PR;审核通过后会出现在这里。`}),(0,j.jsx)(`a`,{className:`ml-auto flex-none text-[#3565c5]`,href:`https://github.com/pi-harness/pi-harness/blob/main/docs/plugin-marketplace.md`,target:`_blank`,rel:`noreferrer`,children:`查看贡献规范 ↗`})]})]})]})})}function Gc({plugin:e,installed:t,onInstall:n,onBack:r}){let[i,a]=(0,o.useState)(!1),[s,c]=(0,o.useState)(``),[l,u]=(0,o.useState)(``),d=async()=>{c(``),u(``),a(!0);try{(await n(e)).restartRequired===!0&&u(`已写入 profile,重启 Pi Harness 后生效。`)}catch(e){c(e instanceof Error?e.message:String(e))}finally{a(!1)}};return(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),r()},children:`← 插件市场`}),(0,j.jsx)(`span`,{children:`插件详情`})]}),(0,j.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,j.jsxs)(`header`,{className:`border-b border-[#e3e7ee] pb-7`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded bg-[#e4edfd] px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:e.source===`official`?`官方插件`:`社区插件`}),(0,j.jsx)(`span`,{className:`rounded bg-[#f2edff] px-2 py-1 text-[10px] text-[#6d4bc3]`,children:e.category.label}),(0,j.jsx)(`span`,{className:e.status===`verified`?`rounded bg-[#e6faed] px-2 py-1 font-mono text-[10px] text-[#14733f]`:`rounded bg-[#fff5e7] px-2 py-1 font-mono text-[10px] text-[#9a6700]`,children:e.status===`verified`?`已验证`:`实验性`})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[#687381]`,children:`PLUGIN DETAIL`}),(0,j.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[#20252b]`,children:e.name}),(0,j.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[#687381]`,children:[e.packageName,` · v`,e.version]})]}),(0,j.jsx)(`div`,{className:`plugin-detail-actions`,children:(0,j.jsx)(`button`,{className:`plugin-detail-action primary`,disabled:t||i,onClick:()=>void d(),type:`button`,children:t?`已安装`:i?`安装中…`:`安装插件`})})]}),(0,j.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[#59636e]`,children:e.description}),l&&(0,j.jsx)(`p`,{className:`mt-3 text-[12px] text-[#3565c5]`,children:l}),s&&(0,j.jsxs)(`p`,{className:`mt-3 text-[12px] text-[#b42318]`,children:[`安装失败:`,s]})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件能力`}),(0,j.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:e.capabilities.map(e=>(0,j.jsx)(`span`,{className:`rounded-md bg-[#f1f4f9] px-2 py-1 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}),(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`扩展点`}),(0,j.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.hooks.map(e=>(0,j.jsx)(`div`,{className:`rounded-md bg-[#f8f9fb] px-3 py-2 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}),(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`运行配置`}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[#687381]`,children:`安装后会写入当前运行 profile。`}),(0,j.jsx)(`pre`,{className:`mt-4 overflow-auto rounded-lg bg-[#f7f8fa] p-4 text-[11px] leading-6 text-[#3b424b]`,children:(0,j.jsx)(`code`,{children:JSON.stringify(e.profile,null,2)})})]})]}),(0,j.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件信息`}),(0,j.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`作者`}),(0,j.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.author})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`许可证`}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.license})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`分类`}),(0,j.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.category.label})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`版本`}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.version})]}),et(e.statistics).map(e=>(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:e.label}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.value})]},e.label))]}),(0,j.jsx)(`a`,{className:`mt-4 block border-t border-[#eef0f3] pt-4 text-[12px] text-[#3565c5]`,href:e.repository,target:`_blank`,rel:`noreferrer`,children:`查看源码 ↗`})]})]})]})]})})}async function Kc(e,t){t.busy(!0),t.state(`重载中…`);try{let n=await e.reloadConfig();t.config(n),t.sourceDraft(n.source),t.state(`已从磁盘重载`)}catch(e){t.state(e instanceof Error?e.message:String(e))}finally{t.busy(!1)}}function qc({data:e,api:t,tab:n,onTab:r,onClose:i,onRefresh:a}){let s=e.status,[c,l]=(0,o.useState)({}),[u,d]=(0,o.useState)({}),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)({provider:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,model:``}),[g,_]=(0,o.useState)(),[v,y]=(0,o.useState)(`form`),[b,x]=(0,o.useState)(``),[S,C]=(0,o.useState)(!1),[w,T]=(0,o.useState)(``),E=e.plugins.some(e=>e.name.endsWith(`/cli-notifier`)&&e.enabled),ee=yc(f,()=>p(!1),u.__add);(0,o.useEffect)(()=>{(n===`general`||n===`toml`)&&(T(`读取中…`),t.getConfig().then(e=>{_(e),x(e.source),T(``)}).catch(e=>T(e instanceof Error?e.message:String(e))))},[t,n]);let D=(e,n)=>{C(!0),T(n),t.updateConfig(e).then(e=>{_(e),x(e.source)}).then(()=>T(`已保存`)).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>C(!1))},O=(e,n)=>{u[e]||(d(t=>({...t,[e]:!0})),l(t=>({...t,[e]:n===`test`?`测试中…`:`刷新中…`})),n===`test`?t.testProvider(e).then(t=>{let n=t.auth,r=n&&typeof n==`object`&&`label`in n&&typeof n.label==`string`?n.label:void 0;l(n=>({...n,[e]:t.reachable?`连接正常`:r??`未检测到认证`}))}).catch(t=>l(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))).finally(()=>d(t=>({...t,[e]:!1}))):t.refreshProvider(e).then(t=>l(n=>({...n,[e]:`${t.models.length} 个模型已刷新`}))).catch(t=>l(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))).finally(()=>d(t=>({...t,[e]:!1}))))};return(0,j.jsx)(`section`,{className:`view-panel settings-page`,children:(0,j.jsxs)(`div`,{className:`settings-dialog`,children:[(0,j.jsx)(`nav`,{"aria-label":`设置分类`,className:`settings-top-tabs`,children:[`general`,`providers`,`toml`].map(t=>(0,j.jsx)(`button`,{"aria-pressed":n===t,className:`settings-tab ${n===t?`active`:``}`,onClick:()=>r(t),type:`button`,children:t===`general`?`通用`:t===`providers`?`提供商 ${e.providers.length}`:`运行配置`},t))}),(0,j.jsxs)(`section`,{children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`button`,{className:`settings-back`,onClick:i,type:`button`,children:`← 返回会话`}),(0,j.jsxs)(`div`,{className:`settings-header-copy`,children:[(0,j.jsx)(`strong`,{children:n===`general`?`通用`:n===`providers`?`提供商`:`运行配置`}),(0,j.jsx)(`small`,{children:n===`toml`?`配置即代码,改完重载`:`运行时状态与快捷键`})]})]}),(0,j.jsxs)(`div`,{className:`settings-body`,children:[n===`general`&&(0,j.jsxs)(j.Fragment,{children:[[[`工作目录`,s?.cwd],[`agent 目录`,s?.agentDir],[`会话`,s?`${s.sessionId} · ${s.messages} 条消息`:`—`],[`快捷键`,`⌘K 命令 · ⌘, 设置 · ⌃C 中断`],[`权限策略`,`当前 API 未提供修改接口`]].map(([e,t])=>(0,j.jsx)(`div`,{className:`general-row`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:e}),(0,j.jsx)(`small`,{children:$(t)})]})},e)),(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`任务结束提醒插件`}),(0,j.jsx)(`small`,{children:`由 CLI Notifier 提供,具体目标在插件配置中管理`})]}),(0,j.jsx)(`span`,{className:`setting-status ${E?`on`:``}`,children:E?`已加载`:`未加载`})]}),(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`自动压缩上下文`}),(0,j.jsx)(`small`,{children:`接近上下文上限时自动整理历史消息,可在运行配置中修改`}),!g&&w&&w!==`读取中…`?(0,j.jsxs)(`small`,{className:`setting-error`,role:`alert`,children:[`配置读取失败:`,w]}):null]}),(0,j.jsx)(`span`,{className:`setting-status ${g?.settings.compaction.enabled?`on`:``}`,children:g?g.settings.compaction.enabled?`已开启`:`已关闭`:w===`读取中…`?`读取中`:`不可用`})]})]}),n===`providers`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`provider-add-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`已启用提供商`}),(0,j.jsx)(`small`,{children:`模型列表只显示当前会话和已配置提供商。`})]}),(0,j.jsx)(`button`,{className:`primary`,onClick:()=>p(!0),type:`button`,children:`添加提供商`})]}),f&&(0,j.jsx)(`div`,{className:`provider-add-overlay`,onClick:()=>{u.__add||p(!1)},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),u.__add||p(!1))},children:(0,j.jsxs)(`div`,{"aria-busy":u.__add,"aria-label":`添加提供商`,"aria-modal":`true`,className:`provider-add-modal`,onClick:e=>e.stopPropagation(),ref:ee,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`添加自定义提供商`}),(0,j.jsx)(`small`,{children:`注册 OpenAI 兼容接口,凭据只提交到本机 Pi runtime。`})]}),(0,j.jsx)(`button`,{"aria-label":`关闭添加提供商`,disabled:u.__add,onClick:()=>p(!1),type:`button`,children:`×`})]}),(0,j.jsxs)(`form`,{className:`provider-add-form`,onSubmit:e=>{e.preventDefault(),!(!m.provider||!m.baseUrl||!m.apiKey||!m.model)&&(d(e=>({...e,__add:!0})),l(e=>({...e,__add:`添加中…`})),t.addProvider(m).then(async()=>{h({provider:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,model:``}),l(e=>({...e,__add:`已添加`})),await a(),p(!1)}).catch(e=>l(t=>({...t,__add:e instanceof Error?e.message:String(e)}))).finally(()=>d(e=>({...e,__add:!1}))))},children:[(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:`提供商 ID`}),(0,j.jsx)(`input`,{"aria-label":`提供商 ID`,"data-dialog-initial-focus":!0,maxLength:64,minLength:2,pattern:`[a-z0-9][a-z0-9._-]{1,63}`,placeholder:`例如 openrouter`,required:!0,value:m.provider,onChange:e=>h(t=>({...t,provider:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:`显示名称`}),(0,j.jsx)(`input`,{"aria-label":`提供商名称`,placeholder:`可选`,value:m.name,onChange:e=>h(t=>({...t,name:e.target.value}))})]}),(0,j.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,j.jsx)(`span`,{children:`接口地址`}),(0,j.jsx)(`input`,{"aria-label":`接口地址`,placeholder:`https://api.example.com/v1`,required:!0,type:`url`,value:m.baseUrl,onChange:e=>h(t=>({...t,baseUrl:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:`模型 ID`}),(0,j.jsx)(`input`,{"aria-label":`模型 ID`,placeholder:`例如 gpt-4o`,required:!0,value:m.model,onChange:e=>h(t=>({...t,model:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:`协议`}),(0,j.jsxs)(`select`,{"aria-label":`协议`,value:m.api,onChange:e=>h(t=>({...t,api:e.target.value})),children:[(0,j.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Completions`}),(0,j.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`})]})]}),(0,j.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,j.jsx)(`span`,{children:`API key`}),(0,j.jsx)(`input`,{"aria-label":`API key`,placeholder:`只在本机提交,不会回显`,required:!0,type:`password`,value:m.apiKey,onChange:e=>h(t=>({...t,apiKey:e.target.value}))})]}),(0,j.jsxs)(`div`,{className:`provider-add-actions`,children:[(0,j.jsx)(`button`,{className:`primary`,disabled:u.__add,type:`submit`,children:u.__add?`添加中…`:`添加提供商`}),c.__add&&(0,j.jsx)(`small`,{"aria-live":`polite`,children:c.__add})]})]})]})}),(0,j.jsx)(`small`,{children:`已启用提供商 · /api/providers`}),e.providers.length?e.providers.map(e=>(0,j.jsxs)(`article`,{className:`provider-card`,children:[(0,j.jsxs)(`div`,{className:`provider-head`,children:[(0,j.jsx)(`span`,{className:`provider-dot`,children:`●`}),(0,j.jsx)(`strong`,{children:e.name}),(0,j.jsx)(`span`,{className:`provider-state`,children:e.active?`当前会话`:e.auth?.configured===!0?`已配置`:`未配置`})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`provider`}),(0,j.jsx)(`input`,{"aria-label":`${e.name} 提供商 ID`,disabled:!0,value:e.provider,readOnly:!0})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`model`}),(0,j.jsxs)(`div`,{className:`provider-model-value`,title:e.models.map(e=>e.id).join(`, `)||`暂无模型`,children:[(0,j.jsx)(`span`,{children:e.activeModel?`${e.activeModel.provider}/${e.activeModel.id}`:`未选择模型`}),e.models.length>0&&(0,j.jsxs)(`details`,{className:`provider-models-details`,children:[(0,j.jsxs)(`summary`,{children:[`查看 `,e.models.length,` 个模型`]}),(0,j.jsx)(`div`,{className:`model-chips`,children:e.models.map(e=>(0,j.jsx)(`span`,{children:e.id},e.id))})]})]})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`api_key`}),(0,j.jsx)(`input`,{"aria-label":`${e.name} API key 状态`,disabled:!0,value:`不会在浏览器显示`,readOnly:!0})]}),(0,j.jsxs)(`div`,{className:`provider-footer`,children:[(0,j.jsxs)(`code`,{children:[e.models.length,` 个模型`]}),(0,j.jsx)(`button`,{disabled:u[e.provider],onClick:()=>O(e.provider,`test`),type:`button`,children:u[e.provider]&&c[e.provider]===`测试中…`?`测试中…`:`测试连接`}),(0,j.jsx)(`button`,{className:`link-button`,disabled:u[e.provider],onClick:()=>O(e.provider,`refresh`),type:`button`,children:u[e.provider]&&c[e.provider]===`刷新中…`?`刷新中…`:`拉取模型`})]}),c[e.provider]&&(0,j.jsx)(`small`,{"aria-live":`polite`,className:`provider-result`,children:c[e.provider]})]},e.provider)):(0,j.jsx)(`div`,{className:`empty-state`,children:`运行时没有注册提供商。`})]}),n===`toml`&&(0,j.jsxs)(`div`,{className:`config-editor`,children:[(0,j.jsxs)(`div`,{className:`toml-toolbar`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`运行时配置`}),(0,j.jsx)(`span`,{children:g?.path??`~/.pi/agent/settings.json`})]}),(0,j.jsx)(`button`,{className:v===`form`?`active`:``,onClick:()=>y(`form`),type:`button`,children:`表单`}),(0,j.jsx)(`button`,{className:v===`source`?`active`:``,onClick:()=>y(`source`),type:`button`,children:`源码`}),(0,j.jsx)(`button`,{className:`primary`,disabled:S,onClick:()=>{Kc(t,{config:_,sourceDraft:x,state:T,busy:C})},type:`button`,children:`重载`})]}),w&&(0,j.jsx)(`div`,{"aria-live":`polite`,className:`config-state ${w.includes(`失败`)||w.includes(`Error`)?`error`:``}`,children:w}),g?v===`source`?(0,j.jsxs)(`div`,{className:`config-source-editor`,children:[(0,j.jsx)(`textarea`,{"aria-label":`settings.json 源码`,className:`config-source`,onChange:e=>x(e.target.value),spellCheck:!1,value:b}),(0,j.jsxs)(`div`,{className:`config-source-actions`,children:[(0,j.jsx)(`small`,{children:`完整 JSON 配置,可编辑未知字段;保存前会校验语法。`}),(0,j.jsx)(`button`,{className:`primary`,disabled:S||!b.trim(),onClick:()=>{C(!0),T(`保存源码…`),t.updateConfigSource(b).then(e=>{_(e),x(e.source),T(`已保存源码`)}).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>C(!1))},type:`button`,children:`保存源码`})]})]}):(0,j.jsxs)(`div`,{className:`config-sections`,children:[(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`模型默认值`}),(0,j.jsx)(`small`,{children:`新会话启动时使用的模型和思考级别`})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`提供商`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({defaultProvider:e.target.value},`保存提供商…`),value:g.settings.defaultProvider??``,children:[(0,j.jsx)(`option`,{value:``,children:`跟随运行时`}),e.providers.map(e=>(0,j.jsx)(`option`,{value:e.provider,children:e.name},e.provider))]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`模型`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({defaultModel:e.target.value},`保存模型…`),value:g.settings.defaultModel??``,children:[(0,j.jsx)(`option`,{value:``,children:`跟随提供商`}),e.models.map(e=>(0,j.jsxs)(`option`,{value:e.id,children:[e.provider,`/`,e.name]},`${e.provider}/${e.id}`))]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`思考级别`}),(0,j.jsx)(`select`,{disabled:S,onChange:e=>D({defaultThinkingLevel:e.target.value},`保存思考级别…`),value:g.settings.defaultThinkingLevel??`medium`,children:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`].map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`运行策略`}),(0,j.jsx)(`small`,{children:`消息队列和网络传输行为`})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`传输方式`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({transport:e.target.value},`保存传输方式…`),value:g.settings.transport,children:[(0,j.jsx)(`option`,{value:`auto`,children:`自动`}),(0,j.jsx)(`option`,{value:`sse`,children:`SSE`}),(0,j.jsx)(`option`,{value:`websocket`,children:`WebSocket`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`Steering 消息`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({steeringMode:e.target.value},`保存队列策略…`),value:g.settings.steeringMode,children:[(0,j.jsx)(`option`,{value:`one-at-a-time`,children:`逐条发送`}),(0,j.jsx)(`option`,{value:`all`,children:`一次发送全部`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`Follow-up 消息`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({followUpMode:e.target.value},`保存跟进策略…`),value:g.settings.followUpMode,children:[(0,j.jsx)(`option`,{value:`one-at-a-time`,children:`逐条发送`}),(0,j.jsx)(`option`,{value:`all`,children:`一次发送全部`})]})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`上下文与显示`}),(0,j.jsx)(`small`,{children:`控制思考内容和自动压缩`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`隐藏思考正文`}),(0,j.jsx)(`small`,{children:`只显示可展开的思考摘要`})]}),(0,j.jsx)(`input`,{checked:g.settings.hideThinkingBlock,disabled:S,onChange:e=>D({hideThinkingBlock:e.target.checked},`保存显示设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`自动压缩上下文`}),(0,j.jsx)(`small`,{children:`接近上下文上限时自动整理历史消息`})]}),(0,j.jsx)(`input`,{checked:g.settings.compaction.enabled,disabled:S,onChange:e=>D({compaction:{...g.settings.compaction,enabled:e.target.checked}},`保存压缩设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`自动重试`}),(0,j.jsx)(`small`,{children:`临时网络错误时自动重试请求`})]}),(0,j.jsx)(`input`,{checked:g.settings.retry.enabled,disabled:S,onChange:e=>D({retry:{...g.settings.retry,enabled:e.target.checked}},`保存重试设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`显示图片`}),(0,j.jsx)(`small`,{children:`允许模型响应中的图片渲染`})]}),(0,j.jsx)(`input`,{checked:g.settings.terminal.showImages,disabled:S,onChange:e=>D({terminal:{...g.settings.terminal,showImages:e.target.checked}},`保存图片设置…`),type:`checkbox`})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`终端与导航`}),(0,j.jsx)(`small`,{children:`控制命令行界面和消息渲染行为`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`安静启动`}),(0,j.jsx)(`small`,{children:`启动时隐藏版本和更新提示`})]}),(0,j.jsx)(`input`,{checked:g.settings.advanced.quietStartup,disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,quietStartup:e.target.checked}},`保存启动设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`项目可信策略`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,projectTrust:e.target.value}},`保存信任策略…`),value:g.settings.advanced.projectTrust,children:[(0,j.jsx)(`option`,{value:`ask`,children:`每次询问`}),(0,j.jsx)(`option`,{value:`always`,children:`始终信任`}),(0,j.jsx)(`option`,{value:`never`,children:`从不信任`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`Mermaid 渲染`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,mermaid:e.target.value}},`保存 Mermaid 设置…`),value:g.settings.advanced.mermaid,children:[(0,j.jsx)(`option`,{value:`off`,children:`关闭`}),(0,j.jsx)(`option`,{value:`final`,children:`完成后渲染`}),(0,j.jsx)(`option`,{value:`streaming`,children:`流式渲染`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`双击 Escape`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,doubleEscapeAction:e.target.value}},`保存快捷键设置…`),value:g.settings.advanced.doubleEscapeAction,children:[(0,j.jsx)(`option`,{value:`tree`,children:`打开会话树`}),(0,j.jsx)(`option`,{value:`fork`,children:`创建分支`}),(0,j.jsx)(`option`,{value:`none`,children:`不执行`})]})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`诊断与隐私`}),(0,j.jsx)(`small`,{children:`控制缓存提示和匿名数据上报`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`显示缓存未命中`}),(0,j.jsx)(`small`,{children:`在消息中显示模型缓存诊断`})]}),(0,j.jsx)(`input`,{checked:g.settings.advanced.showCacheMissNotices,disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,showCacheMissNotices:e.target.checked}},`保存诊断设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`安装遥测`}),(0,j.jsx)(`small`,{children:`发送匿名安装和版本统计`})]}),(0,j.jsx)(`input`,{checked:g.settings.advanced.enableInstallTelemetry,disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,enableInstallTelemetry:e.target.checked}},`保存隐私设置…`),type:`checkbox`})]})]})]}):(0,j.jsx)(`div`,{className:`empty-state`,children:`正在读取运行时配置…`})]})]})]})]})})}var Jc=(e,t)=>{let n=t.trim().toLowerCase();return e.filter(e=>`${e.invocationName} ${e.description??``}`.toLowerCase().includes(n))};function Yc({commands:e,query:t,activeIndex:n,onActiveIndexChange:r,onUse:i}){let a=Jc(e,t),o=e=>{let t=a[e];t&&i(`/${t.invocationName}`)};return(0,j.jsx)(`div`,{"aria-label":`命令面板`,className:`command-palette`,id:`command-menu`,role:`listbox`,children:(0,j.jsxs)(`div`,{className:`palette-group`,children:[(0,j.jsxs)(`small`,{children:[`COMMANDS `,(0,j.jsx)(`span`,{children:`· RUNTIME REGISTRY`})]}),a.length?a.map((e,t)=>{let i=`/${e.invocationName}`;return(0,j.jsxs)(`button`,{"aria-selected":t===n,onClick:()=>o(t),onMouseEnter:()=>r(t),role:`option`,type:`button`,children:[(0,j.jsx)(`code`,{children:i}),(0,j.jsx)(`span`,{children:e.description??e.source??`由当前运行时注册`})]},`${e.invocationName}:${e.source??`runtime`}`)}):(0,j.jsx)(`div`,{className:`empty-state`,children:e.length?`没有匹配的命令。`:`当前运行时没有可用的命令注册清单。`})]})})}function Xc({kind:e,commands:t,files:n,query:r,activeIndex:i,onActiveIndexChange:a,onUse:o}){let s=e===`command`?Jc(t,r).slice(0,12):n.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(r.trim().toLowerCase())).slice(0,12);return(0,j.jsxs)(`div`,{"aria-label":e===`command`?`命令补全`:`文件补全`,className:`prompt-completion`,"data-prompt-completion":!0,id:`prompt-completion-list`,role:`listbox`,children:[(0,j.jsx)(`small`,{children:e===`command`?`命令`:`文件`}),s.length?s.slice(0,12).map((t,n)=>{let r=e===`command`?`/${t.invocationName}`:`@${t.path}`,s=e===`command`?t.description??t.source??`由当前运行时注册`:t.status;return(0,j.jsxs)(`button`,{"aria-selected":n===i,id:`prompt-completion-option-${n}`,onClick:()=>o(r),onMouseEnter:()=>a(n),role:`option`,type:`button`,children:[(0,j.jsx)(`strong`,{children:r}),(0,j.jsx)(`span`,{children:s})]},`${e}:${r}`)}):(0,j.jsx)(`span`,{className:`prompt-completion-empty`,children:`没有匹配项`})]})}function Zc({commands:e,sessions:t,files:n,onClose:r,onUse:i,onOpenSession:a,onOpenFile:s}){let[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(0),f=yc(!0,r),p=c.trim().toLowerCase(),m=e=>!p||e.toLowerCase().includes(p),h=[...e.filter(e=>m(`${e.invocationName} ${e.description??``}`)).map(e=>({kind:`command`,command:e})),...t.filter(e=>m(`${$(e.name,``)} ${$(e.firstMessage,``)} ${$(e.sessionId,``)}`)).map(e=>({kind:`session`,session:e})),...n.filter(e=>m(`${e.path} ${e.label} ${e.status}`)).map(e=>({kind:`file`,file:e}))],g=h.length?Math.min(u,h.length-1):-1,_=g>=0?`global-search-option-${g}`:void 0;(0,o.useEffect)(()=>d(0),[c]);let v=e=>{e&&(e.kind===`command`?i(`/${e.command.invocationName}`):e.kind===`session`?a(e.session):s(e.file),r())};return(0,j.jsx)(`div`,{className:`global-search`,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,j.jsxs)(`div`,{"aria-label":`全局搜索`,"aria-modal":`true`,className:`global-search-dialog`,ref:f,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`div`,{className:`global-search-heading`,children:[(0,j.jsx)(`strong`,{children:`全局搜索`}),(0,j.jsx)(`small`,{children:`命令 · 会话 · 文件`}),(0,j.jsx)(`button`,{"aria-label":`关闭全局搜索`,onClick:r,type:`button`,children:`×`})]}),(0,j.jsx)(`input`,{"aria-activedescendant":_,"aria-autocomplete":`list`,"aria-controls":`global-search-results`,"aria-expanded":`true`,"aria-label":`全局搜索`,"data-dialog-initial-focus":!0,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),r()):e.key===`ArrowDown`&&h.length?(e.preventDefault(),d(e=>(e+1)%h.length)):e.key===`ArrowUp`&&h.length?(e.preventDefault(),d(e=>(e-1+h.length)%h.length)):e.key===`Enter`&&(e.preventDefault(),v(h[g]))},placeholder:`搜索命令、会话或文件`,role:`combobox`,value:c}),(0,j.jsx)(`div`,{className:`global-search-results`,id:`global-search-results`,role:`listbox`,children:h.length?[`command`,`session`,`file`].map(e=>{let t=h.filter(t=>t.kind===e);if(!t.length)return null;let n=e===`command`?`命令`:e===`session`?`会话`:`文件`;return(0,j.jsxs)(`section`,{"aria-label":n,className:`global-search-group`,role:`group`,children:[(0,j.jsx)(`small`,{"aria-hidden":`true`,children:n}),t.map(e=>{let t=h.indexOf(e),n=e.kind===`command`?`/${e.command.invocationName}`:e.kind===`session`?$(e.session.name??e.session.firstMessage??e.session.sessionId,`未命名会话`):e.file.label,r=e.kind===`command`?e.command.description??e.command.source??`由当前运行时注册`:e.kind===`session`?`${$(e.session.messageCount,`0`)} 条消息`:`${e.file.path} · ${e.file.status}`;return(0,j.jsxs)(`button`,{"aria-selected":t===g,id:`global-search-option-${t}`,onClick:()=>v(e),onMouseEnter:()=>d(t),role:`option`,type:`button`,children:[(0,j.jsx)(`strong`,{children:n}),(0,j.jsx)(`span`,{children:r})]},`${e.kind}:${n}:${t}`)})]},e)}):(0,j.jsx)(`div`,{className:`empty-state`,children:`没有匹配的命令、会话或文件。`})})]})})}function Qc(e){let t=e.event;return typeof t!=`object`||!t||t.type!==`message_update`}function $c(e,t){return e.subscribeEvents(e=>t.current(e))}function el(e,t,n){if(e===void 0)return{kind:`clear`};let r=t.find(t=>t.id===e);return r===void 0?n===e?{kind:`keep`}:{kind:`fetch`}:{kind:`show`,plugin:r}}var tl=(0,o.memo)(function({role:e,text:t,thinking:n,onMouseUp:r}){return(0,j.jsx)(`article`,{className:`turn ${e===`user`?`user`:`text`}`,children:e===`user`?(0,j.jsx)(Nc,{text:t}):(0,j.jsxs)(j.Fragment,{children:[n&&(0,j.jsxs)(`details`,{className:`reasoning message-reasoning`,children:[(0,j.jsx)(`summary`,{className:`reasoning-head`,children:`思考`}),(0,j.jsx)(`div`,{className:`reasoning-body`,children:(0,j.jsx)(He,{text:n})})]}),t&&(0,j.jsx)(He,{onMouseUp:r,text:t})]})})});function nl({api:e=Ne(),appVersion:t}){let n=(0,o.useMemo)(wc,[]),[r,i]=(0,o.useState)({sessions:[],files:[],models:[],providers:[],plugins:[],pluginPanels:[],marketplace:[],marketplaceCapabilities:[],marketplaceCategories:[],marketplaceTotal:0,marketplacePage:0,marketplaceHasNext:!1,commands:[],workspaces:[]}),[a,s]=(0,o.useState)(n.view),[c,l]=(0,o.useState)(n.page),[u,d]=(0,o.useState)(n.settings),[f,p]=(0,o.useState)(),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(!1),[v,y]=(0,o.useState)(``),[b,x]=(0,o.useState)(0),[S,C]=(0,o.useState)(!1),[w,T]=(0,o.useState)(),[E,ee]=(0,o.useState)(),[D,O]=(0,o.useState)(!1),[te,ne]=(0,o.useState)(),[re,ie]=(0,o.useState)(!1),[ae,k]=(0,o.useState)(),[oe,se]=(0,o.useState)(),[ce,le]=(0,o.useState)(``),[ue,de]=(0,o.useState)(!1),[fe,pe]=(0,o.useState)(``),[me,he]=(0,o.useState)(),[ge,_e]=(0,o.useState)(n.sessionPath),ve=(0,o.useRef)(n.sessionPath),ye=(0,o.useRef)(!1),[A,be]=(0,o.useState)(``),[xe,Se]=(0,o.useState)([]),[Ce,we]=(0,o.useState)(``),[Te,Ee]=(0,o.useState)(``),[De,Oe]=(0,o.useState)(``),ke=(0,o.useRef)(null),[Ae,M]=(0,o.useState)(n.marketplaceQuery),[Ie,Re]=(0,o.useState)(n.marketplaceCapability),[ze,Be]=(0,o.useState)(n.marketplaceCategory),[N,Ve]=(0,o.useState)(n.marketplacePlugin),[We,Ke]=(0,o.useState)(),[qe,Je]=(0,o.useState)(n.marketplacePlugin!==void 0),[Xe,Ze]=(0,o.useState)(``),[Qe,$e]=(0,o.useState)([]),[P,et]=(0,o.useState)(n.installedPlugin),[nt,rt]=(0,o.useState)(),[it,at]=(0,o.useState)(n.marketplacePage),[ot,F]=(0,o.useState)(``),[st,ct]=(0,o.useState)(!1),[lt,ut]=(0,o.useState)(``),[dt,ft]=(0,o.useState)(!1),[I,pt]=(0,o.useState)(!1),[mt,ht]=(0,o.useState)(0),[gt,_t]=(0,o.useState)(0),[L,vt]=(0,o.useState)(!1),[yt,bt]=(0,o.useState)(new Set),xt=(0,o.useRef)(null),St=(0,o.useRef)(null),[Ct,wt]=(0,o.useState)(),Tt=(0,o.useRef)(null),Et=(0,o.useRef)(null),Dt=(0,o.useRef)(!0),Ot=(0,o.useRef)(void 0),kt=(0,o.useRef)(!1),At=(0,o.useRef)(void 0),[jt,Mt]=(0,o.useState)(0),[Nt,Pt]=(0,o.useState)(!1),[Ft,It]=(0,o.useState)(0),[Lt,Rt]=(0,o.useState)(!0),[zt,Bt]=(0,o.useState)([]);(0,o.useEffect)(()=>{let t=!1;return tt(e).then(e=>{t||$e(e)}).catch(()=>{t||$e([])}),()=>{t=!0}},[e]),(0,o.useEffect)(()=>{!ge&&r.session?.sessionFile&&_e(r.session.sessionFile)},[r.session?.sessionFile,ge]);let Vt=(0,o.useMemo)(()=>Pe(A,jt),[A,jt]),Ht=(0,o.useMemo)(()=>Vt?Vt.kind===`command`?Jc(r.commands,Vt.query).slice(0,12):r.files.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(Vt.query.trim().toLowerCase())).slice(0,12):[],[r.commands,r.files,Vt]),Ut=!!(Vt&&!Nt&&Ht.length),Wt=Math.min(Ft,Math.max(Ht.length-1,0)),Gt=(0,o.useMemo)(()=>new Set(r.plugins.filter(e=>e.removable).map(e=>e.name)),[r.plugins]),Kt=!ue&&!!(me||r.status?.cwd||r.workspaces.find(e=>e.current)?.path||r.session),qt=(0,o.useMemo)(()=>{let e=new Set(r.pluginPanels.map(e=>e.pluginId));return r.plugins.filter(t=>t.removable||e.has(t.name)).length},[r.pluginPanels,r.plugins]);(0,o.useEffect)(()=>{It(0)},[Vt?.kind,Vt?.query]),(0,o.useEffect)(()=>{if(!S&&!D)return;let e=e=>{e.target instanceof Element&&e.target.closest(`[data-session-popover]`)||(C(!1),T(void 0),ee(void 0),O(!1),ne(void 0),se(void 0))},t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),C(!1),T(void 0),ee(void 0),O(!1),ne(void 0),se(void 0),St.current?.focus())},n=()=>{C(!1),T(void 0),ee(void 0),O(!1),ne(void 0),se(void 0)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),document.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[S,D]),(0,o.useEffect)(()=>{if(!m&&!Ut)return;let e=e=>{let t=e.target instanceof Element?e.target:void 0;m&&!t?.closest(`[data-command-palette]`)&&(h(!1),y(``)),Ut&&!t?.closest(`[data-prompt-completion]`)&&Pt(!0)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[m,Ut]),(0,o.useEffect)(()=>{let e=e=>{if(e instanceof KeyboardEvent&&e.key!==`Escape`)return;let t=e.target instanceof Element?e.target:void 0;document.querySelectorAll(`details.provider-models-details[open]`).forEach(n=>{e instanceof PointerEvent&&t&&n.contains(t)||(n.removeAttribute(`open`),e instanceof KeyboardEvent&&n.querySelector(`summary`)?.focus())})};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,e)}},[]),(0,o.useEffect)(()=>{if(typeof window>`u`)return;let e=new URLSearchParams(window.location.search);e.set(`page`,c),a===`chat`?e.delete(`view`):e.set(`view`,a),u?e.set(`settings`,u):e.delete(`settings`),ge?e.set(`session`,ge):e.delete(`session`),Ae?e.set(`marketplaceQuery`,Ae):e.delete(`marketplaceQuery`),Ie?e.set(`capability`,Ie):e.delete(`capability`),ze?e.set(`category`,ze):e.delete(`category`),c===`plugins`&&P?e.set(`plugin`,P):c===`marketplace`&&N?e.set(`plugin`,N):e.delete(`plugin`),it>0?e.set(`marketplacePage`,String(it)):e.delete(`marketplacePage`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)},[P,Ie,ze,it,N,Ae,c,ge,u,a]),(0,o.useEffect)(()=>{let e=()=>{let e=wc();h(!1),_(!1),C(!1),p(void 0),l(e.page),s(e.view),d(e.settings),_e(e.sessionPath),M(e.marketplaceQuery),Re(e.marketplaceCapability),Be(e.marketplaceCategory),at(e.marketplacePage),et(e.installedPlugin),Ve(e.marketplacePlugin)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,o.useEffect)(()=>{let t=el(N,[...r.marketplace,...Qe],At.current);if(t.kind===`keep`)return;if(t.kind===`clear`){At.current=void 0,Ke(void 0),Je(!1),Ze(``);return}if(t.kind===`show`){At.current=N,Ke(t.plugin),Je(!1),Ze(``);return}let n=!1;return Ke(void 0),Je(!0),Ze(``),e.listMarketplace(``,``,0,100).then(e=>{if(n)return;At.current=N;let t=e.items.find(e=>e.id===N);t===void 0?Ze(`没有找到这个市场插件,它可能已下架。`):Ke(t)}).catch(e=>{n||Ze(e instanceof Error?e.message:String(e))}).finally(()=>{n||Je(!1)}),()=>{n=!0}},[e,r.marketplace,Qe,N]),(0,o.useEffect)(()=>{if(P===void 0){rt(void 0);return}let t=Qe.find(e=>e.packageName===P);if(t!==void 0){rt(t);return}let n=!1;return rt(void 0),e.listMarketplace(``,``,0,100).then(e=>{n||rt(e.items.find(e=>e.packageName===P))}).catch(()=>{n||rt(void 0)}),()=>{n=!0}},[e,P,Qe]);let R=(0,o.useCallback)(async()=>{let t=await Promise.allSettled([e.getStatus(),e.getSession(),e.listSessions(mt,30,I),e.getFiles(),e.listModels(),e.listProviders(),e.listPlugins(),e.listPluginPanels(),e.listMarketplace(Ae,Ie,it,24,ze),e.listCommands(),e.listWorkspaces()]),[n,r,a,o,s,c,l,u,d,f,p]=t;Bt(Me([`运行状态`,`当前会话`,`会话列表`,`文件`,`模型`,`提供商`,`插件`,`插件面板`,`插件市场`,`命令`,`工作区`],t)),Rt(!1),i(e=>({status:n.status===`fulfilled`?n.value:e.status,session:r.status===`fulfilled`?r.value:e.session,sessions:a.status===`fulfilled`?a.value.items:e.sessions,files:o.status===`fulfilled`?o.value:e.files,models:s.status===`fulfilled`?s.value:e.models,providers:c.status===`fulfilled`?c.value:e.providers,plugins:l.status===`fulfilled`?l.value:e.plugins,pluginPanels:u.status===`fulfilled`?u.value:e.pluginPanels,marketplace:d.status===`fulfilled`?d.value.items:e.marketplace,marketplaceCapabilities:d.status===`fulfilled`?d.value.capabilities:e.marketplaceCapabilities,marketplaceCategories:d.status===`fulfilled`?d.value.categories:e.marketplaceCategories,marketplaceTotal:d.status===`fulfilled`?d.value.total:e.marketplaceTotal,marketplacePage:d.status===`fulfilled`?d.value.page:e.marketplacePage,marketplaceHasNext:d.status===`fulfilled`?d.value.hasNext:e.marketplaceHasNext,commands:f.status===`fulfilled`?f.value:e.commands,workspaces:p.status===`fulfilled`?p.value:e.workspaces})),a.status===`fulfilled`&&(_t(a.value.total),vt(a.value.hasNext))},[e,I,Ie,ze,it,Ae,mt]),Jt=(0,o.useCallback)(()=>{kt.current=!0,Ot.current===void 0&&(Ot.current=window.setTimeout(()=>{Ot.current=void 0,kt.current&&(kt.current=!1,R())},100))},[R]),z=(0,o.useCallback)(e=>{Qc(e)&&Jt();let t=e.event;if(typeof t!=`object`||!t)return;let n=t;if(n.type===`turn_start`){wt({thinking:``,text:``});return}if(n.type!==`message_update`||typeof n.assistantMessageEvent!=`object`||n.assistantMessageEvent===null)return;let r=n.assistantMessageEvent,i=r.type;if(i!==`thinking_delta`&&i!==`text_delta`)return;let a=typeof r.delta==`string`?r.delta:``;a&&wt(e=>({thinking:(e?.thinking??``)+(i===`thinking_delta`?a:``),text:(e?.text??``)+(i===`text_delta`?a:``)}))},[Jt]),Yt=(0,o.useRef)(z),Xt=(0,o.useRef)(R),Zt=(0,o.useCallback)(async t=>{F(``),pe(``);try{let n=await e.createSession(t?.path);n.sessionFile&&_e(n.sessionFile),d(void 0),h(!1),_(!1),p(void 0),de(!1),he(t?.path),y(``),l(`session`),s(`chat`),C(!1),await R()}catch(e){let n=e instanceof Error?e.message:String(e);t?pe(n):F(n)}},[e,R]),Qt=()=>{F(``),pe(``),he(void 0),de(!0)},$t=(0,o.useCallback)(async()=>{try{let t=await e.pickDirectory(),n=t.split(/[\\/]/).filter(Boolean).pop()??t;await Zt({path:t,branch:`directory`,current:!1,name:n})}catch(e){pe(e instanceof Error?e.message:String(e))}},[e,Zt]),B=(0,o.useCallback)(async()=>{await $t()},[$t]);(0,o.useEffect)(()=>{Yt.current=z,Xt.current=R},[z,R]),(0,o.useEffect)(()=>{R()},[R]),(0,o.useEffect)(()=>$c(e,Yt),[e]),(0,o.useEffect)(()=>{let e=window.setInterval(()=>void Xt.current(),5e3);return()=>{window.clearInterval(e),Ot.current!==void 0&&(window.clearTimeout(Ot.current),Ot.current=void 0)}},[]),(0,o.useEffect)(()=>{r.status?.status!==`running`&&wt(void 0)},[r.status?.status]),(0,o.useEffect)(()=>{let t=ve.current;if(!t||ye.current||r.sessions.length===0)return;ye.current=!0;let n=r.sessions.find(e=>e.path===t);if(!n||typeof n.path!=`string`){_e(void 0);return}r.session?.sessionFile!==n.path&&e.openSession(n.path).then(R).catch(e=>F(e instanceof Error?e.message:String(e)))},[e,r.session?.sessionFile,r.sessions,R]),(0,o.useEffect)(()=>{if(x(0),!m)return;let e=window.requestAnimationFrame(()=>ke.current?.focus());return()=>window.cancelAnimationFrame(e)},[m,v]),(0,o.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(ae){k(void 0);return}if(g){_(!1);return}if(m){h(!1),y(``);return}if(f!==void 0){p(void 0);return}h(!1),C(!1),O(!1),de(!1),d(void 0)}(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),h(!1),_(!0)),(e.metaKey||e.ctrlKey)&&e.key===`,`&&(e.preventDefault(),h(!1),_(!1),p(void 0),d(`general`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,f,g,ae]);let en=r.session?.events??[],tn=(0,o.useMemo)(()=>Le(en),[en]),nn=(0,o.useMemo)(()=>Ge(r.session?.messages??[]),[r.session?.messages]);(0,o.useEffect)(()=>{if(!Dt.current)return;let e=window.requestAnimationFrame(()=>{let e=Et.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[r.session?.messages.length,r.status?.events,lt,st]);let V=r.sessions.filter(e=>!De||$(e.name??e.firstMessage,`未命名会话`).toLowerCase().includes(De.toLowerCase())),rn=t=>{t.preventDefault();let n=A.trim(),r=xe.length>0?Ye(xe,n):n;!r||st||(be(``),F(``),ut(r),wt(void 0),Dt.current=!0,ct(!0),e.prompt(r).then(async()=>{Se([]),await R()}).catch(e=>F(e instanceof Error?e.message:String(e))).finally(()=>ut(``)).finally(()=>ct(!1)))},an=(0,o.useCallback)(()=>{window.requestAnimationFrame(()=>{let e=window.getSelection()?.toString().trim()??``;e.length>0&&we(e.slice(0,4e3))})},[]),on=()=>{let e=Ce.trim();e&&(Se(t=>[...t,{id:t.length===0?1:Math.max(...t.map(e=>e.id))+1,quote:e,note:Te.trim()}]),we(``),Ee(``))},sn=()=>{let e=Tt.current,t=e?.selectionStart??A.length,n=Pe(A,t),r=t;if(n?.kind!==`command`){let e=`${t>0&&!/\s/.test(A[t-1]??``)?` `:``}/`,n=`${A.slice(0,t)}${e}${A.slice(t)}`;r=t+e.length,be(n)}Mt(r),Pt(!1),It(0),window.requestAnimationFrame(()=>{e?.focus(),e?.setSelectionRange(r,r)})},cn=t=>{let n=typeof t.path==`string`?t.path:``;n&&(d(void 0),h(!1),_(!1),l(`session`),s(`chat`),p(void 0),_e(n),e.openSession(n).then(R).catch(e=>F(e instanceof Error?e.message:String(e))))},ln=async e=>{if(!dt){ft(!0),F(``);try{await e(),await R(),bt(new Set),C(!1),T(void 0),ee(void 0),O(!1),ne(void 0),se(void 0),ie(!1),k(void 0)}catch(e){F(e instanceof Error?e.message:String(e))}finally{ft(!1)}}},H=r.session?.sessionFile,un=e=>{bt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},dn=(e,t,n)=>{if(S&&w===e){fn(),se(void 0);return}O(!1),ne(void 0),St.current=n,le(t??``),se({name:t||`未命名会话`,path:e}),T(e),ee(jc(n,142,190,`beside`)),C(!0)},fn=()=>{C(!1),T(void 0),ee(void 0)},pn=e=>{let t=new URLSearchParams(window.location.search);t.set(`page`,`plugins`),t.delete(`settings`),e?t.set(`plugin`,e):t.delete(`plugin`);let n=t.toString();window.history.pushState(null,``,`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`),d(void 0),p(void 0),h(!1),_(!1),C(!1),T(void 0),l(`plugins`),et(e),Ve(void 0)},mn=e=>{let t=new URLSearchParams(window.location.search);t.set(`page`,`marketplace`),t.delete(`settings`),e?t.set(`plugin`,e):t.delete(`plugin`);let n=t.toString();window.history.pushState(null,``,`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`),d(void 0),p(void 0),h(!1),_(!1),C(!1),T(void 0),l(`marketplace`),et(void 0),Ve(e)},hn=P===void 0?void 0:r.plugins.find(e=>e.name===P),gn=P===void 0?void 0:r.pluginPanels.find(e=>e.pluginId===P),_n=u?(0,j.jsx)(qc,{api:e,data:r,tab:u,onTab:d,onRefresh:R,onClose:()=>{d(void 0),l(`session`),s(`chat`),p(void 0)}}):c===`plugins`&&P&&hn?(0,j.jsx)(Uc,{metadata:nt,onBack:()=>pn(void 0),onToggle:async t=>{await e.togglePlugin(t.id,!t.enabled),await R()},onUninstall:async t=>{await e.uninstallPlugin(t.id);let n=await e.listPlugins();i(e=>({...e,plugins:n.filter(e=>e.id!==t.id)})),pn(void 0)},panel:gn,plugin:hn}):c===`plugins`&&P?(0,j.jsxs)(`section`,{className:`view-panel min-w-0 overflow-auto bg-[#f8f9fb]`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav bg-white`,children:[(0,j.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),pn(void 0)},children:`← 已安装插件`}),(0,j.jsx)(`span`,{children:`插件详情`})]}),(0,j.jsx)(`div`,{className:`empty-state`,children:r.status?`没有找到这个已安装插件,它可能已被移除。`:`正在读取插件详情…`})]}):c===`plugins`?(0,j.jsx)(Hc,{plugins:r.plugins,panels:r.pluginPanels,catalog:Qe.length?Qe:r.marketplace,onMarketplace:()=>mn(void 0),onOpenDetail:e=>pn(e.name),onToml:()=>{p(void 0),d(`toml`)},onToggle:async t=>{await e.togglePlugin(t.id,!t.enabled),await R()},onUninstall:async t=>{await e.uninstallPlugin(t.id);let n=await e.listPlugins();i(e=>({...e,plugins:n.filter(e=>e.id!==t.id)}))}}):c===`marketplace`?N&&We?.id===N?(0,j.jsx)(Gc,{plugin:We,installed:Gt.has(We.packageName),onBack:()=>mn(void 0),onInstall:async t=>{let n=await e.installMarketplace(t.id);return await R(),n}}):N?(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),mn(void 0)},children:`← 插件市场`}),(0,j.jsx)(`span`,{children:`插件详情`})]}),(0,j.jsx)(`div`,{className:`empty-state`,children:qe?`正在读取插件详情…`:Xe||`没有找到这个市场插件,它可能已下架。`})]})}):(0,j.jsx)(Wc,{plugins:r.marketplace,capabilities:r.marketplaceCapabilities,categories:r.marketplaceCategories,total:r.marketplaceTotal,page:r.marketplacePage,hasNext:r.marketplaceHasNext,query:Ae,capabilityFilter:Ie,categoryFilter:ze,onQueryChange:e=>{M(e),at(0)},onCapabilityChange:e=>{Re(e),at(0)},onCategoryChange:e=>{Be(e),at(0)},onOpenDetail:e=>mn(e.id),onPageChange:at,onBack:()=>pn(void 0),onToml:()=>{p(void 0),d(`toml`)},installedPackages:Gt,onInstall:async t=>{let n=await e.installMarketplace(t.id);return await R(),n}}):a===`chat`?(0,j.jsxs)(`section`,{className:`view-panel chat-view`,children:[(0,j.jsxs)(`div`,{className:`chat-scroll ${r.session?.messages.length?``:`is-empty`}`,onScroll:e=>{let t=e.currentTarget;Dt.current=t.scrollHeight-t.scrollTop-t.clientHeight<120},ref:Et,children:[r.session?.messages.length?nn.map((e,t)=>(0,j.jsx)(tl,{onMouseUp:an,role:e.role,text:e.text,thinking:e.thinking},t)):(0,j.jsx)(Ec,{status:r.status,workspaces:r.workspaces,onCreate:e=>void Zt(e),onStarter:be,onToml:()=>{p(void 0),d(`toml`)}}),Ct&&r.status?.status===`running`&&(0,j.jsxs)(`article`,{className:`turn text streaming-turn`,"aria-live":`polite`,children:[Ct.thinking&&(0,j.jsxs)(`details`,{className:`reasoning message-reasoning`,children:[(0,j.jsx)(`summary`,{className:`reasoning-head`,children:`思考中…`}),(0,j.jsx)(`div`,{className:`reasoning-body`,children:(0,j.jsx)(He,{text:Ct.thinking})})]}),!Ct.thinking&&!Ct.text&&(0,j.jsx)(`div`,{className:`streaming-placeholder`,children:`正在生成…`}),Ct.text&&(0,j.jsx)(He,{onMouseUp:an,text:Ct.text})]}),lt&&!r.session?.messages.some(e=>e.role===`user`&&Ue(e)===lt)&&(0,j.jsx)(`article`,{className:`turn user pending-turn`,children:(0,j.jsx)(Nc,{text:lt})})]}),(0,j.jsxs)(`div`,{className:`composer-wrap`,children:[(0,j.jsx)(`div`,{className:`context-shell`,children:(0,j.jsxs)(`div`,{className:`context-line`,children:[(0,j.jsx)(`span`,{className:`context-label`,children:`实时上下文`}),(0,j.jsxs)(`div`,{className:`context-metrics`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`b`,{children:r.status?.messages??0}),` 条消息`]}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`b`,{children:r.status?.events??en.length}),` 个事件`]}),(0,j.jsx)(`span`,{children:(0,j.jsx)(`b`,{children:$(r.status?.model)})})]})]})}),(0,j.jsxs)(`div`,{className:`composer-stack`,children:[ot&&(0,j.jsx)(Mc,{message:ot}),Ce?(0,j.jsxs)(`div`,{"aria-label":`添加批注`,className:`rounded-lg border border-[#cdddf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,j.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded bg-[#dce9ff] px-1.5 py-0.5 text-[10px] text-[#315fb8]`,children:`选中片段`}),(0,j.jsx)(`p`,{className:`max-h-16 flex-1 overflow-auto whitespace-pre-wrap text-[11px] text-[#30343b]`,children:Ce}),(0,j.jsx)(`button`,{"aria-label":`取消批注`,className:`text-[12px] text-[#687381]`,onClick:()=>we(``),type:`button`,children:`×`})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,j.jsx)(`input`,{"aria-label":`批注备注`,className:`min-w-0 flex-1 rounded-md border border-[#dce5f5] bg-white px-2 py-1.5 text-[11px] outline-none`,onChange:e=>Ee(e.target.value),placeholder:`备注(可选)`,value:Te}),(0,j.jsx)(`button`,{className:`rounded-md bg-[#3565c5] px-3 py-1.5 text-[11px] font-medium text-white`,onClick:on,type:`button`,children:`加入批注`})]})]}):null,xe.length>0?(0,j.jsxs)(`div`,{className:`flex items-center gap-2 overflow-x-auto text-[10px]`,children:[(0,j.jsxs)(`span`,{className:`shrink-0 rounded-md bg-[#edf3fe] px-2 py-1 font-medium text-[#315fb8]`,children:[`批注 ×`,xe.length]}),xe.map(e=>(0,j.jsxs)(`button`,{className:`max-w-48 shrink-0 truncate rounded-md border border-[#dce5f5] bg-white px-2 py-1 text-left text-[#65707b]`,onClick:()=>Se(t=>t.filter(t=>t.id!==e.id)),title:`点击移除批注`,type:`button`,children:[`#`,e.id,` `,e.quote]},e.id)),(0,j.jsx)(`button`,{className:`shrink-0 text-[#687381]`,onClick:()=>Se([]),type:`button`,children:`清空`})]}):null,(0,j.jsxs)(`form`,{className:`composer`,onSubmit:rn,children:[(0,j.jsx)(`textarea`,{"aria-activedescendant":Ut?`prompt-completion-option-${Wt}`:void 0,"aria-autocomplete":`list`,"aria-controls":Ut?`prompt-completion-list`:void 0,"aria-expanded":Ut,"aria-haspopup":`listbox`,"aria-label":`Prompt`,onChange:e=>{be(e.target.value),Mt(e.currentTarget.selectionStart??e.target.value.length),Pt(!1),e.currentTarget.style.height=`auto`,e.currentTarget.style.height=`${Math.min(e.currentTarget.scrollHeight,180)}px`},onKeyDown:e=>{let t=e.currentTarget.selectionStart??A.length,n=Pe(e.currentTarget.value,t),i=n?n.kind===`command`?Jc(r.commands,n.query).slice(0,12):r.files.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(n.query.trim().toLowerCase())).slice(0,12):[],a=!!(n&&!Nt&&i.length);if(a&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),It(t=>(t+(e.key===`ArrowDown`?1:-1)+i.length)%i.length);return}if(a&&(e.key===`Enter`||e.key===`Tab`)){e.preventDefault();let t=i[Math.min(Ft,i.length-1)];if(t&&n){let r=n.kind===`command`?`/${t.invocationName}`:`@${t.path}`,i=Fe(e.currentTarget.value,n,`${r} `);be(i.text),Mt(i.caret),Pt(!1),requestAnimationFrame(()=>{let e=Tt.current;e?.focus(),e?.setSelectionRange(i.caret,i.caret)})}return}if(e.key===`Escape`&&n&&!Nt){e.preventDefault(),Pt(!0);return}(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onClick:()=>{Kt||de(!0)},onFocus:e=>{Kt||(e.currentTarget.blur(),de(!0))},placeholder:Kt?`描述要做的改动,⌘↵ 发送;@ 引用文件,/ 调用命令`:`先选择工作区,再描述要做的改动`,readOnly:!Kt,ref:Tt,rows:2,"data-prompt-completion":!0,value:A}),Ut&&Vt&&(0,j.jsx)(Xc,{activeIndex:Wt,commands:r.commands,files:r.files,kind:Vt.kind,onActiveIndexChange:It,onUse:e=>{let t=Fe(A,Vt,`${e} `);be(t.text),Mt(t.caret),Pt(!1),requestAnimationFrame(()=>{let e=Tt.current;e?.focus(),e?.setSelectionRange(t.caret,t.caret)})},query:Vt.query}),(0,j.jsxs)(`div`,{className:`composer-tools`,children:[(0,j.jsx)(`select`,{"aria-label":`模型`,disabled:!r.models.length||st,value:r.status?.model??``,onChange:t=>{let[n,...r]=t.target.value.split(`/`),i=r.join(`/`);!n||!i||(F(``),e.selectModel(n,i).then(R).catch(e=>F(e instanceof Error?e.message:String(e))))},children:r.models.length?r.models.map(e=>(0,j.jsx)(`option`,{value:`${e.provider}/${e.id}`,children:e.name===e.id?`${e.provider}/${e.id}`:`${e.name} (${e.provider})`},`${e.provider}/${e.id}`)):(0,j.jsx)(`option`,{value:``,children:`暂无可用模型`})}),(0,j.jsx)(`button`,{className:`tool-chip`,onClick:sn,type:`button`,children:`/ 命令`}),(0,j.jsx)(`span`,{className:`composer-hint`,children:`⌘↵ 发送 · ⌘K 命令 · ⌃C 中断`}),(0,j.jsx)(`button`,{"aria-label":st?`发送中`:`发送消息`,className:`send-button`,disabled:st||!A.trim(),title:st?`正在发送`:`发送消息(⌘↵)`,type:`submit`,children:st?`…`:`↑`})]})]})]})]})]}):a===`trajectory`?(0,j.jsx)(Fc,{events:tn,onSelect:p}):(0,j.jsx)(Ic,{api:e,files:r.files,onDiff:async t=>{let n=await e.getFileDiff(t);p({type:`file_diff`,path:n.path,output:n.diff||`没有可显示的差异(工作区可能已更新)。`})},onRefresh:()=>void R()}),vn=Tc(V),yn=!!(r.session&&!De&&!V.some(e=>e.sessionId===r.session?.sessionId)),bn=Jc(r.commands,v),xn=r.pluginPanels.find(e=>e.id===`better-sidebar-panel`),U=xn?.data!==null&&typeof xn?.data==`object`&&!Array.isArray(xn?.data)?xn.data:void 0,Sn=r.pluginPanels.find(e=>e.id===`theme-studio-panel`),Cn=Sn?.data!==null&&typeof Sn?.data==`object`&&!Array.isArray(Sn?.data)?Sn.data:void 0,wn=(0,o.useMemo)(()=>{if(!Cn?.tokens||typeof Cn.tokens!=`object`||Array.isArray(Cn.tokens))return;let e=Object.entries(Cn.tokens).filter(([e,t])=>e.startsWith(`--`)&&typeof t==`string`);return e.length?Object.fromEntries(e):void 0},[Cn]),Tn=typeof Cn?.theme==`string`?Cn.theme:void 0,En=e=>{be(e),h(!1),y(``)};return(0,j.jsxs)(`div`,{className:`app-frame`,"data-theme":Tn,style:wn,children:[(0,j.jsxs)(`aside`,{className:`sidebar`,children:[(0,j.jsxs)(`header`,{className:`brand-row`,children:[(0,j.jsx)(`span`,{className:`pi-mark`,"aria-hidden":`true`,children:(0,j.jsx)(`img`,{src:`/icons/svg/mark-white.svg`,alt:``})}),(0,j.jsx)(`strong`,{children:`pi harness`}),t?(0,j.jsx)(`span`,{className:`version`,children:t}):null]}),(0,j.jsxs)(`div`,{className:`sidebar-actions`,children:[(0,j.jsx)(`button`,{className:`new-session`,onClick:Qt,type:`button`,"aria-expanded":ue,children:`+ 新建会话`}),(0,j.jsxs)(`div`,{className:`session-search`,"data-command-palette":!0,children:[(0,j.jsx)(`input`,{"aria-controls":m?`command-menu`:void 0,"aria-expanded":m,"aria-label":m?`搜索命令`:`搜索会话`,onChange:e=>{let t=e.target.value;if(!m&&t.startsWith(`/`)){h(!0),y(t.slice(1));return}m?y(t.replace(/^\/\s?/,``)):Oe(t)},onKeyDown:e=>{m&&(e.key===`ArrowDown`&&bn.length?(e.preventDefault(),x(e=>(e+1)%bn.length)):e.key===`ArrowUp`&&bn.length?(e.preventDefault(),x(e=>(e-1+bn.length)%bn.length)):e.key===`Enter`&&bn.length&&(e.preventDefault(),En(`/${bn[b]?.invocationName??``}`)))},placeholder:m?`输入命令名称或描述`:`搜索会话 · ⌘K 命令`,ref:ke,type:`search`,value:m?`/${v}`:De}),m&&(0,j.jsx)(Yc,{activeIndex:b,commands:r.commands,onActiveIndexChange:x,onUse:En,query:v})]}),(0,j.jsx)(`input`,{accept:`.jsonl,application/json,application/x-ndjson`,"aria-label":`导入会话文件`,hidden:!0,onChange:t=>{let n=t.currentTarget.files?.[0];t.currentTarget.value=``,n&&ln(async()=>{let t=await e.importSession(await n.text(),n.name);t.sessionFile&&_e(t.sessionFile)})},ref:xt,type:`file`})]}),(0,j.jsxs)(`div`,{className:`session-list-toolbar`,children:[(0,j.jsxs)(`div`,{className:`session-list-title`,children:[(0,j.jsx)(`strong`,{children:`会话`}),(0,j.jsx)(`span`,{children:gt||r.sessions.length})]}),(0,j.jsxs)(`div`,{className:`session-list-tools`,children:[(0,j.jsx)(`button`,{"aria-pressed":re,className:`session-tool-button ${re?`active`:``}`,onClick:()=>{ie(!re),bt(new Set),O(!1),fn()},type:`button`,children:re?`完成`:`选择`}),(0,j.jsxs)(`div`,{className:`session-tools-wrap`,"data-session-popover":!0,children:[(0,j.jsx)(`button`,{"aria-expanded":D,"aria-haspopup":`menu`,"aria-label":`会话工具`,className:`session-tool-button icon`,onClick:e=>{fn(),St.current=e.currentTarget,se(void 0),D?(O(!1),ne(void 0)):(ne(jc(e.currentTarget,150,190,`below`)),O(!0))},type:`button`,children:`⋯`}),D&&te&&(0,je.createPortal)((0,j.jsxs)(`div`,{className:`session-tools-popover`,"data-session-popover":!0,role:`menu`,style:te,children:[(0,j.jsx)(`button`,{autoFocus:!0,onClick:()=>window.location.reload(),role:`menuitem`,type:`button`,children:`刷新列表`}),(0,j.jsx)(`button`,{onClick:()=>{O(!1),ne(void 0),xt.current?.click()},role:`menuitem`,type:`button`,children:`导入会话`}),(0,j.jsx)(`button`,{disabled:!H||dt,onClick:()=>{H&&ln(async()=>{let t=await e.exportSession(H),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`${r.session?.sessionId??`session`}.jsonl`,n.click(),URL.revokeObjectURL(n.href)})},role:`menuitem`,type:`button`,children:`导出当前会话`}),(0,j.jsx)(`button`,{onClick:()=>{pt(e=>!e),O(!1),ne(void 0),R()},role:`menuitem`,type:`button`,children:I?`隐藏归档会话`:`显示归档会话`})]}),document.body)]})]})]}),re&&yt.size>0&&(0,j.jsxs)(`div`,{className:`session-batch-bar`,children:[(0,j.jsxs)(`span`,{children:[yt.size,` 个已选择`]}),(0,j.jsx)(`button`,{onClick:()=>void ln(()=>e.batchSessions(`archive`,[...yt]).then(()=>void 0)),type:`button`,children:`归档`}),(0,j.jsx)(`button`,{onClick:()=>void ln(()=>e.batchSessions(`pin`,[...yt]).then(()=>void 0)),type:`button`,children:`置顶`}),(0,j.jsx)(`button`,{className:`danger`,onClick:()=>{se(void 0),k(`batch-delete`)},type:`button`,children:`删除`})]}),(0,j.jsxs)(`div`,{className:`sidebar-scroll`,children:[yn&&r.session&&(0,j.jsxs)(`div`,{className:`session-group`,children:[(0,j.jsx)(`div`,{className:`group-label`,children:`当前`}),(0,j.jsxs)(`div`,{className:`session-row-wrap current-session-row`,children:[re&&(0,j.jsx)(`input`,{"aria-label":`选择当前会话`,checked:H?yt.has(H):!1,onChange:()=>H&&un(H),type:`checkbox`}),(0,j.jsxs)(`button`,{className:`session-row active`,onClick:()=>{d(void 0),h(!1),_(!1),l(`session`),s(`chat`),p(void 0),C(!1),R()},type:`button`,children:[(0,j.jsx)(`span`,{className:`session-dot ok`}),(0,j.jsxs)(`span`,{className:`session-copy`,children:[(0,j.jsx)(`strong`,{children:r.session.messages.length?r.session.sessionId.slice(0,12):`新会话`}),(0,j.jsxs)(`small`,{children:[r.session.messages.length,` 条消息`]})]})]}),!re&&H&&(0,j.jsx)(`button`,{"aria-expanded":S&&w===H,"aria-haspopup":`menu`,"aria-label":`当前会话操作`,className:`session-row-more`,"data-session-popover":!0,onClick:e=>dn(H,r.session?.messages.length?r.session?.sessionId.slice(0,12):`新会话`,e.currentTarget),type:`button`,children:`⋯`}),!re&&H&&w===H&&S&&E&&(0,j.jsx)(Ac,{busy:dt,position:E,onArchive:()=>{fn(),k(`archive`)},onDelete:()=>{fn(),k(`delete`)},onFork:()=>void ln(async()=>{let t=await e.forkSession(H);t.sessionFile&&(_e(t.sessionFile),await e.openSession(t.sessionFile))}),onRename:()=>{fn(),k(`rename`)}})]})]}),vn.length?vn.map(([t,n])=>(0,j.jsxs)(`div`,{className:`session-group`,children:[(0,j.jsx)(`div`,{className:`group-label`,children:t}),n.map((t,n)=>(0,j.jsxs)(`div`,{className:`session-row-wrap`,children:[re&&(0,j.jsx)(`input`,{"aria-label":`选择会话 ${$(t.name??t.firstMessage,`未命名会话`)}`,checked:typeof t.path==`string`&&yt.has(t.path),onChange:()=>{typeof t.path==`string`&&un(t.path)},type:`checkbox`}),(0,j.jsxs)(`button`,{className:`session-row ${t.sessionId===r.session?.sessionId?`active`:``}`,onClick:()=>cn(t),type:`button`,children:[(0,j.jsx)(`span`,{className:`session-dot ok`}),(0,j.jsxs)(`span`,{className:`session-copy`,children:[(0,j.jsx)(`strong`,{children:$(t.name??t.firstMessage,`未命名会话`)}),(0,j.jsxs)(`small`,{children:[$(t.messageCount,`0`),` 条消息`,t.pinned===!0?` · 已置顶`:``,t.archived===!0?` · 已归档`:``]})]})]}),!re&&typeof t.path==`string`&&(0,j.jsx)(`button`,{"aria-expanded":S&&w===t.path,"aria-haspopup":`menu`,"aria-label":`会话操作 ${$(t.name??t.firstMessage,`未命名会话`)}`,className:`session-row-more`,"data-session-popover":!0,onClick:e=>{e.stopPropagation(),dn(t.path,$(t.name??t.firstMessage,``),e.currentTarget)},type:`button`,children:`⋯`}),!re&&typeof t.path==`string`&&w===t.path&&S&&E&&(0,j.jsx)(Ac,{busy:dt,position:E,onArchive:()=>{fn(),k(`archive`)},onDelete:()=>{fn(),k(`delete`)},onFork:()=>void ln(async()=>{let n=await e.forkSession(t.path);n.sessionFile&&(_e(n.sessionFile),await e.openSession(n.sessionFile))}),onRename:()=>{fn(),k(`rename`)}})]},n))]},t)):yn?null:(0,j.jsx)(`div`,{className:`empty-state`,children:`暂无已保存会话`}),gt>30&&(0,j.jsxs)(`div`,{className:`session-pagination`,children:[(0,j.jsx)(`button`,{disabled:mt===0,onClick:()=>ht(e=>Math.max(0,e-1)),type:`button`,children:`上一页`}),(0,j.jsxs)(`span`,{children:[mt+1,` / `,Math.max(1,Math.ceil(gt/30))]}),(0,j.jsx)(`button`,{disabled:!L,onClick:()=>ht(e=>e+1),type:`button`,children:`下一页`})]}),U&&(0,j.jsxs)(`section`,{"aria-label":`工作区概览`,className:`mx-3 mt-3 rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`text-[11px] font-semibold text-[#253044]`,children:`工作区概览`}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[9px] ${U.clean===!0?`bg-[#eaf8f0] text-[#14733f]`:`bg-[#fff0f0] text-[#b42318]`}`,children:U.clean===!0?`clean`:`${$(U.changedCount??0)} 变更`})]}),(0,j.jsx)(`code`,{className:`mt-2 block truncate text-[10px] text-[#315fb8]`,children:$(U.cwd??`当前工作区`)}),(0,j.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-[#65707b]`,children:$(U.branch??`非 Git 工作区`)}),Array.isArray(U.changedFiles)&&U.changedFiles.length>0?(0,j.jsx)(`div`,{className:`mt-2 grid gap-1 border-t border-[#dce5f5] pt-2`,children:U.changedFiles.slice(0,3).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`code`,{className:`truncate text-[9px] text-[#65707b]`,children:[$(n.status??`??`),` `,$(n.path??`未命名`)]},`${$(n.path??`file`)}-${t}`)})}):null]})]}),(0,j.jsxs)(`footer`,{className:`sidebar-footer`,children:[(0,j.jsxs)(`div`,{className:`runtime-cells`,children:[(0,j.jsxs)(`span`,{children:[`model `,(0,j.jsx)(`b`,{children:$(r.status?.model)})]}),(0,j.jsxs)(`span`,{children:[`msgs `,(0,j.jsx)(`b`,{children:r.status?.messages??0})]}),(0,j.jsxs)(`span`,{children:[`status `,(0,j.jsx)(`b`,{children:$(r.status?.status,`connecting`)})]})]}),(0,j.jsx)(`button`,{"aria-label":`搜索会话、文件和命令`,className:`sidebar-link compact-session-search`,onClick:()=>{h(!1),O(!1),fn(),_(!0)},title:`搜索会话、文件和命令`,type:`button`,children:`⌕`}),(0,j.jsx)(`button`,{"aria-label":`新建会话`,className:`sidebar-link compact-new-session`,onClick:Qt,title:`新建会话`,type:`button`,children:`+`}),(0,j.jsxs)(`button`,{"aria-label":`插件,已安装 ${qt} 个`,className:`sidebar-link ${c===`plugins`||c===`marketplace`?`active`:``}`,onClick:()=>pn(void 0),title:`插件 · ${qt} 个`,type:`button`,children:[`◈ `,(0,j.jsx)(`span`,{children:`插件`}),(0,j.jsx)(`b`,{children:qt})]}),(0,j.jsxs)(`button`,{"aria-label":`设置`,className:`sidebar-link ${u?`active`:``}`,onClick:()=>{h(!1),_(!1),C(!1),T(void 0),p(void 0),d(`general`)},title:`设置`,type:`button`,children:[`⚙ `,(0,j.jsx)(`span`,{children:`设置`})]})]})]}),(0,j.jsxs)(`section`,{className:`main-pane`,children:[(0,j.jsxs)(`header`,{className:`main-header ${!u&&c===`session`?`session-track`:``}`,children:[(0,j.jsxs)(`div`,{className:`active-heading`,children:[(0,j.jsx)(`strong`,{children:u?`设置`:c===`plugins`?P?`插件详情`:`运行时插件`:c===`marketplace`?N?`插件详情`:`插件市场`:r.session?.messages.length?r.session.sessionId.slice(0,12):`新会话`}),(0,j.jsx)(`small`,{children:u?`运行时状态与配置`:c===`plugins`?P?nt?.name??Cc(P):`已安装插件`:c===`marketplace`?N?We?.name??N:`官方与社区 · 已审核目录`:bc(r.status,r.session)})]}),(0,j.jsx)(`div`,{className:`header-spacer`}),r.status?.status===`running`&&(0,j.jsxs)(`div`,{className:`run-indicator running`,children:[(0,j.jsx)(`span`,{className:`run-dot`}),(0,j.jsx)(`span`,{children:`运行中 · Pi agent`}),(0,j.jsx)(`button`,{className:`stop-button`,onClick:()=>{F(``),e.abort().then(R).catch(e=>F(e instanceof Error?e.message:String(e)))},type:`button`,children:`停止`})]}),!u&&c===`session`&&(0,j.jsx)(`div`,{"aria-label":`会话视图`,className:`view-tabs`,children:[`chat`,`trajectory`,`files`].map(e=>(0,j.jsx)(`button`,{"aria-pressed":a===e,className:`view-tab ${a===e?`active`:``}`,onClick:()=>{s(e),p(void 0)},type:`button`,children:e===`chat`?`对话`:e===`trajectory`?`轨迹`:`产出`},e))}),!u&&c===`session`&&(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`header-divider`}),!u&&c===`session`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`session-menu-wrap`,"data-session-popover":!0,children:[(0,j.jsx)(`button`,{"aria-expanded":S&&!w,"aria-haspopup":`menu`,className:`session-menu`,onClick:e=>{let t=S&&!w;T(void 0),ee(void 0),St.current=e.currentTarget,se(!t&&H?{name:r.session?.sessionId?.slice(0,12)||`当前会话`,path:H}:void 0),C(!t)},type:`button`,"aria-label":`会话操作`,children:`⋯`}),S&&!w&&(0,j.jsxs)(`div`,{className:`session-menu-popover compact-session-menu`,role:`menu`,children:[(0,j.jsxs)(`button`,{className:`session-action`,disabled:!H||dt,onClick:()=>{le(r.session?.sessionId?.slice(0,12)??``),k(`rename`),C(!1)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:`重命名`}),(0,j.jsx)(`small`,{children:`设置一个容易识别的名称`})]}),(0,j.jsxs)(`button`,{className:`session-action`,disabled:!H||dt,onClick:()=>void ln(async()=>{let t=await e.forkSession(H);t.sessionFile&&(_e(t.sessionFile),await e.openSession(t.sessionFile))}),role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:`复制会话`}),(0,j.jsx)(`small`,{children:`复制上下文并打开副本`})]}),(0,j.jsxs)(`button`,{className:`session-action`,disabled:!H||dt,onClick:()=>{C(!1),k(`archive`)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:`归档会话`}),(0,j.jsx)(`small`,{children:`从默认列表隐藏`})]}),(0,j.jsxs)(`button`,{className:`session-action danger`,disabled:!H||dt,onClick:()=>{C(!1),k(`delete`)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:`删除会话`}),(0,j.jsx)(`small`,{children:`永久删除本地记录`})]})]})]}),(0,j.jsxs)(`button`,{"aria-label":f===void 0?`打开详情`:`关闭详情`,"aria-pressed":f!==void 0,className:`details-toggle`,onClick:()=>p(f?void 0:{}),type:`button`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`◨`}),` `,(0,j.jsx)(`span`,{className:`details-toggle-label`,children:`详情`})]})]})]}),zt.length>0&&(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`refresh-warning`,role:`status`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`部分数据刷新失败`}),zt.join(`、`),`可能为空或显示上次结果。`]}),(0,j.jsx)(`button`,{onClick:()=>void R(),type:`button`,children:`重试`})]}),(0,j.jsx)(`div`,{className:`view-host`,children:Lt?(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`initial-loading`,role:`status`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`}),`正在连接 Pi runtime…`]}):_n})]}),!u&&c===`session`&&f!==void 0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{"aria-label":`关闭详情`,className:`details-backdrop`,onClick:()=>p(void 0),type:`button`}),(0,j.jsx)(Pc,{event:Object.keys(f).length?f:void 0,onClose:()=>p(void 0),onCopy:()=>void navigator.clipboard?.writeText(JSON.stringify(f,null,2))})]}),g&&(0,j.jsx)(Zc,{commands:r.commands,files:r.files,onClose:()=>_(!1),onOpenFile:e=>{l(`session`),s(`files`),p({type:`file`,path:e.path,status:e.status})},onOpenSession:cn,onUse:be,sessions:r.sessions}),ue&&(0,j.jsx)(Dc,{error:fe,onClose:()=>de(!1),onPickDirectory:B,onSelect:e=>void Zt(e),workspaces:r.workspaces}),ae&&(0,j.jsx)(Oc,{busy:dt,count:ae===`batch-delete`?yt.size:void 0,kind:ae,name:ae===`rename`||ae===`batch-delete`?void 0:oe?.name??$(r.session?.sessionId,`当前会话`),onChange:le,onClose:()=>{k(void 0),se(void 0)},onConfirm:()=>{let t=oe?.path??H;ae===`rename`&&t?ln(()=>e.renameSession(t,ce.trim()).then(()=>void 0)):ae===`archive`&&t?ln(async()=>{await e.setSessionMetadata(t,{archived:!0})}):ae===`delete`&&t?ln(async()=>{await e.deleteSession(t)}):ae===`batch-delete`&&ln(()=>e.batchSessions(`delete`,[...yt]).then(()=>void 0))},value:ce})]})}var rl=class{context;root;version;#e;constructor(e,t={}){this.root=e,this.version=t.version,this.context=new Ae}run(){this.context.provide(`clientRoot`,this.root),this.context.provide(`clientApi`,Ne()),this.#e=(0,s.createRoot)(this.root),this.#e.render((0,o.createElement)(nl,{api:this.context.clientApi,appVersion:this.version}))}async dispose(){this.#e?.unmount(),await this.context.fiber.dispose()}},il=document.getElementById(`root`);if(!(il instanceof HTMLElement))throw Error(`Pi Harness web app is missing #root`);var al=new rl(il,{version:`0.1.27`});try{al.run()}catch(e){il.textContent=e instanceof Error?e.message:String(e)}
25
+ `)}):null,t.diagnosticsTruncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[#8a5a00]`,children:`诊断预览已截断,完整计数保留在摘要中。`}):null]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`max:`,Math.round(e.limits.fileBytes/1024),`KiB · read-only`]})]})})():e.id===`browser-session-panel`?(()=>{let e=Vn(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] text-[#b42318]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:`Browser Session 面板数据异常`}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:`面板数据不完整或不可信,请重新连接后再试。`})]});let t=e.tabs,r=e.latest,i=r?.screenshot?`已截图`:r?.clicked===!0?`已点击`:r?.status===`read`||typeof r?.text==`string`?`已读取`:r?.status===`navigated`?`已导航`:void 0;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:e.endpoint||`本地浏览器未连接`}),(0,j.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] font-semibold ${e.connected?`bg-[#e8f8ee] text-[#14733f]`:`bg-[#fff4e5] text-[#8a5a00]`}`,children:e.connected?`已连接`:`未连接`})]}),(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:[`Chrome DevTools Protocol · 显示 `,e.inventory.shown,`/`,e.inventory.total,` 个可调试页面`]}),e.connected?null:(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#b42318]`,children:[`请使用 remote-debugging-port 启动 Chrome。`,e.error??``]})]}),i?(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-2 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[#65707b]`,children:`最近动作`}),(0,j.jsx)(`strong`,{className:`font-mono text-[#315fb8]`,children:i})]}):null,r?.text===void 0?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap break-words text-[10px] leading-4 text-[#4c5663]`,children:r.text}),r.previewTruncated?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[#8a5a00]`,children:`面板正文预览已截断。`}):null]}),r?.screenshot===void 0?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-2 text-[10px] text-[#315fb8]`,children:[`截图元数据:`,r.screenshot.mimeType,` · `,r.screenshot.bytes.toLocaleString(),` bytes`]}),t.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.map(e=>(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:e.title}),(0,j.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[#687381]`,children:e.url})]},e.targetId))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有可调试的浏览器页面。`}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`tabs`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`read`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`click`}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`screenshot`})]})]})})():e.id===`mcp-client-panel`?(()=>{let e=ya(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:$(e.server??`尚未连接 MCP 服务器`)}),(0,j.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 font-mono text-[10px] text-[#3565c5]`,children:[(0,j.jsxs)(`span`,{children:[e.inventory.tools.total,` 工具`]}),(0,j.jsx)(`span`,{className:`text-[#687381]`,children:`·`}),(0,j.jsxs)(`span`,{children:[e.inventory.resources.total,` 资源`]}),(0,j.jsx)(`span`,{className:`text-[#687381]`,children:`·`}),(0,j.jsxs)(`span`,{children:[e.inventory.prompts.total,` 提示`]})]})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:e.lastCall===null?`使用 mcp_list_tools 发现 stdio 工具。`:`最近调用:${e.lastCall}`})]}),e.tools.length>0?(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.tools.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,title:e.description,children:e.name},`${e.name}-${t}`))}):null,e.resources.length>0?(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[#687381]`,children:`资源`}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.resources.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#65707b]`,title:e.uri,children:e.name??e.uri},`${e.uri}-${t}`))})]}):null,e.prompts.length>0?(0,j.jsxs)(`div`,{className:`grid gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[#687381]`,children:`提示模板`}),(0,j.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.prompts.map((e,t)=>(0,j.jsx)(`span`,{className:`max-w-full truncate rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#65707b]`,title:e.description,children:e.name},`${e.name}-${t}`))})]}):null,e.servers.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:e.servers.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[#30343b]`,children:e.id}),(0,j.jsx)(`span`,{className:e.status===`running`?`text-[#14733f]`:`text-[#687381]`,children:e.status})]},`${e.id}-${t}`))}):null,e.inventory.tools.truncated||e.inventory.resources.truncated||e.inventory.prompts.truncated||e.inventory.servers.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`面板仅显示受限预览;完整清单请使用对应 MCP 列表工具。`}):null,(0,j.jsxs)(`p`,{className:`font-mono text-[9px] text-[#8a94a1]`,children:[`响应上限 `,Math.round(e.limits.responseBytes/1024),` KiB · 请求超时 `,Math.round(e.limits.requestTimeoutMs/1e3),` 秒`]})]})})():e.id===`mcp-panel`?(()=>{let e=Array.isArray(n?.servers)?n.servers:[];return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.length>0?(0,j.jsx)(`ul`,{className:`grid gap-2`,children:e.map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.status===`running`;return(0,j.jsxs)(`li`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[#30343b]`,children:$(n.id,`未命名服务器`)}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${r?`bg-[#eaf8f0] text-[#14733f]`:`bg-[#fff5f5] text-[#b42318]`}`,children:$(n.status,`unknown`)})]}),(0,j.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[$(n.toolCount,`0`),` 个桥接工具`]}),(0,j.jsx)(`span`,{children:`·`}),(0,j.jsx)(`span`,{children:$(n.statusSource,`runtime`)})]})]},`${$(n.id??`server`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前没有 MCP 服务器快照。`}),(0,j.jsxs)(`div`,{className:`text-[10px] text-[#687381]`,children:[`只读读取官方 MCP bridge 状态;健康建议通过 mcp_panel 的 health 操作查看。`,n?.writesEnabled===!0?` 已启用 profile patch 写入:${$(n.patchPath)}`:` profile patch 写入未配置,apply 会被拒绝。`]})]})})():e.id===`mock-server-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.running===!0?`运行中`:`未启动`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[11px] text-[#3565c5]`,children:[$(n?.routes??0),` 路由`]})]}),n?.url?(0,j.jsx)(`code`,{className:`rounded-md bg-white px-3 py-2 text-[10px] text-[#65707b]`,children:$(n.url)}):null,n?.lastRequest?(0,j.jsxs)(`p`,{className:`text-[11px] text-[#687381]`,children:[`最近请求:`,$(n.lastRequest)]}):null]}):e.id===`cli-notifier-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.enabled===!0?`已启用`:`已停用`}),(0,j.jsxs)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:[$(n?.platform??`unknown`),` · `,$(n?.timeoutMs??1e4),`ms`]})]}),Array.isArray(n?.notifications)&&n.notifications.length>0?(0,j.jsx)(`div`,{className:`grid gap-2`,children:n.notifications.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`text-[#30343b]`,children:$(n.title??`Pi Harness`)}),(0,j.jsx)(`span`,{className:n.delivered===!0?`text-[#14733f]`:`text-[#b42318]`,children:n.delivered===!0?`已送达`:`未送达`})]}),(0,j.jsx)(`span`,{className:`mt-1 block text-[#65707b]`,children:$(n.message,``)}),n.delivered!==!0&&n.reason?(0,j.jsx)(`span`,{className:`mt-1 block break-words text-[#b42318]`,children:$(n.reason)}):null]},`${$(n.time??`notification`)}-${t}`)})}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有发送通知。`})]}):e.id===`obsidian-sync-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.configured===!0?`已配置`:`未配置 vault`}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:`Markdown`})]}),n?.vaultPath?(0,j.jsx)(`code`,{className:`truncate rounded-md bg-white px-3 py-2 text-[10px] text-[#65707b]`,children:$(n.vaultPath)}):null,n?.last!==null&&n?.last!==void 0&&typeof n.last==`object`?(0,j.jsxs)(`p`,{className:`text-[11px] text-[#687381]`,children:[`最近写入:`,$(n.last.relativePath??`note.md`)]}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有同步笔记。`})]}):e.id===`web-research-panel`?(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3 text-[11px]`,children:[(0,j.jsx)(`span`,{className:`text-[#315fb8]`,children:n?.keyless===!0?`Firecrawl 匿名模式`:`Firecrawl 已认证`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[#315fb8]`,children:[`最多 `,$(n?.maxResults??8),` 条`]})]}),n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.items)?e.items:[];return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[11px]`,children:[(0,j.jsx)(`strong`,{className:`truncate text-[#30343b]`,children:$(e.query??`网页搜索`)}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[#687381]`,children:[`前 `,Math.min(8,t.length),` / 共 `,t.length]})]}),(0,j.jsx)(`div`,{className:`grid gap-2`,children:t.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`a`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 transition-colors hover:border-[#bdd0f5] hover:bg-[#fbfdff]`,href:$(n.url,``),rel:`noreferrer`,target:`_blank`,children:[(0,j.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:$(n.title??n.url??`来源`)}),(0,j.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[#3565c5]`,children:$(n.source??n.url,``)}),n.snippet?(0,j.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-[10px] leading-4 text-[#65707b]`,children:$(n.snippet)}):null]},`${$(n.url??`source`)}-${t}`)})})]})})():(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有联网搜索。可让 Agent 调用 web_search;单页读取使用 read_page。`}),(0,j.jsxs)(`p`,{className:`text-[10px] text-[#687381]`,children:[`搜索词会发送到 Firecrawl;页面读取`,n?.readPageAvailable===!0?`已复用本地 Browser Fetch`:`需要启用 Browser Fetch`,`。`]})]}):e.id===`browser-fetch-panel`?(()=>{let e=yn(n);if(e.malformed)return(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] text-[#b42318]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:`Browser Fetch 面板数据异常`}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:`面板数据不完整或不可信,请重新加载后再抓取。`})]});let t=e.latest;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有抓取网页。默认阻止本地和私有网络目标。`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:$(t.finalUrl||t.url||`page`)}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#14733f]`,children:[`HTTP `,$(t.status||`—`)]})]}),(0,j.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:$(t.text,``)}),t.previewTruncated||t.truncated?(0,j.jsxs)(`p`,{className:`text-[10px] text-[#9a6700]`,children:[t.truncated?`响应正文已达到抓取上限;`:``,t.previewTruncated?`面板仅显示有界预览。`:``]}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`max:`,$(Math.round(e.limits.responseBytes/1024)),`KiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`timeout:`,$(e.limits.timeoutMs),`ms`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`redirects:`,$(e.limits.redirects)]}),(0,j.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:`scripts:disabled`}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`private:`,$(e.allowPrivate?`allowed`:`blocked`)]})]})]})})():e.id===`i18n-pair-panel`?(()=>{let e=ra(n),t=e.report,r=t!==null&&t.missingTotal===0&&t.extraTotal===0,i=e.status.state===`unknown`?`数据异常`:e.status.state===`running`?`检查中`:e.status.state===`failed`?`检查失败`:e.status.state===`cancelled`?`已取消`:e.status.state===`completed`?`已完成`:`等待检查`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px] text-[#687381]`,children:[(0,j.jsx)(`span`,{className:`rounded-full border border-[#dce5f5] bg-[#f6f8fa] px-2 py-1 font-semibold text-[#3565c5]`,children:i}),e.status.at===null?null:(0,j.jsx)(`time`,{className:`font-mono`,children:new Date(e.status.at).toLocaleString()})]}),e.status.error===null?null:(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[10px] leading-4 text-[#b42318]`,children:e.status.error}),e.malformed?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[10px] leading-4 text-[#b42318]`,children:`面板数据不完整或不可信,未显示语言包统计。`}):null,t===null?(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有检查语言包。可让 Agent 调用 i18n_check。`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${r?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`}`,children:r?`语言包键完全一致。`:`缺失 ${t.missingTotal} 个,额外 ${t.extraTotal} 个。`}),(0,j.jsxs)(`div`,{className:`grid gap-2 rounded-lg border border-[#edf0f3] bg-[#fbfcfd] px-3 py-3 font-mono text-[10px]`,children:[(0,j.jsxs)(`div`,{className:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[#687381]`,children:`基准`}),(0,j.jsx)(`span`,{className:`truncate text-[#30343b]`,title:t.base,children:t.base})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-[3rem_minmax(0,1fr)] gap-2`,children:[(0,j.jsx)(`span`,{className:`text-[#687381]`,children:`目标`}),(0,j.jsx)(`span`,{className:`truncate text-[#30343b]`,title:t.target,children:t.target})]})]}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`基准键`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:t.baseKeys})]}),(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`目标键`}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:t.targetKeys})]})]}),t.missing.length>0||t.extra.length>0?(0,j.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[{label:`缺失 · ${t.missingTotal}`,keys:t.missing,tone:`text-[#b42318]`},{label:`额外 · ${t.extraTotal}`,keys:t.extra,tone:`text-[#9a6700]`}].map(e=>(0,j.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3`,children:[(0,j.jsx)(`strong`,{className:`text-[10px] ${e.tone}`,children:e.label}),(0,j.jsx)(`ul`,{className:`mt-2 max-h-36 space-y-1 overflow-auto font-mono text-[10px] text-[#30343b]`,children:e.keys.map((e,t)=>(0,j.jsx)(`li`,{className:`truncate`,title:e,children:e},`${e}-${t}`))})]},e.label))}):null,t.truncated?(0,j.jsx)(`p`,{className:`text-[10px] text-[#9a6700]`,children:`面板仅显示有界键列表;完整结果保留在工具调用详情中。`}):null]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap gap-2 font-mono text-[10px] text-[#3565c5]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`file:`,Math.round(e.limits.fileBytes/1048576),`MiB`]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`depth:`,e.limits.depth]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`keys:`,e.limits.keysPerFile]})]})]})})():e.id===`cleaner-panel`?(()=>{let e=ur(n);if(e.malformed||e.inventory===null)return(0,j.jsxs)(`div`,{className:`mt-3 rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-3 text-[11px] text-[#b42318]`,children:[(0,j.jsx)(`strong`,{className:`block text-[12px]`,children:`Cleaner 面板数据异常`}),(0,j.jsx)(`span`,{className:`mt-1 block`,children:`面板数据不完整或不可信,请重新加载后再执行清理。`})]});let t=e.inventory,r=e.lastCleanup,i=r?.status===`running`?`清理中`:r?.status===`completed`?`已完成`:r?.status===`cancelled`?`已取消`:r?.status===`failed`?`清理失败`:`尚未清理`;return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`Git 胶囊库存`}),(0,j.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#3565c5]`,children:[t.total,` 个`]})]}),(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`仅清理 agent 数据目录中的 .patch 胶囊,必须显式 confirm=true。`}),(0,j.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 font-mono text-[10px] text-[#3565c5]`,children:[(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`capsules:`,e.limits.capsules]}),(0,j.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1`,children:[`scan:`,e.limits.directoryEntries]})]})]}),r===null?null:(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#fbfcfd] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[10px]`,children:[(0,j.jsx)(`strong`,{className:r.status===`failed`?`text-[#b42318]`:`text-[#30343b]`,children:i}),r.at===null?null:(0,j.jsx)(`time`,{className:`font-mono text-[#687381]`,children:new Date(r.at).toLocaleString()})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex gap-4 text-[11px] text-[#687381]`,children:[(0,j.jsxs)(`span`,{children:[`已删 `,(0,j.jsx)(`strong`,{className:`font-mono text-[#30343b]`,children:r.removed})]}),(0,j.jsxs)(`span`,{children:[`保留 `,(0,j.jsx)(`strong`,{className:`font-mono text-[#30343b]`,children:r.kept??`—`})]}),(0,j.jsxs)(`span`,{children:[`请求保留 `,(0,j.jsx)(`strong`,{className:`font-mono text-[#30343b]`,children:r.requestedKeep})]})]}),r.error===null?null:(0,j.jsx)(`p`,{className:`mt-2 break-words text-[10px] leading-4 text-[#b42318]`,children:r.error})]}),e.capsules.length>0?(0,j.jsx)(`div`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd]`,children:e.capsules.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`truncate font-mono text-[10px] text-[#30343b]`,title:e.name,children:e.name}),(0,j.jsxs)(`span`,{className:`shrink-0 font-mono text-[9px] text-[#687381]`,children:[e.bytes.toLocaleString(),` B`]})]},`${e.name}-${t}`))}):(0,j.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前没有可清理的 Git 胶囊。`}),t.truncated?(0,j.jsxs)(`p`,{className:`text-[10px] text-[#9a6700]`,children:[`面板显示 `,t.shown,` / `,t.total,` 个条目;清理工具仍按完整的有界库存执行。`]}):null]})})():e.id===`fail-logger-panel`?(0,j.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=oi(n);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#fff5f5] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#7f1d1d]`,children:`聚合后的失败记录`}),(0,j.jsx)(`strong`,{className:`font-mono text-[17px] text-[#b42318]`,children:e.total})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3 text-[10px] text-[#8b4a4a]`,children:[(0,j.jsxs)(`span`,{children:[`观测 `,e.observed,` 次`]}),(0,j.jsxs)(`span`,{children:[`容量 `,e.total,` / `,e.capacity]}),e.dropped>0?(0,j.jsxs)(`span`,{children:[`已淘汰 `,e.dropped,` 条旧记录`]}):null,e.truncated?(0,j.jsx)(`span`,{children:`面板明细已截断`}):null]})]}),(0,j.jsx)(`div`,{className:`max-h-56 overflow-auto rounded-lg border border-[#edf0f3]`,children:e.failures.length>0?e.failures.map((e,t)=>(0,j.jsxs)(`div`,{className:`border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#b42318]`,children:e.source}),(0,j.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 font-mono text-[9px] text-[#8a94a0]`,children:[e.occurrences>1?(0,j.jsxs)(`strong`,{className:`text-[#b42318]`,children:[`×`,e.occurrences]}):null,e.time===null?`时间未知`:`${e.time.slice(11,19)} UTC`]})]}),(0,j.jsx)(`p`,{className:`mt-1 break-words text-[11px] leading-4 text-[#65707b]`,children:e.message})]},`${e.time??`failure`}-${t}`)):(0,j.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[#687381]`,children:`暂无失败记录。`})})]})})()}):e.id===`context-insight-panel`?(()=>{let e=fo(n);return(0,j.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[#5d6d82]`,children:`上下文占用`}),(0,j.jsx)(`strong`,{className:`text-[13px] font-semibold text-[#315fb8]`,children:e.percent===null?`—`:`${e.percent}%`})]}),(0,j.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-[#dfe8fb]`,children:(0,j.jsx)(`div`,{className:`h-full rounded-full bg-[#5d8bea] transition-[width] duration-300`,style:{width:`${Math.min(100,e.percent??0)}%`}})}),(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#5d6d82]`,children:[e.tokens===null?`令牌数未知`:`${e.tokens.toLocaleString()} tokens`,e.contextWindow===null?``:` / ${e.contextWindow.toLocaleString()} 上限`]})]}),(0,j.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`消息`,e.messages],[`事件`,e.events],[`压缩`,e.compactions]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:$(t)})]},$(e)))}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`消息组成`}),(0,j.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:e.messagesTruncated?`最近 ${e.scannedMessages} / ${e.messages} 条`:`全部 ${e.scannedMessages} 条`})]}),(0,j.jsx)(`div`,{className:`mt-2 grid grid-cols-5 gap-1.5`,children:[[`用户`,e.composition.user],[`助手`,e.composition.assistant],[`工具`,e.composition.toolResult],[`系统`,e.composition.system],[`其他`,e.composition.other]].map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded bg-[#f6f8fa] px-2 py-1.5 text-center`,children:[(0,j.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:$(e)}),(0,j.jsx)(`strong`,{className:`mt-0.5 block font-mono text-[13px] text-[#30343b]`,children:$(t)})]},$(e)))})]}),(0,j.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,j.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`最近上下文事件`}),(0,j.jsxs)(`span`,{className:`text-[10px] text-[#687381]`,children:[`显示 `,e.limits.displayedEvents,` / 保留 `,e.limits.retainedEvents,` 条`]})]}),(0,j.jsx)(`div`,{className:`mt-2 max-h-28 overflow-auto`,children:e.recentEvents.length>0?e.recentEvents.map((e,t)=>(0,j.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[#f0f2f5] py-1.5 last:border-b-0`,children:[(0,j.jsx)(`span`,{className:`font-mono text-[10px] text-[#5d6d82]`,children:e.type}),(0,j.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:e.at===null?`—`:new Date(e.at).toLocaleTimeString()})]},`${e.type}-${e.at??`unknown`}-${t}`)):(0,j.jsx)(`div`,{className:`py-2 text-[11px] text-[#687381]`,children:`暂无上下文事件。`})}),e.recentEventsTruncated?(0,j.jsx)(`p`,{className:`mt-2 text-[10px] text-[#687381]`,children:`更早事件已按浏览器显示上限省略。`}):null]})]})})():(0,j.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.map(([e,t])=>(0,j.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,j.jsx)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:e}),(0,j.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words text-[12px] leading-5 text-[#30343b]`,children:Lc(t)})]},e))})]})}function Bc({pluginName:e,busy:t,error:n,onCancel:r,onConfirm:i}){let a=yc(!0,r,t);return(0,j.jsx)(`div`,{className:`plugin-confirm-backdrop`,onClick:()=>{t||r()},children:(0,j.jsxs)(`div`,{"aria-label":`确认卸载插件`,"aria-modal":`true`,className:`plugin-confirm-dialog`,onClick:e=>e.stopPropagation(),ref:a,role:`dialog`,tabIndex:-1,children:[(0,j.jsx)(`header`,{children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`卸载插件?`}),(0,j.jsx)(`small`,{children:`将从运行配置中移除,之后可以从插件市场重新安装。`})]})}),(0,j.jsx)(`code`,{children:e}),n&&(0,j.jsx)(`p`,{className:`plugin-confirm-error`,role:`alert`,children:n}),(0,j.jsxs)(`footer`,{children:[(0,j.jsx)(`button`,{"data-dialog-initial-focus":!0,disabled:t,onClick:r,type:`button`,children:`取消`}),(0,j.jsx)(`button`,{className:`danger`,disabled:t,onClick:i,type:`button`,children:t?`卸载中…`:`确认卸载`})]})]})})}function Vc({label:e,categories:t,activeCategory:n,onChange:r}){let i=(0,o.useRef)(null),[a,s]=(0,o.useState)(!1),[c,l]=(0,o.useState)(!1),u=(0,o.useCallback)(()=>{let e=i.current;if(!e)return;let t=Math.max(0,e.scrollWidth-e.clientWidth);s(e.scrollLeft>1),l(e.scrollLeft<t-1)},[]);(0,o.useEffect)(()=>{let e=i.current;if(!e)return;u();let t=typeof ResizeObserver>`u`?void 0:new ResizeObserver(u);return t?.observe(e),window.addEventListener(`resize`,u),()=>{t?.disconnect(),window.removeEventListener(`resize`,u)}},[t,u]);let d=e=>{let t=i.current;t&&t.scrollBy({behavior:`smooth`,left:e*Math.max(180,t.clientWidth*.72)})};return(0,j.jsxs)(`div`,{className:`marketplace-categories-shell ${a?`can-scroll-left`:``} ${c?`can-scroll-right`:``}`,children:[a&&(0,j.jsx)(`button`,{"aria-label":`向左查看更多分类`,className:`marketplace-category-scroll previous`,onClick:()=>d(-1),type:`button`,children:`‹`}),(0,j.jsx)(`nav`,{"aria-label":e,className:`marketplace-categories`,onScroll:u,ref:i,children:t.map(e=>{let t=n===e.id;return(0,j.jsxs)(`button`,{"aria-pressed":t,className:`marketplace-category ${t?`active`:``}`,onClick:()=>r(e.id),type:`button`,children:[(0,j.jsx)(`span`,{children:e.label}),(0,j.jsx)(`span`,{className:t?`font-mono text-[10px] text-[#3565c5]`:`font-mono text-[10px] text-[#687381]`,children:e.count})]},e.id||`all`)})}),c&&(0,j.jsx)(`button`,{"aria-label":`向右查看更多分类`,className:`marketplace-category-scroll next`,onClick:()=>d(1),type:`button`,children:`›`})]})}function Hc({plugins:e,panels:t,catalog:n,onMarketplace:r,onOpenDetail:i,onToml:a,onToggle:s,onUninstall:c}){let l=(0,o.useMemo)(()=>new Map(n.map(e=>[e.packageName,e])),[n]),u=(0,o.useMemo)(()=>new Set(t.map(e=>e.pluginId)),[t]),d=(0,o.useMemo)(()=>e.filter(e=>e.removable||u.has(e.name)),[u,e]),[f,p]=(0,o.useState)(``),[m,h]=(0,o.useState)(``),[g,_]=(0,o.useState)(),[v,y]=(0,o.useState)(``),[b,x]=(0,o.useState)(),S=(0,o.useRef)(null),C=(0,o.useMemo)(()=>{let e=new Map;for(let t of d){let n=l.get(t.name)?.category??t.category??{id:`other`,label:`其他`},r=e.get(n.id);e.set(n.id,{...n,count:(r?.count??0)+1})}return $e([...e.values()].sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label,`zh-CN`)))},[l,d]),w=(0,o.useMemo)(()=>d.filter(e=>{let t=l.get(e.name),n=t?.category??e.category??{id:`other`,label:`其他`};if(m&&n.id!==m)return!1;let r=[e.name,t?.name,Cc(e.name),t?.category.label,...t?.capabilities??[],e.category?.label,Sc(e.name)];return dr(f,r)}),[l,m,d,f]);(0,o.useEffect)(()=>{S.current?.scrollTo({top:0})},[m,f]),(0,o.useEffect)(()=>{m&&!C.some(e=>e.id===m)&&h(``)},[m,C]);let T=async(e,t)=>{y(``),_(e.id);try{return await t(e),!0}catch(e){return y(e instanceof Error?e.message:String(e)),!1}finally{_(void 0)}};return(0,j.jsx)(`section`,{className:`view-panel plugins-view`,children:(0,j.jsxs)(`div`,{className:`plugins-page`,children:[(0,j.jsxs)(`div`,{className:`subnav`,children:[(0,j.jsxs)(`div`,{"aria-label":`插件目录`,className:`segmented`,children:[(0,j.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:`已安装`}),(0,j.jsx)(`button`,{"aria-pressed":`false`,onClick:r,type:`button`,children:`插件市场`})]}),(0,j.jsx)(`span`,{children:`已安装插件`}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),a()},children:`查看运行配置`})]}),(0,j.jsxs)(`div`,{className:`plugins-toolbar`,children:[(0,j.jsx)(`input`,{"aria-label":`搜索已安装插件`,onChange:e=>p(e.target.value),placeholder:`搜索名称、包名或能力…`,type:`search`,value:f}),(0,j.jsxs)(`span`,{"aria-live":`polite`,children:[f.trim()||m?`${w.length} / ${d.length}`:`${d.length}`,` 个插件`]})]}),(0,j.jsx)(Vc,{activeCategory:m,categories:C,label:`已安装插件分类`,onChange:h}),(0,j.jsxs)(`div`,{className:`plugins-scroll`,ref:S,children:[(0,j.jsxs)(`div`,{className:`plugins-list`,children:[w.map(e=>{let t=l.get(e.name),n=t?.category.label??e.category?.label,r=Sc(e.name),a=t?.name??Cc(e.name),o=pr(e,t);return(0,j.jsxs)(`article`,{className:`catalog-card plugin-card`,children:[(0,j.jsxs)(`div`,{className:`plugin-card-head`,children:[(0,j.jsx)(`span`,{className:`plugin-icon`,children:`◈`}),(0,j.jsx)(`div`,{className:`plugin-copy`,children:(0,j.jsxs)(`div`,{className:`plugin-heading`,children:[(0,j.jsxs)(`div`,{className:`plugin-title`,children:[(0,j.jsx)(`strong`,{children:a}),(0,j.jsx)(`span`,{className:`plugin-state ${e.enabled?`active`:``}`,children:e.enabled?`运行中`:`已停用`}),n&&(0,j.jsx)(`span`,{className:`capability`,children:n}),n!==r&&(0,j.jsx)(`span`,{className:`capability`,children:r})]}),(0,j.jsx)(`div`,{className:`plugin-actions`,children:e.removable?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{"aria-label":`${e.enabled?`停用`:`启用`} ${a}`,"aria-pressed":e.enabled,className:`plugin-switch-button`,disabled:g!==void 0,onClick:()=>void T(e,e=>s(e)),type:`button`,children:(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`switch ${e.enabled?`on`:``}`,children:(0,j.jsx)(`i`,{})})}),(0,j.jsx)(`button`,{className:`plugin-uninstall`,disabled:g!==void 0,onClick:()=>{y(``),x(e)},type:`button`,children:`卸载`})]}):(0,j.jsx)(`span`,{className:`switch ${e.enabled?`on`:``}`,children:(0,j.jsx)(`i`,{})})})]})})]}),(0,j.jsxs)(`div`,{className:`plugin-card-body`,children:[(0,j.jsx)(`code`,{className:`plugin-package`,children:o.packageLabel}),(0,j.jsx)(`p`,{className:`plugin-description`,children:o.description}),(0,j.jsx)(`div`,{className:`hook-list`,children:o.tags.map((e,t)=>(0,j.jsx)(`span`,{children:e},`${e}-${t}`))})]}),(0,j.jsxs)(`footer`,{className:`plugin-card-footer`,children:[(0,j.jsx)(`button`,{"aria-label":`查看 ${a} 详情`,className:`plugin-detail-link`,onClick:()=>i(e),type:`button`,children:`查看详情 →`}),u.has(e.name)?(0,j.jsx)(`span`,{children:`实时面板`}):null]})]},e.id)}),d.length?w.length?null:(0,j.jsx)(`div`,{className:`empty-state`,children:`没有匹配当前搜索与分类条件的已安装插件。`}):(0,j.jsx)(`div`,{className:`empty-state`,children:`还没有安装可管理的插件。去插件市场安装一个吧。`})]}),v&&(0,j.jsx)(`p`,{className:`plugin-action-error`,children:v}),t.length>d.length&&(0,j.jsxs)(`section`,{className:`mt-4 border-t border-[#e3e7ee] pt-4`,children:[(0,j.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`其他插件面板`}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[#687381]`,children:`由已启用插件提供的实时状态。`})]}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:`LIVE`})]}),(0,j.jsx)(`div`,{className:`grid gap-3 xl:grid-cols-2`,children:t.filter(e=>!d.some(t=>t.name===e.pluginId)).map(e=>(0,j.jsx)(zc,{panel:e},e.id))})]})]}),b&&(0,j.jsx)(Bc,{busy:g!==void 0,error:v,onCancel:()=>x(void 0),onConfirm:()=>void T(b,c).then(e=>{e&&x(void 0)}),pluginName:l.get(b.name)?.name??Cc(b.name)})]})})}function Uc({plugin:e,panel:t,metadata:n,onBack:r,onToggle:i,onUninstall:a}){let[s,c]=(0,o.useState)(),[l,u]=(0,o.useState)(``),[d,f]=(0,o.useState)(!1),p=n?.name??Cc(e.name),m=async(e,t)=>{u(``),c(e);try{return await t(),!0}catch(e){return u(e instanceof Error?e.message:String(e)),!1}finally{c(void 0)}};return(0,j.jsxs)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),r()},children:`← 已安装插件`}),(0,j.jsx)(`span`,{children:`插件详情`})]}),(0,j.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,j.jsxs)(`header`,{className:`border-b border-[#e3e7ee] pb-7`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded px-2 py-1 font-mono text-[10px] ${e.enabled?`bg-[#e6faed] text-[#14733f]`:`bg-[#eef0f3] text-[#687381]`}`,children:e.enabled?`运行中`:`已停用`}),(0,j.jsx)(`span`,{className:`rounded bg-[#f2edff] px-2 py-1 text-[10px] text-[#6d4bc3]`,children:n?.category.label??e.category?.label??`运行时插件`}),(0,j.jsx)(`span`,{className:`rounded bg-[#e4edfd] px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:Sc(e.name)})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[#687381]`,children:`PLUGIN DETAIL`}),(0,j.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[#20252b]`,children:p}),(0,j.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[#687381]`,children:[e.name,n?` · v${n.version}`:``]})]}),e.removable?(0,j.jsxs)(`div`,{className:`plugin-detail-actions`,children:[(0,j.jsx)(`button`,{className:`plugin-detail-action`,disabled:s!==void 0,onClick:()=>void m(`toggle`,()=>i(e)),type:`button`,children:s===`toggle`?`处理中…`:e.enabled?`停用插件`:`启用插件`}),(0,j.jsx)(`button`,{className:`plugin-detail-action danger`,disabled:s!==void 0,onClick:()=>{u(``),f(!0)},type:`button`,children:`卸载插件`})]}):(0,j.jsx)(`span`,{className:`rounded-full bg-[#eef0f3] px-3 py-1.5 text-[11px] text-[#687381]`,children:`内置组件`})]}),(0,j.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[#59636e]`,children:n?.description??(e.enabled?`由当前运行时加载并启用,能力与 hook 已注册。`:`插件保留在运行配置中,但当前处于停用状态。`)}),l&&(0,j.jsxs)(`p`,{className:`mt-3 text-[12px] text-[#b42318]`,role:`alert`,children:[`操作失败:`,l]})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件能力`}),(0,j.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(n?.capabilities.length?n.capabilities:[Sc(e.name)]).map(e=>(0,j.jsx)(`span`,{className:`rounded-md bg-[#f1f4f9] px-2 py-1 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}),n?.hooks.length?(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`扩展点`}),(0,j.jsx)(`div`,{className:`mt-4 space-y-2`,children:n.hooks.map(e=>(0,j.jsx)(`div`,{className:`rounded-md bg-[#f8f9fb] px-3 py-2 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}):null,(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`实时详情`}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[#687381]`,children:`当前本机会话中的插件运行状态。`})]}),(0,j.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.1em] text-[#687381]`,children:`LIVE`})]}),t?(0,j.jsx)(zc,{inline:!0,panel:t}):(0,j.jsx)(`div`,{className:`empty-state`,children:`这个插件暂未提供实时面板。`})]})]}),(0,j.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件信息`}),(0,j.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`运行状态`}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.state})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`配置标识`}),(0,j.jsx)(`dd`,{className:`max-w-[150px] break-all text-right font-mono text-[#3b424b]`,children:e.id})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`分类`}),(0,j.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.category?.label??`运行时插件`})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`管理方式`}),(0,j.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.removable?`可配置`:`随运行时加载`})]}),n?(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`版本`}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:n.version})]}):null]}),n?(0,j.jsx)(`a`,{className:`mt-4 block border-t border-[#eef0f3] pt-4 text-[12px] text-[#3565c5]`,href:n.repository,rel:`noreferrer`,target:`_blank`,children:`查看源码 ↗`}):null]})]})]})]}),d?(0,j.jsx)(Bc,{busy:s===`uninstall`,error:l,onCancel:()=>f(!1),onConfirm:()=>void m(`uninstall`,()=>a(e)).then(e=>{e&&f(!1)}),pluginName:p}):null]})}function Wc({plugins:e,capabilities:t,categories:n,total:r,page:i,hasNext:a,query:s,capabilityFilter:c,categoryFilter:l,onQueryChange:u,onCapabilityChange:d,onCategoryChange:f,onPageChange:p,onOpenDetail:m,onBack:h,onToml:g,installedPackages:_,onInstall:v}){let[y,b]=(0,o.useState)(),[x,S]=(0,o.useState)(``),[C,w]=(0,o.useState)(``),T=(0,o.useMemo)(()=>$e(n),[n]),E=async e=>{S(``),w(``),b(e.id);try{(await v(e)).restartRequired===!0&&w(`已写入 profile,重启 Pi Harness 后生效。`)}catch(e){S(e instanceof Error?e.message:String(e))}finally{b(void 0)}};return(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,j.jsxs)(`div`,{className:`subnav`,children:[(0,j.jsxs)(`div`,{"aria-label":`插件目录`,className:`segmented`,children:[(0,j.jsx)(`button`,{"aria-pressed":`false`,onClick:h,type:`button`,children:`已安装`}),(0,j.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:`插件市场`})]}),(0,j.jsx)(`span`,{children:`已审核插件目录`}),(0,j.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),g()},children:`查看运行配置`})]}),(0,j.jsxs)(`div`,{className:`marketplace-toolbar`,children:[(0,j.jsx)(`input`,{className:`marketplace-search`,"aria-label":`搜索插件`,onChange:e=>u(e.target.value),placeholder:`搜索名称、包名、能力…`,value:s}),(0,j.jsxs)(`select`,{className:`marketplace-filter`,"aria-label":`按能力筛选`,onChange:e=>d(e.target.value),value:c,children:[(0,j.jsx)(`option`,{value:``,children:`全部能力`}),t.map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))]}),(0,j.jsxs)(`span`,{className:`marketplace-count`,children:[r,` 个已审核条目 · 推荐排序`]})]}),(0,j.jsx)(Vc,{activeCategory:l,categories:T,label:`插件分类`,onChange:f}),(0,j.jsxs)(`div`,{className:`marketplace-scroll`,children:[(0,j.jsxs)(`div`,{className:`marketplace-grid`,children:[e.map(e=>(0,j.jsxs)(`article`,{className:`catalog-card marketplace-card`,children:[(0,j.jsxs)(`header`,{className:`marketplace-card-head`,children:[(0,j.jsx)(`div`,{className:`marketplace-card-mark`,children:`◈`}),(0,j.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,j.jsx)(`strong`,{className:`marketplace-title`,children:e.name}),(0,j.jsx)(`span`,{className:e.status===`verified`?`rounded bg-[#e6faed] px-1.5 py-px font-mono text-[10px] text-[#14733f]`:`rounded bg-[#fff5e7] px-1.5 py-px font-mono text-[10px] text-[#9a6700]`,children:e.status===`verified`?`已验证`:`实验性`}),(0,j.jsx)(`span`,{className:e.source===`official`?`rounded bg-[#e4edfd] px-1.5 py-px font-mono text-[10px] text-[#3565c5]`:`rounded bg-[#fef5e7] px-1.5 py-px font-mono text-[10px] text-[#9a6700]`,children:e.source===`official`?`官方`:`社区`}),(0,j.jsx)(`span`,{className:`rounded bg-[#f2edff] px-1.5 py-px text-[10px] text-[#6d4bc3]`,children:e.category.label})]})})]}),(0,j.jsxs)(`div`,{className:`marketplace-card-body`,children:[(0,j.jsxs)(`code`,{className:`marketplace-package`,children:[Cc(e.packageName),` · v`,e.version]}),(0,j.jsx)(`p`,{className:`marketplace-description`,children:e.description}),(0,j.jsxs)(`div`,{className:`marketplace-tags`,children:[e.capabilities.map(e=>(0,j.jsx)(`span`,{className:`rounded bg-[#f1f4f9] px-1.5 py-px font-mono text-[10px] text-[#61666b]`,children:e},e)),e.hooks.map(e=>(0,j.jsxs)(`span`,{className:`rounded bg-[#f1f4f9] px-1.5 py-px font-mono text-[10px] text-[#61666b]`,children:[`hook:`,e]},`hook:${e}`))]}),e.statistics&&(0,j.jsx)(`div`,{className:`marketplace-statistics mt-3 grid grid-cols-3 divide-x divide-[#e3e7ee] rounded-md border border-[#e3e7ee] bg-[#f8f9fb]`,children:et(e.statistics).map(e=>(0,j.jsxs)(`span`,{className:`min-w-0 px-2 py-1.5`,title:`${e.label} ${e.value}`,children:[(0,j.jsx)(`small`,{className:`block truncate text-[9px] text-[#687381]`,children:e.label}),(0,j.jsx)(`strong`,{className:`mt-0.5 block truncate font-mono text-[10px] font-medium text-[#3b424b]`,children:e.value})]},e.label))})]}),(0,j.jsxs)(`footer`,{className:`marketplace-card-footer`,children:[(0,j.jsxs)(`span`,{children:[e.author,` · `,e.license]}),(0,j.jsx)(`a`,{href:Ze(e.id),onClick:t=>{t.preventDefault(),m(e)},children:`查看详情 →`}),(0,j.jsx)(`a`,{href:e.repository,target:`_blank`,rel:`noreferrer`,children:`查看源码 ↗`}),(0,j.jsx)(`button`,{disabled:_.has(e.packageName)||y!==void 0,onClick:()=>void E(e),type:`button`,children:_.has(e.packageName)?`已安装`:y===e.id?`安装中…`:`安装`})]})]},e.id)),!e.length&&(0,j.jsx)(`div`,{className:`empty-state`,children:`没有匹配的插件。`})]}),C&&(0,j.jsx)(`p`,{className:`mt-2 text-[11px] text-[#3565c5]`,children:C}),x&&(0,j.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#b42318]`,children:[`安装失败:`,x]}),(0,j.jsxs)(`div`,{className:`marketplace-pagination`,children:[(0,j.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:i===0,onClick:()=>p(i-1),type:`button`,children:`上一页`}),(0,j.jsxs)(`span`,{children:[`第 `,i+1,` 页`]}),(0,j.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:!a,onClick:()=>p(i+1),type:`button`,children:`下一页`})]}),(0,j.jsxs)(`div`,{className:`marketplace-contribute mt-3 flex items-center gap-2.5 rounded-[10px] border border-dashed border-[#b8ccf5] bg-[#f8f9ff] p-2.5 text-[11.5px] text-[#687381]`,children:[(0,j.jsx)(`strong`,{className:`text-[12px] text-[#0f1115]`,children:`你有一个 Pi Harness 插件?`}),(0,j.jsx)(`span`,{children:`在 entries 目录新增一个元数据文件,附测试和 README 后提交 PR;审核通过后会出现在这里。`}),(0,j.jsx)(`a`,{className:`ml-auto flex-none text-[#3565c5]`,href:`https://github.com/pi-harness/pi-harness/blob/main/docs/plugin-marketplace.md`,target:`_blank`,rel:`noreferrer`,children:`查看贡献规范 ↗`})]})]})]})})}function Gc({plugin:e,installed:t,onInstall:n,onBack:r}){let[i,a]=(0,o.useState)(!1),[s,c]=(0,o.useState)(``),[l,u]=(0,o.useState)(``),d=async()=>{c(``),u(``),a(!0);try{(await n(e)).restartRequired===!0&&u(`已写入 profile,重启 Pi Harness 后生效。`)}catch(e){c(e instanceof Error?e.message:String(e))}finally{a(!1)}};return(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),r()},children:`← 插件市场`}),(0,j.jsx)(`span`,{children:`插件详情`})]}),(0,j.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,j.jsxs)(`header`,{className:`border-b border-[#e3e7ee] pb-7`,children:[(0,j.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,j.jsx)(`span`,{className:`rounded bg-[#e4edfd] px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:e.source===`official`?`官方插件`:`社区插件`}),(0,j.jsx)(`span`,{className:`rounded bg-[#f2edff] px-2 py-1 text-[10px] text-[#6d4bc3]`,children:e.category.label}),(0,j.jsx)(`span`,{className:e.status===`verified`?`rounded bg-[#e6faed] px-2 py-1 font-mono text-[10px] text-[#14733f]`:`rounded bg-[#fff5e7] px-2 py-1 font-mono text-[10px] text-[#9a6700]`,children:e.status===`verified`?`已验证`:`实验性`})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,j.jsxs)(`div`,{className:`min-w-0`,children:[(0,j.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[#687381]`,children:`PLUGIN DETAIL`}),(0,j.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[#20252b]`,children:e.name}),(0,j.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[#687381]`,children:[e.packageName,` · v`,e.version]})]}),(0,j.jsx)(`div`,{className:`plugin-detail-actions`,children:(0,j.jsx)(`button`,{className:`plugin-detail-action primary`,disabled:t||i,onClick:()=>void d(),type:`button`,children:t?`已安装`:i?`安装中…`:`安装插件`})})]}),(0,j.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[#59636e]`,children:e.description}),l&&(0,j.jsx)(`p`,{className:`mt-3 text-[12px] text-[#3565c5]`,children:l}),s&&(0,j.jsxs)(`p`,{className:`mt-3 text-[12px] text-[#b42318]`,children:[`安装失败:`,s]})]}),(0,j.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,j.jsxs)(`div`,{className:`space-y-4`,children:[(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件能力`}),(0,j.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:e.capabilities.map(e=>(0,j.jsx)(`span`,{className:`rounded-md bg-[#f1f4f9] px-2 py-1 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}),(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`扩展点`}),(0,j.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.hooks.map(e=>(0,j.jsx)(`div`,{className:`rounded-md bg-[#f8f9fb] px-3 py-2 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}),(0,j.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`运行配置`}),(0,j.jsx)(`p`,{className:`mt-1 text-[12px] text-[#687381]`,children:`安装后会写入当前运行 profile。`}),(0,j.jsx)(`pre`,{className:`mt-4 overflow-auto rounded-lg bg-[#f7f8fa] p-4 text-[11px] leading-6 text-[#3b424b]`,children:(0,j.jsx)(`code`,{children:JSON.stringify(e.profile,null,2)})})]})]}),(0,j.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,j.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件信息`}),(0,j.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`作者`}),(0,j.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.author})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`许可证`}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.license})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`分类`}),(0,j.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.category.label})]}),(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:`版本`}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.version})]}),et(e.statistics).map(e=>(0,j.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,j.jsx)(`dt`,{className:`text-[#687381]`,children:e.label}),(0,j.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.value})]},e.label))]}),(0,j.jsx)(`a`,{className:`mt-4 block border-t border-[#eef0f3] pt-4 text-[12px] text-[#3565c5]`,href:e.repository,target:`_blank`,rel:`noreferrer`,children:`查看源码 ↗`})]})]})]})]})})}async function Kc(e,t){t.busy(!0),t.state(`重载中…`);try{let n=await e.reloadConfig();t.config(n),t.sourceDraft(n.source),t.state(`已从磁盘重载`)}catch(e){t.state(e instanceof Error?e.message:String(e))}finally{t.busy(!1)}}function qc({data:e,api:t,tab:n,onTab:r,onClose:i,onRefresh:a}){let s=e.status,[c,l]=(0,o.useState)({}),[u,d]=(0,o.useState)({}),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)({provider:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,model:``}),[g,_]=(0,o.useState)(),[v,y]=(0,o.useState)(`form`),[b,x]=(0,o.useState)(``),[S,C]=(0,o.useState)(!1),[w,T]=(0,o.useState)(``),E=e.plugins.some(e=>e.name.endsWith(`/cli-notifier`)&&e.enabled),ee=yc(f,()=>p(!1),u.__add);(0,o.useEffect)(()=>{(n===`general`||n===`toml`)&&(T(`读取中…`),t.getConfig().then(e=>{_(e),x(e.source),T(``)}).catch(e=>T(e instanceof Error?e.message:String(e))))},[t,n]);let D=(e,n)=>{C(!0),T(n),t.updateConfig(e).then(e=>{_(e),x(e.source)}).then(()=>T(`已保存`)).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>C(!1))},O=(e,n)=>{u[e]||(d(t=>({...t,[e]:!0})),l(t=>({...t,[e]:n===`test`?`测试中…`:`刷新中…`})),n===`test`?t.testProvider(e).then(t=>{let n=t.auth,r=n&&typeof n==`object`&&`label`in n&&typeof n.label==`string`?n.label:void 0;l(n=>({...n,[e]:t.reachable?`连接正常`:r??`未检测到认证`}))}).catch(t=>l(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))).finally(()=>d(t=>({...t,[e]:!1}))):t.refreshProvider(e).then(t=>l(n=>({...n,[e]:`${t.models.length} 个模型已刷新`}))).catch(t=>l(n=>({...n,[e]:t instanceof Error?t.message:String(t)}))).finally(()=>d(t=>({...t,[e]:!1}))))};return(0,j.jsx)(`section`,{className:`view-panel settings-page`,children:(0,j.jsxs)(`div`,{className:`settings-dialog`,children:[(0,j.jsx)(`nav`,{"aria-label":`设置分类`,className:`settings-top-tabs`,children:[`general`,`providers`,`toml`].map(t=>(0,j.jsx)(`button`,{"aria-pressed":n===t,className:`settings-tab ${n===t?`active`:``}`,onClick:()=>r(t),type:`button`,children:t===`general`?`通用`:t===`providers`?`提供商 ${e.providers.length}`:`运行配置`},t))}),(0,j.jsxs)(`section`,{children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`button`,{className:`settings-back`,onClick:i,type:`button`,children:`← 返回会话`}),(0,j.jsxs)(`div`,{className:`settings-header-copy`,children:[(0,j.jsx)(`strong`,{children:n===`general`?`通用`:n===`providers`?`提供商`:`运行配置`}),(0,j.jsx)(`small`,{children:n===`toml`?`配置即代码,改完重载`:`运行时状态与快捷键`})]})]}),(0,j.jsxs)(`div`,{className:`settings-body`,children:[n===`general`&&(0,j.jsxs)(j.Fragment,{children:[[[`工作目录`,s?.cwd],[`agent 目录`,s?.agentDir],[`会话`,s?`${s.sessionId} · ${s.messages} 条消息`:`—`],[`快捷键`,`⌘K 命令 · ⌘, 设置 · ⌃C 中断`],[`权限策略`,`当前 API 未提供修改接口`]].map(([e,t])=>(0,j.jsx)(`div`,{className:`general-row`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:e}),(0,j.jsx)(`small`,{children:$(t)})]})},e)),(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`任务结束提醒插件`}),(0,j.jsx)(`small`,{children:`由 CLI Notifier 提供,具体目标在插件配置中管理`})]}),(0,j.jsx)(`span`,{className:`setting-status ${E?`on`:``}`,children:E?`已加载`:`未加载`})]}),(0,j.jsxs)(`div`,{className:`general-row`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`自动压缩上下文`}),(0,j.jsx)(`small`,{children:`接近上下文上限时自动整理历史消息,可在运行配置中修改`}),!g&&w&&w!==`读取中…`?(0,j.jsxs)(`small`,{className:`setting-error`,role:`alert`,children:[`配置读取失败:`,w]}):null]}),(0,j.jsx)(`span`,{className:`setting-status ${g?.settings.compaction.enabled?`on`:``}`,children:g?g.settings.compaction.enabled?`已开启`:`已关闭`:w===`读取中…`?`读取中`:`不可用`})]})]}),n===`providers`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`provider-add-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`已启用提供商`}),(0,j.jsx)(`small`,{children:`模型列表只显示当前会话和已配置提供商。`})]}),(0,j.jsx)(`button`,{className:`primary`,onClick:()=>p(!0),type:`button`,children:`添加提供商`})]}),f&&(0,j.jsx)(`div`,{className:`provider-add-overlay`,onClick:()=>{u.__add||p(!1)},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),u.__add||p(!1))},children:(0,j.jsxs)(`div`,{"aria-busy":u.__add,"aria-label":`添加提供商`,"aria-modal":`true`,className:`provider-add-modal`,onClick:e=>e.stopPropagation(),ref:ee,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`添加自定义提供商`}),(0,j.jsx)(`small`,{children:`注册 OpenAI 兼容接口,凭据只提交到本机 Pi runtime。`})]}),(0,j.jsx)(`button`,{"aria-label":`关闭添加提供商`,disabled:u.__add,onClick:()=>p(!1),type:`button`,children:`×`})]}),(0,j.jsxs)(`form`,{className:`provider-add-form`,onSubmit:e=>{e.preventDefault(),!(!m.provider||!m.baseUrl||!m.apiKey||!m.model)&&(d(e=>({...e,__add:!0})),l(e=>({...e,__add:`添加中…`})),t.addProvider(m).then(async()=>{h({provider:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,model:``}),l(e=>({...e,__add:`已添加`})),await a(),p(!1)}).catch(e=>l(t=>({...t,__add:e instanceof Error?e.message:String(e)}))).finally(()=>d(e=>({...e,__add:!1}))))},children:[(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:`提供商 ID`}),(0,j.jsx)(`input`,{"aria-label":`提供商 ID`,"data-dialog-initial-focus":!0,maxLength:64,minLength:2,pattern:`[a-z0-9][a-z0-9._-]{1,63}`,placeholder:`例如 openrouter`,required:!0,value:m.provider,onChange:e=>h(t=>({...t,provider:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:`显示名称`}),(0,j.jsx)(`input`,{"aria-label":`提供商名称`,placeholder:`可选`,value:m.name,onChange:e=>h(t=>({...t,name:e.target.value}))})]}),(0,j.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,j.jsx)(`span`,{children:`接口地址`}),(0,j.jsx)(`input`,{"aria-label":`接口地址`,placeholder:`https://api.example.com/v1`,required:!0,type:`url`,value:m.baseUrl,onChange:e=>h(t=>({...t,baseUrl:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:`模型 ID`}),(0,j.jsx)(`input`,{"aria-label":`模型 ID`,placeholder:`例如 gpt-4o`,required:!0,value:m.model,onChange:e=>h(t=>({...t,model:e.target.value}))})]}),(0,j.jsxs)(`label`,{children:[(0,j.jsx)(`span`,{children:`协议`}),(0,j.jsxs)(`select`,{"aria-label":`协议`,value:m.api,onChange:e=>h(t=>({...t,api:e.target.value})),children:[(0,j.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Completions`}),(0,j.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`})]})]}),(0,j.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,j.jsx)(`span`,{children:`API key`}),(0,j.jsx)(`input`,{"aria-label":`API key`,placeholder:`只在本机提交,不会回显`,required:!0,type:`password`,value:m.apiKey,onChange:e=>h(t=>({...t,apiKey:e.target.value}))})]}),(0,j.jsxs)(`div`,{className:`provider-add-actions`,children:[(0,j.jsx)(`button`,{className:`primary`,disabled:u.__add,type:`submit`,children:u.__add?`添加中…`:`添加提供商`}),c.__add&&(0,j.jsx)(`small`,{"aria-live":`polite`,children:c.__add})]})]})]})}),(0,j.jsx)(`small`,{children:`已启用提供商 · /api/providers`}),e.providers.length?e.providers.map(e=>(0,j.jsxs)(`article`,{className:`provider-card`,children:[(0,j.jsxs)(`div`,{className:`provider-head`,children:[(0,j.jsx)(`span`,{className:`provider-dot`,children:`●`}),(0,j.jsx)(`strong`,{children:e.name}),(0,j.jsx)(`span`,{className:`provider-state`,children:e.active?`当前会话`:e.auth?.configured===!0?`已配置`:`未配置`})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`provider`}),(0,j.jsx)(`input`,{"aria-label":`${e.name} 提供商 ID`,disabled:!0,value:e.provider,readOnly:!0})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`model`}),(0,j.jsxs)(`div`,{className:`provider-model-value`,title:e.models.map(e=>e.id).join(`, `)||`暂无模型`,children:[(0,j.jsx)(`span`,{children:e.activeModel?`${e.activeModel.provider}/${e.activeModel.id}`:`未选择模型`}),e.models.length>0&&(0,j.jsxs)(`details`,{className:`provider-models-details`,children:[(0,j.jsxs)(`summary`,{children:[`查看 `,e.models.length,` 个模型`]}),(0,j.jsx)(`div`,{className:`model-chips`,children:e.models.map(e=>(0,j.jsx)(`span`,{children:e.id},e.id))})]})]})]}),(0,j.jsxs)(`div`,{className:`provider-field`,children:[(0,j.jsx)(`code`,{children:`api_key`}),(0,j.jsx)(`input`,{"aria-label":`${e.name} API key 状态`,disabled:!0,value:`不会在浏览器显示`,readOnly:!0})]}),(0,j.jsxs)(`div`,{className:`provider-footer`,children:[(0,j.jsxs)(`code`,{children:[e.models.length,` 个模型`]}),(0,j.jsx)(`button`,{disabled:u[e.provider],onClick:()=>O(e.provider,`test`),type:`button`,children:u[e.provider]&&c[e.provider]===`测试中…`?`测试中…`:`测试连接`}),(0,j.jsx)(`button`,{className:`link-button`,disabled:u[e.provider],onClick:()=>O(e.provider,`refresh`),type:`button`,children:u[e.provider]&&c[e.provider]===`刷新中…`?`刷新中…`:`拉取模型`})]}),c[e.provider]&&(0,j.jsx)(`small`,{"aria-live":`polite`,className:`provider-result`,children:c[e.provider]})]},e.provider)):(0,j.jsx)(`div`,{className:`empty-state`,children:`运行时没有注册提供商。`})]}),n===`toml`&&(0,j.jsxs)(`div`,{className:`config-editor`,children:[(0,j.jsxs)(`div`,{className:`toml-toolbar`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`strong`,{children:`运行时配置`}),(0,j.jsx)(`span`,{children:g?.path??`~/.pi/agent/settings.json`})]}),(0,j.jsx)(`button`,{className:v===`form`?`active`:``,onClick:()=>y(`form`),type:`button`,children:`表单`}),(0,j.jsx)(`button`,{className:v===`source`?`active`:``,onClick:()=>y(`source`),type:`button`,children:`源码`}),(0,j.jsx)(`button`,{className:`primary`,disabled:S,onClick:()=>{Kc(t,{config:_,sourceDraft:x,state:T,busy:C})},type:`button`,children:`重载`})]}),w&&(0,j.jsx)(`div`,{"aria-live":`polite`,className:`config-state ${w.includes(`失败`)||w.includes(`Error`)?`error`:``}`,children:w}),g?v===`source`?(0,j.jsxs)(`div`,{className:`config-source-editor`,children:[(0,j.jsx)(`textarea`,{"aria-label":`settings.json 源码`,className:`config-source`,onChange:e=>x(e.target.value),spellCheck:!1,value:b}),(0,j.jsxs)(`div`,{className:`config-source-actions`,children:[(0,j.jsx)(`small`,{children:`完整 JSON 配置,可编辑未知字段;保存前会校验语法。`}),(0,j.jsx)(`button`,{className:`primary`,disabled:S||!b.trim(),onClick:()=>{C(!0),T(`保存源码…`),t.updateConfigSource(b).then(e=>{_(e),x(e.source),T(`已保存源码`)}).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>C(!1))},type:`button`,children:`保存源码`})]})]}):(0,j.jsxs)(`div`,{className:`config-sections`,children:[(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`模型默认值`}),(0,j.jsx)(`small`,{children:`新会话启动时使用的模型和思考级别`})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`提供商`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({defaultProvider:e.target.value},`保存提供商…`),value:g.settings.defaultProvider??``,children:[(0,j.jsx)(`option`,{value:``,children:`跟随运行时`}),e.providers.map(e=>(0,j.jsx)(`option`,{value:e.provider,children:e.name},e.provider))]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`模型`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({defaultModel:e.target.value},`保存模型…`),value:g.settings.defaultModel??``,children:[(0,j.jsx)(`option`,{value:``,children:`跟随提供商`}),e.models.map(e=>(0,j.jsxs)(`option`,{value:e.id,children:[e.provider,`/`,e.name]},`${e.provider}/${e.id}`))]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`思考级别`}),(0,j.jsx)(`select`,{disabled:S,onChange:e=>D({defaultThinkingLevel:e.target.value},`保存思考级别…`),value:g.settings.defaultThinkingLevel??`medium`,children:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`].map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`运行策略`}),(0,j.jsx)(`small`,{children:`消息队列和网络传输行为`})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`传输方式`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({transport:e.target.value},`保存传输方式…`),value:g.settings.transport,children:[(0,j.jsx)(`option`,{value:`auto`,children:`自动`}),(0,j.jsx)(`option`,{value:`sse`,children:`SSE`}),(0,j.jsx)(`option`,{value:`websocket`,children:`WebSocket`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`Steering 消息`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({steeringMode:e.target.value},`保存队列策略…`),value:g.settings.steeringMode,children:[(0,j.jsx)(`option`,{value:`one-at-a-time`,children:`逐条发送`}),(0,j.jsx)(`option`,{value:`all`,children:`一次发送全部`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`Follow-up 消息`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({followUpMode:e.target.value},`保存跟进策略…`),value:g.settings.followUpMode,children:[(0,j.jsx)(`option`,{value:`one-at-a-time`,children:`逐条发送`}),(0,j.jsx)(`option`,{value:`all`,children:`一次发送全部`})]})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`上下文与显示`}),(0,j.jsx)(`small`,{children:`控制思考内容和自动压缩`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`隐藏思考正文`}),(0,j.jsx)(`small`,{children:`只显示可展开的思考摘要`})]}),(0,j.jsx)(`input`,{checked:g.settings.hideThinkingBlock,disabled:S,onChange:e=>D({hideThinkingBlock:e.target.checked},`保存显示设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`自动压缩上下文`}),(0,j.jsx)(`small`,{children:`接近上下文上限时自动整理历史消息`})]}),(0,j.jsx)(`input`,{checked:g.settings.compaction.enabled,disabled:S,onChange:e=>D({compaction:{...g.settings.compaction,enabled:e.target.checked}},`保存压缩设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`自动重试`}),(0,j.jsx)(`small`,{children:`临时网络错误时自动重试请求`})]}),(0,j.jsx)(`input`,{checked:g.settings.retry.enabled,disabled:S,onChange:e=>D({retry:{...g.settings.retry,enabled:e.target.checked}},`保存重试设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`显示图片`}),(0,j.jsx)(`small`,{children:`允许模型响应中的图片渲染`})]}),(0,j.jsx)(`input`,{checked:g.settings.terminal.showImages,disabled:S,onChange:e=>D({terminal:{...g.settings.terminal,showImages:e.target.checked}},`保存图片设置…`),type:`checkbox`})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`终端与导航`}),(0,j.jsx)(`small`,{children:`控制命令行界面和消息渲染行为`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`安静启动`}),(0,j.jsx)(`small`,{children:`启动时隐藏版本和更新提示`})]}),(0,j.jsx)(`input`,{checked:g.settings.advanced.quietStartup,disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,quietStartup:e.target.checked}},`保存启动设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`项目可信策略`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,projectTrust:e.target.value}},`保存信任策略…`),value:g.settings.advanced.projectTrust,children:[(0,j.jsx)(`option`,{value:`ask`,children:`每次询问`}),(0,j.jsx)(`option`,{value:`always`,children:`始终信任`}),(0,j.jsx)(`option`,{value:`never`,children:`从不信任`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`Mermaid 渲染`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,mermaid:e.target.value}},`保存 Mermaid 设置…`),value:g.settings.advanced.mermaid,children:[(0,j.jsx)(`option`,{value:`off`,children:`关闭`}),(0,j.jsx)(`option`,{value:`final`,children:`完成后渲染`}),(0,j.jsx)(`option`,{value:`streaming`,children:`流式渲染`})]})]}),(0,j.jsxs)(`label`,{className:`config-field`,children:[(0,j.jsx)(`span`,{children:`双击 Escape`}),(0,j.jsxs)(`select`,{disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,doubleEscapeAction:e.target.value}},`保存快捷键设置…`),value:g.settings.advanced.doubleEscapeAction,children:[(0,j.jsx)(`option`,{value:`tree`,children:`打开会话树`}),(0,j.jsx)(`option`,{value:`fork`,children:`创建分支`}),(0,j.jsx)(`option`,{value:`none`,children:`不执行`})]})]})]}),(0,j.jsxs)(`section`,{className:`config-section`,children:[(0,j.jsxs)(`header`,{children:[(0,j.jsx)(`strong`,{children:`诊断与隐私`}),(0,j.jsx)(`small`,{children:`控制缓存提示和匿名数据上报`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`显示缓存未命中`}),(0,j.jsx)(`small`,{children:`在消息中显示模型缓存诊断`})]}),(0,j.jsx)(`input`,{checked:g.settings.advanced.showCacheMissNotices,disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,showCacheMissNotices:e.target.checked}},`保存诊断设置…`),type:`checkbox`})]}),(0,j.jsxs)(`label`,{className:`config-toggle`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`安装遥测`}),(0,j.jsx)(`small`,{children:`发送匿名安装和版本统计`})]}),(0,j.jsx)(`input`,{checked:g.settings.advanced.enableInstallTelemetry,disabled:S,onChange:e=>D({advanced:{...g.settings.advanced,enableInstallTelemetry:e.target.checked}},`保存隐私设置…`),type:`checkbox`})]})]})]}):(0,j.jsx)(`div`,{className:`empty-state`,children:`正在读取运行时配置…`})]})]})]})]})})}var Jc=(e,t)=>{let n=t.trim().toLowerCase();return e.filter(e=>`${e.invocationName} ${e.description??``}`.toLowerCase().includes(n))};function Yc({commands:e,query:t,activeIndex:n,onActiveIndexChange:r,onUse:i}){let a=Jc(e,t),o=e=>{let t=a[e];t&&i(`/${t.invocationName}`)};return(0,j.jsx)(`div`,{"aria-label":`命令面板`,className:`command-palette`,id:`command-menu`,role:`listbox`,children:(0,j.jsxs)(`div`,{className:`palette-group`,children:[(0,j.jsxs)(`small`,{children:[`COMMANDS `,(0,j.jsx)(`span`,{children:`· RUNTIME REGISTRY`})]}),a.length?a.map((e,t)=>{let i=`/${e.invocationName}`;return(0,j.jsxs)(`button`,{"aria-selected":t===n,onClick:()=>o(t),onMouseEnter:()=>r(t),role:`option`,type:`button`,children:[(0,j.jsx)(`code`,{children:i}),(0,j.jsx)(`span`,{children:e.description??e.source??`由当前运行时注册`})]},`${e.invocationName}:${e.source??`runtime`}`)}):(0,j.jsx)(`div`,{className:`empty-state`,children:e.length?`没有匹配的命令。`:`当前运行时没有可用的命令注册清单。`})]})})}function Xc({kind:e,commands:t,files:n,query:r,activeIndex:i,onActiveIndexChange:a,onUse:o}){let s=e===`command`?Jc(t,r).slice(0,12):n.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(r.trim().toLowerCase())).slice(0,12);return(0,j.jsxs)(`div`,{"aria-label":e===`command`?`命令补全`:`文件补全`,className:`prompt-completion`,"data-prompt-completion":!0,id:`prompt-completion-list`,role:`listbox`,children:[(0,j.jsx)(`small`,{children:e===`command`?`命令`:`文件`}),s.length?s.slice(0,12).map((t,n)=>{let r=e===`command`?`/${t.invocationName}`:`@${t.path}`,s=e===`command`?t.description??t.source??`由当前运行时注册`:t.status;return(0,j.jsxs)(`button`,{"aria-selected":n===i,id:`prompt-completion-option-${n}`,onClick:()=>o(r),onMouseEnter:()=>a(n),role:`option`,type:`button`,children:[(0,j.jsx)(`strong`,{children:r}),(0,j.jsx)(`span`,{children:s})]},`${e}:${r}`)}):(0,j.jsx)(`span`,{className:`prompt-completion-empty`,children:`没有匹配项`})]})}function Zc({commands:e,sessions:t,files:n,onClose:r,onUse:i,onOpenSession:a,onOpenFile:s}){let[c,l]=(0,o.useState)(``),[u,d]=(0,o.useState)(0),f=yc(!0,r),p=c.trim().toLowerCase(),m=e=>!p||e.toLowerCase().includes(p),h=[...e.filter(e=>m(`${e.invocationName} ${e.description??``}`)).map(e=>({kind:`command`,command:e})),...t.filter(e=>m(`${$(e.name,``)} ${$(e.firstMessage,``)} ${$(e.sessionId,``)}`)).map(e=>({kind:`session`,session:e})),...n.filter(e=>m(`${e.path} ${e.label} ${e.status}`)).map(e=>({kind:`file`,file:e}))],g=h.length?Math.min(u,h.length-1):-1,_=g>=0?`global-search-option-${g}`:void 0;(0,o.useEffect)(()=>d(0),[c]);let v=e=>{e&&(e.kind===`command`?i(`/${e.command.invocationName}`):e.kind===`session`?a(e.session):s(e.file),r())};return(0,j.jsx)(`div`,{className:`global-search`,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,j.jsxs)(`div`,{"aria-label":`全局搜索`,"aria-modal":`true`,className:`global-search-dialog`,ref:f,role:`dialog`,tabIndex:-1,children:[(0,j.jsxs)(`div`,{className:`global-search-heading`,children:[(0,j.jsx)(`strong`,{children:`全局搜索`}),(0,j.jsx)(`small`,{children:`命令 · 会话 · 文件`}),(0,j.jsx)(`button`,{"aria-label":`关闭全局搜索`,onClick:r,type:`button`,children:`×`})]}),(0,j.jsx)(`input`,{"aria-activedescendant":_,"aria-autocomplete":`list`,"aria-controls":`global-search-results`,"aria-expanded":`true`,"aria-label":`全局搜索`,"data-dialog-initial-focus":!0,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),r()):e.key===`ArrowDown`&&h.length?(e.preventDefault(),d(e=>(e+1)%h.length)):e.key===`ArrowUp`&&h.length?(e.preventDefault(),d(e=>(e-1+h.length)%h.length)):e.key===`Enter`&&(e.preventDefault(),v(h[g]))},placeholder:`搜索命令、会话或文件`,role:`combobox`,value:c}),(0,j.jsx)(`div`,{className:`global-search-results`,id:`global-search-results`,role:`listbox`,children:h.length?[`command`,`session`,`file`].map(e=>{let t=h.filter(t=>t.kind===e);if(!t.length)return null;let n=e===`command`?`命令`:e===`session`?`会话`:`文件`;return(0,j.jsxs)(`section`,{"aria-label":n,className:`global-search-group`,role:`group`,children:[(0,j.jsx)(`small`,{"aria-hidden":`true`,children:n}),t.map(e=>{let t=h.indexOf(e),n=e.kind===`command`?`/${e.command.invocationName}`:e.kind===`session`?$(e.session.name??e.session.firstMessage??e.session.sessionId,`未命名会话`):e.file.label,r=e.kind===`command`?e.command.description??e.command.source??`由当前运行时注册`:e.kind===`session`?`${$(e.session.messageCount,`0`)} 条消息`:`${e.file.path} · ${e.file.status}`;return(0,j.jsxs)(`button`,{"aria-selected":t===g,id:`global-search-option-${t}`,onClick:()=>v(e),onMouseEnter:()=>d(t),role:`option`,type:`button`,children:[(0,j.jsx)(`strong`,{children:n}),(0,j.jsx)(`span`,{children:r})]},`${e.kind}:${n}:${t}`)})]},e)}):(0,j.jsx)(`div`,{className:`empty-state`,children:`没有匹配的命令、会话或文件。`})})]})})}function Qc(e){let t=e.event;return typeof t!=`object`||!t||t.type!==`message_update`}function $c(e,t){return e.subscribeEvents(e=>t.current(e))}function el(e,t,n){if(e===void 0)return{kind:`clear`};let r=t.find(t=>t.id===e);return r===void 0?n===e?{kind:`keep`}:{kind:`fetch`}:{kind:`show`,plugin:r}}var tl=(0,o.memo)(function({role:e,text:t,thinking:n,onMouseUp:r}){return(0,j.jsx)(`article`,{className:`turn ${e===`user`?`user`:`text`}`,children:e===`user`?(0,j.jsx)(Nc,{text:t}):(0,j.jsxs)(j.Fragment,{children:[n&&(0,j.jsxs)(`details`,{className:`reasoning message-reasoning`,children:[(0,j.jsx)(`summary`,{className:`reasoning-head`,children:`思考`}),(0,j.jsx)(`div`,{className:`reasoning-body`,children:(0,j.jsx)(He,{text:n})})]}),t&&(0,j.jsx)(He,{onMouseUp:r,text:t})]})})});function nl({api:e=Ne(),appVersion:t}){let n=(0,o.useMemo)(wc,[]),[r,i]=(0,o.useState)({sessions:[],files:[],models:[],providers:[],plugins:[],pluginPanels:[],marketplace:[],marketplaceCapabilities:[],marketplaceCategories:[],marketplaceTotal:0,marketplacePage:0,marketplaceHasNext:!1,commands:[],workspaces:[]}),[a,s]=(0,o.useState)(n.view),[c,l]=(0,o.useState)(n.page),[u,d]=(0,o.useState)(n.settings),[f,p]=(0,o.useState)(),[m,h]=(0,o.useState)(!1),[g,_]=(0,o.useState)(!1),[v,y]=(0,o.useState)(``),[b,x]=(0,o.useState)(0),[S,C]=(0,o.useState)(!1),[w,T]=(0,o.useState)(),[E,ee]=(0,o.useState)(),[D,O]=(0,o.useState)(!1),[te,ne]=(0,o.useState)(),[re,ie]=(0,o.useState)(!1),[ae,k]=(0,o.useState)(),[oe,se]=(0,o.useState)(),[ce,le]=(0,o.useState)(``),[ue,de]=(0,o.useState)(!1),[fe,pe]=(0,o.useState)(``),[me,he]=(0,o.useState)(),[ge,_e]=(0,o.useState)(n.sessionPath),ve=(0,o.useRef)(n.sessionPath),ye=(0,o.useRef)(!1),[A,be]=(0,o.useState)(``),[xe,Se]=(0,o.useState)([]),[Ce,we]=(0,o.useState)(``),[Te,Ee]=(0,o.useState)(``),[De,Oe]=(0,o.useState)(``),ke=(0,o.useRef)(null),[Ae,M]=(0,o.useState)(n.marketplaceQuery),[Ie,Re]=(0,o.useState)(n.marketplaceCapability),[ze,Be]=(0,o.useState)(n.marketplaceCategory),[N,Ve]=(0,o.useState)(n.marketplacePlugin),[We,Ke]=(0,o.useState)(),[qe,Je]=(0,o.useState)(n.marketplacePlugin!==void 0),[Xe,Ze]=(0,o.useState)(``),[Qe,$e]=(0,o.useState)([]),[P,et]=(0,o.useState)(n.installedPlugin),[nt,rt]=(0,o.useState)(),[it,at]=(0,o.useState)(n.marketplacePage),[ot,F]=(0,o.useState)(``),[st,ct]=(0,o.useState)(!1),[lt,ut]=(0,o.useState)(``),[dt,ft]=(0,o.useState)(!1),[I,pt]=(0,o.useState)(!1),[mt,ht]=(0,o.useState)(0),[gt,_t]=(0,o.useState)(0),[L,vt]=(0,o.useState)(!1),[yt,bt]=(0,o.useState)(new Set),xt=(0,o.useRef)(null),St=(0,o.useRef)(null),[Ct,wt]=(0,o.useState)(),Tt=(0,o.useRef)(null),Et=(0,o.useRef)(null),Dt=(0,o.useRef)(!0),Ot=(0,o.useRef)(void 0),kt=(0,o.useRef)(!1),At=(0,o.useRef)(void 0),[jt,Mt]=(0,o.useState)(0),[Nt,Pt]=(0,o.useState)(!1),[Ft,It]=(0,o.useState)(0),[Lt,Rt]=(0,o.useState)(!0),[zt,Bt]=(0,o.useState)([]);(0,o.useEffect)(()=>{let t=!1;return tt(e).then(e=>{t||$e(e)}).catch(()=>{t||$e([])}),()=>{t=!0}},[e]),(0,o.useEffect)(()=>{!ge&&r.session?.sessionFile&&_e(r.session.sessionFile)},[r.session?.sessionFile,ge]);let Vt=(0,o.useMemo)(()=>Pe(A,jt),[A,jt]),Ht=(0,o.useMemo)(()=>Vt?Vt.kind===`command`?Jc(r.commands,Vt.query).slice(0,12):r.files.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(Vt.query.trim().toLowerCase())).slice(0,12):[],[r.commands,r.files,Vt]),Ut=!!(Vt&&!Nt&&Ht.length),Wt=Math.min(Ft,Math.max(Ht.length-1,0)),Gt=(0,o.useMemo)(()=>new Set(r.plugins.filter(e=>e.removable).map(e=>e.name)),[r.plugins]),Kt=!ue&&!!(me||r.status?.cwd||r.workspaces.find(e=>e.current)?.path||r.session),qt=(0,o.useMemo)(()=>{let e=new Set(r.pluginPanels.map(e=>e.pluginId));return r.plugins.filter(t=>t.removable||e.has(t.name)).length},[r.pluginPanels,r.plugins]);(0,o.useEffect)(()=>{It(0)},[Vt?.kind,Vt?.query]),(0,o.useEffect)(()=>{if(!S&&!D)return;let e=e=>{e.target instanceof Element&&e.target.closest(`[data-session-popover]`)||(C(!1),T(void 0),ee(void 0),O(!1),ne(void 0),se(void 0))},t=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),C(!1),T(void 0),ee(void 0),O(!1),ne(void 0),se(void 0),St.current?.focus())},n=()=>{C(!1),T(void 0),ee(void 0),O(!1),ne(void 0),se(void 0)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),document.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t),document.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[S,D]),(0,o.useEffect)(()=>{if(!m&&!Ut)return;let e=e=>{let t=e.target instanceof Element?e.target:void 0;m&&!t?.closest(`[data-command-palette]`)&&(h(!1),y(``)),Ut&&!t?.closest(`[data-prompt-completion]`)&&Pt(!0)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[m,Ut]),(0,o.useEffect)(()=>{let e=e=>{if(e instanceof KeyboardEvent&&e.key!==`Escape`)return;let t=e.target instanceof Element?e.target:void 0;document.querySelectorAll(`details.provider-models-details[open]`).forEach(n=>{e instanceof PointerEvent&&t&&n.contains(t)||(n.removeAttribute(`open`),e instanceof KeyboardEvent&&n.querySelector(`summary`)?.focus())})};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,e)}},[]),(0,o.useEffect)(()=>{if(typeof window>`u`)return;let e=new URLSearchParams(window.location.search);e.set(`page`,c),a===`chat`?e.delete(`view`):e.set(`view`,a),u?e.set(`settings`,u):e.delete(`settings`),ge?e.set(`session`,ge):e.delete(`session`),Ae?e.set(`marketplaceQuery`,Ae):e.delete(`marketplaceQuery`),Ie?e.set(`capability`,Ie):e.delete(`capability`),ze?e.set(`category`,ze):e.delete(`category`),c===`plugins`&&P?e.set(`plugin`,P):c===`marketplace`&&N?e.set(`plugin`,N):e.delete(`plugin`),it>0?e.set(`marketplacePage`,String(it)):e.delete(`marketplacePage`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)},[P,Ie,ze,it,N,Ae,c,ge,u,a]),(0,o.useEffect)(()=>{let e=()=>{let e=wc();h(!1),_(!1),C(!1),p(void 0),l(e.page),s(e.view),d(e.settings),_e(e.sessionPath),M(e.marketplaceQuery),Re(e.marketplaceCapability),Be(e.marketplaceCategory),at(e.marketplacePage),et(e.installedPlugin),Ve(e.marketplacePlugin)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,o.useEffect)(()=>{let t=el(N,[...r.marketplace,...Qe],At.current);if(t.kind===`keep`)return;if(t.kind===`clear`){At.current=void 0,Ke(void 0),Je(!1),Ze(``);return}if(t.kind===`show`){At.current=N,Ke(t.plugin),Je(!1),Ze(``);return}let n=!1;return Ke(void 0),Je(!0),Ze(``),e.listMarketplace(``,``,0,100).then(e=>{if(n)return;At.current=N;let t=e.items.find(e=>e.id===N);t===void 0?Ze(`没有找到这个市场插件,它可能已下架。`):Ke(t)}).catch(e=>{n||Ze(e instanceof Error?e.message:String(e))}).finally(()=>{n||Je(!1)}),()=>{n=!0}},[e,r.marketplace,Qe,N]),(0,o.useEffect)(()=>{if(P===void 0){rt(void 0);return}let t=Qe.find(e=>e.packageName===P);if(t!==void 0){rt(t);return}let n=!1;return rt(void 0),e.listMarketplace(``,``,0,100).then(e=>{n||rt(e.items.find(e=>e.packageName===P))}).catch(()=>{n||rt(void 0)}),()=>{n=!0}},[e,P,Qe]);let R=(0,o.useCallback)(async()=>{let t=await Promise.allSettled([e.getStatus(),e.getSession(),e.listSessions(mt,30,I),e.getFiles(),e.listModels(),e.listProviders(),e.listPlugins(),e.listPluginPanels(),e.listMarketplace(Ae,Ie,it,24,ze),e.listCommands(),e.listWorkspaces()]),[n,r,a,o,s,c,l,u,d,f,p]=t;Bt(Me([`运行状态`,`当前会话`,`会话列表`,`文件`,`模型`,`提供商`,`插件`,`插件面板`,`插件市场`,`命令`,`工作区`],t)),Rt(!1),i(e=>({status:n.status===`fulfilled`?n.value:e.status,session:r.status===`fulfilled`?r.value:e.session,sessions:a.status===`fulfilled`?a.value.items:e.sessions,files:o.status===`fulfilled`?o.value:e.files,models:s.status===`fulfilled`?s.value:e.models,providers:c.status===`fulfilled`?c.value:e.providers,plugins:l.status===`fulfilled`?l.value:e.plugins,pluginPanels:u.status===`fulfilled`?u.value:e.pluginPanels,marketplace:d.status===`fulfilled`?d.value.items:e.marketplace,marketplaceCapabilities:d.status===`fulfilled`?d.value.capabilities:e.marketplaceCapabilities,marketplaceCategories:d.status===`fulfilled`?d.value.categories:e.marketplaceCategories,marketplaceTotal:d.status===`fulfilled`?d.value.total:e.marketplaceTotal,marketplacePage:d.status===`fulfilled`?d.value.page:e.marketplacePage,marketplaceHasNext:d.status===`fulfilled`?d.value.hasNext:e.marketplaceHasNext,commands:f.status===`fulfilled`?f.value:e.commands,workspaces:p.status===`fulfilled`?p.value:e.workspaces})),a.status===`fulfilled`&&(_t(a.value.total),vt(a.value.hasNext))},[e,I,Ie,ze,it,Ae,mt]),Jt=(0,o.useCallback)(()=>{kt.current=!0,Ot.current===void 0&&(Ot.current=window.setTimeout(()=>{Ot.current=void 0,kt.current&&(kt.current=!1,R())},100))},[R]),z=(0,o.useCallback)(e=>{Qc(e)&&Jt();let t=e.event;if(typeof t!=`object`||!t)return;let n=t;if(n.type===`turn_start`){wt({thinking:``,text:``});return}if(n.type!==`message_update`||typeof n.assistantMessageEvent!=`object`||n.assistantMessageEvent===null)return;let r=n.assistantMessageEvent,i=r.type;if(i!==`thinking_delta`&&i!==`text_delta`)return;let a=typeof r.delta==`string`?r.delta:``;a&&wt(e=>({thinking:(e?.thinking??``)+(i===`thinking_delta`?a:``),text:(e?.text??``)+(i===`text_delta`?a:``)}))},[Jt]),Yt=(0,o.useRef)(z),Xt=(0,o.useRef)(R),Zt=(0,o.useCallback)(async t=>{F(``),pe(``);try{let n=await e.createSession(t?.path);n.sessionFile&&_e(n.sessionFile),d(void 0),h(!1),_(!1),p(void 0),de(!1),he(t?.path),y(``),l(`session`),s(`chat`),C(!1),await R()}catch(e){let n=e instanceof Error?e.message:String(e);t?pe(n):F(n)}},[e,R]),Qt=()=>{F(``),pe(``),he(void 0),de(!0)},$t=(0,o.useCallback)(async()=>{try{let t=await e.pickDirectory(),n=t.split(/[\\/]/).filter(Boolean).pop()??t;await Zt({path:t,branch:`directory`,current:!1,name:n})}catch(e){pe(e instanceof Error?e.message:String(e))}},[e,Zt]),B=(0,o.useCallback)(async()=>{await $t()},[$t]);(0,o.useEffect)(()=>{Yt.current=z,Xt.current=R},[z,R]),(0,o.useEffect)(()=>{R()},[R]),(0,o.useEffect)(()=>$c(e,Yt),[e]),(0,o.useEffect)(()=>{let e=window.setInterval(()=>void Xt.current(),5e3);return()=>{window.clearInterval(e),Ot.current!==void 0&&(window.clearTimeout(Ot.current),Ot.current=void 0)}},[]),(0,o.useEffect)(()=>{r.status?.status!==`running`&&wt(void 0)},[r.status?.status]),(0,o.useEffect)(()=>{let t=ve.current;if(!t||ye.current||r.sessions.length===0)return;ye.current=!0;let n=r.sessions.find(e=>e.path===t);if(!n||typeof n.path!=`string`){_e(void 0);return}r.session?.sessionFile!==n.path&&e.openSession(n.path).then(R).catch(e=>F(e instanceof Error?e.message:String(e)))},[e,r.session?.sessionFile,r.sessions,R]),(0,o.useEffect)(()=>{if(x(0),!m)return;let e=window.requestAnimationFrame(()=>ke.current?.focus());return()=>window.cancelAnimationFrame(e)},[m,v]),(0,o.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(ae){k(void 0);return}if(g){_(!1);return}if(m){h(!1),y(``);return}if(f!==void 0){p(void 0);return}h(!1),C(!1),O(!1),de(!1),d(void 0)}(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),h(!1),_(!0)),(e.metaKey||e.ctrlKey)&&e.key===`,`&&(e.preventDefault(),h(!1),_(!1),p(void 0),d(`general`))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,f,g,ae]);let en=r.session?.events??[],tn=(0,o.useMemo)(()=>Le(en),[en]),nn=(0,o.useMemo)(()=>Ge(r.session?.messages??[]),[r.session?.messages]);(0,o.useEffect)(()=>{if(!Dt.current)return;let e=window.requestAnimationFrame(()=>{let e=Et.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[r.session?.messages.length,r.status?.events,lt,st]);let V=r.sessions.filter(e=>!De||$(e.name??e.firstMessage,`未命名会话`).toLowerCase().includes(De.toLowerCase())),rn=t=>{t.preventDefault();let n=A.trim(),r=xe.length>0?Ye(xe,n):n;!r||st||(be(``),F(``),ut(r),wt(void 0),Dt.current=!0,ct(!0),e.prompt(r).then(async()=>{Se([]),await R()}).catch(e=>F(e instanceof Error?e.message:String(e))).finally(()=>ut(``)).finally(()=>ct(!1)))},an=(0,o.useCallback)(()=>{window.requestAnimationFrame(()=>{let e=window.getSelection()?.toString().trim()??``;e.length>0&&we(e.slice(0,4e3))})},[]),on=()=>{let e=Ce.trim();e&&(Se(t=>[...t,{id:t.length===0?1:Math.max(...t.map(e=>e.id))+1,quote:e,note:Te.trim()}]),we(``),Ee(``))},sn=()=>{let e=Tt.current,t=e?.selectionStart??A.length,n=Pe(A,t),r=t;if(n?.kind!==`command`){let e=`${t>0&&!/\s/.test(A[t-1]??``)?` `:``}/`,n=`${A.slice(0,t)}${e}${A.slice(t)}`;r=t+e.length,be(n)}Mt(r),Pt(!1),It(0),window.requestAnimationFrame(()=>{e?.focus(),e?.setSelectionRange(r,r)})},cn=t=>{let n=typeof t.path==`string`?t.path:``;n&&(d(void 0),h(!1),_(!1),l(`session`),s(`chat`),p(void 0),_e(n),e.openSession(n).then(R).catch(e=>F(e instanceof Error?e.message:String(e))))},ln=async e=>{if(!dt){ft(!0),F(``);try{await e(),await R(),bt(new Set),C(!1),T(void 0),ee(void 0),O(!1),ne(void 0),se(void 0),ie(!1),k(void 0)}catch(e){F(e instanceof Error?e.message:String(e))}finally{ft(!1)}}},H=r.session?.sessionFile,un=e=>{bt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},dn=(e,t,n)=>{if(S&&w===e){fn(),se(void 0);return}O(!1),ne(void 0),St.current=n,le(t??``),se({name:t||`未命名会话`,path:e}),T(e),ee(jc(n,142,190,`beside`)),C(!0)},fn=()=>{C(!1),T(void 0),ee(void 0)},pn=e=>{let t=new URLSearchParams(window.location.search);t.set(`page`,`plugins`),t.delete(`settings`),e?t.set(`plugin`,e):t.delete(`plugin`);let n=t.toString();window.history.pushState(null,``,`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`),d(void 0),p(void 0),h(!1),_(!1),C(!1),T(void 0),l(`plugins`),et(e),Ve(void 0)},mn=e=>{let t=new URLSearchParams(window.location.search);t.set(`page`,`marketplace`),t.delete(`settings`),e?t.set(`plugin`,e):t.delete(`plugin`);let n=t.toString();window.history.pushState(null,``,`${window.location.pathname}${n?`?${n}`:``}${window.location.hash}`),d(void 0),p(void 0),h(!1),_(!1),C(!1),T(void 0),l(`marketplace`),et(void 0),Ve(e)},hn=P===void 0?void 0:r.plugins.find(e=>e.name===P),gn=P===void 0?void 0:r.pluginPanels.find(e=>e.pluginId===P),_n=u?(0,j.jsx)(qc,{api:e,data:r,tab:u,onTab:d,onRefresh:R,onClose:()=>{d(void 0),l(`session`),s(`chat`),p(void 0)}}):c===`plugins`&&P&&hn?(0,j.jsx)(Uc,{metadata:nt,onBack:()=>pn(void 0),onToggle:async t=>{await e.togglePlugin(t.id,!t.enabled),await R()},onUninstall:async t=>{await e.uninstallPlugin(t.id);let n=await e.listPlugins();i(e=>({...e,plugins:n.filter(e=>e.id!==t.id)})),pn(void 0)},panel:gn,plugin:hn}):c===`plugins`&&P?(0,j.jsxs)(`section`,{className:`view-panel min-w-0 overflow-auto bg-[#f8f9fb]`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav bg-white`,children:[(0,j.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),pn(void 0)},children:`← 已安装插件`}),(0,j.jsx)(`span`,{children:`插件详情`})]}),(0,j.jsx)(`div`,{className:`empty-state`,children:r.status?`没有找到这个已安装插件,它可能已被移除。`:`正在读取插件详情…`})]}):c===`plugins`?(0,j.jsx)(Hc,{plugins:r.plugins,panels:r.pluginPanels,catalog:Qe.length?Qe:r.marketplace,onMarketplace:()=>mn(void 0),onOpenDetail:e=>pn(e.name),onToml:()=>{p(void 0),d(`toml`)},onToggle:async t=>{await e.togglePlugin(t.id,!t.enabled),await R()},onUninstall:async t=>{await e.uninstallPlugin(t.id);let n=await e.listPlugins();i(e=>({...e,plugins:n.filter(e=>e.id!==t.id)}))}}):c===`marketplace`?N&&We?.id===N?(0,j.jsx)(Gc,{plugin:We,installed:Gt.has(We.packageName),onBack:()=>mn(void 0),onInstall:async t=>{let n=await e.installMarketplace(t.id);return await R(),n}}):N?(0,j.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,j.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,j.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,j.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),mn(void 0)},children:`← 插件市场`}),(0,j.jsx)(`span`,{children:`插件详情`})]}),(0,j.jsx)(`div`,{className:`empty-state`,children:qe?`正在读取插件详情…`:Xe||`没有找到这个市场插件,它可能已下架。`})]})}):(0,j.jsx)(Wc,{plugins:r.marketplace,capabilities:r.marketplaceCapabilities,categories:r.marketplaceCategories,total:r.marketplaceTotal,page:r.marketplacePage,hasNext:r.marketplaceHasNext,query:Ae,capabilityFilter:Ie,categoryFilter:ze,onQueryChange:e=>{M(e),at(0)},onCapabilityChange:e=>{Re(e),at(0)},onCategoryChange:e=>{Be(e),at(0)},onOpenDetail:e=>mn(e.id),onPageChange:at,onBack:()=>pn(void 0),onToml:()=>{p(void 0),d(`toml`)},installedPackages:Gt,onInstall:async t=>{let n=await e.installMarketplace(t.id);return await R(),n}}):a===`chat`?(0,j.jsxs)(`section`,{className:`view-panel chat-view`,children:[(0,j.jsxs)(`div`,{className:`chat-scroll ${r.session?.messages.length?``:`is-empty`}`,onScroll:e=>{let t=e.currentTarget;Dt.current=t.scrollHeight-t.scrollTop-t.clientHeight<120},ref:Et,children:[r.session?.messages.length?nn.map((e,t)=>(0,j.jsx)(tl,{onMouseUp:an,role:e.role,text:e.text,thinking:e.thinking},t)):(0,j.jsx)(Ec,{status:r.status,workspaces:r.workspaces,onCreate:e=>void Zt(e),onStarter:be,onToml:()=>{p(void 0),d(`toml`)}}),Ct&&r.status?.status===`running`&&(0,j.jsxs)(`article`,{className:`turn text streaming-turn`,"aria-live":`polite`,children:[Ct.thinking&&(0,j.jsxs)(`details`,{className:`reasoning message-reasoning`,children:[(0,j.jsx)(`summary`,{className:`reasoning-head`,children:`思考中…`}),(0,j.jsx)(`div`,{className:`reasoning-body`,children:(0,j.jsx)(He,{text:Ct.thinking})})]}),!Ct.thinking&&!Ct.text&&(0,j.jsx)(`div`,{className:`streaming-placeholder`,children:`正在生成…`}),Ct.text&&(0,j.jsx)(He,{onMouseUp:an,text:Ct.text})]}),lt&&!r.session?.messages.some(e=>e.role===`user`&&Ue(e)===lt)&&(0,j.jsx)(`article`,{className:`turn user pending-turn`,children:(0,j.jsx)(Nc,{text:lt})})]}),(0,j.jsxs)(`div`,{className:`composer-wrap`,children:[(0,j.jsx)(`div`,{className:`context-shell`,children:(0,j.jsxs)(`div`,{className:`context-line`,children:[(0,j.jsx)(`span`,{className:`context-label`,children:`实时上下文`}),(0,j.jsxs)(`div`,{className:`context-metrics`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`b`,{children:r.status?.messages??0}),` 条消息`]}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`b`,{children:r.status?.events??en.length}),` 个事件`]}),(0,j.jsx)(`span`,{children:(0,j.jsx)(`b`,{children:$(r.status?.model)})})]})]})}),(0,j.jsxs)(`div`,{className:`composer-stack`,children:[ot&&(0,j.jsx)(Mc,{message:ot}),Ce?(0,j.jsxs)(`div`,{"aria-label":`添加批注`,className:`rounded-lg border border-[#cdddf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,j.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded bg-[#dce9ff] px-1.5 py-0.5 text-[10px] text-[#315fb8]`,children:`选中片段`}),(0,j.jsx)(`p`,{className:`max-h-16 flex-1 overflow-auto whitespace-pre-wrap text-[11px] text-[#30343b]`,children:Ce}),(0,j.jsx)(`button`,{"aria-label":`取消批注`,className:`text-[12px] text-[#687381]`,onClick:()=>we(``),type:`button`,children:`×`})]}),(0,j.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,j.jsx)(`input`,{"aria-label":`批注备注`,className:`min-w-0 flex-1 rounded-md border border-[#dce5f5] bg-white px-2 py-1.5 text-[11px] outline-none`,onChange:e=>Ee(e.target.value),placeholder:`备注(可选)`,value:Te}),(0,j.jsx)(`button`,{className:`rounded-md bg-[#3565c5] px-3 py-1.5 text-[11px] font-medium text-white`,onClick:on,type:`button`,children:`加入批注`})]})]}):null,xe.length>0?(0,j.jsxs)(`div`,{className:`flex items-center gap-2 overflow-x-auto text-[10px]`,children:[(0,j.jsxs)(`span`,{className:`shrink-0 rounded-md bg-[#edf3fe] px-2 py-1 font-medium text-[#315fb8]`,children:[`批注 ×`,xe.length]}),xe.map(e=>(0,j.jsxs)(`button`,{className:`max-w-48 shrink-0 truncate rounded-md border border-[#dce5f5] bg-white px-2 py-1 text-left text-[#65707b]`,onClick:()=>Se(t=>t.filter(t=>t.id!==e.id)),title:`点击移除批注`,type:`button`,children:[`#`,e.id,` `,e.quote]},e.id)),(0,j.jsx)(`button`,{className:`shrink-0 text-[#687381]`,onClick:()=>Se([]),type:`button`,children:`清空`})]}):null,(0,j.jsxs)(`form`,{className:`composer`,onSubmit:rn,children:[(0,j.jsx)(`textarea`,{"aria-activedescendant":Ut?`prompt-completion-option-${Wt}`:void 0,"aria-autocomplete":`list`,"aria-controls":Ut?`prompt-completion-list`:void 0,"aria-expanded":Ut,"aria-haspopup":`listbox`,"aria-label":`Prompt`,onChange:e=>{be(e.target.value),Mt(e.currentTarget.selectionStart??e.target.value.length),Pt(!1),e.currentTarget.style.height=`auto`,e.currentTarget.style.height=`${Math.min(e.currentTarget.scrollHeight,180)}px`},onKeyDown:e=>{let t=e.currentTarget.selectionStart??A.length,n=Pe(e.currentTarget.value,t),i=n?n.kind===`command`?Jc(r.commands,n.query).slice(0,12):r.files.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(n.query.trim().toLowerCase())).slice(0,12):[],a=!!(n&&!Nt&&i.length);if(a&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),It(t=>(t+(e.key===`ArrowDown`?1:-1)+i.length)%i.length);return}if(a&&(e.key===`Enter`||e.key===`Tab`)){e.preventDefault();let t=i[Math.min(Ft,i.length-1)];if(t&&n){let r=n.kind===`command`?`/${t.invocationName}`:`@${t.path}`,i=Fe(e.currentTarget.value,n,`${r} `);be(i.text),Mt(i.caret),Pt(!1),requestAnimationFrame(()=>{let e=Tt.current;e?.focus(),e?.setSelectionRange(i.caret,i.caret)})}return}if(e.key===`Escape`&&n&&!Nt){e.preventDefault(),Pt(!0);return}(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onClick:()=>{Kt||de(!0)},onFocus:e=>{Kt||(e.currentTarget.blur(),de(!0))},placeholder:Kt?`描述要做的改动,⌘↵ 发送;@ 引用文件,/ 调用命令`:`先选择工作区,再描述要做的改动`,readOnly:!Kt,ref:Tt,rows:2,"data-prompt-completion":!0,value:A}),Ut&&Vt&&(0,j.jsx)(Xc,{activeIndex:Wt,commands:r.commands,files:r.files,kind:Vt.kind,onActiveIndexChange:It,onUse:e=>{let t=Fe(A,Vt,`${e} `);be(t.text),Mt(t.caret),Pt(!1),requestAnimationFrame(()=>{let e=Tt.current;e?.focus(),e?.setSelectionRange(t.caret,t.caret)})},query:Vt.query}),(0,j.jsxs)(`div`,{className:`composer-tools`,children:[(0,j.jsx)(`select`,{"aria-label":`模型`,disabled:!r.models.length||st,value:r.status?.model??``,onChange:t=>{let[n,...r]=t.target.value.split(`/`),i=r.join(`/`);!n||!i||(F(``),e.selectModel(n,i).then(R).catch(e=>F(e instanceof Error?e.message:String(e))))},children:r.models.length?r.models.map(e=>(0,j.jsx)(`option`,{value:`${e.provider}/${e.id}`,children:e.name===e.id?`${e.provider}/${e.id}`:`${e.name} (${e.provider})`},`${e.provider}/${e.id}`)):(0,j.jsx)(`option`,{value:``,children:`暂无可用模型`})}),(0,j.jsx)(`button`,{className:`tool-chip`,onClick:sn,type:`button`,children:`/ 命令`}),(0,j.jsx)(`span`,{className:`composer-hint`,children:`⌘↵ 发送 · ⌘K 命令 · ⌃C 中断`}),(0,j.jsx)(`button`,{"aria-label":st?`发送中`:`发送消息`,className:`send-button`,disabled:st||!A.trim(),title:st?`正在发送`:`发送消息(⌘↵)`,type:`submit`,children:st?`…`:`↑`})]})]})]})]})]}):a===`trajectory`?(0,j.jsx)(Fc,{events:tn,onSelect:p}):(0,j.jsx)(Ic,{api:e,files:r.files,onDiff:async t=>{let n=await e.getFileDiff(t);p({type:`file_diff`,path:n.path,output:n.diff||`没有可显示的差异(工作区可能已更新)。`})},onRefresh:()=>void R()}),vn=Tc(V),yn=!!(r.session&&!De&&!V.some(e=>e.sessionId===r.session?.sessionId)),bn=Jc(r.commands,v),xn=r.pluginPanels.find(e=>e.id===`better-sidebar-panel`),U=xn?.data!==null&&typeof xn?.data==`object`&&!Array.isArray(xn?.data)?xn.data:void 0,Sn=r.pluginPanels.find(e=>e.id===`theme-studio-panel`),Cn=Sn?.data!==null&&typeof Sn?.data==`object`&&!Array.isArray(Sn?.data)?Sn.data:void 0,wn=(0,o.useMemo)(()=>{if(!Cn?.tokens||typeof Cn.tokens!=`object`||Array.isArray(Cn.tokens))return;let e=Object.entries(Cn.tokens).filter(([e,t])=>e.startsWith(`--`)&&typeof t==`string`);return e.length?Object.fromEntries(e):void 0},[Cn]),Tn=typeof Cn?.theme==`string`?Cn.theme:void 0,En=e=>{be(e),h(!1),y(``)};return(0,j.jsxs)(`div`,{className:`app-frame`,"data-theme":Tn,style:wn,children:[(0,j.jsxs)(`aside`,{className:`sidebar`,children:[(0,j.jsxs)(`header`,{className:`brand-row`,children:[(0,j.jsx)(`span`,{className:`pi-mark`,"aria-hidden":`true`,children:(0,j.jsx)(`img`,{src:`/icons/svg/mark-white.svg`,alt:``})}),(0,j.jsx)(`strong`,{children:`pi harness`}),t?(0,j.jsx)(`span`,{className:`version`,children:t}):null]}),(0,j.jsxs)(`div`,{className:`sidebar-actions`,children:[(0,j.jsx)(`button`,{className:`new-session`,onClick:Qt,type:`button`,"aria-expanded":ue,children:`+ 新建会话`}),(0,j.jsxs)(`div`,{className:`session-search`,"data-command-palette":!0,children:[(0,j.jsx)(`input`,{"aria-controls":m?`command-menu`:void 0,"aria-expanded":m,"aria-label":m?`搜索命令`:`搜索会话`,onChange:e=>{let t=e.target.value;if(!m&&t.startsWith(`/`)){h(!0),y(t.slice(1));return}m?y(t.replace(/^\/\s?/,``)):Oe(t)},onKeyDown:e=>{m&&(e.key===`ArrowDown`&&bn.length?(e.preventDefault(),x(e=>(e+1)%bn.length)):e.key===`ArrowUp`&&bn.length?(e.preventDefault(),x(e=>(e-1+bn.length)%bn.length)):e.key===`Enter`&&bn.length&&(e.preventDefault(),En(`/${bn[b]?.invocationName??``}`)))},placeholder:m?`输入命令名称或描述`:`搜索会话 · ⌘K 命令`,ref:ke,type:`search`,value:m?`/${v}`:De}),m&&(0,j.jsx)(Yc,{activeIndex:b,commands:r.commands,onActiveIndexChange:x,onUse:En,query:v})]}),(0,j.jsx)(`input`,{accept:`.jsonl,application/json,application/x-ndjson`,"aria-label":`导入会话文件`,hidden:!0,onChange:t=>{let n=t.currentTarget.files?.[0];t.currentTarget.value=``,n&&ln(async()=>{let t=await e.importSession(await n.text(),n.name);t.sessionFile&&_e(t.sessionFile)})},ref:xt,type:`file`})]}),(0,j.jsxs)(`div`,{className:`session-list-toolbar`,children:[(0,j.jsxs)(`div`,{className:`session-list-title`,children:[(0,j.jsx)(`strong`,{children:`会话`}),(0,j.jsx)(`span`,{children:gt||r.sessions.length})]}),(0,j.jsxs)(`div`,{className:`session-list-tools`,children:[(0,j.jsx)(`button`,{"aria-pressed":re,className:`session-tool-button ${re?`active`:``}`,onClick:()=>{ie(!re),bt(new Set),O(!1),fn()},type:`button`,children:re?`完成`:`选择`}),(0,j.jsxs)(`div`,{className:`session-tools-wrap`,"data-session-popover":!0,children:[(0,j.jsx)(`button`,{"aria-expanded":D,"aria-haspopup":`menu`,"aria-label":`会话工具`,className:`session-tool-button icon`,onClick:e=>{fn(),St.current=e.currentTarget,se(void 0),D?(O(!1),ne(void 0)):(ne(jc(e.currentTarget,150,190,`below`)),O(!0))},type:`button`,children:`⋯`}),D&&te&&(0,je.createPortal)((0,j.jsxs)(`div`,{className:`session-tools-popover`,"data-session-popover":!0,role:`menu`,style:te,children:[(0,j.jsx)(`button`,{autoFocus:!0,onClick:()=>window.location.reload(),role:`menuitem`,type:`button`,children:`刷新列表`}),(0,j.jsx)(`button`,{onClick:()=>{O(!1),ne(void 0),xt.current?.click()},role:`menuitem`,type:`button`,children:`导入会话`}),(0,j.jsx)(`button`,{disabled:!H||dt,onClick:()=>{H&&ln(async()=>{let t=await e.exportSession(H),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`${r.session?.sessionId??`session`}.jsonl`,n.click(),URL.revokeObjectURL(n.href)})},role:`menuitem`,type:`button`,children:`导出当前会话`}),(0,j.jsx)(`button`,{onClick:()=>{pt(e=>!e),O(!1),ne(void 0),R()},role:`menuitem`,type:`button`,children:I?`隐藏归档会话`:`显示归档会话`})]}),document.body)]})]})]}),re&&yt.size>0&&(0,j.jsxs)(`div`,{className:`session-batch-bar`,children:[(0,j.jsxs)(`span`,{children:[yt.size,` 个已选择`]}),(0,j.jsx)(`button`,{onClick:()=>void ln(()=>e.batchSessions(`archive`,[...yt]).then(()=>void 0)),type:`button`,children:`归档`}),(0,j.jsx)(`button`,{onClick:()=>void ln(()=>e.batchSessions(`pin`,[...yt]).then(()=>void 0)),type:`button`,children:`置顶`}),(0,j.jsx)(`button`,{className:`danger`,onClick:()=>{se(void 0),k(`batch-delete`)},type:`button`,children:`删除`})]}),(0,j.jsxs)(`div`,{className:`sidebar-scroll`,children:[yn&&r.session&&(0,j.jsxs)(`div`,{className:`session-group`,children:[(0,j.jsx)(`div`,{className:`group-label`,children:`当前`}),(0,j.jsxs)(`div`,{className:`session-row-wrap current-session-row`,children:[re&&(0,j.jsx)(`input`,{"aria-label":`选择当前会话`,checked:H?yt.has(H):!1,onChange:()=>H&&un(H),type:`checkbox`}),(0,j.jsxs)(`button`,{className:`session-row active`,onClick:()=>{d(void 0),h(!1),_(!1),l(`session`),s(`chat`),p(void 0),C(!1),R()},type:`button`,children:[(0,j.jsx)(`span`,{className:`session-dot ok`}),(0,j.jsxs)(`span`,{className:`session-copy`,children:[(0,j.jsx)(`strong`,{children:r.session.messages.length?r.session.sessionId.slice(0,12):`新会话`}),(0,j.jsxs)(`small`,{children:[r.session.messages.length,` 条消息`]})]})]}),!re&&H&&(0,j.jsx)(`button`,{"aria-expanded":S&&w===H,"aria-haspopup":`menu`,"aria-label":`当前会话操作`,className:`session-row-more`,"data-session-popover":!0,onClick:e=>dn(H,r.session?.messages.length?r.session?.sessionId.slice(0,12):`新会话`,e.currentTarget),type:`button`,children:`⋯`}),!re&&H&&w===H&&S&&E&&(0,j.jsx)(Ac,{busy:dt,position:E,onArchive:()=>{fn(),k(`archive`)},onDelete:()=>{fn(),k(`delete`)},onFork:()=>void ln(async()=>{let t=await e.forkSession(H);t.sessionFile&&(_e(t.sessionFile),await e.openSession(t.sessionFile))}),onRename:()=>{fn(),k(`rename`)}})]})]}),vn.length?vn.map(([t,n])=>(0,j.jsxs)(`div`,{className:`session-group`,children:[(0,j.jsx)(`div`,{className:`group-label`,children:t}),n.map((t,n)=>(0,j.jsxs)(`div`,{className:`session-row-wrap`,children:[re&&(0,j.jsx)(`input`,{"aria-label":`选择会话 ${$(t.name??t.firstMessage,`未命名会话`)}`,checked:typeof t.path==`string`&&yt.has(t.path),onChange:()=>{typeof t.path==`string`&&un(t.path)},type:`checkbox`}),(0,j.jsxs)(`button`,{className:`session-row ${t.sessionId===r.session?.sessionId?`active`:``}`,onClick:()=>cn(t),type:`button`,children:[(0,j.jsx)(`span`,{className:`session-dot ok`}),(0,j.jsxs)(`span`,{className:`session-copy`,children:[(0,j.jsx)(`strong`,{children:$(t.name??t.firstMessage,`未命名会话`)}),(0,j.jsxs)(`small`,{children:[$(t.messageCount,`0`),` 条消息`,t.pinned===!0?` · 已置顶`:``,t.archived===!0?` · 已归档`:``]})]})]}),!re&&typeof t.path==`string`&&(0,j.jsx)(`button`,{"aria-expanded":S&&w===t.path,"aria-haspopup":`menu`,"aria-label":`会话操作 ${$(t.name??t.firstMessage,`未命名会话`)}`,className:`session-row-more`,"data-session-popover":!0,onClick:e=>{e.stopPropagation(),dn(t.path,$(t.name??t.firstMessage,``),e.currentTarget)},type:`button`,children:`⋯`}),!re&&typeof t.path==`string`&&w===t.path&&S&&E&&(0,j.jsx)(Ac,{busy:dt,position:E,onArchive:()=>{fn(),k(`archive`)},onDelete:()=>{fn(),k(`delete`)},onFork:()=>void ln(async()=>{let n=await e.forkSession(t.path);n.sessionFile&&(_e(n.sessionFile),await e.openSession(n.sessionFile))}),onRename:()=>{fn(),k(`rename`)}})]},n))]},t)):yn?null:(0,j.jsx)(`div`,{className:`empty-state`,children:`暂无已保存会话`}),gt>30&&(0,j.jsxs)(`div`,{className:`session-pagination`,children:[(0,j.jsx)(`button`,{disabled:mt===0,onClick:()=>ht(e=>Math.max(0,e-1)),type:`button`,children:`上一页`}),(0,j.jsxs)(`span`,{children:[mt+1,` / `,Math.max(1,Math.ceil(gt/30))]}),(0,j.jsx)(`button`,{disabled:!L,onClick:()=>ht(e=>e+1),type:`button`,children:`下一页`})]}),U&&(0,j.jsxs)(`section`,{"aria-label":`工作区概览`,className:`mx-3 mt-3 rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,j.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,j.jsx)(`strong`,{className:`text-[11px] font-semibold text-[#253044]`,children:`工作区概览`}),(0,j.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[9px] ${U.clean===!0?`bg-[#eaf8f0] text-[#14733f]`:`bg-[#fff0f0] text-[#b42318]`}`,children:U.clean===!0?`clean`:`${$(U.changedCount??0)} 变更`})]}),(0,j.jsx)(`code`,{className:`mt-2 block truncate text-[10px] text-[#315fb8]`,children:$(U.cwd??`当前工作区`)}),(0,j.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-[#65707b]`,children:$(U.branch??`非 Git 工作区`)}),Array.isArray(U.changedFiles)&&U.changedFiles.length>0?(0,j.jsx)(`div`,{className:`mt-2 grid gap-1 border-t border-[#dce5f5] pt-2`,children:U.changedFiles.slice(0,3).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,j.jsxs)(`code`,{className:`truncate text-[9px] text-[#65707b]`,children:[$(n.status??`??`),` `,$(n.path??`未命名`)]},`${$(n.path??`file`)}-${t}`)})}):null]})]}),(0,j.jsxs)(`footer`,{className:`sidebar-footer`,children:[(0,j.jsxs)(`div`,{className:`runtime-cells`,children:[(0,j.jsxs)(`span`,{children:[`model `,(0,j.jsx)(`b`,{children:$(r.status?.model)})]}),(0,j.jsxs)(`span`,{children:[`msgs `,(0,j.jsx)(`b`,{children:r.status?.messages??0})]}),(0,j.jsxs)(`span`,{children:[`status `,(0,j.jsx)(`b`,{children:$(r.status?.status,`connecting`)})]})]}),(0,j.jsx)(`button`,{"aria-label":`搜索会话、文件和命令`,className:`sidebar-link compact-session-search`,onClick:()=>{h(!1),O(!1),fn(),_(!0)},title:`搜索会话、文件和命令`,type:`button`,children:`⌕`}),(0,j.jsx)(`button`,{"aria-label":`新建会话`,className:`sidebar-link compact-new-session`,onClick:Qt,title:`新建会话`,type:`button`,children:`+`}),(0,j.jsxs)(`button`,{"aria-label":`插件,已安装 ${qt} 个`,className:`sidebar-link ${c===`plugins`||c===`marketplace`?`active`:``}`,onClick:()=>pn(void 0),title:`插件 · ${qt} 个`,type:`button`,children:[`◈ `,(0,j.jsx)(`span`,{children:`插件`}),(0,j.jsx)(`b`,{children:qt})]}),(0,j.jsxs)(`button`,{"aria-label":`设置`,className:`sidebar-link ${u?`active`:``}`,onClick:()=>{h(!1),_(!1),C(!1),T(void 0),p(void 0),d(`general`)},title:`设置`,type:`button`,children:[`⚙ `,(0,j.jsx)(`span`,{children:`设置`})]})]})]}),(0,j.jsxs)(`section`,{className:`main-pane`,children:[(0,j.jsxs)(`header`,{className:`main-header ${!u&&c===`session`?`session-track`:``}`,children:[(0,j.jsxs)(`div`,{className:`active-heading`,children:[(0,j.jsx)(`strong`,{children:u?`设置`:c===`plugins`?P?`插件详情`:`运行时插件`:c===`marketplace`?N?`插件详情`:`插件市场`:r.session?.messages.length?r.session.sessionId.slice(0,12):`新会话`}),(0,j.jsx)(`small`,{children:u?`运行时状态与配置`:c===`plugins`?P?nt?.name??Cc(P):`已安装插件`:c===`marketplace`?N?We?.name??N:`官方与社区 · 已审核目录`:bc(r.status,r.session)})]}),(0,j.jsx)(`div`,{className:`header-spacer`}),r.status?.status===`running`&&(0,j.jsxs)(`div`,{className:`run-indicator running`,children:[(0,j.jsx)(`span`,{className:`run-dot`}),(0,j.jsx)(`span`,{children:`运行中 · Pi agent`}),(0,j.jsx)(`button`,{className:`stop-button`,onClick:()=>{F(``),e.abort().then(R).catch(e=>F(e instanceof Error?e.message:String(e)))},type:`button`,children:`停止`})]}),!u&&c===`session`&&(0,j.jsx)(`div`,{"aria-label":`会话视图`,className:`view-tabs`,children:[`chat`,`trajectory`,`files`].map(e=>(0,j.jsx)(`button`,{"aria-pressed":a===e,className:`view-tab ${a===e?`active`:``}`,onClick:()=>{s(e),p(void 0)},type:`button`,children:e===`chat`?`对话`:e===`trajectory`?`轨迹`:`产出`},e))}),!u&&c===`session`&&(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`header-divider`}),!u&&c===`session`&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`session-menu-wrap`,"data-session-popover":!0,children:[(0,j.jsx)(`button`,{"aria-expanded":S&&!w,"aria-haspopup":`menu`,className:`session-menu`,onClick:e=>{let t=S&&!w;T(void 0),ee(void 0),St.current=e.currentTarget,se(!t&&H?{name:r.session?.sessionId?.slice(0,12)||`当前会话`,path:H}:void 0),C(!t)},type:`button`,"aria-label":`会话操作`,children:`⋯`}),S&&!w&&(0,j.jsxs)(`div`,{className:`session-menu-popover compact-session-menu`,role:`menu`,children:[(0,j.jsxs)(`button`,{className:`session-action`,disabled:!H||dt,onClick:()=>{le(r.session?.sessionId?.slice(0,12)??``),k(`rename`),C(!1)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:`重命名`}),(0,j.jsx)(`small`,{children:`设置一个容易识别的名称`})]}),(0,j.jsxs)(`button`,{className:`session-action`,disabled:!H||dt,onClick:()=>void ln(async()=>{let t=await e.forkSession(H);t.sessionFile&&(_e(t.sessionFile),await e.openSession(t.sessionFile))}),role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:`复制会话`}),(0,j.jsx)(`small`,{children:`复制上下文并打开副本`})]}),(0,j.jsxs)(`button`,{className:`session-action`,disabled:!H||dt,onClick:()=>{C(!1),k(`archive`)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:`归档会话`}),(0,j.jsx)(`small`,{children:`从默认列表隐藏`})]}),(0,j.jsxs)(`button`,{className:`session-action danger`,disabled:!H||dt,onClick:()=>{C(!1),k(`delete`)},role:`menuitem`,type:`button`,children:[(0,j.jsx)(`strong`,{children:`删除会话`}),(0,j.jsx)(`small`,{children:`永久删除本地记录`})]})]})]}),(0,j.jsxs)(`button`,{"aria-label":f===void 0?`打开详情`:`关闭详情`,"aria-pressed":f!==void 0,className:`details-toggle`,onClick:()=>p(f?void 0:{}),type:`button`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`◨`}),` `,(0,j.jsx)(`span`,{className:`details-toggle-label`,children:`详情`})]})]})]}),zt.length>0&&(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`refresh-warning`,role:`status`,children:[(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`部分数据刷新失败`}),zt.join(`、`),`可能为空或显示上次结果。`]}),(0,j.jsx)(`button`,{onClick:()=>void R(),type:`button`,children:`重试`})]}),(0,j.jsx)(`div`,{className:`view-host`,children:Lt?(0,j.jsxs)(`div`,{"aria-live":`polite`,className:`initial-loading`,role:`status`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`}),`正在连接 Pi runtime…`]}):_n})]}),!u&&c===`session`&&f!==void 0&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{"aria-label":`关闭详情`,className:`details-backdrop`,onClick:()=>p(void 0),type:`button`}),(0,j.jsx)(Pc,{event:Object.keys(f).length?f:void 0,onClose:()=>p(void 0),onCopy:()=>void navigator.clipboard?.writeText(JSON.stringify(f,null,2))})]}),g&&(0,j.jsx)(Zc,{commands:r.commands,files:r.files,onClose:()=>_(!1),onOpenFile:e=>{l(`session`),s(`files`),p({type:`file`,path:e.path,status:e.status})},onOpenSession:cn,onUse:be,sessions:r.sessions}),ue&&(0,j.jsx)(Dc,{error:fe,onClose:()=>de(!1),onPickDirectory:B,onSelect:e=>void Zt(e),workspaces:r.workspaces}),ae&&(0,j.jsx)(Oc,{busy:dt,count:ae===`batch-delete`?yt.size:void 0,kind:ae,name:ae===`rename`||ae===`batch-delete`?void 0:oe?.name??$(r.session?.sessionId,`当前会话`),onChange:le,onClose:()=>{k(void 0),se(void 0)},onConfirm:()=>{let t=oe?.path??H;ae===`rename`&&t?ln(()=>e.renameSession(t,ce.trim()).then(()=>void 0)):ae===`archive`&&t?ln(async()=>{await e.setSessionMetadata(t,{archived:!0})}):ae===`delete`&&t?ln(async()=>{await e.deleteSession(t)}):ae===`batch-delete`&&ln(()=>e.batchSessions(`delete`,[...yt]).then(()=>void 0))},value:ce})]})}var rl=class{context;root;version;#e;constructor(e,t={}){this.root=e,this.version=t.version,this.context=new Ae}run(){this.context.provide(`clientRoot`,this.root),this.context.provide(`clientApi`,Ne()),this.#e=(0,s.createRoot)(this.root),this.#e.render((0,o.createElement)(nl,{api:this.context.clientApi,appVersion:this.version}))}async dispose(){this.#e?.unmount(),await this.context.fiber.dispose()}},il=document.getElementById(`root`);if(!(il instanceof HTMLElement))throw Error(`Pi Harness web app is missing #root`);var al=new rl(il,{version:`0.1.28`});try{al.run()}catch(e){il.textContent=e instanceof Error?e.message:String(e)}