@pi-harness/pi-harness 0.1.2 → 0.1.4

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 (914) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +31 -7
  3. package/apps/web/dist/assets/index-CihATCjR.css +2 -0
  4. package/apps/web/dist/assets/index-NzapJoGa.js +20 -0
  5. package/apps/web/dist/assets/markdown-vendor-DUdMWn0M.js +66 -0
  6. package/apps/web/dist/assets/react-vendor-BD7-wQo9.js +9 -0
  7. package/apps/web/dist/icons/app/android-192.png +0 -0
  8. package/apps/web/dist/icons/app/android-512.png +0 -0
  9. package/apps/web/dist/icons/app/app-blue-512.png +0 -0
  10. package/apps/web/dist/icons/app/app-store-1024.png +0 -0
  11. package/apps/web/dist/icons/app/apple-touch-icon-180.png +0 -0
  12. package/apps/web/dist/icons/app/maskable-512.png +0 -0
  13. package/apps/web/dist/icons/favicon/favicon-16.png +0 -0
  14. package/apps/web/dist/icons/favicon/favicon-32.png +0 -0
  15. package/apps/web/dist/icons/favicon/favicon-48.png +0 -0
  16. package/apps/web/dist/icons/png-blue/pi-256.png +0 -0
  17. package/apps/web/dist/icons/png-blue/pi-512.png +0 -0
  18. package/apps/web/dist/icons/png-ink/pi-1024.png +0 -0
  19. package/apps/web/dist/icons/png-ink/pi-128.png +0 -0
  20. package/apps/web/dist/icons/png-ink/pi-16.png +0 -0
  21. package/apps/web/dist/icons/png-ink/pi-24.png +0 -0
  22. package/apps/web/dist/icons/png-ink/pi-256.png +0 -0
  23. package/apps/web/dist/icons/png-ink/pi-32.png +0 -0
  24. package/apps/web/dist/icons/png-ink/pi-48.png +0 -0
  25. package/apps/web/dist/icons/png-ink/pi-512.png +0 -0
  26. package/apps/web/dist/icons/png-ink/pi-64.png +0 -0
  27. package/apps/web/dist/icons/png-white/pi-1024.png +0 -0
  28. package/apps/web/dist/icons/png-white/pi-128.png +0 -0
  29. package/apps/web/dist/icons/png-white/pi-16.png +0 -0
  30. package/apps/web/dist/icons/png-white/pi-24.png +0 -0
  31. package/apps/web/dist/icons/png-white/pi-256.png +0 -0
  32. package/apps/web/dist/icons/png-white/pi-32.png +0 -0
  33. package/apps/web/dist/icons/png-white/pi-48.png +0 -0
  34. package/apps/web/dist/icons/png-white/pi-512.png +0 -0
  35. package/apps/web/dist/icons/png-white/pi-64.png +0 -0
  36. package/apps/web/dist/icons/social/og-1200x630.png +0 -0
  37. package/apps/web/dist/icons/svg/app-icon-blue.svg +13 -0
  38. package/apps/web/dist/icons/svg/app-icon-ink.svg +13 -0
  39. package/apps/web/dist/icons/svg/favicon.svg +10 -0
  40. package/apps/web/dist/icons/svg/lockup-horizontal.svg +13 -0
  41. package/apps/web/dist/icons/svg/mark-blue.svg +10 -0
  42. package/apps/web/dist/icons/svg/mark-compact.svg +10 -0
  43. package/apps/web/dist/icons/svg/mark-ink.svg +10 -0
  44. package/apps/web/dist/icons/svg/mark-white.svg +10 -0
  45. package/apps/web/dist/icons/svg/mark.svg +10 -0
  46. package/apps/web/dist/index.html +18 -6
  47. package/apps/web/dist/manifest.webmanifest +14 -0
  48. package/apps/web/index.html +14 -4
  49. package/apps/web/package.json +11 -9
  50. package/apps/web/profile/cordis.yml +222 -1
  51. package/apps/web/public/icons/app/android-192.png +0 -0
  52. package/apps/web/public/icons/app/android-512.png +0 -0
  53. package/apps/web/public/icons/app/app-blue-512.png +0 -0
  54. package/apps/web/public/icons/app/app-store-1024.png +0 -0
  55. package/apps/web/public/icons/app/apple-touch-icon-180.png +0 -0
  56. package/apps/web/public/icons/app/maskable-512.png +0 -0
  57. package/apps/web/public/icons/favicon/favicon-16.png +0 -0
  58. package/apps/web/public/icons/favicon/favicon-32.png +0 -0
  59. package/apps/web/public/icons/favicon/favicon-48.png +0 -0
  60. package/apps/web/public/icons/png-blue/pi-256.png +0 -0
  61. package/apps/web/public/icons/png-blue/pi-512.png +0 -0
  62. package/apps/web/public/icons/png-ink/pi-1024.png +0 -0
  63. package/apps/web/public/icons/png-ink/pi-128.png +0 -0
  64. package/apps/web/public/icons/png-ink/pi-16.png +0 -0
  65. package/apps/web/public/icons/png-ink/pi-24.png +0 -0
  66. package/apps/web/public/icons/png-ink/pi-256.png +0 -0
  67. package/apps/web/public/icons/png-ink/pi-32.png +0 -0
  68. package/apps/web/public/icons/png-ink/pi-48.png +0 -0
  69. package/apps/web/public/icons/png-ink/pi-512.png +0 -0
  70. package/apps/web/public/icons/png-ink/pi-64.png +0 -0
  71. package/apps/web/public/icons/png-white/pi-1024.png +0 -0
  72. package/apps/web/public/icons/png-white/pi-128.png +0 -0
  73. package/apps/web/public/icons/png-white/pi-16.png +0 -0
  74. package/apps/web/public/icons/png-white/pi-24.png +0 -0
  75. package/apps/web/public/icons/png-white/pi-256.png +0 -0
  76. package/apps/web/public/icons/png-white/pi-32.png +0 -0
  77. package/apps/web/public/icons/png-white/pi-48.png +0 -0
  78. package/apps/web/public/icons/png-white/pi-512.png +0 -0
  79. package/apps/web/public/icons/png-white/pi-64.png +0 -0
  80. package/apps/web/public/icons/social/og-1200x630.png +0 -0
  81. package/apps/web/public/icons/svg/app-icon-blue.svg +13 -0
  82. package/apps/web/public/icons/svg/app-icon-ink.svg +13 -0
  83. package/apps/web/public/icons/svg/favicon.svg +10 -0
  84. package/apps/web/public/icons/svg/lockup-horizontal.svg +13 -0
  85. package/apps/web/public/icons/svg/mark-blue.svg +10 -0
  86. package/apps/web/public/icons/svg/mark-compact.svg +10 -0
  87. package/apps/web/public/icons/svg/mark-ink.svg +10 -0
  88. package/apps/web/public/icons/svg/mark-white.svg +10 -0
  89. package/apps/web/public/icons/svg/mark.svg +10 -0
  90. package/apps/web/public/manifest.webmanifest +14 -0
  91. package/apps/web/server-dist/bin.js +19 -6
  92. package/apps/web/server-dist/bin.js.map +1 -1
  93. package/apps/web/src/command-palette.ts +28 -7
  94. package/apps/web/src/file-diff.ts +15 -10
  95. package/apps/web/src/main.ts +4 -1
  96. package/apps/web/src/runtime.css +17 -4
  97. package/apps/web/src/server/bin.ts +24 -7
  98. package/apps/web/src/style.css +2618 -8
  99. package/apps/web/src/tailwind.css +25 -0
  100. package/apps/web/tsconfig.build.json +5 -1
  101. package/apps/web/tsconfig.json +1 -1
  102. package/apps/web/vite.config.ts +20 -0
  103. package/package.json +29 -17
  104. package/packages/api-gateway/LICENSE +9 -0
  105. package/packages/api-gateway/dist/index.d.ts.map +1 -1
  106. package/packages/api-gateway/dist/index.js +1188 -42
  107. package/packages/api-gateway/dist/index.js.map +1 -1
  108. package/packages/api-gateway/dist/marketplace-entries/official/agent-teams.json +31 -0
  109. package/packages/api-gateway/dist/marketplace-entries/official/anchored-standard.json +29 -0
  110. package/packages/api-gateway/dist/marketplace-entries/official/annotation.json +28 -0
  111. package/packages/api-gateway/dist/marketplace-entries/official/archify.json +31 -0
  112. package/packages/api-gateway/dist/marketplace-entries/official/at-file.json +28 -0
  113. package/packages/api-gateway/dist/marketplace-entries/official/auto-mode.json +32 -0
  114. package/packages/api-gateway/dist/marketplace-entries/official/better-sidebar.json +32 -0
  115. package/packages/api-gateway/dist/marketplace-entries/official/browser-fetch.json +28 -0
  116. package/packages/api-gateway/dist/marketplace-entries/official/browser-session.json +29 -0
  117. package/packages/api-gateway/dist/marketplace-entries/official/canvas-draw.json +29 -0
  118. package/packages/api-gateway/dist/marketplace-entries/official/change-verifier.json +30 -0
  119. package/packages/api-gateway/dist/marketplace-entries/official/cleaner.json +29 -0
  120. package/packages/api-gateway/dist/marketplace-entries/official/cli-notifier.json +30 -0
  121. package/packages/api-gateway/dist/marketplace-entries/official/code2skill.json +29 -0
  122. package/packages/api-gateway/dist/marketplace-entries/official/colleague-skill.json +30 -0
  123. package/packages/api-gateway/dist/marketplace-entries/official/context-doctor.json +30 -0
  124. package/packages/api-gateway/dist/marketplace-entries/official/context.json +28 -0
  125. package/packages/api-gateway/dist/marketplace-entries/official/cordis-group.json +16 -0
  126. package/packages/api-gateway/dist/marketplace-entries/official/cordis-logger-console.json +16 -0
  127. package/packages/api-gateway/dist/marketplace-entries/official/cordis-timer.json +16 -0
  128. package/packages/api-gateway/dist/marketplace-entries/official/cost-meter.json +31 -0
  129. package/packages/api-gateway/dist/marketplace-entries/official/dependency-checker.json +31 -0
  130. package/packages/api-gateway/dist/marketplace-entries/official/docker-sandbox.json +29 -0
  131. package/packages/api-gateway/dist/marketplace-entries/official/fail-logger.json +29 -0
  132. package/packages/api-gateway/dist/marketplace-entries/official/genui.json +28 -0
  133. package/packages/api-gateway/dist/marketplace-entries/official/git-time-capsule.json +30 -0
  134. package/packages/api-gateway/dist/marketplace-entries/official/graph-memory.json +29 -0
  135. package/packages/api-gateway/dist/marketplace-entries/official/history-compressor.json +33 -0
  136. package/packages/api-gateway/dist/marketplace-entries/official/hol-guard.json +29 -0
  137. package/packages/api-gateway/dist/marketplace-entries/official/i18n-pair.json +29 -0
  138. package/packages/api-gateway/dist/marketplace-entries/official/image-compressor.json +29 -0
  139. package/packages/api-gateway/dist/marketplace-entries/official/llm-verifier.json +32 -0
  140. package/packages/api-gateway/dist/marketplace-entries/official/mcp-client.json +29 -0
  141. package/packages/api-gateway/dist/marketplace-entries/official/mcp-panel.json +29 -0
  142. package/packages/api-gateway/dist/marketplace-entries/official/memory.json +28 -0
  143. package/packages/api-gateway/dist/marketplace-entries/official/mirage-bridge.json +33 -0
  144. package/packages/api-gateway/dist/marketplace-entries/official/mock-server.json +29 -0
  145. package/packages/api-gateway/dist/marketplace-entries/official/modlens.json +28 -0
  146. package/packages/api-gateway/dist/marketplace-entries/official/module-search.json +30 -0
  147. package/packages/api-gateway/dist/marketplace-entries/official/obsidian-sync.json +29 -0
  148. package/packages/api-gateway/dist/marketplace-entries/official/openpets.json +29 -0
  149. package/packages/api-gateway/dist/marketplace-entries/official/plan-execute.json +29 -0
  150. package/packages/api-gateway/dist/marketplace-entries/official/plugin-check.json +29 -0
  151. package/packages/api-gateway/dist/marketplace-entries/official/plugin-dev.json +29 -0
  152. package/packages/api-gateway/dist/marketplace-entries/official/plugin-finder.json +32 -0
  153. package/packages/api-gateway/dist/marketplace-entries/official/plugin-radar.json +28 -0
  154. package/packages/api-gateway/dist/marketplace-entries/official/plugin-stars.json +29 -0
  155. package/packages/api-gateway/dist/marketplace-entries/official/prompt-guard.json +28 -0
  156. package/packages/api-gateway/dist/marketplace-entries/official/prompt-library.json +30 -0
  157. package/packages/api-gateway/dist/marketplace-entries/official/readme-gen.json +31 -0
  158. package/packages/api-gateway/dist/marketplace-entries/official/recall-unread.json +29 -0
  159. package/packages/api-gateway/dist/marketplace-entries/official/reverse-skill.json +30 -0
  160. package/packages/api-gateway/dist/marketplace-entries/official/reviewer-bot.json +29 -0
  161. package/packages/api-gateway/dist/marketplace-entries/official/runtime-doctor.json +32 -0
  162. package/packages/api-gateway/dist/marketplace-entries/official/secure-audit.json +30 -0
  163. package/packages/api-gateway/dist/marketplace-entries/official/session-bookmarks.json +30 -0
  164. package/packages/api-gateway/dist/marketplace-entries/official/session-bridge.json +30 -0
  165. package/packages/api-gateway/dist/marketplace-entries/official/session-compare.json +30 -0
  166. package/packages/api-gateway/dist/marketplace-entries/official/session-export.json +30 -0
  167. package/packages/api-gateway/dist/marketplace-entries/official/session-insights.json +29 -0
  168. package/packages/api-gateway/dist/marketplace-entries/official/session-search.json +30 -0
  169. package/packages/api-gateway/dist/marketplace-entries/official/skill-catalog.json +31 -0
  170. package/packages/api-gateway/dist/marketplace-entries/official/skill-guard.json +29 -0
  171. package/packages/api-gateway/dist/marketplace-entries/official/sql-lens.json +29 -0
  172. package/packages/api-gateway/dist/marketplace-entries/official/synapse.json +28 -0
  173. package/packages/api-gateway/dist/marketplace-entries/official/tab-manager.json +29 -0
  174. package/packages/api-gateway/dist/marketplace-entries/official/taskboard.json +29 -0
  175. package/packages/api-gateway/dist/marketplace-entries/official/telemetry-blocker.json +29 -0
  176. package/packages/api-gateway/dist/marketplace-entries/official/test-harness.json +29 -0
  177. package/packages/api-gateway/dist/marketplace-entries/official/theme-studio.json +32 -0
  178. package/packages/api-gateway/dist/marketplace-entries/official/token-guard.json +32 -0
  179. package/packages/api-gateway/dist/marketplace-entries/official/turn-rewind.json +29 -0
  180. package/packages/api-gateway/dist/marketplace-entries/official/undo-savepoint.json +28 -0
  181. package/packages/api-gateway/dist/marketplace-entries/official/vision-toolkit.json +29 -0
  182. package/packages/api-gateway/dist/marketplace-entries/official/web-research.json +29 -0
  183. package/packages/api-gateway/dist/marketplace-entries/official/workspace-navigator.json +32 -0
  184. package/packages/api-gateway/dist/marketplace-entries/official/workspace-search.json +29 -0
  185. package/packages/api-gateway/dist/marketplace-entries/official/yaml-validator.json +29 -0
  186. package/packages/api-gateway/dist/marketplace.d.ts +40 -2
  187. package/packages/api-gateway/dist/marketplace.d.ts.map +1 -1
  188. package/packages/api-gateway/dist/marketplace.js +225 -19
  189. package/packages/api-gateway/dist/marketplace.js.map +1 -1
  190. package/packages/api-gateway/dist/workspaces.d.ts +8 -0
  191. package/packages/api-gateway/dist/workspaces.d.ts.map +1 -0
  192. package/packages/api-gateway/dist/workspaces.js +14 -0
  193. package/packages/api-gateway/dist/workspaces.js.map +1 -0
  194. package/packages/api-gateway/package.json +20 -10
  195. package/packages/api-gateway/scripts/copy-marketplace-entries.mjs +13 -0
  196. package/packages/api-gateway/src/index.ts +1258 -61
  197. package/packages/api-gateway/src/marketplace-entries/official/agent-teams.json +31 -0
  198. package/packages/api-gateway/src/marketplace-entries/official/anchored-standard.json +29 -0
  199. package/packages/api-gateway/src/marketplace-entries/official/annotation.json +28 -0
  200. package/packages/api-gateway/src/marketplace-entries/official/archify.json +31 -0
  201. package/packages/api-gateway/src/marketplace-entries/official/at-file.json +28 -0
  202. package/packages/api-gateway/src/marketplace-entries/official/auto-mode.json +32 -0
  203. package/packages/api-gateway/src/marketplace-entries/official/better-sidebar.json +32 -0
  204. package/packages/api-gateway/src/marketplace-entries/official/browser-fetch.json +28 -0
  205. package/packages/api-gateway/src/marketplace-entries/official/browser-session.json +29 -0
  206. package/packages/api-gateway/src/marketplace-entries/official/canvas-draw.json +29 -0
  207. package/packages/api-gateway/src/marketplace-entries/official/change-verifier.json +30 -0
  208. package/packages/api-gateway/src/marketplace-entries/official/cleaner.json +29 -0
  209. package/packages/api-gateway/src/marketplace-entries/official/cli-notifier.json +30 -0
  210. package/packages/api-gateway/src/marketplace-entries/official/code2skill.json +29 -0
  211. package/packages/api-gateway/src/marketplace-entries/official/colleague-skill.json +30 -0
  212. package/packages/api-gateway/src/marketplace-entries/official/context-doctor.json +30 -0
  213. package/packages/api-gateway/src/marketplace-entries/official/context.json +28 -0
  214. package/packages/api-gateway/src/marketplace-entries/official/cordis-group.json +16 -0
  215. package/packages/api-gateway/src/marketplace-entries/official/cordis-logger-console.json +16 -0
  216. package/packages/api-gateway/src/marketplace-entries/official/cordis-timer.json +16 -0
  217. package/packages/api-gateway/src/marketplace-entries/official/cost-meter.json +31 -0
  218. package/packages/api-gateway/src/marketplace-entries/official/dependency-checker.json +31 -0
  219. package/packages/api-gateway/src/marketplace-entries/official/docker-sandbox.json +29 -0
  220. package/packages/api-gateway/src/marketplace-entries/official/fail-logger.json +29 -0
  221. package/packages/api-gateway/src/marketplace-entries/official/genui.json +28 -0
  222. package/packages/api-gateway/src/marketplace-entries/official/git-time-capsule.json +30 -0
  223. package/packages/api-gateway/src/marketplace-entries/official/graph-memory.json +29 -0
  224. package/packages/api-gateway/src/marketplace-entries/official/history-compressor.json +33 -0
  225. package/packages/api-gateway/src/marketplace-entries/official/hol-guard.json +29 -0
  226. package/packages/api-gateway/src/marketplace-entries/official/i18n-pair.json +29 -0
  227. package/packages/api-gateway/src/marketplace-entries/official/image-compressor.json +29 -0
  228. package/packages/api-gateway/src/marketplace-entries/official/llm-verifier.json +32 -0
  229. package/packages/api-gateway/src/marketplace-entries/official/mcp-client.json +29 -0
  230. package/packages/api-gateway/src/marketplace-entries/official/mcp-panel.json +29 -0
  231. package/packages/api-gateway/src/marketplace-entries/official/memory.json +28 -0
  232. package/packages/api-gateway/src/marketplace-entries/official/mirage-bridge.json +33 -0
  233. package/packages/api-gateway/src/marketplace-entries/official/mock-server.json +29 -0
  234. package/packages/api-gateway/src/marketplace-entries/official/modlens.json +28 -0
  235. package/packages/api-gateway/src/marketplace-entries/official/module-search.json +30 -0
  236. package/packages/api-gateway/src/marketplace-entries/official/obsidian-sync.json +29 -0
  237. package/packages/api-gateway/src/marketplace-entries/official/openpets.json +29 -0
  238. package/packages/api-gateway/src/marketplace-entries/official/plan-execute.json +29 -0
  239. package/packages/api-gateway/src/marketplace-entries/official/plugin-check.json +29 -0
  240. package/packages/api-gateway/src/marketplace-entries/official/plugin-dev.json +29 -0
  241. package/packages/api-gateway/src/marketplace-entries/official/plugin-finder.json +32 -0
  242. package/packages/api-gateway/src/marketplace-entries/official/plugin-radar.json +28 -0
  243. package/packages/api-gateway/src/marketplace-entries/official/plugin-stars.json +29 -0
  244. package/packages/api-gateway/src/marketplace-entries/official/prompt-guard.json +28 -0
  245. package/packages/api-gateway/src/marketplace-entries/official/prompt-library.json +30 -0
  246. package/packages/api-gateway/src/marketplace-entries/official/readme-gen.json +31 -0
  247. package/packages/api-gateway/src/marketplace-entries/official/recall-unread.json +29 -0
  248. package/packages/api-gateway/src/marketplace-entries/official/reverse-skill.json +30 -0
  249. package/packages/api-gateway/src/marketplace-entries/official/reviewer-bot.json +29 -0
  250. package/packages/api-gateway/src/marketplace-entries/official/runtime-doctor.json +32 -0
  251. package/packages/api-gateway/src/marketplace-entries/official/secure-audit.json +30 -0
  252. package/packages/api-gateway/src/marketplace-entries/official/session-bookmarks.json +30 -0
  253. package/packages/api-gateway/src/marketplace-entries/official/session-bridge.json +30 -0
  254. package/packages/api-gateway/src/marketplace-entries/official/session-compare.json +30 -0
  255. package/packages/api-gateway/src/marketplace-entries/official/session-export.json +30 -0
  256. package/packages/api-gateway/src/marketplace-entries/official/session-insights.json +29 -0
  257. package/packages/api-gateway/src/marketplace-entries/official/session-search.json +30 -0
  258. package/packages/api-gateway/src/marketplace-entries/official/skill-catalog.json +31 -0
  259. package/packages/api-gateway/src/marketplace-entries/official/skill-guard.json +29 -0
  260. package/packages/api-gateway/src/marketplace-entries/official/sql-lens.json +29 -0
  261. package/packages/api-gateway/src/marketplace-entries/official/synapse.json +28 -0
  262. package/packages/api-gateway/src/marketplace-entries/official/tab-manager.json +29 -0
  263. package/packages/api-gateway/src/marketplace-entries/official/taskboard.json +29 -0
  264. package/packages/api-gateway/src/marketplace-entries/official/telemetry-blocker.json +29 -0
  265. package/packages/api-gateway/src/marketplace-entries/official/test-harness.json +29 -0
  266. package/packages/api-gateway/src/marketplace-entries/official/theme-studio.json +32 -0
  267. package/packages/api-gateway/src/marketplace-entries/official/token-guard.json +32 -0
  268. package/packages/api-gateway/src/marketplace-entries/official/turn-rewind.json +29 -0
  269. package/packages/api-gateway/src/marketplace-entries/official/undo-savepoint.json +28 -0
  270. package/packages/api-gateway/src/marketplace-entries/official/vision-toolkit.json +29 -0
  271. package/packages/api-gateway/src/marketplace-entries/official/web-research.json +29 -0
  272. package/packages/api-gateway/src/marketplace-entries/official/workspace-navigator.json +32 -0
  273. package/packages/api-gateway/src/marketplace-entries/official/workspace-search.json +29 -0
  274. package/packages/api-gateway/src/marketplace-entries/official/yaml-validator.json +29 -0
  275. package/packages/api-gateway/src/marketplace.ts +267 -22
  276. package/packages/api-gateway/src/workspaces.ts +20 -0
  277. package/packages/api-gateway/test/index.test.ts +483 -33
  278. package/packages/api-gateway/test/marketplace.test.ts +282 -3
  279. package/packages/api-gateway/test/release-version.test.ts +71 -0
  280. package/packages/api-gateway/test/workspaces.test.ts +13 -0
  281. package/packages/api-gateway/tsconfig.build.json +1 -1
  282. package/packages/api-gateway/tsconfig.json +1 -1
  283. package/packages/bundle-web-app/LICENSE +9 -0
  284. package/packages/bundle-web-app/package.json +19 -9
  285. package/packages/bundle-web-app/tsconfig.build.json +1 -1
  286. package/packages/bundle-web-app/tsconfig.json +1 -1
  287. package/packages/cli/LICENSE +9 -0
  288. package/packages/cli/dist/args.d.ts.map +1 -1
  289. package/packages/cli/dist/args.js +16 -9
  290. package/packages/cli/dist/args.js.map +1 -1
  291. package/packages/cli/dist/bin.js +12 -3
  292. package/packages/cli/dist/bin.js.map +1 -1
  293. package/packages/cli/dist/main.d.ts +1 -0
  294. package/packages/cli/dist/main.d.ts.map +1 -1
  295. package/packages/cli/dist/main.js +49 -9
  296. package/packages/cli/dist/main.js.map +1 -1
  297. package/packages/cli/dist/node-stdio.d.ts +3 -1
  298. package/packages/cli/dist/node-stdio.d.ts.map +1 -1
  299. package/packages/cli/dist/node-stdio.js +91 -13
  300. package/packages/cli/dist/node-stdio.js.map +1 -1
  301. package/packages/cli/dist/relaunch.d.ts.map +1 -1
  302. package/packages/cli/dist/relaunch.js +23 -10
  303. package/packages/cli/dist/relaunch.js.map +1 -1
  304. package/packages/cli/package.json +18 -8
  305. package/packages/cli/src/args.ts +16 -10
  306. package/packages/cli/src/bin.ts +12 -3
  307. package/packages/cli/src/main.ts +54 -10
  308. package/packages/cli/src/node-stdio.ts +85 -13
  309. package/packages/cli/src/relaunch.ts +19 -6
  310. package/packages/cli/test/args.test.ts +22 -3
  311. package/packages/cli/test/binary.test.ts +58 -0
  312. package/packages/cli/test/broken-pipe.test.ts +32 -0
  313. package/packages/cli/test/cli.test.ts +57 -8
  314. package/packages/cli/test/node-stdio.test.ts +89 -0
  315. package/packages/cli/test/relaunch.test.ts +30 -2
  316. package/packages/cli/test/stdin-shutdown.test.ts +59 -0
  317. package/packages/cli/tsconfig.build.json +1 -3
  318. package/packages/cli/tsconfig.json +1 -4
  319. package/packages/client-web/LICENSE +9 -0
  320. package/packages/client-web/dist/annotation-ui.d.ts +11 -0
  321. package/packages/client-web/dist/annotation-ui.d.ts.map +1 -0
  322. package/packages/client-web/dist/annotation-ui.js +24 -0
  323. package/packages/client-web/dist/annotation-ui.js.map +1 -0
  324. package/packages/client-web/dist/browser-session-view.d.ts +7 -0
  325. package/packages/client-web/dist/browser-session-view.d.ts.map +1 -0
  326. package/packages/client-web/dist/browser-session-view.js +8 -0
  327. package/packages/client-web/dist/browser-session-view.js.map +1 -0
  328. package/packages/client-web/dist/control-room.d.ts +151 -6
  329. package/packages/client-web/dist/control-room.d.ts.map +1 -1
  330. package/packages/client-web/dist/control-room.js +156 -11
  331. package/packages/client-web/dist/control-room.js.map +1 -1
  332. package/packages/client-web/dist/design-contract.d.ts.map +1 -1
  333. package/packages/client-web/dist/design-contract.js +178 -19
  334. package/packages/client-web/dist/design-contract.js.map +1 -1
  335. package/packages/client-web/dist/index.d.ts +4 -1
  336. package/packages/client-web/dist/index.d.ts.map +1 -1
  337. package/packages/client-web/dist/index.js +11 -3
  338. package/packages/client-web/dist/index.js.map +1 -1
  339. package/packages/client-web/dist/markdown.d.ts +5 -0
  340. package/packages/client-web/dist/markdown.d.ts.map +1 -0
  341. package/packages/client-web/dist/markdown.js +20 -0
  342. package/packages/client-web/dist/markdown.js.map +1 -0
  343. package/packages/client-web/dist/marketplace-catalog.d.ts +3 -0
  344. package/packages/client-web/dist/marketplace-catalog.d.ts.map +1 -0
  345. package/packages/client-web/dist/marketplace-catalog.js +10 -0
  346. package/packages/client-web/dist/marketplace-catalog.js.map +1 -0
  347. package/packages/client-web/dist/marketplace-navigation.d.ts +19 -0
  348. package/packages/client-web/dist/marketplace-navigation.d.ts.map +1 -0
  349. package/packages/client-web/dist/marketplace-navigation.js +31 -0
  350. package/packages/client-web/dist/marketplace-navigation.js.map +1 -0
  351. package/packages/client-web/dist/message-content.d.ts +9 -0
  352. package/packages/client-web/dist/message-content.d.ts.map +1 -0
  353. package/packages/client-web/dist/message-content.js +54 -0
  354. package/packages/client-web/dist/message-content.js.map +1 -0
  355. package/packages/client-web/dist/plugin-navigation.d.ts +3 -0
  356. package/packages/client-web/dist/plugin-navigation.d.ts.map +1 -0
  357. package/packages/client-web/dist/plugin-navigation.js +10 -0
  358. package/packages/client-web/dist/plugin-navigation.js.map +1 -0
  359. package/packages/client-web/dist/plugin-search.d.ts +2 -0
  360. package/packages/client-web/dist/plugin-search.d.ts.map +1 -0
  361. package/packages/client-web/dist/plugin-search.js +7 -0
  362. package/packages/client-web/dist/plugin-search.js.map +1 -0
  363. package/packages/client-web/dist/plugin-stars-view.d.ts +12 -0
  364. package/packages/client-web/dist/plugin-stars-view.d.ts.map +1 -0
  365. package/packages/client-web/dist/plugin-stars-view.js +8 -0
  366. package/packages/client-web/dist/plugin-stars-view.js.map +1 -0
  367. package/packages/client-web/dist/prompt-completion.d.ts +13 -0
  368. package/packages/client-web/dist/prompt-completion.d.ts.map +1 -0
  369. package/packages/client-web/dist/prompt-completion.js +17 -0
  370. package/packages/client-web/dist/prompt-completion.js.map +1 -0
  371. package/packages/client-web/dist/react-room.d.ts +2 -1
  372. package/packages/client-web/dist/react-room.d.ts.map +1 -1
  373. package/packages/client-web/dist/react-room.js +2347 -93
  374. package/packages/client-web/dist/react-room.js.map +1 -1
  375. package/packages/client-web/dist/runtime-events.d.ts +4 -0
  376. package/packages/client-web/dist/runtime-events.d.ts.map +1 -0
  377. package/packages/client-web/dist/runtime-events.js +29 -0
  378. package/packages/client-web/dist/runtime-events.js.map +1 -0
  379. package/packages/client-web/package.json +19 -7
  380. package/packages/client-web/src/annotation-ui.ts +29 -0
  381. package/packages/client-web/src/browser-session-view.ts +13 -0
  382. package/packages/client-web/src/control-room.ts +359 -11
  383. package/packages/client-web/src/design-contract.ts +248 -26
  384. package/packages/client-web/src/index.ts +17 -4
  385. package/packages/client-web/src/markdown.tsx +22 -0
  386. package/packages/client-web/src/marketplace-catalog.ts +10 -0
  387. package/packages/client-web/src/marketplace-navigation.ts +46 -0
  388. package/packages/client-web/src/message-content.ts +51 -0
  389. package/packages/client-web/src/plugin-navigation.ts +9 -0
  390. package/packages/client-web/src/plugin-search.ts +5 -0
  391. package/packages/client-web/src/plugin-stars-view.ts +19 -0
  392. package/packages/client-web/src/prompt-completion.ts +24 -0
  393. package/packages/client-web/src/react-room.tsx +7360 -54
  394. package/packages/client-web/src/runtime-events.ts +29 -0
  395. package/packages/client-web/test/annotation-ui.test.ts +21 -0
  396. package/packages/client-web/test/browser-session-view.test.ts +17 -0
  397. package/packages/client-web/test/design-contract.test.ts +46 -1
  398. package/packages/client-web/test/marketplace-catalog.test.ts +52 -0
  399. package/packages/client-web/test/message-content.test.ts +43 -0
  400. package/packages/client-web/test/plugin-navigation.test.ts +16 -0
  401. package/packages/client-web/test/plugin-search.test.ts +22 -0
  402. package/packages/client-web/test/plugin-stars-view.test.ts +20 -0
  403. package/packages/client-web/test/prompt-completion.test.ts +21 -0
  404. package/packages/client-web/test/runtime-events.test.ts +28 -0
  405. package/packages/client-web/tsconfig.build.json +13 -1
  406. package/packages/client-web/tsconfig.json +11 -1
  407. package/packages/core/LICENSE +9 -0
  408. package/packages/core/dist/boot.d.ts.map +1 -1
  409. package/packages/core/dist/boot.js +42 -3
  410. package/packages/core/dist/boot.js.map +1 -1
  411. package/packages/core/dist/config.d.ts +2 -0
  412. package/packages/core/dist/config.d.ts.map +1 -0
  413. package/packages/core/dist/config.js +8 -0
  414. package/packages/core/dist/config.js.map +1 -0
  415. package/packages/core/dist/http.d.ts +8 -0
  416. package/packages/core/dist/http.d.ts.map +1 -0
  417. package/packages/core/dist/http.js +27 -0
  418. package/packages/core/dist/http.js.map +1 -0
  419. package/packages/core/dist/index.d.ts +2 -0
  420. package/packages/core/dist/index.d.ts.map +1 -1
  421. package/packages/core/dist/index.js +2 -0
  422. package/packages/core/dist/index.js.map +1 -1
  423. package/packages/core/dist/plugins/agent-teams.d.ts +17 -0
  424. package/packages/core/dist/plugins/agent-teams.d.ts.map +1 -0
  425. package/packages/core/dist/plugins/agent-teams.js +298 -0
  426. package/packages/core/dist/plugins/agent-teams.js.map +1 -0
  427. package/packages/core/dist/plugins/anchored-standard.d.ts +14 -0
  428. package/packages/core/dist/plugins/anchored-standard.d.ts.map +1 -0
  429. package/packages/core/dist/plugins/anchored-standard.js +84 -0
  430. package/packages/core/dist/plugins/anchored-standard.js.map +1 -0
  431. package/packages/core/dist/plugins/annotation.d.ts +18 -0
  432. package/packages/core/dist/plugins/annotation.d.ts.map +1 -0
  433. package/packages/core/dist/plugins/annotation.js +94 -0
  434. package/packages/core/dist/plugins/annotation.js.map +1 -0
  435. package/packages/core/dist/plugins/archify.d.ts +23 -0
  436. package/packages/core/dist/plugins/archify.d.ts.map +1 -0
  437. package/packages/core/dist/plugins/archify.js +98 -0
  438. package/packages/core/dist/plugins/archify.js.map +1 -0
  439. package/packages/core/dist/plugins/at-file.d.ts +8 -0
  440. package/packages/core/dist/plugins/at-file.d.ts.map +1 -0
  441. package/packages/core/dist/plugins/at-file.js +52 -0
  442. package/packages/core/dist/plugins/at-file.js.map +1 -0
  443. package/packages/core/dist/plugins/auto-mode.d.ts +15 -0
  444. package/packages/core/dist/plugins/auto-mode.d.ts.map +1 -0
  445. package/packages/core/dist/plugins/auto-mode.js +114 -0
  446. package/packages/core/dist/plugins/auto-mode.js.map +1 -0
  447. package/packages/core/dist/plugins/better-sidebar.d.ts +37 -0
  448. package/packages/core/dist/plugins/better-sidebar.d.ts.map +1 -0
  449. package/packages/core/dist/plugins/better-sidebar.js +89 -0
  450. package/packages/core/dist/plugins/better-sidebar.js.map +1 -0
  451. package/packages/core/dist/plugins/browser-fetch.d.ts +14 -0
  452. package/packages/core/dist/plugins/browser-fetch.d.ts.map +1 -0
  453. package/packages/core/dist/plugins/browser-fetch.js +167 -0
  454. package/packages/core/dist/plugins/browser-fetch.js.map +1 -0
  455. package/packages/core/dist/plugins/browser-session.d.ts +14 -0
  456. package/packages/core/dist/plugins/browser-session.d.ts.map +1 -0
  457. package/packages/core/dist/plugins/browser-session.js +265 -0
  458. package/packages/core/dist/plugins/browser-session.js.map +1 -0
  459. package/packages/core/dist/plugins/canvas-draw.d.ts +8 -0
  460. package/packages/core/dist/plugins/canvas-draw.d.ts.map +1 -0
  461. package/packages/core/dist/plugins/canvas-draw.js +88 -0
  462. package/packages/core/dist/plugins/canvas-draw.js.map +1 -0
  463. package/packages/core/dist/plugins/change-verifier.d.ts +8 -0
  464. package/packages/core/dist/plugins/change-verifier.d.ts.map +1 -0
  465. package/packages/core/dist/plugins/change-verifier.js +67 -0
  466. package/packages/core/dist/plugins/change-verifier.js.map +1 -0
  467. package/packages/core/dist/plugins/cleaner.d.ts +8 -0
  468. package/packages/core/dist/plugins/cleaner.d.ts.map +1 -0
  469. package/packages/core/dist/plugins/cleaner.js +56 -0
  470. package/packages/core/dist/plugins/cleaner.js.map +1 -0
  471. package/packages/core/dist/plugins/cli-notifier.d.ts +15 -0
  472. package/packages/core/dist/plugins/cli-notifier.d.ts.map +1 -0
  473. package/packages/core/dist/plugins/cli-notifier.js +110 -0
  474. package/packages/core/dist/plugins/cli-notifier.js.map +1 -0
  475. package/packages/core/dist/plugins/code2skill.d.ts +8 -0
  476. package/packages/core/dist/plugins/code2skill.d.ts.map +1 -0
  477. package/packages/core/dist/plugins/code2skill.js +95 -0
  478. package/packages/core/dist/plugins/code2skill.js.map +1 -0
  479. package/packages/core/dist/plugins/colleague-skill.d.ts +27 -0
  480. package/packages/core/dist/plugins/colleague-skill.d.ts.map +1 -0
  481. package/packages/core/dist/plugins/colleague-skill.js +99 -0
  482. package/packages/core/dist/plugins/colleague-skill.js.map +1 -0
  483. package/packages/core/dist/plugins/context-doctor.d.ts +30 -0
  484. package/packages/core/dist/plugins/context-doctor.d.ts.map +1 -0
  485. package/packages/core/dist/plugins/context-doctor.js +95 -0
  486. package/packages/core/dist/plugins/context-doctor.js.map +1 -0
  487. package/packages/core/dist/plugins/context.d.ts +8 -0
  488. package/packages/core/dist/plugins/context.d.ts.map +1 -0
  489. package/packages/core/dist/plugins/context.js +87 -0
  490. package/packages/core/dist/plugins/context.js.map +1 -0
  491. package/packages/core/dist/plugins/cost-meter.d.ts +32 -0
  492. package/packages/core/dist/plugins/cost-meter.d.ts.map +1 -0
  493. package/packages/core/dist/plugins/cost-meter.js +204 -0
  494. package/packages/core/dist/plugins/cost-meter.js.map +1 -0
  495. package/packages/core/dist/plugins/dependency-checker.d.ts +27 -0
  496. package/packages/core/dist/plugins/dependency-checker.d.ts.map +1 -0
  497. package/packages/core/dist/plugins/dependency-checker.js +221 -0
  498. package/packages/core/dist/plugins/dependency-checker.js.map +1 -0
  499. package/packages/core/dist/plugins/docker-sandbox.d.ts +8 -0
  500. package/packages/core/dist/plugins/docker-sandbox.d.ts.map +1 -0
  501. package/packages/core/dist/plugins/docker-sandbox.js +102 -0
  502. package/packages/core/dist/plugins/docker-sandbox.js.map +1 -0
  503. package/packages/core/dist/plugins/fail-logger.d.ts +8 -0
  504. package/packages/core/dist/plugins/fail-logger.d.ts.map +1 -0
  505. package/packages/core/dist/plugins/fail-logger.js +51 -0
  506. package/packages/core/dist/plugins/fail-logger.js.map +1 -0
  507. package/packages/core/dist/plugins/genui.d.ts +8 -0
  508. package/packages/core/dist/plugins/genui.d.ts.map +1 -0
  509. package/packages/core/dist/plugins/genui.js +79 -0
  510. package/packages/core/dist/plugins/genui.js.map +1 -0
  511. package/packages/core/dist/plugins/git-time-capsule.d.ts +9 -0
  512. package/packages/core/dist/plugins/git-time-capsule.d.ts.map +1 -0
  513. package/packages/core/dist/plugins/git-time-capsule.js +90 -0
  514. package/packages/core/dist/plugins/git-time-capsule.js.map +1 -0
  515. package/packages/core/dist/plugins/graph-memory.d.ts +16 -0
  516. package/packages/core/dist/plugins/graph-memory.d.ts.map +1 -0
  517. package/packages/core/dist/plugins/graph-memory.js +382 -0
  518. package/packages/core/dist/plugins/graph-memory.js.map +1 -0
  519. package/packages/core/dist/plugins/history-compressor.d.ts +15 -0
  520. package/packages/core/dist/plugins/history-compressor.d.ts.map +1 -0
  521. package/packages/core/dist/plugins/history-compressor.js +80 -0
  522. package/packages/core/dist/plugins/history-compressor.js.map +1 -0
  523. package/packages/core/dist/plugins/hol-guard.d.ts +29 -0
  524. package/packages/core/dist/plugins/hol-guard.d.ts.map +1 -0
  525. package/packages/core/dist/plugins/hol-guard.js +139 -0
  526. package/packages/core/dist/plugins/hol-guard.js.map +1 -0
  527. package/packages/core/dist/plugins/i18n-pair.d.ts +8 -0
  528. package/packages/core/dist/plugins/i18n-pair.d.ts.map +1 -0
  529. package/packages/core/dist/plugins/i18n-pair.js +76 -0
  530. package/packages/core/dist/plugins/i18n-pair.js.map +1 -0
  531. package/packages/core/dist/plugins/image-compressor.d.ts +8 -0
  532. package/packages/core/dist/plugins/image-compressor.d.ts.map +1 -0
  533. package/packages/core/dist/plugins/image-compressor.js +150 -0
  534. package/packages/core/dist/plugins/image-compressor.js.map +1 -0
  535. package/packages/core/dist/plugins/llm-verifier.d.ts +42 -0
  536. package/packages/core/dist/plugins/llm-verifier.d.ts.map +1 -0
  537. package/packages/core/dist/plugins/llm-verifier.js +128 -0
  538. package/packages/core/dist/plugins/llm-verifier.js.map +1 -0
  539. package/packages/core/dist/plugins/mcp-client.d.ts +19 -0
  540. package/packages/core/dist/plugins/mcp-client.d.ts.map +1 -0
  541. package/packages/core/dist/plugins/mcp-client.js +534 -0
  542. package/packages/core/dist/plugins/mcp-client.js.map +1 -0
  543. package/packages/core/dist/plugins/mcp-panel.d.ts +14 -0
  544. package/packages/core/dist/plugins/mcp-panel.d.ts.map +1 -0
  545. package/packages/core/dist/plugins/mcp-panel.js +180 -0
  546. package/packages/core/dist/plugins/mcp-panel.js.map +1 -0
  547. package/packages/core/dist/plugins/memory.d.ts +15 -0
  548. package/packages/core/dist/plugins/memory.d.ts.map +1 -0
  549. package/packages/core/dist/plugins/memory.js +161 -0
  550. package/packages/core/dist/plugins/memory.js.map +1 -0
  551. package/packages/core/dist/plugins/mirage-bridge.d.ts +23 -0
  552. package/packages/core/dist/plugins/mirage-bridge.d.ts.map +1 -0
  553. package/packages/core/dist/plugins/mirage-bridge.js +149 -0
  554. package/packages/core/dist/plugins/mirage-bridge.js.map +1 -0
  555. package/packages/core/dist/plugins/mock-server.d.ts +22 -0
  556. package/packages/core/dist/plugins/mock-server.d.ts.map +1 -0
  557. package/packages/core/dist/plugins/mock-server.js +149 -0
  558. package/packages/core/dist/plugins/mock-server.js.map +1 -0
  559. package/packages/core/dist/plugins/model.d.ts +1 -1
  560. package/packages/core/dist/plugins/model.d.ts.map +1 -1
  561. package/packages/core/dist/plugins/model.js +3 -1
  562. package/packages/core/dist/plugins/model.js.map +1 -1
  563. package/packages/core/dist/plugins/models.d.ts.map +1 -1
  564. package/packages/core/dist/plugins/models.js +5 -2
  565. package/packages/core/dist/plugins/models.js.map +1 -1
  566. package/packages/core/dist/plugins/modlens.d.ts +8 -0
  567. package/packages/core/dist/plugins/modlens.d.ts.map +1 -0
  568. package/packages/core/dist/plugins/modlens.js +63 -0
  569. package/packages/core/dist/plugins/modlens.js.map +1 -0
  570. package/packages/core/dist/plugins/module-search.d.ts +27 -0
  571. package/packages/core/dist/plugins/module-search.d.ts.map +1 -0
  572. package/packages/core/dist/plugins/module-search.js +174 -0
  573. package/packages/core/dist/plugins/module-search.js.map +1 -0
  574. package/packages/core/dist/plugins/obsidian-sync.d.ts +14 -0
  575. package/packages/core/dist/plugins/obsidian-sync.d.ts.map +1 -0
  576. package/packages/core/dist/plugins/obsidian-sync.js +79 -0
  577. package/packages/core/dist/plugins/obsidian-sync.js.map +1 -0
  578. package/packages/core/dist/plugins/openpets.d.ts +14 -0
  579. package/packages/core/dist/plugins/openpets.d.ts.map +1 -0
  580. package/packages/core/dist/plugins/openpets.js +99 -0
  581. package/packages/core/dist/plugins/openpets.js.map +1 -0
  582. package/packages/core/dist/plugins/plan-execute.d.ts +8 -0
  583. package/packages/core/dist/plugins/plan-execute.d.ts.map +1 -0
  584. package/packages/core/dist/plugins/plan-execute.js +70 -0
  585. package/packages/core/dist/plugins/plan-execute.js.map +1 -0
  586. package/packages/core/dist/plugins/plugin-check.d.ts +38 -0
  587. package/packages/core/dist/plugins/plugin-check.d.ts.map +1 -0
  588. package/packages/core/dist/plugins/plugin-check.js +227 -0
  589. package/packages/core/dist/plugins/plugin-check.js.map +1 -0
  590. package/packages/core/dist/plugins/plugin-dev.d.ts +8 -0
  591. package/packages/core/dist/plugins/plugin-dev.d.ts.map +1 -0
  592. package/packages/core/dist/plugins/plugin-dev.js +44 -0
  593. package/packages/core/dist/plugins/plugin-dev.js.map +1 -0
  594. package/packages/core/dist/plugins/plugin-finder.d.ts +16 -0
  595. package/packages/core/dist/plugins/plugin-finder.d.ts.map +1 -0
  596. package/packages/core/dist/plugins/plugin-finder.js +98 -0
  597. package/packages/core/dist/plugins/plugin-finder.js.map +1 -0
  598. package/packages/core/dist/plugins/plugin-radar.d.ts +29 -0
  599. package/packages/core/dist/plugins/plugin-radar.d.ts.map +1 -0
  600. package/packages/core/dist/plugins/plugin-radar.js +146 -0
  601. package/packages/core/dist/plugins/plugin-radar.js.map +1 -0
  602. package/packages/core/dist/plugins/plugin-stars.d.ts +45 -0
  603. package/packages/core/dist/plugins/plugin-stars.d.ts.map +1 -0
  604. package/packages/core/dist/plugins/plugin-stars.js +165 -0
  605. package/packages/core/dist/plugins/plugin-stars.js.map +1 -0
  606. package/packages/core/dist/plugins/prompt-guard.d.ts +8 -0
  607. package/packages/core/dist/plugins/prompt-guard.d.ts.map +1 -0
  608. package/packages/core/dist/plugins/prompt-guard.js +114 -0
  609. package/packages/core/dist/plugins/prompt-guard.js.map +1 -0
  610. package/packages/core/dist/plugins/prompt-library.d.ts +25 -0
  611. package/packages/core/dist/plugins/prompt-library.d.ts.map +1 -0
  612. package/packages/core/dist/plugins/prompt-library.js +142 -0
  613. package/packages/core/dist/plugins/prompt-library.js.map +1 -0
  614. package/packages/core/dist/plugins/readme-gen.d.ts +25 -0
  615. package/packages/core/dist/plugins/readme-gen.d.ts.map +1 -0
  616. package/packages/core/dist/plugins/readme-gen.js +139 -0
  617. package/packages/core/dist/plugins/readme-gen.js.map +1 -0
  618. package/packages/core/dist/plugins/recall-unread.d.ts +24 -0
  619. package/packages/core/dist/plugins/recall-unread.d.ts.map +1 -0
  620. package/packages/core/dist/plugins/recall-unread.js +124 -0
  621. package/packages/core/dist/plugins/recall-unread.js.map +1 -0
  622. package/packages/core/dist/plugins/resources.d.ts +1 -0
  623. package/packages/core/dist/plugins/resources.d.ts.map +1 -1
  624. package/packages/core/dist/plugins/resources.js +31 -22
  625. package/packages/core/dist/plugins/resources.js.map +1 -1
  626. package/packages/core/dist/plugins/reverse-skill.d.ts +23 -0
  627. package/packages/core/dist/plugins/reverse-skill.d.ts.map +1 -0
  628. package/packages/core/dist/plugins/reverse-skill.js +60 -0
  629. package/packages/core/dist/plugins/reverse-skill.js.map +1 -0
  630. package/packages/core/dist/plugins/reviewer-bot.d.ts +14 -0
  631. package/packages/core/dist/plugins/reviewer-bot.d.ts.map +1 -0
  632. package/packages/core/dist/plugins/reviewer-bot.js +133 -0
  633. package/packages/core/dist/plugins/reviewer-bot.js.map +1 -0
  634. package/packages/core/dist/plugins/runtime-doctor.d.ts +33 -0
  635. package/packages/core/dist/plugins/runtime-doctor.d.ts.map +1 -0
  636. package/packages/core/dist/plugins/runtime-doctor.js +114 -0
  637. package/packages/core/dist/plugins/runtime-doctor.js.map +1 -0
  638. package/packages/core/dist/plugins/runtime.d.ts.map +1 -1
  639. package/packages/core/dist/plugins/runtime.js +63 -14
  640. package/packages/core/dist/plugins/runtime.js.map +1 -1
  641. package/packages/core/dist/plugins/secure-audit.d.ts +31 -0
  642. package/packages/core/dist/plugins/secure-audit.d.ts.map +1 -0
  643. package/packages/core/dist/plugins/secure-audit.js +121 -0
  644. package/packages/core/dist/plugins/secure-audit.js.map +1 -0
  645. package/packages/core/dist/plugins/session-bookmarks.d.ts +15 -0
  646. package/packages/core/dist/plugins/session-bookmarks.d.ts.map +1 -0
  647. package/packages/core/dist/plugins/session-bookmarks.js +87 -0
  648. package/packages/core/dist/plugins/session-bookmarks.js.map +1 -0
  649. package/packages/core/dist/plugins/session-bridge.d.ts +44 -0
  650. package/packages/core/dist/plugins/session-bridge.d.ts.map +1 -0
  651. package/packages/core/dist/plugins/session-bridge.js +265 -0
  652. package/packages/core/dist/plugins/session-bridge.js.map +1 -0
  653. package/packages/core/dist/plugins/session-compare.d.ts +33 -0
  654. package/packages/core/dist/plugins/session-compare.d.ts.map +1 -0
  655. package/packages/core/dist/plugins/session-compare.js +150 -0
  656. package/packages/core/dist/plugins/session-compare.js.map +1 -0
  657. package/packages/core/dist/plugins/session-export.d.ts +9 -0
  658. package/packages/core/dist/plugins/session-export.d.ts.map +1 -0
  659. package/packages/core/dist/plugins/session-export.js +93 -0
  660. package/packages/core/dist/plugins/session-export.js.map +1 -0
  661. package/packages/core/dist/plugins/session-insights.d.ts +8 -0
  662. package/packages/core/dist/plugins/session-insights.d.ts.map +1 -0
  663. package/packages/core/dist/plugins/session-insights.js +47 -0
  664. package/packages/core/dist/plugins/session-insights.js.map +1 -0
  665. package/packages/core/dist/plugins/session-search.d.ts +20 -0
  666. package/packages/core/dist/plugins/session-search.d.ts.map +1 -0
  667. package/packages/core/dist/plugins/session-search.js +122 -0
  668. package/packages/core/dist/plugins/session-search.js.map +1 -0
  669. package/packages/core/dist/plugins/session.d.ts.map +1 -1
  670. package/packages/core/dist/plugins/session.js +4 -2
  671. package/packages/core/dist/plugins/session.js.map +1 -1
  672. package/packages/core/dist/plugins/skill-catalog.d.ts +26 -0
  673. package/packages/core/dist/plugins/skill-catalog.d.ts.map +1 -0
  674. package/packages/core/dist/plugins/skill-catalog.js +97 -0
  675. package/packages/core/dist/plugins/skill-catalog.js.map +1 -0
  676. package/packages/core/dist/plugins/skill-guard.d.ts +26 -0
  677. package/packages/core/dist/plugins/skill-guard.d.ts.map +1 -0
  678. package/packages/core/dist/plugins/skill-guard.js +139 -0
  679. package/packages/core/dist/plugins/skill-guard.js.map +1 -0
  680. package/packages/core/dist/plugins/sql-lens.d.ts +8 -0
  681. package/packages/core/dist/plugins/sql-lens.d.ts.map +1 -0
  682. package/packages/core/dist/plugins/sql-lens.js +85 -0
  683. package/packages/core/dist/plugins/sql-lens.js.map +1 -0
  684. package/packages/core/dist/plugins/stdio.d.ts +1 -1
  685. package/packages/core/dist/plugins/stdio.d.ts.map +1 -1
  686. package/packages/core/dist/plugins/stdio.js +3 -1
  687. package/packages/core/dist/plugins/stdio.js.map +1 -1
  688. package/packages/core/dist/plugins/synapse.d.ts +38 -0
  689. package/packages/core/dist/plugins/synapse.d.ts.map +1 -0
  690. package/packages/core/dist/plugins/synapse.js +93 -0
  691. package/packages/core/dist/plugins/synapse.js.map +1 -0
  692. package/packages/core/dist/plugins/tab-manager.d.ts +8 -0
  693. package/packages/core/dist/plugins/tab-manager.d.ts.map +1 -0
  694. package/packages/core/dist/plugins/tab-manager.js +135 -0
  695. package/packages/core/dist/plugins/tab-manager.js.map +1 -0
  696. package/packages/core/dist/plugins/taskboard.d.ts +15 -0
  697. package/packages/core/dist/plugins/taskboard.d.ts.map +1 -0
  698. package/packages/core/dist/plugins/taskboard.js +347 -0
  699. package/packages/core/dist/plugins/taskboard.js.map +1 -0
  700. package/packages/core/dist/plugins/telemetry-blocker.d.ts +8 -0
  701. package/packages/core/dist/plugins/telemetry-blocker.d.ts.map +1 -0
  702. package/packages/core/dist/plugins/telemetry-blocker.js +57 -0
  703. package/packages/core/dist/plugins/telemetry-blocker.js.map +1 -0
  704. package/packages/core/dist/plugins/test-harness.d.ts +8 -0
  705. package/packages/core/dist/plugins/test-harness.d.ts.map +1 -0
  706. package/packages/core/dist/plugins/test-harness.js +64 -0
  707. package/packages/core/dist/plugins/test-harness.js.map +1 -0
  708. package/packages/core/dist/plugins/theme-studio.d.ts +29 -0
  709. package/packages/core/dist/plugins/theme-studio.d.ts.map +1 -0
  710. package/packages/core/dist/plugins/theme-studio.js +141 -0
  711. package/packages/core/dist/plugins/theme-studio.js.map +1 -0
  712. package/packages/core/dist/plugins/token-guard.d.ts +15 -0
  713. package/packages/core/dist/plugins/token-guard.d.ts.map +1 -0
  714. package/packages/core/dist/plugins/token-guard.js +78 -0
  715. package/packages/core/dist/plugins/token-guard.js.map +1 -0
  716. package/packages/core/dist/plugins/tools.d.ts.map +1 -1
  717. package/packages/core/dist/plugins/tools.js +5 -2
  718. package/packages/core/dist/plugins/tools.js.map +1 -1
  719. package/packages/core/dist/plugins/turn-rewind.d.ts +19 -0
  720. package/packages/core/dist/plugins/turn-rewind.d.ts.map +1 -0
  721. package/packages/core/dist/plugins/turn-rewind.js +74 -0
  722. package/packages/core/dist/plugins/turn-rewind.js.map +1 -0
  723. package/packages/core/dist/plugins/undo-savepoint.d.ts +17 -0
  724. package/packages/core/dist/plugins/undo-savepoint.d.ts.map +1 -0
  725. package/packages/core/dist/plugins/undo-savepoint.js +247 -0
  726. package/packages/core/dist/plugins/undo-savepoint.js.map +1 -0
  727. package/packages/core/dist/plugins/vision-toolkit.d.ts +17 -0
  728. package/packages/core/dist/plugins/vision-toolkit.d.ts.map +1 -0
  729. package/packages/core/dist/plugins/vision-toolkit.js +145 -0
  730. package/packages/core/dist/plugins/vision-toolkit.js.map +1 -0
  731. package/packages/core/dist/plugins/web-research.d.ts +17 -0
  732. package/packages/core/dist/plugins/web-research.d.ts.map +1 -0
  733. package/packages/core/dist/plugins/web-research.js +275 -0
  734. package/packages/core/dist/plugins/web-research.js.map +1 -0
  735. package/packages/core/dist/plugins/workspace-navigator.d.ts +36 -0
  736. package/packages/core/dist/plugins/workspace-navigator.d.ts.map +1 -0
  737. package/packages/core/dist/plugins/workspace-navigator.js +150 -0
  738. package/packages/core/dist/plugins/workspace-navigator.js.map +1 -0
  739. package/packages/core/dist/plugins/workspace-search.d.ts +8 -0
  740. package/packages/core/dist/plugins/workspace-search.d.ts.map +1 -0
  741. package/packages/core/dist/plugins/workspace-search.js +134 -0
  742. package/packages/core/dist/plugins/workspace-search.js.map +1 -0
  743. package/packages/core/dist/plugins/yaml-validator.d.ts +8 -0
  744. package/packages/core/dist/plugins/yaml-validator.d.ts.map +1 -0
  745. package/packages/core/dist/plugins/yaml-validator.js +94 -0
  746. package/packages/core/dist/plugins/yaml-validator.js.map +1 -0
  747. package/packages/core/dist/profile.d.ts +1 -0
  748. package/packages/core/dist/profile.d.ts.map +1 -1
  749. package/packages/core/dist/profile.js +3 -0
  750. package/packages/core/dist/profile.js.map +1 -1
  751. package/packages/core/dist/runtime.d.ts.map +1 -1
  752. package/packages/core/dist/runtime.js +13 -4
  753. package/packages/core/dist/runtime.js.map +1 -1
  754. package/packages/core/dist/services.d.ts +55 -0
  755. package/packages/core/dist/services.d.ts.map +1 -1
  756. package/packages/core/dist/services.js +58 -2
  757. package/packages/core/dist/services.js.map +1 -1
  758. package/packages/core/dist/stdio.d.ts +13 -2
  759. package/packages/core/dist/stdio.d.ts.map +1 -1
  760. package/packages/core/dist/stdio.js +75 -9
  761. package/packages/core/dist/stdio.js.map +1 -1
  762. package/packages/core/dist/workspace-path.d.ts +12 -0
  763. package/packages/core/dist/workspace-path.d.ts.map +1 -0
  764. package/packages/core/dist/workspace-path.js +62 -0
  765. package/packages/core/dist/workspace-path.js.map +1 -0
  766. package/packages/core/package.json +18 -8
  767. package/packages/core/profiles/default/cordis.yml +85 -0
  768. package/packages/core/profiles/development/cordis.yml +1 -1
  769. package/packages/core/src/boot.ts +38 -2
  770. package/packages/core/src/config.ts +5 -0
  771. package/packages/core/src/http.ts +32 -0
  772. package/packages/core/src/index.ts +2 -0
  773. package/packages/core/src/plugins/agent-teams.ts +291 -0
  774. package/packages/core/src/plugins/anchored-standard.ts +88 -0
  775. package/packages/core/src/plugins/annotation.ts +106 -0
  776. package/packages/core/src/plugins/archify.ts +124 -0
  777. package/packages/core/src/plugins/at-file.ts +54 -0
  778. package/packages/core/src/plugins/auto-mode.ts +123 -0
  779. package/packages/core/src/plugins/better-sidebar.ts +117 -0
  780. package/packages/core/src/plugins/browser-fetch.ts +171 -0
  781. package/packages/core/src/plugins/browser-session.ts +287 -0
  782. package/packages/core/src/plugins/canvas-draw.ts +90 -0
  783. package/packages/core/src/plugins/change-verifier.ts +79 -0
  784. package/packages/core/src/plugins/cleaner.ts +61 -0
  785. package/packages/core/src/plugins/cli-notifier.ts +125 -0
  786. package/packages/core/src/plugins/code2skill.ts +96 -0
  787. package/packages/core/src/plugins/colleague-skill.ts +122 -0
  788. package/packages/core/src/plugins/context-doctor.ts +117 -0
  789. package/packages/core/src/plugins/context.ts +102 -0
  790. package/packages/core/src/plugins/cost-meter.ts +231 -0
  791. package/packages/core/src/plugins/dependency-checker.ts +241 -0
  792. package/packages/core/src/plugins/docker-sandbox.ts +100 -0
  793. package/packages/core/src/plugins/fail-logger.ts +51 -0
  794. package/packages/core/src/plugins/genui.ts +88 -0
  795. package/packages/core/src/plugins/git-time-capsule.ts +97 -0
  796. package/packages/core/src/plugins/graph-memory.ts +394 -0
  797. package/packages/core/src/plugins/history-compressor.ts +81 -0
  798. package/packages/core/src/plugins/hol-guard.ts +153 -0
  799. package/packages/core/src/plugins/i18n-pair.ts +82 -0
  800. package/packages/core/src/plugins/image-compressor.ts +144 -0
  801. package/packages/core/src/plugins/llm-verifier.ts +164 -0
  802. package/packages/core/src/plugins/mcp-client.ts +559 -0
  803. package/packages/core/src/plugins/mcp-panel.ts +190 -0
  804. package/packages/core/src/plugins/memory.ts +176 -0
  805. package/packages/core/src/plugins/mirage-bridge.ts +179 -0
  806. package/packages/core/src/plugins/mock-server.ts +158 -0
  807. package/packages/core/src/plugins/model.ts +3 -1
  808. package/packages/core/src/plugins/models.ts +5 -2
  809. package/packages/core/src/plugins/modlens.ts +63 -0
  810. package/packages/core/src/plugins/module-search.ts +201 -0
  811. package/packages/core/src/plugins/obsidian-sync.ts +83 -0
  812. package/packages/core/src/plugins/openpets.ts +109 -0
  813. package/packages/core/src/plugins/plan-execute.ts +76 -0
  814. package/packages/core/src/plugins/plugin-check.ts +232 -0
  815. package/packages/core/src/plugins/plugin-dev.ts +47 -0
  816. package/packages/core/src/plugins/plugin-finder.ts +108 -0
  817. package/packages/core/src/plugins/plugin-radar.ts +179 -0
  818. package/packages/core/src/plugins/plugin-stars.ts +205 -0
  819. package/packages/core/src/plugins/prompt-guard.ts +122 -0
  820. package/packages/core/src/plugins/prompt-library.ts +165 -0
  821. package/packages/core/src/plugins/readme-gen.ts +147 -0
  822. package/packages/core/src/plugins/recall-unread.ts +142 -0
  823. package/packages/core/src/plugins/resources.ts +28 -21
  824. package/packages/core/src/plugins/reverse-skill.ts +79 -0
  825. package/packages/core/src/plugins/reviewer-bot.ts +146 -0
  826. package/packages/core/src/plugins/runtime-doctor.ts +137 -0
  827. package/packages/core/src/plugins/runtime.ts +61 -14
  828. package/packages/core/src/plugins/secure-audit.ts +146 -0
  829. package/packages/core/src/plugins/session-bookmarks.ts +89 -0
  830. package/packages/core/src/plugins/session-bridge.ts +299 -0
  831. package/packages/core/src/plugins/session-compare.ts +180 -0
  832. package/packages/core/src/plugins/session-export.ts +99 -0
  833. package/packages/core/src/plugins/session-insights.ts +47 -0
  834. package/packages/core/src/plugins/session-search.ts +126 -0
  835. package/packages/core/src/plugins/session.ts +4 -2
  836. package/packages/core/src/plugins/skill-catalog.ts +117 -0
  837. package/packages/core/src/plugins/skill-guard.ts +152 -0
  838. package/packages/core/src/plugins/sql-lens.ts +92 -0
  839. package/packages/core/src/plugins/stdio.ts +3 -1
  840. package/packages/core/src/plugins/synapse.ts +130 -0
  841. package/packages/core/src/plugins/tab-manager.ts +135 -0
  842. package/packages/core/src/plugins/taskboard.ts +412 -0
  843. package/packages/core/src/plugins/telemetry-blocker.ts +62 -0
  844. package/packages/core/src/plugins/test-harness.ts +67 -0
  845. package/packages/core/src/plugins/theme-studio.ts +165 -0
  846. package/packages/core/src/plugins/token-guard.ts +84 -0
  847. package/packages/core/src/plugins/tools.ts +5 -2
  848. package/packages/core/src/plugins/turn-rewind.ts +86 -0
  849. package/packages/core/src/plugins/undo-savepoint.ts +284 -0
  850. package/packages/core/src/plugins/vision-toolkit.ts +153 -0
  851. package/packages/core/src/plugins/web-research.ts +289 -0
  852. package/packages/core/src/plugins/workspace-navigator.ts +164 -0
  853. package/packages/core/src/plugins/workspace-search.ts +139 -0
  854. package/packages/core/src/plugins/yaml-validator.ts +97 -0
  855. package/packages/core/src/profile.ts +3 -0
  856. package/packages/core/src/runtime.ts +11 -4
  857. package/packages/core/src/services.ts +110 -3
  858. package/packages/core/src/stdio.ts +79 -9
  859. package/packages/core/src/workspace-path.ts +69 -0
  860. package/packages/core/test/agent-teams.test.ts +24 -0
  861. package/packages/core/test/archify.test.ts +33 -0
  862. package/packages/core/test/better-sidebar.test.ts +125 -0
  863. package/packages/core/test/boot.test.ts +49 -6
  864. package/packages/core/test/colleague-skill.test.ts +74 -0
  865. package/packages/core/test/config.test.ts +121 -0
  866. package/packages/core/test/context-doctor.test.ts +32 -0
  867. package/packages/core/test/dependency-checker.test.ts +60 -0
  868. package/packages/core/test/git-time-capsule.test.ts +115 -0
  869. package/packages/core/test/http.test.ts +34 -0
  870. package/packages/core/test/llm-verifier.test.ts +72 -0
  871. package/packages/core/test/mirage-bridge.test.ts +54 -0
  872. package/packages/core/test/module-search.test.ts +78 -0
  873. package/packages/core/test/plugin-check.test.ts +16 -0
  874. package/packages/core/test/plugin-stars.test.ts +55 -0
  875. package/packages/core/test/profiles.integration.test.ts +49 -15
  876. package/packages/core/test/prompt-library.test.ts +56 -0
  877. package/packages/core/test/readme-gen.test.ts +45 -0
  878. package/packages/core/test/recall-unread.test.ts +35 -0
  879. package/packages/core/test/registry.test.ts +48 -0
  880. package/packages/core/test/reverse-skill.test.ts +40 -0
  881. package/packages/core/test/runtime-doctor.test.ts +55 -0
  882. package/packages/core/test/runtime-fixture.ts +4 -4
  883. package/packages/core/test/runtime.test.ts +90 -1
  884. package/packages/core/test/secure-audit.test.ts +16 -0
  885. package/packages/core/test/services.test.ts +2024 -5
  886. package/packages/core/test/session-bookmarks.test.ts +62 -0
  887. package/packages/core/test/session-bridge.test.ts +103 -0
  888. package/packages/core/test/session-compare.test.ts +94 -0
  889. package/packages/core/test/session-export.test.ts +54 -0
  890. package/packages/core/test/session-search.test.ts +30 -0
  891. package/packages/core/test/skill-catalog.test.ts +18 -0
  892. package/packages/core/test/skill-guard.test.ts +21 -0
  893. package/packages/core/test/stdio-args.test.ts +178 -0
  894. package/packages/core/test/theme-studio.test.ts +39 -0
  895. package/packages/core/test/token-guard.test.ts +34 -0
  896. package/packages/core/test/turn-rewind.test.ts +19 -0
  897. package/packages/core/test/vision-toolkit.test.ts +38 -0
  898. package/packages/core/test/workspace-git-status.test.ts +37 -0
  899. package/packages/core/test/workspace-navigator.test.ts +33 -0
  900. package/packages/core/test/workspace-path.test.ts +34 -0
  901. package/packages/core/tsconfig.build.json +1 -3
  902. package/packages/core/tsconfig.json +1 -4
  903. package/packages/host-webserver/LICENSE +9 -0
  904. package/packages/host-webserver/dist/index.js +1 -1
  905. package/packages/host-webserver/dist/index.js.map +1 -1
  906. package/packages/host-webserver/package.json +17 -7
  907. package/packages/host-webserver/src/index.ts +1 -1
  908. package/packages/host-webserver/test/index.test.ts +4 -1
  909. package/packages/host-webserver/tsconfig.build.json +1 -1
  910. package/packages/host-webserver/tsconfig.json +1 -1
  911. package/apps/web/dist/assets/index-Bwqek8LF.js +0 -20
  912. package/apps/web/dist/assets/index-DCHSASjq.css +0 -1
  913. package/packages/api-gateway/dist/marketplace-registry.json +0 -62
  914. package/packages/api-gateway/src/marketplace-registry.json +0 -62
@@ -0,0 +1,20 @@
1
+ import{n as e,r as t,t as n}from"./react-vendor-BD7-wQo9.js";import{n as r,t as i}from"./markdown-vendor-DUdMWn0M.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var a=t(),o=e();function s(e){return e==null}function c(e,t,n){return Object.defineProperty(e,t,{writable:!0,value:n,enumerable:!1})}function l(e,t){return arguments.length===1?t=>l(e,t):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}function u(e){return l(`ArrayBuffer`,e)||l(`SharedArrayBuffer`,e)}function d(e){return u(e)||ArrayBuffer.isView(e)}var f;(function(e){e.is=u,e.isSource=d;function t(e){return ArrayBuffer.isView(e)?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}e.fromSource=t;function n(e){if(e=t(e),typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let n=``,r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)n+=String.fromCharCode(r[e]);return btoa(n)}e.toBase64=n;function r(e){return typeof Buffer<`u`?t(Buffer.from(e,`base64`)):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}e.fromBase64=r;function i(e){return e=t(e),typeof Buffer<`u`?Buffer.from(e).toString(`hex`):Array.from(new Uint8Array(e),e=>e.toString(16).padStart(2,`0`)).join(``)}e.toHex=i;function a(e){if(typeof Buffer<`u`)return t(Buffer.from(e,`hex`));let n=e.length%2==0?e:e.slice(0,e.length-1),r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(`${n[e]}${n[e+1]}`,16));return Uint8Array.from(r).buffer}e.fromHex=a})(f||={}),f.fromBase64,f.toBase64,f.fromHex,f.toHex;function p(e,t,n){let r=[],i=0;for(let a=0;a<e.length;a++){let o=e.charCodeAt(a);if(o>=65&&o<=90){if(i===1){let t=e.charCodeAt(a+1);t>=97&&t<=122&&r.push(n),r.push(o+32)}else i!==0&&r.push(n),r.push(o+32);i=1}else o>=97&&o<=122?(r.push(o),i=2):t.includes(o)?(i!==0&&r.push(n),i=0):r.push(o)}return String.fromCharCode(...r)}function m(e){return p(e,[45,95],45)}var h=m,g;(function(e){e.millisecond=1,e.second=1e3,e.minute=e.second*60,e.hour=e.minute*60,e.day=e.hour*24,e.week=e.day*7;let t=new Date().getTimezoneOffset();function n(e){t=e}e.setTimezoneOffset=n;function r(){return t}e.getTimezoneOffset=r;function i(n=new Date,r){return typeof n==`number`&&(n=new Date(n)),r===void 0&&(r=t),Math.floor((n.valueOf()/e.minute-r)/1440)}e.getDateNumber=i;function a(n,r){let i=new Date(n*e.day);return r===void 0&&(r=t),new Date(+i+r*e.minute)}e.fromDateNumber=a;let o=RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(e=>`(\\d+(?:\\.\\d+)?${e})?`).join(``)}$`);function s(t){let n=o.exec(t);return n?(parseFloat(n[1])*e.week||0)+(parseFloat(n[2])*e.day||0)+(parseFloat(n[3])*e.hour||0)+(parseFloat(n[4])*e.minute||0)+(parseFloat(n[5])*e.second||0):0}e.parseTime=s;function c(e){let t=s(e);return t?e=Date.now()+t:/^\d{1,2}(:\d{1,2}){1,2}$/.test(e)?e=`${new Date().toLocaleDateString()}-${e}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(e)&&(e=`${new Date().getFullYear()}-${e}`),e?new Date(e):new Date}e.parseDate=c;function l(t){let n=Math.abs(t);return n>=e.day-e.hour/2?Math.round(t/e.day)+`d`:n>=e.hour-e.minute/2?Math.round(t/e.hour)+`h`:n>=e.minute-e.second/2?Math.round(t/e.minute)+`m`:n>=e.second?Math.round(t/e.second)+`s`:t+`ms`}e.format=l;function u(e,t=2){return e.toString().padStart(t,`0`)}e.toDigits=u;function d(e,t=new Date){return e.replace(`yyyy`,t.getFullYear().toString()).replace(`yy`,t.getFullYear().toString().slice(2)).replace(`MM`,u(t.getMonth()+1)).replace(`dd`,u(t.getDate())).replace(`hh`,u(t.getHours())).replace(`mm`,u(t.getMinutes())).replace(`ss`,u(t.getSeconds())).replace(`SSS`,u(t.getMilliseconds(),3))}e.template=d})(g||={});var _=class{sn=0;map=new Map;weak=new WeakMap;get length(){return this.map.size}push(e){let t=++this.sn;return this.map.set(t,e),this.weak.set(e,t),()=>this.map.delete(t)}delete(e){let t=this.weak.get(e);return t?this.map.delete(t):!1}clear(){let e=[...this.map.values()];return this.map.clear(),e.reverse()}[Symbol.iterator](){return this.map.values()}[Symbol.for(`nodejs.util.inspect.custom`)](){return[...this]}},v={shadow:Symbol.for(`cordis.shadow`),receiver:Symbol.for(`cordis.receiver`),original:Symbol.for(`cordis.original`),metadata:Symbol.for(`cordis.metadata`),initHooks:Symbol.for(`cordis.initHooks`),checkProto:Symbol.for(`cordis.checkProto`),effect:Symbol.for(`cordis.effect`),filter:Symbol.for(`cordis.filter`),isolate:Symbol.for(`cordis.isolate`),intercept:Symbol.for(`cordis.intercept`),init:Symbol.for(`cordis.init`),check:Symbol.for(`cordis.check`),config:Symbol.for(`cordis.config`),invoke:Symbol.for(`cordis.invoke`),extend:Symbol.for(`cordis.extend`),tracker:Symbol.for(`cordis.tracker`),resolveConfig:Symbol.for(`cordis.resolveConfig`)},y=function*(){}.constructor,b=async function*(){}.constructor;function x(e){return!(!e.prototype||e instanceof y||b!==Function&&e instanceof b)}function S(e,t){if(e===Object.prototype)return t;let n=Object.create(S(Object.getPrototypeOf(e),t));for(let t of Reflect.ownKeys(e))Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t));return n}function C(e){return e&&(typeof e==`object`||typeof e==`function`)}function w(e,t){let n=e;for(;n;){let e=Reflect.getOwnPropertyDescriptor(n,t);if(e)return e;n=Object.getPrototypeOf(n)}}function T(e,t){if(!C(t))return t;if(Object.hasOwn(t,v.shadow))return Object.getPrototypeOf(t);let n=t[v.tracker];return n?k(e,t,n):t}function E(e,t){return t?new Proxy(e,{get:(e,n,r)=>n in t&&n!==`constructor`?Reflect.get(t,n,r):Reflect.get(e,n,r),set:(e,n,r,i)=>n in t&&n!==`constructor`?Reflect.set(t,n,r,i):Reflect.set(e,n,r,i)}):e}function D(e,t,n){return E(e,Object.defineProperty(Object.create(null),t,{value:n,writable:!1}))}function O(e,t,n,r){if(!n)return r;let i=Reflect.getOwnPropertyDescriptor(t,n)?.value;return i?D(r,n,e.extend({[v.shadow]:i})):r}function ee(e,t,n,r){return new Proxy(t,{apply:(t,i,a)=>(i===n&&(i=r),T(e,Reflect.apply(t,i,a)))})}function k(e,t,n){e[v.shadow]&&!n.noShadow&&(e=Object.getPrototypeOf(e));let r=new Proxy(t,{get:(t,r,i)=>{if(r===v.original)return t;if(r===n.property)return e;if(typeof r==`symbol`)return Reflect.get(t,r,i);if(n.associate&&e.reflect.props[`${n.associate}.${r}`])return Reflect.get(e,`${n.associate}.${r}`,D(e,v.receiver,i));let a,o,s=w(t,r);s&&`value`in s?o=s.value:(a=O(e,t,n.property,i),o=Reflect.get(t,r,a));let c=o?.[v.tracker];return c?k(e,o,c):!n.noShadow&&typeof o==`function`?(a??=O(e,t,n.property,i),ee(e,o,i,a)):o},set:(t,r,i,a)=>{if(r===v.original||r===n.property)return!1;if(typeof r==`symbol`)return Reflect.set(t,r,i,a);if(n.associate&&e.reflect.props[`${n.associate}.${r}`])return Reflect.set(e,`${n.associate}.${r}`,i,D(e,v.receiver,a));let o=O(e,t,n.property,a);return Reflect.set(t,r,i,o)},apply:(e,t,n)=>A(r,e,t,n)});return r}function A(e,t,n,r){return t[v.invoke]?t[v.invoke].apply(e,r):Reflect.apply(t,n,r)}function te(e,t,n){let r=function(...e){return A(k(r.ctx,r,n),r,this,e)};return c(r,`name`,e),Object.setPrototypeOf(r,t)}function ne(e,t,n){let r=e.error.stack.split(`
2
+ `);if(typeof t?.stack!=`string`){let e=Error(t),r=e.stack.split(`
3
+ `);throw r.splice(1,1/0,...n()),e.stack=r.join(`
4
+ `),e}let i=t.stack.split(`
5
+ `),a=i.indexOf(r[2]);if(a===-1)throw t;for(a-=e.offset;a>0&&i[a-1].endsWith(` (<anonymous>)`);)--a;throw i.splice(a,1/0,...n()),t.stack=i.join(`
6
+ `),t}function re(e,t=j()){let n={offset:1,error:Error()};try{let r=e(n);return C(r)&&`then`in r?r.then(void 0,e=>ne(n,e,t)):r}catch(e){ne(n,e,t)}}function j(e=0){let t=Error();return()=>t.stack.split(`
7
+ `).slice(3+e)}function ie(e){return e!==null&&e!==!1&&e!==void 0}var ae=class{ctx;_hooks={};constructor(e){this.ctx=e,c(this,v.tracker,{property:`ctx`,noShadow:!0}),this.on(`internal/listener`,function(e,t,n){if(e===`internal/update`&&!n.global)return(this.fiber._hooks[`internal/update`]??=new _)[n.prepend?`unshift`:`push`](t)}),this.on(`internal/update`,function(e,t,n){let r=[...this._hooks[`internal/update`]||[]],i=()=>(r.shift()??n).call(this,e,t,i);return i()},{global:!0,prepend:!0})}dispatch(e,t){let n=typeof t[0]==`object`||typeof t[0]==`function`?t.shift():null,r=t.shift();r.startsWith(`internal/`)||this.emit(`internal/dispatch`,e,r,t,n);let i=n?.[R.filter];return(this._hooks[r]||[]).filter(e=>e.global||!i||i.call(n,e.ctx)).map(e=>e.callback.bind(n))}async parallel(...e){let t=(await Promise.allSettled(this.dispatch(`emit`,e).map(async t=>t(...e)))).filter(e=>e.status===`rejected`);if(t.length)throw AggregateError(t.map(e=>e.reason))}emit(...e){this.dispatch(`emit`,e).map(t=>t(...e))}async serial(...e){for(let t of this.dispatch(`serial`,e)){let n=await t(...e);if(ie(n))return n}}bail(...e){for(let t of this.dispatch(`bail`,e)){let n=t(...e);if(ie(n))return n}}waterfall(...e){let t=this.dispatch(`waterfall`,e),n=e.pop(),r=()=>(t.shift()??n)(...e);return e.push(r),r()}register(e,t,n,r){let i=r.prepend?`unshift`:`push`;return this.ctx.fiber.effect(()=>(t[i]({ctx:this.ctx,callback:n,...r}),()=>this.unregister(t,n)),e)}unregister(e,t){let n=e.findIndex(e=>e.callback===t);if(n>=0)return e.splice(n,1),!0}on(e,t,n){typeof n!=`object`&&(n={prepend:n}),this.ctx.fiber.assertActive(),t=this.ctx.reflect.bind(t);let r=this.bail(this.ctx,`internal/listener`,e,t,n);if(r)return r;let i=this._hooks[e]||=[],a=`ctx.on(${typeof e==`string`?JSON.stringify(e):e.toString()})`;return this.register(a,i,t,n)}once(e,t,n){let r=this.on(e,function(...e){return r(),t.apply(this,e)},n);return r}},oe={s:e=>String(e),d:e=>Math.trunc(Number(e)),i:e=>Math.trunc(Number(e)),f:e=>Number(e),o:e=>JSON.stringify(e),O:e=>JSON.stringify(e),c:()=>``,C:(e,t,n)=>M.color(t,M.code(n.name,t.colors),e)};function se(e){return e instanceof Error&&Array.isArray(e.errors)}var M=class{service;static color(e,t,n,r=``){return e.colors?`\u001b[3${t<8?t:`8;5;`+t}${e.colors>=2?r:``}m${n}\u001b[0m`:``+n}static code(e,t){let n=0;for(let t=0;t<e.length;t++)n=(n<<3)-n+e.charCodeAt(t)+13,n|=0;let r=t?t>=2?ce:N:[];return r[Math.abs(n)%r.length]}static format(e,t){let n=t.args.slice();n[0]instanceof Error?(n[0]=n[0].stack||n[0].message,n.unshift(`%s`)):typeof n[0]!=`string`&&n.unshift(`%o`);let r=n.shift();r=r.replace(/%([a-zA-Z%])/g,(r,i)=>{if(r===`%%`)return`%`;let a=e.formatters?.[i]??oe[i];return typeof a==`function`?a(n.shift(),e,t):r});let i=e.formatters?.o??oe.o;for(let a of n)typeof a==`object`&&a&&(a=i(a,e,t)),r+=` `+a;let{maxLength:a=10240}=e;return r.split(/\r?\n/g).map(e=>e.slice(0,a)+(e.length>a?`...`:``)).join(`
8
+ `)}constructor(e,t){this.service=t,Object.assign(this,e),this.error=this._method(`error`,0),this.info=this._method(`info`,1),this.warn=this._method(`warn`,2),this.debug=this._method(`debug`,3)}_method(e,t){return(...n)=>{if(n.length===1&&n[0]instanceof Error){if(n[0].cause)this[e](n[0].cause);else if(se(n[0])){n[0].errors.forEach(t=>this[e](t));return}}let r=++this.service._snMessage,i=Date.now();for(let a of this.service.exporters.values()){if((a.levels?.[this.name]??a.levels?.default??this.level??1)<t)continue;let o={sn:r,ts:i,type:e,level:t,name:this.name,...this.meta,args:n};a.export(o)}}}},N=[6,2,3,4,5,1],ce=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221],le=class e{bufferSize=1e3;buffer=[];ctx;_snMessage=0;_snExporter=0;exporters=new Map;constructor(e){let t={property:`ctx`,noShadow:!0},n=te(`logger`,S(Object.getPrototypeOf(this),Function.prototype),t);return Object.assign(n,this),n.ctx=e,c(n,v.tracker,t),n.exporter({colors:3,export:e=>{n.buffer.push(e),n.buffer.length>n.bufferSize&&(n.buffer=n.buffer.slice(-n.bufferSize))}}),n}exporter(e){return this.ctx.effect(()=>(this.exporters.set(++this._snExporter,e),()=>this.exporters.delete(this._snExporter)),`ctx.logger.exporter()`)}_resolveConfig(){let e=this.ctx[v.intercept],t=[];for(;`logger`in e;)Object.hasOwn(e,`logger`)&&t.unshift(e.logger),e=Object.getPrototypeOf(e);return Object.assign({},...t)}[v.invoke](e){let t=this._resolveConfig(),n=(this.ctx[v.shadow]??this.ctx).fiber;return e??=t.name,e??=h(n.name),new M({name:e,level:t.level,meta:{fiber:new WeakRef(n)}},this)}static{for(let t of[`error`,`info`,`warn`,`debug`])e.prototype[t]=function(...e){return this()[t](...e)}}};function P(e){let t=e.stack.split(`
9
+ `);return t.splice(0,2,`Error: ${e.message}`),e.stack=t.join(`
10
+ `),e}var F=[`prototype`,`then`];function I(e){return typeof e==`symbol`||F.includes(e)||parseInt(e).toString()===e||e.startsWith(`_`)}var ue=class{ctx;static handler={get:(e,t,n)=>{if(I(t))return Reflect.get(e,t,n);if(Reflect.has(e,t))return T(n,Reflect.get(e,t,n));let r=Error(`cannot get property "${t}" without inject`);try{let i=e.reflect.props[t];return i?.type===`accessor`?i.get.call(n,n[v.receiver],r):n.fiber.runtime?n.events.waterfall(`internal/get`,n,t,r,()=>{let i=e[v.isolate][t],a=(n[v.shadow]??n).fiber;for(;;){let e=a.store?.[t];if(e)return T(n,e.value);if(t in a.inject)throw r.message=`cannot get required service "${t}" in inactive context`,r;if(!a.runtime||a.parent[v.isolate][t]!==i)throw r;a=a.parent.fiber}}):n.reflect.get(t,!1)}catch(e){throw e===r?P(e):e}},set:(e,t,n,r)=>{if(I(t))return Reflect.set(e,t,n,r);let i=Error(`cannot set property "${t}" without provide`),a=e.reflect.props[t];if(!a){if(!r.fiber.runtime)return Reflect.set(e,t,n,r);throw P(i)}try{return a.type===`accessor`?a.set?a.set.call(r,n,r[v.receiver],i):!1:r.events.waterfall(`internal/set`,r,t,n,i,()=>r.reflect.set(t,n,i))}catch(e){throw e===i?P(e):e}},has:(e,t)=>I(t)?Reflect.has(e,t):Reflect.has(e,t)?!0:!!e.reflect.props[t]};store=Object.create(null);props=Object.create(null);constructor(e){this.ctx=e,c(this,v.tracker,{property:`ctx`,noShadow:!0}),this.mixin(`reflect`,[`get`,`set`,`provide`,`accessor`,`mixin`]),this.mixin(`fiber`,[`runtime`,`effect`]),this.mixin(`registry`,[`inject`,`plugin`]),this.mixin(`events`,[`on`,`once`,`parallel`,`emit`,`serial`,`bail`,`waterfall`])}get(e,t=!0){return T(this.ctx,this._getImpl(e,t)?.value)}_getImpl(e,t=!0){let n=this.ctx[v.isolate][e],r=n&&this.store[n];if(r&&!(t&&r.fiber.state!==2))return r}set(e,t,n){let r=this.ctx[v.isolate][e],i=this.store[r];if(!i)throw Error(`cannot set property "${e}" without provide`);if(i.fiber!==this.ctx.fiber)throw Error(`cannot set property "${e}" in multiple fibers`);return i.value=t,!0}provide(e,t,n){return this.ctx.fiber.effect(()=>{if(!this.props[e])this.props[e]??={type:`service`};else if(this.props[e].type!==`service`)throw Error(`property "${e}" is already declared as ${this.props[e].type}`);this.props[e]={type:`service`},this.ctx.root[v.isolate][e]??=Symbol(e);let r=this.ctx[v.isolate][e],i={name:e,value:t,fiber:this.ctx.fiber,check:n};if(this.store[r])throw Error(`service "${e}" has been registered at <${this.store[r].fiber.name}>`);return this.store[r]=i,this.ctx.fiber.store[e]=i,this.ctx.fiber.state===2&&this.notify([e]),async()=>{delete this.store[r];let t=this.notify([e]);await Promise.allSettled(t.map(e=>e.await())),delete this.ctx.fiber.store[e]}},`ctx.provide(${JSON.stringify(e)})`)}notify(e,t=(e,t)=>e[v.isolate][t]===this.ctx[v.isolate][t]){let n=[];for(let r of this.ctx.registry.values())for(let i of r.fibers){let r=!1;for(let n of e)n in i.inject&&t(i.ctx,n)&&(r=!0,i._checkImpl(n));r&&(i._refresh(),n.push(i))}for(let n of e){let e=Object.create(this.ctx);e[v.filter]=e=>t(e,n),this.ctx.events.emit(e,`internal/service`,n,this._getImpl(n,!1)?.value)}return n}accessor(e,t){return this.ctx.fiber.effect(()=>{if(e in this.props)throw Error(`property "${e}" is already declared as ${this.props[e].type}`);return this.props[e]={type:`accessor`,...t},()=>delete this.props[e]},`ctx.accessor(${JSON.stringify(e)})`)}mixin(e,t){let n=this;return this.ctx.fiber.effect(function*(){let r=Array.isArray(t)?t.map(e=>[e,e]):Object.entries(t),i=(t,n)=>t[e];for(let[e,t]of r)yield n.accessor(t,{get(t,n){let r=i(this,n);if(s(r))return r;let a=t?E(t,r):r,o=Reflect.get(r,e,a);return typeof o==`function`?o.bind(a??r):o},set(t,n,r){let a=i(this,r),o=n?E(n,a):a;return Reflect.set(a,e,t,o)}})},`ctx.mixin(${JSON.stringify(e)})`)}trace(e){return T(this.ctx,e)}bind(e){return new Proxy(e,{apply:(e,t,n)=>Reflect.apply(e,this.trace(t),n.map(e=>this.trace(e))),construct:(e,t,n)=>Reflect.construct(e,t.map(e=>this.trace(e)),n)})}},de=Symbol.for(`ValidationError`),fe=class extends TypeError{name=`ValidationError`;constructor(e){super(`invalid config:
11
+ `+e.map(e=>e.path?` - ${e.message} (at ${e.path.join(`.`)})`:` - ${e.message}`).join(`
12
+ `))}};Object.defineProperty(fe.prototype,de,{value:!0});function pe(e,t){if(!e.Config)return t;let n=e.Config[`~standard`].validate(t);if(`then`in n)throw TypeError(`Async config validation is not supported`);if(n.issues)throw new fe(n.issues);return n.value}var me=new WeakMap;function he(e){let t=e();return me.get(e)?.()??t}function ge(e,t){let n=[`internal/plugin`,t],r;try{r=e.events.dispatch(`emit`,n)}catch(t){e.logger.error(t);return}for(let t of r)try{let r=t(...n);Promise.resolve(r).catch(t=>e.logger.error(t))}catch(t){e.logger.error(t)}}var _e=class e extends Error{code;constructor(t,n){super(n??e.Code[t]),this.code=t}};(function(e){e.Code={INACTIVE_EFFECT:`cannot create effect on inactive context`}})(_e||={});var L=`__INACTIVE__`,ve=class{parent;inject;runtime;uid;ctx;config;_config;state=0;dispose;store;inertia;_hooks=Object.create(null);_disposables=new _;context;_error;_runner;_store=Object.create(null);constructor(e,t,n,r,i){this.parent=e,this.inject=n,this.runtime=r,this._config=t;let a=e=>{this._disposables.push(e)};if(r){this.uid=e.registry.counter,this.ctx=this.context=e.extend({fiber:this});let t=Object.entries(this.inject);if(t.length){this.ctx[R.intercept]=Object.create(e[R.intercept]);for(let[e,n]of t)s(n)||(this.ctx[R.intercept][e]=n)}this._runner={epoch:L,getOuterStack:i,execute:function(){if(x(r.callback)){let e=new r.callback(this.ctx,this.config);for(let t of e?.[v.initHooks]??[])t();return e?.[v.init]?.()}return r.callback(this.ctx,this.config)},collect:a},this.dispose=e.fiber.effect(()=>{let e=r.fibers.push(this);return async()=>{for(this.uid=null,ge(this.context,this),this.ctx.registry.has(r.callback)&&(e(),r.fibers.length||this.ctx.registry.delete(r.callback)),this._setEpoch(L),this.inertia||this._updateState(()=>(this.inertia=this._unload(),5));this.inertia;)await this.inertia}},`ctx.plugin()`);try{this.context.emit(`internal/plugin`,this)}catch(e){throw Promise.resolve(this.dispose()).catch(e=>this.ctx.logger.error(e)),e}if(this.uid!==null&&e.fiber.state!==5){for(let e of Object.keys(this.inject))this._checkImpl(e);this._refresh()}}else this.uid=0,this.ctx=this.context=e,this.state=2,this.store=Object.create(null),this._runner={epoch:``,getOuterStack:i,execute:()=>{},collect:a},this.dispose=()=>this.restart()}get name(){let e=this;do{if(e.runtime?.name)return e.runtime.name;e=e.parent.fiber}while(e!==e.parent.fiber);return`root`}assertActive(){if(this.uid===null)throw new _e(`INACTIVE_EFFECT`)}_execute(e){let t=e.epoch;return re(n=>{let r=t=>{if(typeof t==`function`)e.collect(t);else if(!s(t))throw TypeError(`Invalid effect`)},i=e.execute.call(this);if(typeof i==`function`)return e.collect(i);if(!s(i)){if(!C(i))throw TypeError(`Invalid effect`);if(`then`in i)return i.then(r);if(Symbol.iterator in i){n.error=Error();let e=i[Symbol.iterator]();for(;;){let t=e.next();if(r(t.value),t.done)return}}else if(Symbol.asyncIterator in i){let a=i[Symbol.asyncIterator]();return(async()=>{for(await Promise.resolve(),n.error=Error();;){if(e.epoch!==t)return;let n=await a.next();if(r(n.value),n.done)return}})()}else throw TypeError(`Invalid effect`)}},e.getOuterStack)}effect(e,t=`anonymous`){if(this.assertActive(),this.state===5)throw new _e(`INACTIVE_EFFECT`);let n=[],r=!1,i,a=()=>{if(r)return i;r=!0;let e;for(let t of n.splice(0).reverse())if(e)e=e.then(()=>he(t));else{let n=he(t);C(n)&&`then`in n&&(e=n)}return i=e},o={label:t,children:[]},s={execute:e,epoch:!0,collect:e=>{n.push(e),this._disposables.delete(e),e[v.effect]&&o.children.push(e[v.effect])},getOuterStack:j()},l,u=!0,d,f,p,m=!1,h,g=()=>!1,_=()=>(p??=new Promise((e,t)=>{d=e,f=t}),p),y=e=>Promise.resolve(e).then(()=>a(),async e=>{throw await a(),e}),b=e=>{let t;try{t=e()}catch(e){throw g(),e}if(C(t)&&`then`in t){let e=Promise.resolve(t).finally(()=>{g(),h===e&&(h=void 0)});return h=e}return g(),t},x=c(()=>s.epoch?(s.epoch=!1,b(()=>u?y(_()):l?y(l):a())):m?h:void 0,v.effect,o);me.set(x,()=>h),g=this._disposables.push(x);try{l=this._execute(s)}catch(e){u=!1,m=!0,s.epoch=!1;let t;try{t=b(a)}finally{f?.(e)}throw C(t)&&`then`in t&&t.catch(e=>this.ctx.logger.error(e)),e}u=!1,p&&Promise.resolve(l).then(d,f),l?.catch(()=>s.epoch?b(a):a()).catch(e=>this.ctx.logger.error(e));let S=()=>{if(s.epoch)return s.epoch=!1,b(a)};return x.then=async(e,t)=>Promise.resolve(l).then(()=>S).then(e,t),x}getEffects(){return[...this._disposables].map(e=>e[v.effect]).filter(Boolean)}_getState(){return this.uid===null?4:this._error?3:this._runner.epoch===L?0:2}_updateState(e){let t=this.state;if(this.state=e()??this._getState(),t!==this.state&&(this.context.emit(`internal/status`,this,t),t===2||this.state===2))for(let e of Reflect.ownKeys(this.ctx.reflect.store)){let t=this.ctx.reflect.store[e];t.fiber===this&&this.ctx.reflect.notify([t.name])}}_checkImpl(e){let t=this.ctx.reflect._getImpl(e,!0);if(!t)return delete this._store[e];try{if(t.check&&!t.check.call(T(this.ctx,t.value)))return delete this._store[e]}catch(n){return t.fiber.ctx.logger.error(n),delete this._store[e]}this._store[e]=t}_refresh(){let e=!1;e=``;for(let t of Object.keys(this.inject)){let n=this._store[t];if(!n){e=L;break}e+=`:`+n.fiber.uid}this._setEpoch(e)}_setEpoch(e){let t=this._runner.epoch;e!==t&&(this._runner.epoch=e,!this.inertia&&this._updateState(()=>e!==L&&t===L?(this.inertia=this._reload(),1):(this.inertia=this._unload(),5)))}_resolveConfig(e){return e=this.context.waterfall(this,`internal/config`,e,()=>e),this.runtime?pe(this.runtime,e):e}async _reload(){this.store={...this._store};let e=this._runner.epoch;try{await Promise.resolve(),this._runner.epoch===e&&(this.config=this._resolveConfig(this._config),await this._execute(this._runner),this._error=void 0)}catch(e){this.ctx.logger.error(e),this._error=e,this._runner.epoch=L}this._updateState(()=>{if(this._runner.epoch===e)this.inertia=void 0;else return this.inertia=this._unload(),5})}async _unload(){await Promise.all(this._disposables.clear().map(async e=>{try{await re(async t=>{await Promise.resolve(),t.error=Error(),await he(e)},this._runner.getOuterStack)}catch(e){this.ctx.logger.error(e)}})),this.store=void 0,this._updateState(()=>{if(this._runner.epoch===L)this.inertia=void 0;else return this.inertia=this._reload(),1})}async await(){for(;this.inertia;)await this.inertia;if(this._error)throw this._error;return this}async restart(){this.assertActive(),this._setEpoch(L),this._refresh(),await this.await()}update(e,t=!1){if(this.assertActive(),this._config=e,this.state!==2){this._error=void 0,this._setEpoch(L),this._refresh();return}return e=this._resolveConfig(e),this.context.waterfall(this,`internal/update`,e,t,()=>(this.config=e,this._error=void 0,this.restart()))}};function ye(e){return e&&typeof e==`object`&&typeof e.apply==`function`}function be(e,t){return function(n,r){if(r.kind===`class`)Object.hasOwn(n,`inject`)||(c(n,`inject`,Object.create(Object.getPrototypeOf(n).inject??null)),c(n.inject,v.checkProto,!0)),n.inject[e]=t;else if(r.kind===`method`){let i=(n[v.metadata]??={}).inject??=Object.create(null);i[e]=t,r.addInitializer(function(){let e=this[v.tracker]?.property;(this[v.initHooks]??=[]).push(()=>{this.ctx.inject(i,t=>n.call(e?E(this,{[e]:t}):this))})})}else throw Error(`@Inject() can only be used on class or class methods`)}}(function(e){function t(e,n=Object.create(null)){if(!e)return n;if(Array.isArray(e))for(let t of e)n[t]=null;else if(Reflect.has(e,v.checkProto)){Object.assign(n,t(Object.getPrototypeOf(e)));for(let t of Object.keys(e))n[t]=e[t]??null}else for(let t of Object.keys(e))n[t]=e[t]??null;return n}e.resolve=t})(be||={});var xe=class{ctx;_counter=0;_internal=new Map;constructor(e){this.ctx=e,c(this,v.tracker,{property:`ctx`,noShadow:!0})}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e){try{if(typeof e==`function`)return e;if(ye(e))return e.apply}catch{}}get(e){let t=this.resolve(e);return t&&this._internal.get(t)}has(e){let t=this.resolve(e);return!!t&&this._internal.has(t)}delete(e){let t=this.resolve(e),n=t&&this._internal.get(t);if(n){this._internal.delete(t);for(let e of n.fibers)e.dispose();return n}}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}inject(e,t){return this.plugin({inject:e,apply:t,name:t.name})}plugin(e,t,n=j()){let r=this.resolve(e);if(!r)throw Error(`invalid plugin, expect function or object with an "apply" method, received `+typeof e);this.ctx.fiber.assertActive();let i=this._internal.get(r);if(!i){let t=e.name;t===`apply`&&(t=void 0),i={name:t,callback:r,fibers:new _,Config:e.Config},this._internal.set(r,i)}let a=new ve(this.ctx,t,be.resolve(e.inject),i,n),o=Object.create(a);return o.then=(e,t)=>a.await().then(e,t),o}},R=class e{static effect=v.effect;static filter=v.filter;static isolate=v.isolate;static intercept=v.intercept;static is(t){return!!t?.[e.is]}static{e.is[Symbol.toPrimitive]=()=>Symbol.for(`cordis.is`),e.prototype[e.is]=!0}constructor(){this[v.isolate]=Object.create(null),this[v.intercept]=Object.create(null);let e=new Proxy(this,ue.handler);return this.root=e,this.baseUrl=void 0,this.fiber=new ve(e,{},Object.create(null),null,()=>[]),this.reflect=new ue(e),this.registry=new xe(e),this.events=new ae(e),this.logger=new le(e),this.fiber._disposables.clear(),e}[Symbol.for(`nodejs.util.inspect.custom`)](){return`Context <${this.fiber.name}>`}extend(e={}){let t=Reflect.getOwnPropertyDescriptor(this,v.shadow)?.value,n=Object.create(T(this,this));for(let t of Reflect.ownKeys(e))Object.defineProperty(n,t,Reflect.getOwnPropertyDescriptor(e,t));return t?Object.assign(Object.create(n),{[v.shadow]:t}):n}isolate(e,t){let n=Object.create(this[v.isolate]);return n[e]=t??Symbol(e),this.extend({[v.isolate]:n})}intercept(e,t){let n=Object.create(this[v.intercept]);return n[e]=t,this.extend({[v.intercept]:n})}};(class e{ctx;static init=v.init;static check=v.check;static config=v.config;static invoke=v.invoke;static extend=v.extend;static tracker=v.tracker;static resolveConfig=v.resolveConfig;name;constructor(e,t){this.ctx=e,t??=this.constructor.provide;let n=this,r={associate:t,property:`ctx`};return n[v.invoke]&&(n=te(t,S(Object.getPrototypeOf(this),Function.prototype),r)),n.ctx=e,n.name=t,c(n,v.tracker,r),n.ctx.reflect.provide(t,n,this[v.check]),n}[v.filter](e){return e[v.isolate][this.name]===this.ctx[v.isolate][this.name]}[v.extend](t){let n;return n=this[e.invoke]?te(this.name,this,this[v.tracker]):Object.create(this),Object.assign(n,t)}[v.resolveConfig](e,t){let n=this.ctx[R.intercept],r=[];for(;this.name in n;)Object.hasOwn(n,this.name)&&r.unshift(n[this.name]),n=Object.getPrototypeOf(n);return e&&r.unshift(e),t&&r.push(t),this.Config?.merge?this.Config.merge(...r):Object.assign({},...r)}static[Symbol.hasInstance](e){if(!e)return!1;let t=e.constructor;for(;t;){if(t=t.prototype?.constructor,t===this)return!0;t&&=Object.getPrototypeOf(t)}return!1}});var z=n();function Se(e,t){return e.filter((e,n)=>t[n]?.status===`rejected`)}function B(e,t){return fetch(e,t).then(async e=>{let t=await e.json();if(!e.ok){let n=typeof t==`object`&&t&&`error`in t&&typeof t.error==`string`?t.error:`Request failed with status ${e.status}`;throw Error(n)}return t})}function Ce(){return{getStatus:()=>B(`/api/status`),getSession:()=>B(`/api/session`),getFiles:async()=>(await B(`/api/files`)).items,listWorkspaces:async()=>(await B(`/api/workspaces`)).items,pickDirectory:async()=>(await B(`/api/workspaces/pick`,{method:`POST`})).path,getFileDiff:e=>B(`/api/files/diff?path=${encodeURIComponent(e)}`),commitFiles:(e,t)=>B(`/api/files/commit`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({paths:e,message:t})}),revertFiles:e=>B(`/api/files/revert`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({paths:e,confirm:!0})}),prompt:e=>B(`/api/prompt`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({prompt:e})}),abort:()=>B(`/api/abort`,{method:`POST`}),createSession:e=>B(`/api/session/new`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e?{cwd:e}:{})}),openSession:e=>B(`/api/session/open`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e})}),listSessions:(e=0,t=50,n=!1)=>B(`/api/sessions?page=${e}&pageSize=${t}&includeArchived=${n}`),renameSession:(e,t)=>B(`/api/session/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e,name:t})}),deleteSession:e=>B(`/api/session/delete`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e,confirm:!0})}),setSessionMetadata:(e,t)=>B(`/api/session/metadata`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e,...t})}),batchSessions:(e,t)=>B(`/api/sessions/batch`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:e,paths:t,confirm:e===`delete`})}),forkSession:(e,t)=>B(`/api/session/fork`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:e,cwd:t})}),importSession:async(e,t,n)=>{let r=await B(`/api/session/import`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({content:e,filename:t,cwd:n})});return{sessionId:r.sessionId,sessionFile:r.sessionFile,messages:[],entries:[],events:[]}},exportSession:async e=>{let t=await fetch(`/api/session/export?path=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`Export failed with status ${t.status}`);return t.blob()},listModels:async()=>(await B(`/api/models`)).items,listProviders:async()=>(await B(`/api/providers`)).items,testProvider:e=>B(`/api/providers/test`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({provider:e})}),refreshProvider:e=>B(`/api/providers/refresh`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({provider:e})}),addProvider:e=>B(`/api/providers/add`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),listPlugins:async()=>(await B(`/api/plugins`)).items,listPluginPanels:async()=>(await B(`/api/plugin-ui`)).items,togglePlugin:(e,t)=>B(`/api/plugins/toggle`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:e,enabled:t})}),uninstallPlugin:e=>B(`/api/plugins/uninstall`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:e})}),listMarketplace:(e=``,t=``,n=0,r=24,i=``)=>B(`/api/marketplace?q=${encodeURIComponent(e)}&capability=${encodeURIComponent(t)}&category=${encodeURIComponent(i)}&page=${n}&pageSize=${r}&sort=recommended`),installMarketplace:e=>B(`/api/marketplace/install`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:e})}),listCommands:async()=>(await B(`/api/commands`)).items,selectModel:(e,t)=>B(`/api/model`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({provider:e,model:t})}),getConfig:()=>B(`/api/config`),updateConfig:e=>B(`/api/config`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),updateConfigSource:e=>B(`/api/config/source`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({source:e})}),reloadConfig:()=>B(`/api/config/reload`,{method:`POST`}),subscribeEvents:e=>{if(typeof EventSource>`u`)return()=>{};let t=new EventSource(`/api/events`);return t.onmessage=t=>{try{let n=t.data;typeof n==`string`&&e(JSON.parse(n))}catch{}},()=>t.close()}}}function we(e,t){let n=Math.max(0,Math.min(t,e.length)),r=Math.max(e.lastIndexOf(` `,n-1),e.lastIndexOf(`
13
+ `,n-1))+1,i=e.slice(r,n),a=i[0];if(a!==`/`&&a!==`@`)return null;let o=i.slice(1);return/\s/.test(o)?null:{kind:a===`/`?`command`:`file`,query:o,start:r,end:n}}function Te(e,t,n){return{text:`${e.slice(0,t.start)}${n}${e.slice(t.end)}`,caret:t.start+n.length}}function Ee(e){if(e?.type!==`message_update`||typeof e.assistantMessageEvent!=`object`||e.assistantMessageEvent===null)return;let t=e.assistantMessageEvent;if(t.type===`thinking_delta`)return{assistantMessageEvent:t,delta:typeof t.delta==`string`?t.delta:``}}function De(e){let t=[];for(let n of e){let e=Ee(n),r=t.at(-1),i=Ee(r);if(e&&r&&i){t[t.length-1]={...r,assistantMessageEvent:{...i.assistantMessageEvent,delta:i.delta+e.delta}};continue}t.push(n)}return t}var Oe={gfm:!0,breaks:!0},ke=typeof window>`u`?void 0:r(window);function Ae(e){let t=i.parse(e,Oe);return typeof t==`string`?ke?.sanitize(t,{USE_PROFILES:{html:!0},ALLOWED_TAGS:[`a`,`blockquote`,`br`,`code`,`del`,`em`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`hr`,`li`,`ol`,`p`,`pre`,`strong`,`ul`],ALLOWED_ATTR:[`href`,`rel`,`target`],FORBID_ATTR:[`style`,`class`,`id`]})??``:``}function je({text:e,onMouseUp:t}){return(0,z.jsx)(`div`,{className:`turn-markdown`,dangerouslySetInnerHTML:{__html:Ae(e)},onMouseUp:t})}function Me(e){let t=e.content;return typeof t==`string`?t:Array.isArray(t)?t.map(e=>{if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return``;let t=e;return(t.type===void 0||t.type===`text`)&&typeof t.text==`string`?t.text:``}).join(``):``}function Ne(e){let t=e.content;return Array.isArray(t)?t.map(e=>{if(typeof e!=`object`||!e)return``;let t=e;return t.type===`thinking`&&typeof t.thinking==`string`?t.thinking:``}).filter(Boolean).join(`
14
+
15
+ `):``}function Pe(e){let t=[];for(let n of e){if(n.role===`toolResult`)continue;let e=n.role===`user`?`user`:n.role===`assistant`?`assistant`:void 0;if(!e)continue;let r=Me(n),i=e===`assistant`?Ne(n):``;if(!r&&!i)continue;let a=t.at(-1);e===`assistant`&&a?.role===`assistant`?t[t.length-1]={role:e,text:a.text+r,thinking:a.thinking+i}:t.push({role:e,text:r,thinking:i})}return t}var Fe=`[Pi Harness annotations]`,V=`[/Pi Harness annotations]`,Ie=`
16
+
17
+ 提问:`;function Le(e,t){let n=e.flatMap(e=>[`${e.id}. ${e.quote}`,...e.note===``?[]:[` 批注:${e.note}`]]),r=e.map(e=>`Annotation ${e.id}:`).join(`、`);return`${Fe}\n${n.join(`
18
+ `)}\n${V}\n\n请逐条回应 ${r}${Ie}${t.trim()}`}function Re(e){let t=e.lastIndexOf(Ie);if(t<0)return{question:e,count:0};let n=e.lastIndexOf(Fe,t),r=e.indexOf(V,n);if(n<0||r<n)return{question:e,count:0};let i=e.slice(n+24,r).split(`
19
+ `).filter(e=>/^\d+\.\s+/u.test(e)).length;return{question:e.slice(t+5),count:i}}function H(e){return`?page=marketplace&plugin=${encodeURIComponent(e)}`}function ze(e){if(e.get(`page`)===`marketplace`)return e.get(`plugin`)?.trim()||void 0}function Be(e){return[{id:``,label:`全部`,count:e.reduce((e,t)=>e+t.count,0)},...e]}function Ve(e){return e>=1e4?`${(e/1e4).toFixed(1).replace(/\.0$/,``)} 万`:new Intl.NumberFormat(`zh-CN`).format(e)}function He(e){if(e===void 0)return[];let t=[];return e.downloads30d!==void 0&&t.push({label:`近 30 天下载量`,value:Ve(e.downloads30d)}),e.quality!==void 0&&t.push({label:`npm 质量分`,value:String(Math.round(e.quality*100))}),e.updatedAt!==void 0&&Number.isFinite(Date.parse(e.updatedAt))&&t.push({label:`npm 更新时间`,value:e.updatedAt.slice(0,10)}),t}var Ue=async e=>{let t=[];for(let n=0;;n+=1){let r=await e.listMarketplace(``,``,n,100);if(t.push(...r.items),!r.hasNext||r.items.length===0||t.length>=r.total)return t}};function We(e,t){let n=Math.max(0,Math.min(50,Math.trunc(t)));return[...e].sort((e,t)=>t.stars-e.stars||e.fullName.localeCompare(t.fullName)).slice(0,n).map((e,t)=>({...e,rank:t+1}))}function Ge(e,t){let n=Math.max(0,Math.min(20,Math.trunc(t)));return e.filter(e=>e.targetId.trim()!==``&&e.url.trim()!==``).slice(0,n).map(e=>({targetId:e.targetId,title:e.title||`未命名页面`,url:e.url}))}var Ke=(e,t)=>{let n=e.trim().toLowerCase();return!n||t.some(e=>e?.toLowerCase().includes(n))};function qe(e){return`?page=plugins&plugin=${encodeURIComponent(e)}`}function Je(e){if(e.get(`page`)===`plugins`)return e.get(`plugin`)?.trim()||void 0}var U=(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}},Ye=[`button:not([disabled])`,`a[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`summary`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function W(e,t,n=!1,r){let i=(0,a.useRef)(null),o=(0,a.useRef)(t),s=(0,a.useRef)(n);return o.current=t,s.current=n,(0,a.useEffect)(()=>{if(!e)return;let t=document.activeElement,n=t instanceof HTMLElement&&t!==document.body&&t!==document.documentElement?t:void 0,a=()=>Array.from(i.current?.querySelectorAll(Ye)??[]).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]`)??a()[0])?.focus()}),l=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopImmediatePropagation(),s.current||o.current();return}if(e.key!==`Tab`)return;let t=a();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 Xe=(e,t)=>e?.cwd??(typeof t?.sessionFile==`string`?t.sessionFile:`未选择工作区`),G=e=>{let t=U(e.type,``);return t===`file_diff`?`文件差异`:t===`file`?`文件详情`:U(e.summary??e.message??e.toolName??e.type??e.event,`未命名事件`)},Ze=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]??`运行时`,Qe=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},$e=()=>{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:ze(e),installedPlugin:Je(e),marketplacePage:Number.isFinite(s)&&s>=0?s:0}};function et(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 tt({status:e,workspaces:t,onCreate:n,onStarter:r,onToml:i}){return(0,z.jsxs)(`div`,{className:`new-session-screen`,children:[(0,z.jsx)(`div`,{className:`welcome-kicker`,children:`PI AGENT HARNESS · REAL RUNTIME`}),(0,z.jsxs)(`div`,{className:`welcome-heading`,children:[(0,z.jsx)(`span`,{className:`pi-mark large`,"aria-hidden":`true`,children:(0,z.jsx)(`img`,{src:`/icons/svg/mark-white.svg`,alt:``})}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{children:`开始一个工作会话`}),(0,z.jsx)(`p`,{children:`连接当前工作区,直接让 Pi agent 读取、修改并验证代码。`})]})]}),(0,z.jsx)(`div`,{className:`workspace-picker`,children:t.length?t.map(t=>(0,z.jsxs)(`button`,{className:`workspace-row`,onClick:()=>n(t),type:`button`,children:[(0,z.jsx)(`span`,{className:`workspace-status ${t.current?`live`:`offline`}`,children:t.current?`已连接`:`工作区`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`code`,{children:t.path}),(0,z.jsx)(`small`,{children:t.current&&e?`${t.branch} · ${e.model}`:t.branch})]}),(0,z.jsx)(`span`,{className:`workspace-arrow`,children:`↗`})]},t.path)):(0,z.jsxs)(`div`,{className:`workspace-row is-empty`,children:[(0,z.jsx)(`span`,{className:`workspace-status offline`,children:`加载中`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`code`,{children:e?.cwd??`加载工作区…`}),(0,z.jsx)(`small`,{children:`正在读取 git worktree`})]})]})}),(0,z.jsxs)(`div`,{className:`effective-config`,children:[(0,z.jsx)(`span`,{className:`config-label`,children:`当前运行时`}),(0,z.jsx)(`span`,{children:e?.model??`由运行时提供`}),(0,z.jsx)(`span`,{children:e?`${e.messages} 条消息`:`—`}),(0,z.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),i()},children:`改配置 ⌘,`})]}),(0,z.jsx)(`div`,{className:`starter-grid`,children:[[`定位问题`,`分析当前仓库并给出根因`],[`修复并测试`,`实现修复并运行相关测试`],[`审查改动`,`只读检查未提交变更`],[`解释代码`,`解释当前文件的关键逻辑`]].map(([e,t])=>(0,z.jsxs)(`button`,{className:`starter-card`,onClick:()=>r(t),type:`button`,children:[(0,z.jsx)(`strong`,{children:e}),(0,z.jsx)(`small`,{children:t})]},e))})]})}function nt({workspaces:e,onSelect:t,onPickDirectory:n,onClose:r,error:i}){let a=W(!0,r);return(0,z.jsx)(`div`,{className:`workspace-chooser`,onClick:r,children:(0,z.jsxs)(`div`,{"aria-label":`选择工作区`,"aria-modal":`true`,className:`workspace-chooser-dialog`,onClick:e=>e.stopPropagation(),ref:a,role:`dialog`,tabIndex:-1,children:[(0,z.jsxs)(`div`,{className:`workspace-chooser-heading`,children:[(0,z.jsx)(`strong`,{children:`新建会话`}),(0,z.jsx)(`button`,{"aria-label":`关闭工作区选择`,onClick:r,type:`button`,children:`×`})]}),(0,z.jsx)(`small`,{children:`选择这个会话要使用的工作区`}),i?(0,z.jsx)(`div`,{className:`workspace-chooser-error`,role:`alert`,children:i}):null,(0,z.jsxs)(`button`,{className:`workspace-pick-directory`,"data-dialog-initial-focus":!0,onClick:()=>void n(),type:`button`,children:[(0,z.jsx)(`span`,{children:`打开目录`}),(0,z.jsx)(`small`,{children:`从 Finder 选择一个新的工作目录`})]}),(0,z.jsx)(`div`,{className:`workspace-chooser-divider`,children:(0,z.jsx)(`span`,{children:`或选择已有 worktree`})}),e.length?e.map(e=>(0,z.jsxs)(`button`,{className:`workspace-chooser-row`,onClick:()=>t(e),type:`button`,children:[(0,z.jsx)(`span`,{className:`workspace-status ${e.current?`live`:`offline`}`,children:e.current?`当前`:`worktree`}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:e.name}),(0,z.jsx)(`code`,{children:e.path})]}),(0,z.jsx)(`small`,{children:e.branch})]},e.path)):(0,z.jsx)(`span`,{className:`workspace-chooser-empty`,children:`正在读取 git worktree…`})]})})}function rt({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=W(!0,o,i,`.session-menu`);return(0,z.jsx)(`div`,{className:`session-dialog-backdrop`,onClick:()=>{i||o()},children:(0,z.jsxs)(`div`,{"aria-label":l,"aria-modal":`true`,className:`session-dialog`,onClick:e=>e.stopPropagation(),ref:d,role:`dialog`,tabIndex:-1,children:[(0,z.jsxs)(`header`,{className:`session-dialog-header`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:l}),(0,z.jsx)(`small`,{children:u})]}),(0,z.jsx)(`button`,{"aria-label":`关闭`,disabled:i,onClick:o,type:`button`,children:`×`})]}),e===`rename`&&(0,z.jsxs)(`label`,{className:`session-dialog-field`,children:[(0,z.jsx)(`span`,{children:`名称`}),(0,z.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,z.jsx)(`div`,{className:`session-dialog-target`,children:t}),(0,z.jsxs)(`footer`,{className:`session-dialog-actions`,children:[(0,z.jsx)(`button`,{"data-dialog-initial-focus":e===`rename`?void 0:``,disabled:i,onClick:o,type:`button`,children:`取消`}),(0,z.jsx)(`button`,{className:c?`danger`:`primary`,disabled:i||e===`rename`&&!r.trim(),onClick:s,type:`button`,children:i?`处理中…`:e===`rename`?`保存名称`:e===`archive`?`归档`:`永久删除`})]})]})})}function it({title:e,description:t,target:n,confirmLabel:r,busy:i,onClose:a,onConfirm:o}){let s=W(!0,a,i);return(0,z.jsx)(`div`,{className:`session-dialog-backdrop`,onClick:()=>{i||a()},children:(0,z.jsxs)(`div`,{"aria-label":e,"aria-modal":`true`,className:`session-dialog`,onClick:e=>e.stopPropagation(),ref:s,role:`dialog`,tabIndex:-1,children:[(0,z.jsxs)(`header`,{className:`session-dialog-header`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e}),(0,z.jsx)(`small`,{children:t})]}),(0,z.jsx)(`button`,{"aria-label":`关闭`,disabled:i,onClick:a,type:`button`,children:`×`})]}),n&&(0,z.jsx)(`div`,{className:`session-dialog-target`,children:n}),(0,z.jsxs)(`footer`,{className:`session-dialog-actions`,children:[(0,z.jsx)(`button`,{"data-dialog-initial-focus":!0,disabled:i,onClick:a,type:`button`,children:`取消`}),(0,z.jsx)(`button`,{className:`danger`,disabled:i,onClick:o,type:`button`,children:i?`处理中…`:r})]})]})})}function at({busy:e,onRename:t,onFork:n,onArchive:r,onDelete:i}){return(0,z.jsxs)(`div`,{className:`session-row-menu-popover`,onClick:e=>e.stopPropagation(),children:[(0,z.jsx)(`button`,{disabled:e,onClick:t,type:`button`,children:`重命名`}),(0,z.jsx)(`button`,{disabled:e,onClick:n,type:`button`,children:`复制会话`}),(0,z.jsx)(`button`,{disabled:e,onClick:r,type:`button`,children:`归档会话`}),(0,z.jsx)(`button`,{className:`danger`,disabled:e,onClick:i,type:`button`,children:`删除会话`})]})}function ot({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,z.jsxs)(`div`,{className:`action-error`,role:`alert`,children:[(0,z.jsxs)(`div`,{className:`action-error-summary`,children:[(0,z.jsx)(`strong`,{children:t?`EveryAPI 认证未注入当前进程`:n?`模型尚未配置认证`:`发送失败`}),(0,z.jsx)(`span`,{children:t?`请用 everyapi use pi-harness 启动,或设置 EVERYAPI_RELAY_KEY 后重启。`:n?`请在设置 → 提供商中配置 API key,然后重试。`:`运行时没有接受这次请求,请重试或查看错误详情。`})]}),(0,z.jsxs)(`details`,{children:[(0,z.jsx)(`summary`,{children:`查看原始错误`}),(0,z.jsx)(`code`,{children:e})]})]})}function st({text:e}){let t=Re(e);return(0,z.jsxs)(`div`,{className:`user-bubble`,children:[(0,z.jsx)(`span`,{children:t.question}),t.count>0?(0,z.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 ct({event:e,onClose:t,onCopy:n}){if(!e)return(0,z.jsxs)(`aside`,{className:`details-panel`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:`事件详情`}),(0,z.jsx)(`button`,{"aria-label":`关闭事件详情`,onClick:t,type:`button`,children:`×`})]}),(0,z.jsx)(`div`,{className:`details-body`,children:(0,z.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`],[`文件`,U(e.path)]]:[[`来源`,U(e.type??e.source,`event`)],[`产生者`,U(e.by??e.source)],[`耗时`,U(e.duration??e.dur)],[`时间`,U(e.timestamp??e.ts??e.time)]];return(0,z.jsxs)(`aside`,{className:`details-panel`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:G(e)}),(0,z.jsx)(`button`,{"aria-label":`关闭事件详情`,onClick:t,type:`button`,children:`×`})]}),(0,z.jsxs)(`div`,{className:`details-body`,children:[(0,z.jsx)(`div`,{className:`detail-stats`,children:a.map(([e,t])=>(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`small`,{children:e}),(0,z.jsx)(`b`,{children:t})]},e))}),r!==void 0&&(0,z.jsxs)(`div`,{className:`detail-section`,children:[(0,z.jsx)(`small`,{children:`输出`}),(0,z.jsx)(`pre`,{className:`tool-output`,children:typeof r==`string`?r:JSON.stringify(r,null,2)})]}),(0,z.jsxs)(`div`,{className:`detail-section`,children:[(0,z.jsx)(`small`,{children:i?`数据来源`:`经过的插件`}),(0,z.jsx)(`div`,{className:`detail-plugin`,children:i?`Git workspace · /api/files`:`Runtime loader · event`})]}),(0,z.jsxs)(`div`,{className:`detail-actions`,children:[(0,z.jsx)(`button`,{onClick:n,type:`button`,children:`复制 JSON`}),(0,z.jsx)(`button`,{disabled:!0,title:`当前 API 未提供重放接口`,type:`button`,children:`重放`})]}),(0,z.jsxs)(`details`,{className:`raw-json`,children:[(0,z.jsx)(`summary`,{children:`原始 JSON`}),(0,z.jsx)(`pre`,{className:`raw-json-body`,children:JSON.stringify(e,null,2)})]})]})]})}function lt({events:e,onSelect:t}){let[n,r]=(0,a.useState)(`all`),i=(0,a.useMemo)(()=>{let t=new Map;return e.forEach(e=>{let n=U(e.type,`event`);t.set(n,(t.get(n)??0)+1)}),t},[e]),o=e.filter(e=>n===`all`||U(e.type,`event`)===n);return(0,z.jsxs)(`section`,{className:`view-panel trajectory-view`,children:[(0,z.jsxs)(`div`,{className:`trajectory-summary`,children:[(0,z.jsx)(`span`,{children:`按轮次`}),(0,z.jsxs)(`b`,{children:[e.length,` 个事件`]}),(0,z.jsx)(`div`,{className:`timeline`,children:e.length?e.map((e,t)=>(0,z.jsx)(`span`,{className:`timeline-turn`,children:(0,z.jsx)(`i`,{className:`timeline-strip`,title:G(e)})},t)):(0,z.jsx)(`span`,{className:`timeline-empty`,children:`等待真实事件…`})})]}),(0,z.jsxs)(`div`,{className:`source-filters`,children:[(0,z.jsxs)(`button`,{className:`filter ${n===`all`?`active`:``}`,onClick:()=>r(`all`),type:`button`,children:[`全部 `,e.length]}),[...i].map(([e,t])=>(0,z.jsxs)(`button`,{className:`filter ${n===e?`active`:``}`,onClick:()=>r(e),type:`button`,children:[e,` `,t]},e))]}),(0,z.jsxs)(`div`,{className:`event-table`,children:[(0,z.jsxs)(`div`,{className:`event-head`,children:[(0,z.jsx)(`span`,{children:`时间`}),(0,z.jsx)(`span`,{children:`来源`}),(0,z.jsx)(`span`,{children:`事件`}),(0,z.jsx)(`span`,{children:`产生者`}),(0,z.jsx)(`span`,{children:`耗时`})]}),o.map((e,n)=>(0,z.jsxs)(`button`,{className:`event-row`,onClick:()=>t(e),type:`button`,children:[(0,z.jsx)(`span`,{children:U(e.timestamp??e.ts??e.time)}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`i`,{className:`event-dot`}),U(e.type,`event`)]}),(0,z.jsx)(`strong`,{children:G(e)}),(0,z.jsx)(`span`,{children:U(e.by??e.source)}),(0,z.jsx)(`span`,{children:U(e.duration??e.dur)})]},n)),!o.length&&(0,z.jsx)(`div`,{className:`empty-state`,children:`暂无轨迹事件。`})]})]})}function ut({files:e,api:t,onDiff:n,onRefresh:r}){let i=e.filter(e=>e.status.includes(`A`)||e.status===`??`).length,o=e.filter(e=>e.status.includes(`D`)).length,[s,c]=(0,a.useState)(``),[l,u]=(0,a.useState)(!1),[d,f]=(0,a.useState)(``),[p,m]=(0,a.useState)(!1);return(0,z.jsxs)(`section`,{className:`view-panel files-view`,children:[(0,z.jsxs)(`div`,{className:`files-content`,children:[(0,z.jsxs)(`div`,{className:`files-title`,children:[(0,z.jsx)(`strong`,{children:`本次会话改动`}),(0,z.jsx)(`span`,{children:`由 /api/files 提供`})]}),(0,z.jsx)(`div`,{className:`file-summary`,children:`${e.length} 个文件 · ${i} 个新增 · ${o} 个删除`}),(0,z.jsx)(`div`,{className:`file-list`,children:e.length?e.map(e=>(0,z.jsxs)(`div`,{className:`file-row`,children:[(0,z.jsx)(`b`,{className:`file-kind ${e.label===`untracked`?`new`:``}`,children:e.label}),(0,z.jsx)(`code`,{children:e.path}),(0,z.jsx)(`span`,{className:e.status.includes(`D`)?`del`:`add`,children:e.status}),(0,z.jsx)(`button`,{className:`diff-button`,onClick:()=>n(e.path),type:`button`,children:`查看差异`})]},e.path)):(0,z.jsx)(`div`,{className:`empty-state`,children:`工作区没有未提交改动。`})}),e.length>0&&(0,z.jsxs)(`div`,{className:`file-actions`,children:[(0,z.jsx)(`input`,{"aria-label":`提交说明`,onChange:e=>c(e.target.value),placeholder:`提交说明`,value:s}),(0,z.jsx)(`button`,{className:`primary`,disabled:l||!s.trim(),onClick:()=>{let n=s.trim();!n||l||(u(!0),f(``),t.commitFiles(e.map(e=>e.path),n).then(()=>{c(``),r()}).catch(e=>f(e instanceof Error?e.message:String(e))).finally(()=>u(!1)))},type:`button`,children:l?`处理中…`:`提交这些改动`}),(0,z.jsx)(`button`,{disabled:l,onClick:()=>m(!0),type:`button`,children:`全部撤销`})]}),d&&(0,z.jsx)(`p`,{className:`files-error`,children:d})]}),p&&(0,z.jsx)(it,{busy:l,confirmLabel:`确认撤销`,description:`这会丢弃当前工作区的全部未提交改动,此操作不可恢复。`,onClose:()=>m(!1),onConfirm:()=>{!e.length||l||(m(!1),u(!0),f(``),t.revertFiles(e.map(e=>e.path)).then(r).catch(e=>f(e instanceof Error?e.message:String(e))).finally(()=>u(!1)))},target:`${e.length} 个文件`,title:`撤销全部改动`})]})}function dt(e){if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)??U(e)}catch{return U(e)}}function K({panel:e,inline:t=!1}){let n=e.data!==null&&typeof e.data==`object`&&!Array.isArray(e.data)?e.data:void 0,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,z.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,z.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,z.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,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`strong`,{className:`block text-[13px] font-semibold text-[#20252b]`,children:e.title}),(0,z.jsx)(`p`,{className:`mt-1 text-[11px] leading-4 text-[#687381]`,children:e.description??e.pluginId.replace(/cordis/gi,`runtime`)})]})]}),e.error?(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:`最近日志`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[20px] font-semibold text-[#20252b]`,children:U(n?.total??0)})]}),(0,z.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,z.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-2 border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:U(n.level??`log`)}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:U(n.source??`runtime`)}),(0,z.jsx)(`span`,{className:`block whitespace-pre-wrap break-words text-[11px] leading-4 text-[#65707b]`,children:dt(n.args??``)})]})]},`${U(n.time??`log`)}-${t}`)}):(0,z.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[#687381]`,children:`暂无日志输出。`})})]}):e.id===`plugin-group-panel`?(0,z.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,z.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,z.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n.enabled===!1?`bg-[#a0a8b2]`:`bg-[#22c55e]`}`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[#30343b]`,children:U(n.name??`plugin`)}),(0,z.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:U(n.state??`unknown`)})]},`${U(n.id??`plugin`)}-${t}`)}):(0,z.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[#687381]`,children:`暂无插件条目。`})}):e.id===`timer-service-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:`服务状态`}),(0,z.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,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o.map((e,t)=>(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:U(e)},`${U(e)}-${t}`))})]}):e.id===`agent-teams-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,children:[o.length>0?o.map((e,t)=>(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 text-center text-[10px] text-[#3565c5]`,children:U(e)},`${U(e)}-${t}`)):null,(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`成员`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:U(Array.isArray(n?.members)?n.members.length:0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`任务`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:U(Array.isArray(n?.tasks)?n.tasks.length:0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`未读消息`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:U(Array.isArray(n?.messages)?n.messages.filter(e=>typeof e==`object`&&!!e&&e.read!==!0).length:0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`可执行任务`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:U(Array.isArray(n?.readyTasks)?n.readyTasks.length:0)})]})]}),Array.isArray(n?.dependencyCycle)&&n.dependencyCycle.length>1?(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#f4caca] bg-[#fff5f5] px-3 py-2 text-[11px] text-[#b42318]`,children:[`依赖循环:`,n.dependencyCycle.map(e=>U(e)).join(` → `)]}):null,(0,z.jsx)(`div`,{className:`grid gap-2`,children:Array.isArray(n?.members)&&n.members.length>0?n.members.map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[#edf0f3] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-[#22c55e]`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[11px] font-semibold text-[#30343b]`,children:U(n.name??`成员`)}),(0,z.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:U(n.role??`协作成员`)}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#3565c5]`,children:U(n.status??`idle`)})]},`${U(n.id??`member`)}-${t}`)}):(0,z.jsx)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-3 text-[12px] text-[#687381]`,children:`暂无协作成员。`})}),(0,z.jsx)(`div`,{className:`grid gap-2`,children:Array.isArray(n?.tasks)&&n.tasks.length>0?n.tasks.map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[#edf0f3] px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-[11px] text-[#30343b]`,children:U(n.title??`未命名任务`)}),Array.isArray(n.dependsOn)&&n.dependsOn.length>0?(0,z.jsxs)(`span`,{className:`mt-0.5 block truncate font-mono text-[9px] text-[#687381]`,children:[`依赖:`,n.dependsOn.join(`, `)]}):null]}),(0,z.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:U(n.assignee??`unassigned`)}),(0,z.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] ${n.status===`blocked`?`bg-[#fff4e5] text-[#8a5a00]`:n.status===`done`?`bg-[#e8f8ee] text-[#14733f]`:`bg-[#edf3fe] text-[#3565c5]`}`,children:U(n.status??`todo`)})]},`${U(n.id??`task`)}-${t}`)}):(0,z.jsx)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-3 text-[12px] text-[#687381]`,children:`还没有任务。可让 Agent 使用 team_task 创建。`})}),(0,z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`团队消息`}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:`durable mailbox`})]}),Array.isArray(n?.messages)&&n.messages.length>0?Array.from(n.messages).reverse().slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${n.read===!0?`border-[#edf0f3] bg-white`:`border-[#cfe0ff] bg-[#f4f8ff]`}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] text-[#687381]`,children:[(0,z.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[U(n.from??`unknown`),` → `,U(n.to??`unknown`)]}),(0,z.jsx)(`span`,{className:`ml-auto`,children:n.read===!0?`已读`:`未读`})]}),(0,z.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-[11px] text-[#30343b]`,children:U(n.body??``)})]},`${U(n.id??`message`)}-${t}`)}):(0,z.jsx)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-3 text-[12px] text-[#687381]`,children:`暂无团队消息。`})]})]}):e.id===`modlens-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${n?.attached===!0?`border-[#b9e6c9] bg-[#f0fbf4]`:`border-[#e3e7ee] bg-[#f6f8fa]`}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:n?.attached===!0?`图片已附加`:`等待图片`}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:`vision_inspect`})]}),n?.image!==null&&n?.image!==void 0&&typeof n.image==`object`?(0,z.jsxs)(`p`,{className:`mt-2 truncate text-[11px] text-[#65707b]`,children:[U(n.image.path??`图片`),` · `,U(n.image.bytes??0),` bytes`]}):(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`调用 vision_inspect 并提供工作区内图片路径。`})]}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:o.map((e,t)=>(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:U(e)},`${U(e)}-${t}`))})]}):e.id===`at-file-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`最近附加`}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:`file_context`})]}),n?.lastFile!==null&&n?.lastFile!==void 0&&typeof n.lastFile==`object`?(0,z.jsxs)(`p`,{className:`mt-2 truncate text-[11px] text-[#65707b]`,children:[U(n.lastFile.path??`文件`),` · `,U(n.lastFile.bytes??0),` bytes`]}):(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`还没有附加文件。可使用 @file 或让 Agent 调用 file_context。`})]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[#687381]`,children:[(0,z.jsx)(`span`,{children:`单文件上限`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[U(n?.maxBytes??0),` bytes`]})]})]}):e.id===`git-time-capsule-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`最近快照`}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:`git_snapshot`})]}),n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(0,z.jsxs)(`p`,{className:`mt-2 truncate text-[11px] text-[#65707b]`,children:[U(n.latest.name??`snapshot`),` · `,U(n.latest.files??0),` 个文件`,n.latest.restored===!0?` · 已恢复`:``]}):(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`还没有快照。修改代码前让 Agent 调用 git_snapshot。`})]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[#687381]`,children:[(0,z.jsx)(`span`,{children:`保留快照`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[U(Array.isArray(n?.capsules)?n.capsules.length:0),` / 20`]})]}),(0,z.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`恢复会反向应用选中的 patch,必须显式传入 confirm=true。`})]}):e.id===`dependency-checker-panel`?(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=n?.report!==null&&typeof n?.report==`object`?n.report:{},t=Array.isArray(e.missing)?e.missing:[],r=Array.isArray(e.invalid)?e.invalid:[],i=Array.isArray(e.conflicts)?e.conflicts:[];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`text-[#65707b]`,children:`清单类型`}),(0,z.jsx)(`strong`,{className:`font-mono uppercase text-[#315fb8]`,children:U(e.ecosystem??`npm`)})]}),(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`声明`,e.declared??0],[`已安装`,e.installed??0],[`缺失`,t.length+r.length]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:U(t)})]},U(e)))}),(0,z.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${t.length||r.length||i.length?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:t.length||r.length?`缺失或无效:${[...t,...r].map(e=>U(e)).join(`, `)}`:`依赖声明与本地安装一致。`}),i.length>0?(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#f3dfab] bg-[#fffaf0] px-3 py-3 text-[11px] text-[#8a6200]`,children:[(0,z.jsx)(`strong`,{children:`版本冲突`}),(0,z.jsx)(`ul`,{className:`mt-1 grid gap-1 pl-4`,children:i.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=Array.isArray(n.constraints)?n.constraints.map(e=>U(e)).join(` · `):`—`;return(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`code`,{children:U(n.name??`dependency`)}),`:`,r]},`${U(n.name??`dependency`)}-${t}`)})})]}):null]})})()}):e.id===`token-guard-panel`?(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(0,z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${n?.exceeded===!0?`border-[#f4caca] bg-[#fff5f5]`:`border-[#e3eaf8] bg-[#f6f8ff]`}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`上下文预算`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#315fb8]`,children:[U(n?.percent??`—`),`% / `,U(n?.maxPercent??`—`),`%`]})]}),(0,z.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-[#dfe8fb]`,children:(0,z.jsx)(`div`,{className:`h-full rounded-full ${n?.exceeded===!0?`bg-[#d64545]`:`bg-[#5d8bea]`}`,style:{width:`${Math.max(0,Math.min(100,typeof n?.percent==`number`?n.percent:0))}%`}})}),(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#5d6d82]`,children:n?.exceeded===!0?`已达到阈值,运行会被自动停止。`:`自动停止次数:${U(n?.aborts??0)}`})]}),(0,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${n?.runExceeded===!0?`border-[#f4caca] bg-[#fff5f5]`:`border-[#e3eaf8] bg-[#f6f8ff]`}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`单次任务`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#315fb8]`,children:[U(n?.runTokens??`—`),` / `,U(n?.maxRunTokens||`—`)]})]}),(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#5d6d82]`,children:n?.maxRunTokens?`按 agent_start 后累计 token 熔断。`:`未启用绝对 Token 上限。`})]})]})}):e.id===`test-harness-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest;return(0,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${e.exitCode===0?`border-[#b9e6c9] bg-[#f0fbf4]`:`border-[#f4caca] bg-[#fff5f5]`}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[11px] font-semibold text-[#30343b]`,children:U(e.command??`npm run test`)}),(0,z.jsxs)(`strong`,{className:`text-[12px] ${e.exitCode===0?`text-[#14733f]`:`text-[#b42318]`}`,children:[`exit `,U(e.exitCode??`—`)]})]}),(0,z.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#65707b]`,children:[`耗时 `,U(e.durationMs??0),` ms`]})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有执行验证脚本。可让 Agent 调用 run_project_tests。`}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Array.isArray(n?.allowedScripts)?n.allowedScripts.map((e,t)=>(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:U(e)},`${U(e)}-${t}`)):null})]}):e.id===`session-insights-panel`?(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=n?.tokens!==null&&typeof n?.tokens==`object`?n.tokens:{},t=n?.contextUsage!==null&&typeof n?.contextUsage==`object`?n.contextUsage:{};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`消息`,n?.totalMessages??0],[`工具调用`,n?.toolCalls??0],[`成本`,`$${Number(n?.cost??0).toFixed(4)}`]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:U(t)})]},U(e)))}),(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`上下文`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#315fb8]`,children:[U(t.percent??`—`),`%`]})]}),(0,z.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#5d6d82]`,children:[U(e.total??0),` tracked tokens · 输入 `,U(e.input??0),` · 输出 `,U(e.output??0)]})]})]})})()}):e.id===`session-bridge-panel`?(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:(()=>{let e=(n?.latestPreview!==null&&typeof n?.latestPreview==`object`?n.latestPreview.preview:void 0)??(n?.currentPreview!==null&&typeof n?.currentPreview==`object`?n.currentPreview:{}),t=[[`目标`,e.goal],[`当前状态`,e.currentState],[`下一步`,e.nextStep]];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3 text-[11px] leading-5 text-[#315fb8]`,children:`预览不会创建目标会话,也不会修改源会话。`}),t.map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:e}),(0,z.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-[11px] leading-5 text-[#30343b]`,children:U(t)})]},e)),(0,z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[[`关键决策`,e.decisions],[`关键文件`,e.keyFiles]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:U(e)}),Array.isArray(t)&&t.length>0?(0,z.jsx)(`ul`,{className:`mt-2 grid gap-1 text-[10px] leading-4 text-[#65707b]`,children:t.slice(0,8).map((e,t)=>(0,z.jsx)(`li`,{children:U(e)},`${U(e)}-${t}`))}):(0,z.jsx)(`p`,{className:`mt-2 text-[10px] text-[#687381]`,children:`暂无`})]},U(e)))})]})})()}):e.id===`session-compare-panel`?(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[[`左侧会话`,e],[`右侧会话`,t]].map(([e,t])=>{let n=t;return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-2 block truncate text-[12px] text-[#30343b]`,children:U(n.name??n.id)}),(0,z.jsx)(`code`,{className:`mt-1 block truncate text-[10px] text-[#315fb8]`,children:U(n.id)}),(0,z.jsxs)(`span`,{className:`mt-1 block text-[10px] text-[#65707b]`,children:[U(n.messageCount,`0`),` 条消息`]})]},U(e))})}),(0,z.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,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:U(t)})]},U(e)))}),(0,z.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,z.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:`右侧新增消息`}),(0,z.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,z.jsxs)(`li`,{children:[`[`,U(n.role),`] `,U(n.text)]},`${U(n.role)}-${t}`)})})]}):null]})})():(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.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,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-2 py-2 text-center`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[16px] font-semibold text-[#30343b]`,children:U(t)})]},U(e)))}),(0,z.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,z.jsx)(`div`,{className:`grid gap-2`,children:n.findings.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=U(n.severity,`medium`);return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`code`,{className:`min-w-0 truncate text-[10px] text-[#315fb8]`,children:U(n.path)}),(0,z.jsx)(`span`,{className:`shrink-0 text-[10px] font-semibold ${r===`critical`?`text-[#b42318]`:`text-[#9a6700]`}`,children:r})]}),(0,z.jsxs)(`p`,{className:`mt-1 text-[10px] leading-4 text-[#65707b]`,children:[`第 `,U(n.line),` 行 · `,U(n.message)]})]},`${U(n.path)}-${U(n.line)}-${t}`)})}):(0,z.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`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${n?.status===`warning`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:n?.status===`warning`?`需要关注上下文风险。`:`上下文状态正常。`}),(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`占用`,`${U(n?.usagePercent??`—`)}%`],[`超大消息`,n?.oversizedMessages??0],[`工具错误`,n?.toolErrors??0]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:U(t)})]},U(e)))}),Array.isArray(n?.recommendations)&&n.recommendations.length>0?(0,z.jsx)(`ul`,{className:`grid gap-1 rounded-lg border border-[#e3e7ee] bg-white px-4 py-3 text-[10px] text-[#65707b]`,children:n.recommendations.slice(0,4).map((e,t)=>(0,z.jsx)(`li`,{children:U(e)},`${U(e)}-${t}`))}):null]}):e.id===`history-compressor-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.enabled===!0?`自动压缩已启用`:`自动压缩已停用`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[11px] text-[#3565c5]`,children:[`阈值 `,U(n?.thresholdPercent??`—`),`%`]})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`已压缩`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:U(n?.compactions??0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`当前占用`}),(0,z.jsxs)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:[U(n?.lastUsagePercent??`—`),`%`]})]})]}),n?.lastError?(0,z.jsxs)(`p`,{className:`text-[11px] text-[#b42318]`,children:[`最近错误:`,U(n.lastError)]}):null]}):e.id===`session-export-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest;return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:`最近导出`}),(0,z.jsx)(`code`,{className:`mt-2 block truncate text-[11px] text-[#315fb8]`,children:U(e.path??`pi-session.md`)}),(0,z.jsxs)(`p`,{className:`mt-1 text-[10px] text-[#65707b]`,children:[U(e.messages??0),` 条消息 · `,U(e.bytes??0),` bytes`]})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有导出当前会话。`}),(0,z.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`导出文件只允许写入当前工作区内的 .md 路径,覆盖已有文件需要显式确认。`})]}):e.id===`session-search-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.query?(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[#315fb8]`,children:U(n.query)}),(0,z.jsxs)(`strong`,{className:`ml-3 shrink-0 text-[11px] text-[#3565c5]`,children:[U(n.total??0),` 个会话`]})]}):(0,z.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,z.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,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:U(n.name??n.id??`未命名会话`)}),(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] leading-4 text-[#65707b]`,children:r.map(e=>U(typeof e==`object`&&e?e.text??``:e)).join(` | `)})]},`${U(n.id??`session`)}-${t}`)})}):n?.query?(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`当前会话的持久化书签`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[11px] text-[#3565c5]`,children:[U(n?.total??0),` 个书签`]})]}),Array.isArray(n?.bookmarks)&&n.bookmarks.length>0?(0,z.jsx)(`div`,{className:`grid gap-2`,children:n.bookmarks.slice(0,12).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:U(n.label??`未命名书签`)}),(0,z.jsxs)(`code`,{className:`mt-1 block truncate text-[10px] text-[#687381]`,children:[`entry: `,U(n.entryId??`—`)]})]},`${U(n.id??`bookmark`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有标记重要节点。`}),(0,z.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`书签独立保存在 agent 目录,不会改写 Pi 原生会话记录。`})]}):e.id===`llm-verifier-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`校验模型`}),(0,z.jsxs)(`code`,{className:`max-w-[65%] truncate text-[11px] text-[#315fb8]`,children:[U(n?.provider??`—`),`/`,U(n?.model??`—`)]})]}),n?.history&&typeof n.history==`object`?(()=>{let e=n.history,t=e.counts&&typeof e.counts==`object`?e.counts:{};return(0,z.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-2 py-2 text-center`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`累计`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[#30343b]`,children:U(e.total??0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f0fbf4] px-2 py-2 text-center`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#14733f]`,children:`通过`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[#14733f]`,children:U(t.pass??0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#fff5f5] px-2 py-2 text-center`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#b42318]`,children:`失败`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[#b42318]`,children:U(t.fail??0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#fffaf0] px-2 py-2 text-center`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#9a6700]`,children:`未知`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[15px] text-[#9a6700]`,children:U(t.unknown??0)})]})]})})():null,n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=U(e.verdict??`unknown`);return(0,z.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,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`strong`,{className:`uppercase`,children:t}),(0,z.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[U(e.evidenceChars??0),` chars`]})]}),(0,z.jsx)(`p`,{className:`mt-2 leading-4`,children:U(e.rationale??`没有返回校验理由。`)}),(0,z.jsxs)(`p`,{className:`mt-2 truncate text-[10px] opacity-70`,children:[`声明:`,U(e.claim??`—`)]})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有执行模型校验。`}),(0,z.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`证据按不可信数据处理,输入有长度上限;模型返回非结构化结果时显示 unknown。`})]}):e.id===`module-search-panel`?(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[#315fb8]`,children:U(e.query??``)}),(0,z.jsxs)(`strong`,{className:`ml-3 shrink-0 text-[11px] text-[#3565c5]`,children:[U(t.length),` 个结果`]})]}),t.length>0?(0,z.jsx)(`div`,{className:`grid gap-2`,children:t.slice(0,10).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`code`,{className:`min-w-0 truncate text-[10px] text-[#315fb8]`,children:[U(n.path??`—`),`:`,U(n.line??`—`)]}),(0,z.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase text-[#687381]`,children:U(n.kind??`symbol`)})]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#65707b]`,children:U(n.name??`未命名符号`)})]},`${U(n.path??`module`)}:${U(n.line??t)}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有找到匹配的模块符号。`}),(0,z.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`扫描 `,U(e.scannedFiles??0),` 个源码文件,跳过依赖和构建目录。`]})]})})():(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[#315fb8]`,children:U(n?.cwd??`当前工作区`)}),(0,z.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`:`${U(n?.changedCount??e.length)} 个变更`})]}),(0,z.jsx)(`p`,{className:`mt-2 font-mono text-[10px] text-[#65707b]`,children:U(n?.summary??`等待工作区扫描`)}),(0,z.jsxs)(`p`,{className:`mt-1 text-[10px] text-[#687381]`,children:[`会话 `,U(n?.sessionId??`—`),` · 目录 `,U(n?.directoryCount??0),` · 文件 `,U(n?.fileCount??0)]})]}),e.length>0?(0,z.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,z.jsxs)(`code`,{className:`truncate py-0.5 text-[10px] text-[#65707b]`,children:[U(n.status??`??`),` `,U(n.path??`未命名`)]},`${U(n.path??`file`)}-${t}`)})}):null,n?.truncated===!0?(0,z.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`目录摘要已截断,执行 sidebar_overview 获取最新概览。`}):null]})})():e.id===`workspace-navigator-panel`?(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsx)(`code`,{className:`min-w-0 truncate text-[11px] text-[#315fb8]`,children:U(e.path??`.`)}),(0,z.jsxs)(`strong`,{className:`ml-3 shrink-0 text-[11px] text-[#3565c5]`,children:[U(t.length),` 个节点`]})]}),t.length>0?(0,z.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,z.jsxs)(`div`,{className:`flex items-center gap-2 truncate py-1 text-[10px] text-[#65707b]`,children:[(0,z.jsxs)(`span`,{className:`shrink-0 text-[#687381]`,children:[`· `.repeat(r-1),n.kind===`directory`?`▾`:`·`]}),(0,z.jsx)(`code`,{className:`truncate`,children:U(n.name??n.path??`未命名`)})]},`${U(n.path??`node`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前目录为空。`}),(0,z.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`目录 `,U(e.directoryCount??0),` 个,文件 `,U(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,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-medium text-[#253044]`,children:`Git 状态`}),(0,z.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,z.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-[#65707b]`,children:U(e.branch??`detached HEAD`)}):null,t.length>0?(0,z.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,z.jsxs)(`code`,{className:`truncate text-[10px] text-[#65707b]`,children:[U(n.status??`??`),` `,U(n.path??`未命名`)]},`${U(n.path??`file`)}-${t}`)})}):null]})})():null]})})():(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[Array.isArray(n?.templates)&&n.templates.length>0?(0,z.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,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`strong`,{className:`truncate text-[11px] text-[#253044]`,children:U(n.title??`未命名提示词`)}),(0,z.jsx)(`code`,{className:`shrink-0 text-[10px] text-[#687381]`,children:U(n.id??`—`)})]}),(0,z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[10px] leading-4 text-[#65707b]`,children:U(n.prompt??``)}),r.length>0?(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:r.slice(0,6).map(e=>(0,z.jsx)(`span`,{className:`rounded bg-[#f6f8ff] px-1.5 py-0.5 text-[9px] text-[#315fb8]`,children:e},e))}):null]},`${U(n.id??`prompt`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有保存的提示词。可让 Agent 调用 prompt_library 保存模板。`}),(0,z.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`共 `,U(n?.total??0),` 个模板,数据跟随当前会话。`]})]}):e.id===`colleague-skill-panel`?(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`交接给`}),(0,z.jsx)(`strong`,{className:`text-[11px] text-[#315fb8]`,children:U(e.toRole)})]}),(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-3 text-[11px] text-[#253044]`,children:U(e.objective)}),e.context?(0,z.jsx)(`p`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2 text-[10px] leading-4 text-[#65707b]`,children:U(e.context)}):null,i.length>0?(0,z.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,z.jsx)(`code`,{className:`truncate text-[10px] text-[#65707b]`,children:e},e))}):null,(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[#65707b]`,children:[(0,z.jsxs)(`span`,{children:[`约束 `,r.length,` 条`]}),(0,z.jsxs)(`span`,{children:[`验收 `,a.length,` 条`]})]})]})})():(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`复核风险内容`}),(0,z.jsx)(`strong`,{className:`font-mono text-[11px] text-[#3565c5]`,children:n?.allowReviewByDefault===!0?`已允许`:`默认阻断`})]}),n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=U(e.risk??`safe`),r=Array.isArray(e.findings)?e.findings:[];return(0,z.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,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`strong`,{className:`uppercase`,children:t}),(0,z.jsx)(`span`,{className:`font-mono text-[10px]`,children:e.contentIncluded===!0?`可注入`:`已隔离`})]}),(0,z.jsxs)(`p`,{className:`mt-2`,children:[U(e.name??`未命名 Skill`),` · `,U(r.length),` 个风险项`]}),r.length>0?(0,z.jsx)(`p`,{className:`mt-1 text-[10px] opacity-80`,children:r.slice(0,2).map(e=>U(e)).join(`;`)}):null]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`执行 skill_inject 后显示隔离结果。`}),(0,z.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`安全内容会被包裹为不可信数据;review 风险默认不注入,blocked 内容永不返回原文。`})]}):e.id===`reviewer-bot-panel`?(0,z.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=U(e.status??`pass`),r=Array.isArray(e.findings)?e.findings:[];return(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(`span`,{children:t===`error`?`发现阻断风险`:t===`warning`?`需要关注`:`审查通过`}),(0,z.jsxs)(`strong`,{className:`font-mono`,children:[U(r.length),` findings`]})]}),(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`文件`,e.changedFiles??0],[`新增`,e.addedLines??0],[`删除`,e.removedLines??0]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:U(t)})]},U(e)))}),r.length>0?(0,z.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,z.jsx)(`li`,{children:U(typeof e==`object`&&e?e.message??`finding`:e)},t))}):null]})})():(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:n?.mode===`confirm`?`确认模式`:`安全模式`}),(0,z.jsxs)(`span`,{className:`font-mono text-[#65707b]`,children:[`超时 `,U(n?.timeoutMs??`—`),` ms`]})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`阻断次数`}),(0,z.jsxs)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:[U(n?.blocked??0),` 次`]})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`最近命令`}),(0,z.jsx)(`strong`,{className:`mt-1 block truncate font-mono text-[11px] text-[#30343b]`,children:n?.last&&typeof n.last==`object`?U(n.last.command??`—`):`—`})]})]}),n?.last&&typeof n.last==`object`?(0,z.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:U(n.last.stdout,``)||U(n.last.stderr??`无输出`)}):(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`truncate text-[11px] font-medium text-[#30343b]`,children:n?.title?U(n.title):`尚未创建计划`}),(0,z.jsxs)(`span`,{className:`font-mono text-[11px] text-[#3565c5]`,children:[U(n?.completed??0),` / `,U(n?.total??0)]})]}),Array.isArray(n?.steps)&&n.steps.length>0?(0,z.jsx)(`ol`,{className:`grid gap-1.5`,children:n.steps.map((e,t)=>{let n=e&&typeof e==`object`?e:{},r=U(n.status??`pending`);return(0,z.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[11px]`,children:[(0,z.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,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate ${r===`done`?`text-[#14733f]`:`text-[#30343b]`}`,children:U(n.title??`步骤`)}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:r})]},U(n.id??t))})}):(0,z.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`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`社区排行榜`}),(0,z.jsxs)(`span`,{className:`font-mono text-[#65707b]`,children:[`上限 `,U(n?.limit??`—`)]})]}),n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=We(Array.isArray(e.results)?e.results.flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e;return typeof t.fullName!=`string`||typeof t.name!=`string`||typeof t.stars!=`number`||typeof t.htmlUrl!=`string`||typeof t.updatedAt!=`string`?[]:[{fullName:t.fullName,name:t.name,stars:t.stars,htmlUrl:t.htmlUrl,updatedAt:t.updatedAt}]}):[],8);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[#65707b]`,children:[(0,z.jsxs)(`span`,{children:[`查询:`,U(e.query,`全部`)]}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[U(e.total??t.length),` 个结果`]})]}),t.length>0?(0,z.jsx)(`ol`,{className:`grid gap-1.5`,children:t.map(e=>(0,z.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`span`,{className:`w-5 shrink-0 text-center font-mono text-[10px] text-[#9a6700]`,children:[`#`,e.rank]}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`a`,{className:`block truncate font-mono text-[11px] text-[#315fb8] hover:underline`,href:e.htmlUrl,rel:`noreferrer`,target:`_blank`,children:e.fullName}),(0,z.jsxs)(`span`,{className:`block truncate text-[10px] text-[#687381]`,children:[`更新于 `,e.updatedAt||`未知`]})]}),(0,z.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-[#8a5a00]`,children:[`★ `,e.stars.toLocaleString()]})]},e.fullName))}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有找到匹配的社区插件。`}),(0,z.jsxs)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:[`来源:`,U(e.source,`dsh-plugin-stars`),` · 仅展示公开仓库信息,不会自动安装。`]})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`Agent 可调用 plugin_stars_search 拉取并筛选社区排行榜。`})]}):e.id===`plugin-finder-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`只读 Registry 搜索`}),(0,z.jsxs)(`span`,{className:`font-mono text-[#65707b]`,children:[`关键词 `,U(n?.keyword??`pi-harness`),` · 上限 `,U(n?.limit??`—`)]})]}),n?.query?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[#65707b]`,children:[(0,z.jsxs)(`span`,{children:[`查询:`,U(n.query)]}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[U(n.total??0),` 个结果`]})]}),Array.isArray(n?.results)&&n.results.length>0?(0,z.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,z.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`strong`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:U(n.name??`未知插件`)}),(0,z.jsxs)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:[`v`,U(n.version??`—`)]})]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#687381]`,children:U(n.description,``)})]},`${U(n.name??`plugin`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有找到匹配插件。`})]}):(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`跨会话记忆`}),(0,z.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[U(n?.count??0),` 条`]})]}),Array.isArray(n?.memories)&&n.memories.length>0?(0,z.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,z.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsx)(`strong`,{className:`block truncate font-mono text-[11px] text-[#30343b]`,children:U(n.key??`未知键`)}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#687381]`,children:U(n.value,``)})]},`${U(n.key??`memory`)}-${t}`)})}):(0,z.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=n?.kinds!==null&&typeof n?.kinds==`object`?n.kinds:{},t=Array.isArray(n?.recent)?n.recent:[],r=Array.isArray(n?.recentRelations)?n.recentRelations:[];return(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`任务`,e.task??0,`bg-[#3565c5]`],[`技能`,e.skill??0,`bg-[#22a06b]`],[`事件`,e.event??0,`bg-[#d97706]`]].map(([e,t,n])=>(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] text-[#687381]`,children:[(0,z.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${U(n)}`}),U(e)]}),(0,z.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#30343b]`,children:U(t)})]},U(e)))}),(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`text-[#65707b]`,children:`本地关系图`}),(0,z.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[U(n?.nodes??0),` 节点 · `,U(n?.relations??0),` 关系`]})]}),t.length>0?(0,z.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,z.jsxs)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[#687381]`,children:[`最近节点 `,Math.min(t.length,5),` / `,U(n?.nodes??t.length)]}),t.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,z.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.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,z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:U(n.label??`未命名节点`)})]}),(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] leading-4 text-[#65707b]`,children:U(n.summary,``)}),n.source?(0,z.jsxs)(`p`,{className:`mt-1 truncate font-mono text-[9px] text-[#687381]`,children:[`来源:`,U(n.source)]}):null]},`${U(n.id??`node`)}-${t}`)})]}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未记录图记忆。Agent 可调用 graph_memory_record 创建任务、技能或事件节点。`}),r.length>0?(0,z.jsxs)(`div`,{className:`grid gap-1 rounded-lg border border-[#edf0f3] bg-[#fbfcfd] px-3 py-2`,children:[(0,z.jsxs)(`span`,{className:`text-[9px] uppercase tracking-[0.08em] text-[#687381]`,children:[`最近关系 `,Math.min(r.length,3),` / `,U(n?.relations??r.length)]}),r.slice(0,3).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-[9px] text-[#65707b]`,children:[(0,z.jsx)(`span`,{className:`truncate`,children:U(n.fromLabel??n.from??`节点`)}),(0,z.jsxs)(`span`,{className:`shrink-0 text-[#3565c5]`,children:[`—`,U(n.relation??`RELATED_TO`),`→`]}),(0,z.jsx)(`span`,{className:`truncate`,children:U(n.toLabel??n.to??`节点`)})]},`${U(n.id??`relation`)}-${t}`)})]}):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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`text-[#65707b]`,children:`当前工作区任务`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[U(n?.total??0),` 个`]})]}),(0,z.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,z.jsx)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[10px] text-[#687381]`,children:[(0,z.jsx)(`span`,{children:t}),(0,z.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${r}`,children:U(e[n]??0)})]})},n))}),t.length>0?(0,z.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,z.jsxs)(`li`,{className:`text-[9px] uppercase tracking-[0.08em] text-[#687381]`,children:[`最近任务 `,Math.min(t.length,5),` / `,U(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,z.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`code`,{className:`font-mono text-[10px] text-[#3565c5]`,children:U(n.key??`PIH-?`)}),(0,z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:U(n.title??`未命名任务`)}),(0,z.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${o}`,children:a})]}),(0,z.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[9px] text-[#687381]`,children:[(0,z.jsxs)(`span`,{children:[`优先级 `,i]}),n.dueDate?(0,z.jsxs)(`span`,{children:[`截止 `,U(n.dueDate)]}):null]})]},`${U(n.id??`task`)}-${t}`)})]}):(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`Skills`}),(0,z.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#315fb8]`,children:U(n?.skillCount??0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`MCP 服务器`}),(0,z.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#315fb8]`,children:U(n?.mcpCount??0)})]})]}),e.length>0?(0,z.jsx)(`ul`,{className:`grid gap-1.5`,children:e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:U(n.name,`未命名技能`)}),(0,z.jsx)(`span`,{className:`rounded bg-[#f2f3f5] px-1.5 py-0.5 text-[9px] text-[#65707b]`,children:U(n.scope,`unknown`)})]}),(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] text-[#687381]`,children:U(n.description,`无描述`)})]},`${U(n.name??`skill`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前运行时没有加载 Skill。`}),t.length>0?(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold text-[#65707b]`,children:`MCP 状态`}),(0,z.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,z.jsxs)(`li`,{className:`flex items-center justify-between rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-[#65707b]`,children:U(n.id,`未命名服务器`)}),(0,z.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${r?`bg-[#eaf8f0] text-[#14733f]`:`bg-[#f2f3f5] text-[#65707b]`}`,children:U(n.status,`unknown`)})]},`${U(n.id??`server`)}-${t}`)})})]}):null,r.length>0?(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#fff0c2] bg-[#fffaf0] px-3 py-2 text-[10px] text-[#8a5a00]`,children:[`资源诊断:`,r.length,` 条警告`]}):null,(0,z.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=Array.isArray(n?.entries)?n.entries:[],i=t!==null&&t>=100?`text-[#b42318]`:t!==null&&t>=80?`text-[#a15c00]`:`text-[#14733f]`;return(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`今日`,`$${Number(n?.todayCost??0).toFixed(4)}`],[`当前会话`,`$${Number(n?.sessionCost??0).toFixed(4)}`],[`累计`,`$${Number(n?.lifetimeCost??0).toFixed(4)}`]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block font-mono text-[15px] font-semibold text-[#30343b]`,children:U(t)})]},U(e)))}),(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,z.jsx)(`span`,{className:`text-[#65707b]`,children:`每日预算`}),(0,z.jsx)(`strong`,{className:i,children:e===null?`未设置`:`$${e.toFixed(4)} · ${t?.toFixed(2)??`0.00`}%`})]}),e===null?null:(0,z.jsx)(`div`,{className:`mt-2 h-1.5 overflow-hidden rounded-full bg-[#dfe8f7]`,children:(0,z.jsx)(`div`,{className:`h-full ${t!==null&&t>=100?`bg-[#d64545]`:`bg-[#4c83e8]`}`,style:{width:`${Math.min(100,t??0)}%`}})})]}),r.length>0?(0,z.jsx)(`ul`,{className:`grid gap-1.5`,children:r.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`li`,{className:`flex items-center justify-between rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-[#65707b]`,children:U(n.sessionId??`未知会话`)}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#30343b]`,children:[`$`,Number(n.cost??0).toFixed(4)]})]},`${U(n.sessionId??`session`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未记录已完成会话。Agent 可调用 cost_report 的 refresh 操作写入账本。`}),(0,z.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`仅记录运行时报告的实际成本,不内置或猜测模型价格。`})]})})():e.id===`undo-savepoint-panel`?(()=>{let e=Array.isArray(n?.savepoints)?n.savepoints:[];return(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`保存点`}),(0,z.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#315fb8]`,children:U(n?.count??e.length)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`跟踪路径`}),(0,z.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#315fb8]`,children:U(Array.isArray(n?.trackedPaths)?n.trackedPaths.length:0)})]})]}),e.length>0?(0,z.jsx)(`ul`,{className:`grid gap-1.5`,children:e.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsx)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`code`,{className:`font-mono text-[10px] text-[#3565c5]`,children:U(n.id,`unknown`)}),(0,z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:U(n.reason,`manual savepoint`)}),(0,z.jsxs)(`span`,{className:`text-[9px] text-[#687381]`,children:[U(n.fileCount,`0`),` 文件`]})]})},`${U(n.id??`savepoint`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未创建保存点。修改配置或插件代码前,让 Agent 调用 undo_savepoint 的 save 操作。`}),(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`text-[#65707b]`,children:`待发送批注`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[U(n?.count??0),` 条`]})]}),e.length>0?(0,z.jsx)(`ol`,{className:`grid gap-1.5`,children:e.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-start gap-2 text-[10px]`,children:[(0,z.jsxs)(`span`,{className:`rounded bg-[#edf3fe] px-1.5 py-0.5 font-mono text-[#315fb8]`,children:[`#`,U(n.id??t+1)]}),(0,z.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-[#30343b]`,children:U(n.quote,``)})]}),n.note?(0,z.jsx)(`p`,{className:`mt-1 pl-8 text-[10px] text-[#687381]`,children:U(n.note)}):null]},`${U(n.id??t)}-${t}`)})}):(0,z.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,z.jsxs)(`details`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-[#65707b]`,children:`最近生成的提问上下文`}),(0,z.jsx)(`pre`,{className:`mt-2 max-h-40 overflow-auto whitespace-pre-wrap text-[10px] text-[#30343b]`,children:t})]}):null,(0,z.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`批注按编号累积;生成上下文不会改写原会话消息。`})]})})():e.id===`runtime-doctor-panel`?(()=>{let e=U(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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`text-[11px] text-[#65707b]`,children:`运行时边界检查`}),(0,z.jsx)(`span`,{className:`rounded px-2 py-0.5 font-mono text-[10px] uppercase ${i}`,children:e})]}),(0,z.jsx)(`div`,{className:`grid gap-1.5`,children:t.map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=U(n.status??`unknown`),i=r===`ok`?`bg-[#eaf8f0] text-[#14733f]`:r===`warning`?`bg-[#fff7e8] text-[#a15c00]`:`bg-[#fff0f0] text-[#b42318]`;return(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${r===`ok`?`bg-[#22c55e]`:r===`warning`?`bg-[#e6a21a]`:`bg-[#d64545]`}`}),(0,z.jsx)(`code`,{className:`w-20 shrink-0 text-[#65707b]`,children:U(n.id??`check`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[#30343b]`,children:U(n.detail??`—`)}),(0,z.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono ${i}`,children:r})]},`${U(n.id??`check`)}-${t}`)})}),r.length>0?(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#f3dfab] bg-[#fffaf0] px-3 py-2 text-[10px] text-[#8a6200]`,children:[(0,z.jsx)(`strong`,{children:`建议`}),(0,z.jsx)(`ul`,{className:`mt-1 grid gap-1 pl-4`,children:r.slice(0,5).map((e,t)=>(0,z.jsx)(`li`,{children:U(e)},`${U(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=U(e?.verdict??`—`),c=s===`pass`?`bg-[#eaf8f0] text-[#14733f]`:s===`warn`?`bg-[#fff7e8] text-[#a15c00]`:`bg-[#fff0f0] text-[#b42318]`;return(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e?.scanned===void 0?e?.verdict===void 0?o.length>0?(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px] text-[#65707b]`,children:[`检查清单:`,o.length,` 项`]}):null:(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f8fafc] px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`truncate text-[#65707b]`,children:U(e.repo??`当前插件`)}),(0,z.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono ${c}`,children:s})]}):(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`text-[#65707b]`,children:`目录扫描`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[U(e.scanned),` 个仓库`]})]}),t?(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`通过`,t.passed??0],[`失败`,t.failed??0],[`警告`,t.warned??0]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#30343b]`,children:U(t)})]},U(e)))}):null,a.length>0?(0,z.jsx)(`ul`,{className:`grid gap-1.5`,children:a.slice(0,6).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=U(n.verdict??`—`);return(0,z.jsxs)(`li`,{className:`flex items-center justify-between rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-[#65707b]`,children:U(n.repo??`未知仓库`)}),(0,z.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})]},`${U(n.repo??`repo`)}-${t}`)})}):r.length>0||i.length>0?(0,z.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,z.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`strong`,{className:`font-mono text-[#b42318]`,children:U(n.code??`issue`)}),(0,z.jsx)(`p`,{className:`mt-1 text-[#65707b]`,children:U(n.message,``)})]},`${U(n.code??`issue`)}-${t}`)})}):(0,z.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,z.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`只读检查,不修改、不构建被检仓库。`})]})})():e.id===`plugin-radar-panel`?(()=>{let e=Array.isArray(n?.results)?n.results:[];return(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`text-[#65707b]`,children:`GitHub DSH 生态`}),(0,z.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[U(n?.total??0),` 个仓库 · `,Array.isArray(n?.sources)?n.sources.length:0,` 个来源`]})]}),n?.query?(0,z.jsxs)(`div`,{className:`text-[11px] text-[#65707b]`,children:[`查询:`,U(n.query)]}):null,e.length>0?(0,z.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,z.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`w-4 shrink-0 text-right font-mono text-[10px] text-[#687381]`,children:t+1}),i?(0,z.jsx)(`a`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[#315fb8] hover:underline`,href:i,rel:`noreferrer`,target:`_blank`,children:U(n.fullName??n.name??`未知仓库`)}):(0,z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[#30343b]`,children:U(n.fullName??n.name??`未知仓库`)}),(0,z.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-[#a15c00]`,children:[`★ `,U(n.stars??0)]})]}),(0,z.jsx)(`p`,{className:`mt-1 truncate pl-6 text-[10px] text-[#65707b]`,children:U(n.description,`暂无描述`)}),(0,z.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center gap-2 pl-6 text-[9px] text-[#687381]`,children:[n.language?(0,z.jsx)(`span`,{children:U(n.language)}):null,n.updatedAt?(0,z.jsxs)(`span`,{className:`font-mono`,children:[`更新 `,U(n.updatedAt)]}):null,r.length>0?(0,z.jsx)(`span`,{className:`truncate`,children:r.map(e=>`#${e}`).join(` `)}):null]})]},`${U(n.fullName??`repo`)}-${t}`)})}):(0,z.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,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`已阻断`,n?.blocked??0],[`需复核`,n?.review??0],[`安全`,n?.safe??0]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#30343b]`,children:U(t)})]},U(e)))}),t?(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] px-3 py-2 text-[10px] ${i(t.risk)}`,children:[(0,z.jsxs)(`span`,{children:[`最近一次:`,U(t.source,`unknown`)]}),(0,z.jsxs)(`strong`,{children:[r(t.risk),` · `,U(t.findings&&Array.isArray(t.findings)?t.findings.length:0),` 项`]})]}):null,e.length>0?(0,z.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,z.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,z.jsxs)(`li`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`rounded px-1.5 py-0.5 ${i(n.risk)}`,children:r(n.risk)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[#65707b]`,children:U(n.source,`unknown`)}),(0,z.jsxs)(`span`,{className:`text-[#687381]`,children:[a.length,` 项`]})]},`${U(n.source)}-${t}`)})]}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`尚未收到工具调用。Agent 可调用 hol_guard_scan 预检命令或文本。`}),(0,z.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`仅保存风险摘要和计数,不保存命令、路径或凭据原文;当前模式为审计。`})]})})():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=>[U(e.id),e]));return(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`会话`,n?.nodes??0],[`分支`,n?.edges??0],[`孤儿`,n?.orphanCount??0]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-[#f8fafc] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block font-mono text-[17px] text-[#30343b]`,children:U(t)})]},U(e)))}),n?.activeSessionId?(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#b9d0ff] bg-[#f1f6ff] px-3 py-2 text-[10px] text-[#315fb8]`,children:[`当前会话:`,(0,z.jsx)(`code`,{className:`font-mono`,children:U(n.activeSessionId)})]}):null,e.length>0?(0,z.jsxs)(`ul`,{className:`grid gap-1.5`,children:[(0,z.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,z.jsxs)(`li`,{className:`rounded-lg border px-3 py-2 ${n.active===!0?`border-[#b9d0ff] bg-[#f7faff]`:`border-[#edf0f3] bg-white`}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${n.active===!0?`bg-[#3565c5]`:`bg-[#c4ccd6]`}`}),(0,z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:U(n.label??n.sessionId??`未命名会话`)}),(0,z.jsxs)(`span`,{className:`font-mono text-[9px] text-[#687381]`,children:[U(n.messageCount??0),` 条消息`]})]}),(0,z.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[9px] text-[#687381]`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:U(n.cwd??`未知工作区`)}),(0,z.jsxs)(`span`,{children:[U(n.branchCount??0),` 个分支`]})]})]},`${U(n.id??`session`)}-${t}`)})]}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前工作区还没有可投影的持久化会话。`}),t.length>0?(0,z.jsxs)(`div`,{className:`grid gap-1 rounded-lg border border-[#edf0f3] bg-[#fbfcfd] px-3 py-2`,children:[(0,z.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(U(n.from)),a=r.get(U(n.to));return(0,z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-[9px] text-[#65707b]`,children:[(0,z.jsx)(`span`,{className:`truncate`,children:U(i?.label??n.from)}),(0,z.jsx)(`span`,{className:`shrink-0 text-[#3565c5]`,children:`→ fork →`}),(0,z.jsx)(`span`,{className:`truncate`,children:U(a?.label??n.to)})]},`${U(n.from)}-${U(n.to)}-${t}`)})]}):null,(0,z.jsx)(`div`,{className:`text-[10px] text-[#687381]`,children:`数据来源:Pi 原生 JSONL 会话;Agent 可调用 synapse_session_map 刷新。`})]})})():e.id===`archify-panel`?(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`组件`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:U(t.length)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`外部依赖`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:U(r.length)})]})]}),(0,z.jsx)(`div`,{className:`grid gap-1.5`,children:t.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-[#3565c5]`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[#30343b]`,children:U(n.path??`组件`)}),(0,z.jsxs)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:[U(n.files??0),` files`]})]},`${U(n.path??`component`)}-${t}`)})}),r.length>0?(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:r.slice(0,12).map((e,t)=>(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-[#f6f8ff] px-2 py-1 font-mono text-[10px] text-[#315fb8]`,children:U(e)},`${U(e)}-${t}`))}):null,(0,z.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:U(e.mermaid,``)}),e.truncated===!0?(0,z.jsx)(`p`,{className:`text-[10px] text-[#8a5a00]`,children:`扫描达到节点上限,架构图可能不完整。`}):null]})})():(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`Mermaid 流程图`}),(0,z.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[U(n?.nodeCount??0),` 节点 · `,U(n?.edgeCount??0),` 连线`]})]}),n?.latest&&typeof n.latest==`object`?(0,z.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:U(n.latest.mermaid,``)}):(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`PNG 无损压缩`}),(0,z.jsx)(`span`,{className:`font-mono text-[#65707b]`,children:`上限 32 MiB`})]}),n?.last&&typeof n.last==`object`?(()=>{let e=n.last;return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#b9e6c9] bg-[#f0fbf4] px-3 py-3 text-[11px] text-[#14733f]`,children:[U(e.inputPath??`图片`),` → `,U(e.outputPath??`输出`),`,节省 `,U(e.savedBytes??0),` bytes`]})})():(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`工作区文本检索`}),(0,z.jsxs)(`span`,{className:`font-mono text-[#3565c5]`,children:[U(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,z.jsx)(`ul`,{className:`grid gap-1.5`,children:t.slice(0,5).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,z.jsxs)(`li`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`strong`,{className:`block truncate font-mono text-[10px] text-[#3565c5]`,children:[U(n.path??`未知文件`),`:`,U(n.line??`?`)]}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-[#65707b]`,children:U(n.text,``)})]},`${U(n.path??`match`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有找到匹配内容。`})})():(0,z.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`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`font-medium text-[#30343b]`,children:`未回答会话`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[U(n?.total??0),` 个`]})]}),Array.isArray(n?.items)&&n.items.length>0?(0,z.jsx)(`div`,{className:`grid gap-2`,children:n.items.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:U(n.name??n.id??`未命名会话`)}),(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[10px] leading-4 text-[#65707b]`,children:U(n.message??``)})]},`${U(n.id??`session`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有以未回答用户消息结束的会话。`})]}):e.id===`turn-rewind-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=e.target!==null&&typeof e.target==`object`?e.target:{},r=e.cancelled===!0;return(0,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${r?`border-[#f4dfb0] bg-[#fffaf0]`:`border-[#dce5f5] bg-[#f6f8ff]`}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:`最近操作`}),(0,z.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] font-semibold ${r?`bg-[#fff0c7] text-[#9a6700]`:`bg-[#e8f8ee] text-[#14733f]`}`,children:r?`已取消`:`已回退`})]}),(0,z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-[11px] leading-4 text-[#30343b]`,children:U(t.text??`未命名轮次`)})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有执行回退操作。`}),(0,z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.08em] text-[#687381]`,children:`可回退轮次`}),(()=>{let e=Array.isArray(n?.candidates)?n.candidates:[];return e.length>0?e.slice(-8).map((t,n)=>{let r=typeof t==`object`&&t?t:{};return(0,z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`mt-0.5 font-mono text-[10px] text-[#3565c5]`,children:e.length-n}),(0,z.jsx)(`span`,{className:`line-clamp-2 min-w-0 flex-1 text-[11px] leading-4 text-[#65707b]`,children:U(r.text??`未命名轮次`)})]},`${U(r.entryId??`turn`)}-${n}`)}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-3 text-[11px] text-[#687381]`,children:`当前会话还没有可回退的用户轮次。`})})()]})]}):e.id===`skill-guard-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`已扫描`,n?.total??0],[`高风险`,n?.blocked??0],[`待复核`,n?.review??0]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:U(t)})]},U(e)))}),(0,z.jsx)(`div`,{className:`grid gap-2`,children:Array.isArray(n?.reports)&&n.reports.length>0?n.reports.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.risk,i=Array.isArray(n.findings)?n.findings:[];return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`h-2 w-2 rounded-full ${r===`blocked`?`bg-[#d64545]`:r===`review`?`bg-[#e0a11a]`:`bg-[#22a06b]`}`}),(0,z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate text-[11px] text-[#30343b]`,children:U(n.name??`unknown`)}),(0,z.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:r===`blocked`?`阻断`:r===`review`?`复核`:`安全`})]}),i.length>0?(0,z.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#65707b]`,children:i.map(e=>U(typeof e==`object`&&e?e.code??`finding`:e)).join(` · `)}):null]},`${U(n.name??`skill`)}-${t}`)}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`暂无 Skill 扫描结果,可让 Agent 调用 skill_guard_scan。`})})]}):e.id===`prompt-guard-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${n?.risk===`blocked`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:n?.risk===`review`?`border-[#f3dfab] bg-[#fffaf0] text-[#9a6700]`:`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`}`,children:[(0,z.jsx)(`span`,{children:n?.risk===`blocked`?`高风险,需阻断`:n?.risk===`review`?`需要人工复核`:`未发现风险`}),(0,z.jsxs)(`strong`,{className:`font-mono`,children:[U(n?.scans??0),` 次扫描`]})]}),n?.latest&&typeof n.latest==`object`?(()=>{let e=n.latest,t=Array.isArray(e.findings)?e.findings:[];return t.length>0?(0,z.jsx)(`ul`,{className:`grid gap-1 rounded-lg border border-[#e3e7ee] bg-white px-4 py-3 text-[10px] text-[#65707b]`,children:t.slice(0,4).map((e,t)=>{let n=e&&typeof e==`object`?e:{};return(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`strong`,{className:`font-mono text-[#30343b]`,children:U(n.code??`finding`)}),`:`,U(n.message,``)]},`${U(n.code??`finding`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`最近一次扫描未发现风险。`})})():(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`已生成技能`}),(0,z.jsx)(`strong`,{className:`font-mono text-[12px] text-[#315fb8]`,children:U(n?.generated??0)})]}),n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(0,z.jsxs)(`p`,{className:`mt-2 truncate text-[11px] text-[#65707b]`,children:[U(n.latest.slug??`skill`),` ·`,` `,U(Array.isArray(n.latest.files)?n.latest.files.length:0),` `,`个参考文件`]}):(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`还没有生成技能。可让 Agent 调用 skill_pack_create。`})]}),(0,z.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`输出目录:项目 .pi/skills/<name>,包含 SKILL.md 和原始参考文件。`})]}):e.id===`genui-panel`?(0,z.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=Array.isArray(e.blocks)?e.blocks:[],r={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(0,z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[11px]`,children:[(0,z.jsx)(`strong`,{className:`text-[#30343b]`,children:U(e.title??`结构化卡片`)}),(0,z.jsxs)(`span`,{className:`font-mono text-[#687381]`,children:[U(n.rendered??0),` 次`]})]}),t.map((e,t)=>{let n=e&&typeof e==`object`?e:{},i=U(n.tone??`neutral`),a=n.value;return n.type===`progress`?(0,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${r[i]??r.neutral}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[10px]`,children:[(0,z.jsx)(`span`,{children:U(n.label??`进度`)}),(0,z.jsxs)(`strong`,{children:[U(a??0),`%`]})]}),(0,z.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-white/70`,children:(0,z.jsx)(`div`,{className:`h-full rounded-full bg-current`,style:{width:`${Math.max(0,Math.min(100,Number(a)||0))}%`}})})]},`${U(n.label)}-${t}`):(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-2 text-[11px] ${r[i]??r.neutral}`,children:[(0,z.jsx)(`span`,{className:`text-[#65707b]`,children:U(n.label,``)}),(0,z.jsx)(`strong`,{children:U(a,``)})]},`${U(n.label)}-${t}`)})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有结构化卡片。可让 Agent 调用 genui_render。`}),(0,z.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`仅渲染结构化文本、徽标和进度块;HTML 与脚本按普通文本处理。`})]}):e.id===`anchored-standard-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(()=>{let e=Array.isArray(n?.violations)?n.violations:[],t=n?.status===`violated`;return(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(`span`,{children:t?`轨迹存在违规`:n?.status===`anchored`?`运行已锚定`:`等待 Agent 运行`}),(0,z.jsxs)(`strong`,{className:`font-mono`,children:[U(n?.events??0),` 事件`]})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[#65707b]`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`工具调用 `,(0,z.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:U(n?.toolCalls??0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`违规项 `,(0,z.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:U(e.length)})]})]}),e.length>0?(0,z.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,z.jsx)(`li`,{children:U(e&&typeof e==`object`?e.message??`违规`:e)},`${U(e)}-${t}`))}):null]})})(),(0,z.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`可让 Agent 调用 trajectory_anchor_check 审计当前执行轨迹。`})]}):e.id===`telemetry-blocker-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.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,z.jsx)(`span`,{children:`遥测已关闭`}),(0,z.jsxs)(`strong`,{className:`font-mono`,children:[`拦截 `,U(n?.blocked??0),` 次`]})]}),(0,z.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,z.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`只记录事件名和计数,不保留事件属性,也不会发起网络请求。`})]}):e.id===`plugin-dev-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border px-3 py-3 text-[11px] ${n?.status===`reloaded`?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:n?.status===`failed`?`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`:`border-[#e3e7ee] bg-[#f6f8fa] text-[#65707b]`}`,children:[(0,z.jsx)(`span`,{children:n?.status===`reloaded`?`插件已重载`:n?.status===`failed`?`插件重载失败`:`等待重载`}),(0,z.jsx)(`strong`,{className:`font-mono`,children:U(n?.status??`idle`)})]}),(0,z.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:U(n?.reason??`修改本地扩展后调用 plugin_dev_reload`)}),n?.error?(0,z.jsx)(`p`,{className:`rounded-lg bg-[#fff5f5] px-3 py-2 text-[10px] text-[#b42318]`,children:U(n.error)}):null]}):e.id===`openpets-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[#e3e7ee] bg-[#f8fafc] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-[#dceaff] text-[20px] text-[#3565c5]`,children:`◉`}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`strong`,{className:`block truncate text-[13px] text-[#30343b]`,children:U(n?.name??`Pi`)}),(0,z.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:U(n?.lastEvent??`session_start`)})]}),(0,z.jsx)(`span`,{className:`rounded-full bg-[#edf3fe] px-2 py-1 text-[10px] text-[#3565c5]`,children:U(n?.mood??`idle`)})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[#65707b]`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`能量 `,(0,z.jsxs)(`strong`,{className:`ml-1 text-[#30343b]`,children:[U(n?.energy??0),`%`]})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`互动 `,(0,z.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:U(n?.interactions??0)})]})]}),(0,z.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`根据真实 Pi 会话事件自动反应,也可让 Agent 调用 pet_react 进行互动。`})]}):e.id===`change-verifier-panel`?(0,z.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=U(e.status??`fail`);return(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(`span`,{children:i===`pass`?`门禁通过`:i===`warning`?`门禁有警告`:`门禁失败`}),(0,z.jsxs)(`strong`,{className:`font-mono`,children:[U(n.runs??0),` 次`]})]}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 text-[10px] text-[#65707b]`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`测试 exit `,(0,z.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:U(t.exitCode??`—`)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[`审查 `,(0,z.jsx)(`strong`,{className:`ml-1 text-[#30343b]`,children:U(r.status??`—`)})]})]})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有执行发布门禁。可让 Agent 调用 verify_change_gate。`}),(0,z.jsx)(`p`,{className:`text-[10px] text-[#687381]`,children:`复用 run_project_tests 和 review_changes,不重复实现测试或审查逻辑。`})]}):e.id===`readme-gen-panel`?(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.generated===!0?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#b9e6c9] bg-[#f0fbf4] px-3 py-3 text-[11px] text-[#14733f]`,children:[`已生成 `,U(n.name??`项目`),` 的 README 概览:`,U(n.scripts??0),` 个脚本,`,U(n.plugins??0),` 个运行时插件。`]}),n.lastWrite&&typeof n.lastWrite==`object`?(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-2 text-[11px] text-[#315fb8]`,children:[`已写入 `,U(n.lastWrite.path??`README.generated.md`),` ·`,` `,U(n.lastWrite.bytes??0),` bytes`,n.lastWrite.overwritten===!0?` · 已覆盖`:` · 新文件`]}):null,(0,z.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`需要落盘时调用 readme_write,并显式传入 confirm=true;默认写入 README.generated.md。`})]}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有生成文档。让 Agent 调用 readme_report 获取 Markdown 草稿,或调用 readme_write 写入确认后的文件。`})}):e.id===`sql-lens-panel`?(0,z.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=Array.isArray(e.rows)?e.rows:[];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:U(e.database??`database`)}),(0,z.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#3565c5]`,children:[U(t.length),` rows`]})]}),(0,z.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:JSON.stringify(t,null,2)})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有查询数据库。可让 Agent 调用 sql_readonly。`})}):e.id===`theme-studio-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`strong`,{className:`block text-[12px] text-[#30343b]`,children:U(n?.label??`Light`)}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-[10px] text-[#65707b]`,children:U(n?.description??``)})]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-[#edf3fe] px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:U(n?.theme??`light`)})]}),Array.isArray(n?.presets)?(0,z.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,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-2 ${i?`border-[#9bbcff] bg-[#f6f8ff]`:`border-[#edf0f3] bg-white`}`,children:[(0,z.jsx)(`strong`,{className:`block text-[11px] text-[#30343b]`,children:U(r.label??r.id??`主题`)}),(0,z.jsx)(`span`,{className:`mt-1 block truncate text-[10px] text-[#687381]`,children:U(r.description??``)})]},`${U(r.id??`theme`)}-${t}`)})}):null,(0,z.jsx)(`p`,{className:`text-[10px] leading-4 text-[#687381]`,children:`可让 Agent 调用 theme_set 切换预设;选择会保存到当前 session,并由 React 根节点应用 token。`})]}):e.id===`mirage-bridge-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.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,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`官方 Mirage CLI`}),(0,z.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,z.jsx)(`p`,{className:`mt-2 truncate font-mono text-[10px] text-[#65707b]`,children:U(n?.version??n?.executable??`mirage`)}),(0,z.jsxs)(`p`,{className:`mt-1 text-[11px] text-[#65707b]`,children:[`虚拟工作区:`,U(n?.workspaceId??`未配置`)]})]}),n?.lastRun&&typeof n.lastRun==`object`?(()=>{let e=n.lastRun;return(0,z.jsxs)(`div`,{className:`rounded-lg border px-3 py-3 ${e.exitCode===0?`border-[#b9e6c9] bg-[#f0fbf4]`:`border-[#f4caca] bg-[#fff5f5]`}`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-[10px] text-[#30343b]`,children:U(e.command??``)}),(0,z.jsxs)(`strong`,{className:`shrink-0 text-[11px] ${e.exitCode===0?`text-[#14733f]`:`text-[#b42318]`}`,children:[`exit `,U(e.exitCode??`—`)]})]}),(0,z.jsxs)(`p`,{className:`mt-1 text-[10px] text-[#65707b]`,children:[`耗时 `,U(e.durationMs??0),` ms`]})]})})():(0,z.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,z.jsx)(`p`,{className:`text-[10px] leading-4 text-[#9a6700]`,children:U(n.lastError)}):null]}):e.id===`docker-sandbox-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest;return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#b9e6c9] bg-[#f0fbf4] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:U(e.image??`image`)}),(0,z.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#14733f]`,children:[`exit `,U(e.exitCode??`—`)]})]}),(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#65707b]`,children:Array.isArray(e.command)?e.command.map(e=>U(e)).join(` `):`argv`})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有沙箱运行。默认无网络、工作区只读。`}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n?.defaults!==null&&typeof n?.defaults==`object`?Object.entries(n.defaults).map(([e,t])=>(0,z.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[e,`:`,U(t)]},e)):null})]}):e.id===`yaml-validator-panel`?(0,z.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=Array.isArray(e.errors)?e.errors:[],r=Array.isArray(e.warnings)?e.warnings:[],i=e.valid===!0;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${i?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`}`,children:i?`YAML 语法有效。`:`发现 ${t.length} 个语法错误。`}),(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`文档`,e.documents??0],[`错误`,t.length],[`警告`,r.length]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:U(t)})]},U(e)))}),!i&&t.length>0?(0,z.jsx)(`pre`,{className:`max-h-32 overflow-auto rounded-lg border border-[#f4caca] bg-[#fffafa] p-3 text-[10px] leading-4 text-[#b42318]`,children:t.map(e=>typeof e==`object`&&e?`${U(e.line??`?`)}:${U(e.column??`?`)} ${U(e.message,``)}`:U(e)).join(`
20
+ `)}):null]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有校验 YAML。可让 Agent 调用 yaml_validate。`}),(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:`max:512KiB · read-only`})]}):e.id===`browser-session-panel`?(()=>{let e=Array.isArray(n?.tabs)?Ge(n.tabs.flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e;return typeof t.targetId==`string`&&typeof t.url==`string`?[{targetId:t.targetId,title:typeof t.title==`string`?t.title:``,url:t.url}]:[]}),8):[],t=n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?n.latest:void 0,r=t?.screenshot?`已截图`:t?.clicked===!0?`已点击`:t?.text?`已读取`:t?.status===`navigated`?`已导航`:void 0;return(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:U(n?.endpoint??`本地浏览器未连接`)}),(0,z.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[10px] font-semibold ${n?.connected===!0?`bg-[#e8f8ee] text-[#14733f]`:`bg-[#fff4e5] text-[#8a5a00]`}`,children:n?.connected===!0?`已连接`:`未连接`})]}),(0,z.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:[`Chrome DevTools Protocol · `,e.length,` 个可调试页面`]}),n?.connected===!1?(0,z.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#b42318]`,children:[`请使用 remote-debugging-port 启动 Chrome。`,U(n.error,``)]}):null]}),r?(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-2 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`text-[#65707b]`,children:`最近动作`}),(0,z.jsx)(`strong`,{className:`font-mono text-[#315fb8]`,children:r})]}):null,e.length>0?(0,z.jsx)(`div`,{className:`grid gap-2`,children:e.map(e=>(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2`,children:[(0,z.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:e.title}),(0,z.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[#687381]`,children:e.url})]},e.targetId))}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`没有可调试的浏览器页面。`}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-[10px] text-[#687381]`,children:[(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`tabs`}),(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`read`}),(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[#3565c5]`,children:`click`}),(0,z.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`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:U(n?.server??`尚未连接 MCP 服务器`)}),(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 font-mono text-[10px] text-[#3565c5]`,children:[(0,z.jsxs)(`span`,{children:[U(Array.isArray(n?.tools)?n.tools.length:0),` 工具`]}),(0,z.jsx)(`span`,{className:`text-[#687381]`,children:`·`}),(0,z.jsxs)(`span`,{children:[U(Array.isArray(n?.resources)?n.resources.length:0),` 资源`]}),(0,z.jsx)(`span`,{className:`text-[#687381]`,children:`·`}),(0,z.jsxs)(`span`,{children:[U(Array.isArray(n?.prompts)?n.prompts.length:0),` 提示`]})]})]}),(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:n?.lastCall===null||n?.lastCall===void 0?`使用 mcp_list_tools 发现 stdio 工具。`:`最近调用:${U(n.lastCall)}`})]}),Array.isArray(n?.tools)&&n.tools.length>0?(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.tools.slice(0,12).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:U(n.name??`tool`)},`${U(n.name??`tool`)}-${t}`)})}):null,Array.isArray(n?.resources)&&n.resources.length>0?(0,z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[#687381]`,children:`资源`}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.resources.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#65707b]`,children:U(n.name??n.uri??`resource`)},`${U(n.uri??`resource`)}-${t}`)})})]}):null,Array.isArray(n?.prompts)&&n.prompts.length>0?(0,z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,z.jsx)(`span`,{className:`text-[10px] font-semibold uppercase tracking-[0.12em] text-[#687381]`,children:`提示模板`}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.prompts.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#65707b]`,children:U(n.name??`prompt`)},`${U(n.name??`prompt`)}-${t}`)})})]}):null,Array.isArray(n?.servers)&&n.servers.length>0?(0,z.jsx)(`div`,{className:`grid gap-2`,children:n.servers.map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[#30343b]`,children:U(n.id??`server`)}),(0,z.jsx)(`span`,{className:`text-[#14733f]`,children:U(n.status??`unknown`)})]},`${U(n.id??`server`)}-${t}`)})}):null]}):e.id===`mcp-panel`?(()=>{let e=Array.isArray(n?.servers)?n.servers:[];return(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[e.length>0?(0,z.jsx)(`ul`,{className:`grid gap-2`,children:e.map((e,t)=>{let n=typeof e==`object`&&e?e:{},r=n.status===`running`;return(0,z.jsxs)(`li`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`strong`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[#30343b]`,children:U(n.id,`未命名服务器`)}),(0,z.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[9px] ${r?`bg-[#eaf8f0] text-[#14733f]`:`bg-[#fff5f5] text-[#b42318]`}`,children:U(n.status,`unknown`)})]}),(0,z.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 text-[10px] text-[#687381]`,children:[(0,z.jsxs)(`span`,{children:[U(n.toolCount,`0`),` 个桥接工具`]}),(0,z.jsx)(`span`,{children:`·`}),(0,z.jsx)(`span`,{children:U(n.statusSource,`runtime`)})]})]},`${U(n.id??`server`)}-${t}`)})}):(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`当前没有 MCP 服务器快照。`}),(0,z.jsxs)(`div`,{className:`text-[10px] text-[#687381]`,children:[`只读读取官方 MCP bridge 状态;健康建议通过 mcp_panel 的 health 操作查看。`,n?.writesEnabled===!0?` 已启用 profile patch 写入:${U(n.patchPath)}`:` profile patch 写入未配置,apply 会被拒绝。`]})]})})():e.id===`mock-server-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.running===!0?`运行中`:`未启动`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[11px] text-[#3565c5]`,children:[U(n?.routes??0),` 路由`]})]}),n?.url?(0,z.jsx)(`code`,{className:`rounded-md bg-white px-3 py-2 text-[10px] text-[#65707b]`,children:U(n.url)}):null,n?.lastRequest?(0,z.jsxs)(`p`,{className:`text-[11px] text-[#687381]`,children:[`最近请求:`,U(n.lastRequest)]}):null]}):e.id===`cli-notifier-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.enabled===!0?`已启用`:`已停用`}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:U(n?.platform??`unknown`)})]}),Array.isArray(n?.notifications)&&n.notifications.length>0?(0,z.jsx)(`div`,{className:`grid gap-2`,children:n.notifications.slice(0,5).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 text-[10px]`,children:[(0,z.jsx)(`strong`,{className:`block text-[#30343b]`,children:U(n.title??`Pi Harness`)}),(0,z.jsx)(`span`,{className:`mt-1 block text-[#65707b]`,children:U(n.message,``)})]},`${U(n.time??`notification`)}-${t}`)})}):(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[11px] text-[#30343b]`,children:n?.configured===!0?`已配置`:`未配置 vault`}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#687381]`,children:`Markdown`})]}),n?.vaultPath?(0,z.jsx)(`code`,{className:`truncate rounded-md bg-white px-3 py-2 text-[10px] text-[#65707b]`,children:U(n.vaultPath)}):null,n?.last!==null&&n?.last!==void 0&&typeof n.last==`object`?(0,z.jsxs)(`p`,{className:`text-[11px] text-[#687381]`,children:[`最近写入:`,U(n.last.relativePath??`note.md`)]}):(0,z.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,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3 text-[11px]`,children:[(0,z.jsx)(`span`,{className:`text-[#315fb8]`,children:n?.keyless===!0?`Firecrawl 匿名模式`:`Firecrawl 已认证`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#315fb8]`,children:[`最多 `,U(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,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[11px]`,children:[(0,z.jsx)(`strong`,{className:`truncate text-[#30343b]`,children:U(e.query??`网页搜索`)}),(0,z.jsxs)(`span`,{className:`shrink-0 font-mono text-[#687381]`,children:[`前 `,Math.min(8,t.length),` / 共 `,t.length]})]}),(0,z.jsx)(`div`,{className:`grid gap-2`,children:t.slice(0,8).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`a`,{className:`rounded-lg border border-[#e3e7ee] bg-white px-3 py-2 transition-colors hover:border-[#bdd0f5] hover:bg-[#fbfdff]`,href:U(n.url,``),rel:`noreferrer`,target:`_blank`,children:[(0,z.jsx)(`strong`,{className:`block truncate text-[11px] text-[#30343b]`,children:U(n.title??n.url??`来源`)}),(0,z.jsx)(`span`,{className:`mt-1 block truncate font-mono text-[10px] text-[#3565c5]`,children:U(n.source??n.url,``)}),n.snippet?(0,z.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-[10px] leading-4 text-[#65707b]`,children:U(n.snippet)}):null]},`${U(n.url??`source`)}-${t}`)})})]})})():(0,z.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,z.jsxs)(`p`,{className:`text-[10px] text-[#687381]`,children:[`搜索词会发送到 Firecrawl;页面读取`,n?.readPageAvailable===!0?`已复用本地 Browser Fetch`:`需要启用 Browser Fetch`,`。`]})]}):e.id===`browser-fetch-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[n?.latest!==null&&n?.latest!==void 0&&typeof n.latest==`object`?(()=>{let e=n.latest;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[#30343b]`,children:U(e.finalUrl??e.url??`page`)}),(0,z.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#14733f]`,children:[`HTTP `,U(e.status??`—`)]})]}),(0,z.jsx)(`pre`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3] bg-[#fbfcfd] p-3 text-[10px] leading-4 text-[#65707b]`,children:U(e.text,``)})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有抓取网页。默认阻止本地和私有网络目标。`}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:`max:512KiB`}),(0,z.jsx)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:`scripts:disabled`}),(0,z.jsxs)(`span`,{className:`rounded-md border border-[#dce5f5] bg-white px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:[`private:`,U(n?.allowPrivate===!0?`allowed`:`blocked`)]})]})]}):e.id===`i18n-pair-panel`?(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:n?.report!==null&&n?.report!==void 0&&typeof n.report==`object`?(()=>{let e=n.report,t=Array.isArray(e.missing)?e.missing:[],r=Array.isArray(e.extra)?e.extra:[],i=t.length===0&&r.length===0;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`rounded-lg border px-3 py-3 text-[11px] ${i?`border-[#b9e6c9] bg-[#f0fbf4] text-[#14733f]`:`border-[#f4caca] bg-[#fff5f5] text-[#b42318]`}`,children:i?`语言包键完全一致。`:`缺失 ${t.length} 个,额外 ${r.length} 个。`}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`基准键`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:U(e.baseKeys??0)})]}),(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:`目标键`}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] text-[#30343b]`,children:U(e.targetKeys??0)})]})]})]})})():(0,z.jsx)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3 text-[11px] text-[#687381]`,children:`还没有检查语言包。可让 Agent 调用 i18n_check。`})}):e.id===`cleaner-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3e7ee] bg-[#f6f8fa] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`快照清理`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[12px] text-[#3565c5]`,children:[U(Array.isArray(n?.capsules)?n.capsules.length:0),` 个`]})]}),(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#687381]`,children:`仅清理 agent 数据目录中的 .patch 快照,必须显式 confirm=true。`})]}),(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-[#687381]`,children:[(0,z.jsx)(`span`,{children:`上次清理`}),(0,z.jsxs)(`strong`,{className:`font-mono text-[#3565c5]`,children:[U(n?.lastRemoved??0),` 个`]})]})]}):e.id===`fail-logger-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg bg-[#fff5f5] px-3 py-3`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#7f1d1d]`,children:`去重后的失败记录`}),(0,z.jsx)(`strong`,{className:`font-mono text-[17px] text-[#b42318]`,children:U(n?.total??0)})]}),(0,z.jsx)(`div`,{className:`max-h-48 overflow-auto rounded-lg border border-[#edf0f3]`,children:Array.isArray(n?.failures)&&n.failures.length>0?n.failures.map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-2 border-b border-[#edf0f3] px-3 py-2 last:border-b-0`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#b42318]`,children:U(n.source??`runtime`)}),(0,z.jsx)(`span`,{className:`break-words text-[11px] leading-4 text-[#65707b]`,children:U(n.message??`未知错误`)})]},`${U(n.time??`failure`)}-${t}`)}):(0,z.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[#687381]`,children:`暂无失败记录。`})})]}):e.id===`context-insight-panel`?(0,z.jsxs)(`div`,{className:`mt-3 grid gap-3`,children:[(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#e3eaf8] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[#5d6d82]`,children:`上下文占用`}),(0,z.jsx)(`strong`,{className:`text-[13px] font-semibold text-[#315fb8]`,children:n?.percent===null||n?.percent===void 0?`—`:`${U(n.percent)}%`})]}),(0,z.jsx)(`div`,{className:`mt-2 h-2 overflow-hidden rounded-full bg-[#dfe8fb]`,children:(0,z.jsx)(`div`,{className:`h-full rounded-full bg-[#5d8bea] transition-[width] duration-300`,style:{width:`${Math.max(0,Math.min(100,typeof n?.percent==`number`?n.percent:0))}%`}})}),(0,z.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#5d6d82]`,children:[n?.tokens===null||n?.tokens===void 0?`令牌数未知`:`${U(n.tokens)} tokens`,n?.contextWindow===null||n?.contextWindow===void 0?``:` / ${U(n.contextWindow)} 上限`]})]}),(0,z.jsx)(`div`,{className:`grid grid-cols-3 gap-2`,children:[[`消息`,n?.messages??0],[`事件`,n?.events??0],[`压缩`,n?.compactions??0]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-1 block text-[17px] font-semibold text-[#30343b]`,children:U(t)})]},U(e)))}),(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`消息组成`}),(0,z.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:`按角色统计`})]}),(0,z.jsx)(`div`,{className:`mt-2 grid grid-cols-5 gap-1.5`,children:[[`用户`,n?.composition?.user??0],[`助手`,n?.composition?.assistant??0],[`工具`,n?.composition?.toolResult??0],[`系统`,n?.composition?.system??0],[`其他`,n?.composition?.other??0]].map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded bg-[#f6f8fa] px-2 py-1.5 text-center`,children:[(0,z.jsx)(`span`,{className:`block text-[10px] text-[#687381]`,children:U(e)}),(0,z.jsx)(`strong`,{className:`mt-0.5 block font-mono text-[13px] text-[#30343b]`,children:U(t)})]},U(e)))})]}),(0,z.jsxs)(`div`,{className:`rounded-lg border border-[#edf0f3] bg-white px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,z.jsx)(`span`,{className:`text-[11px] font-semibold text-[#30343b]`,children:`最近上下文事件`}),(0,z.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:`最多保留 50 条`})]}),(0,z.jsx)(`div`,{className:`mt-2 max-h-28 overflow-auto`,children:Array.isArray(n?.recentEvents)&&n.recentEvents.length>0?n.recentEvents.slice(-6).reverse().map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[#f0f2f5] py-1.5 last:border-b-0`,children:[(0,z.jsx)(`span`,{className:`font-mono text-[10px] text-[#5d6d82]`,children:U(n.type,`unknown`)}),(0,z.jsx)(`span`,{className:`text-[10px] text-[#687381]`,children:typeof n.at==`number`?new Date(n.at).toLocaleTimeString():`—`})]},`${U(n.type)}-${U(n.at)}-${t}`)}):(0,z.jsx)(`div`,{className:`py-2 text-[11px] text-[#687381]`,children:`暂无上下文事件。`})})]})]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.map(([e,t])=>(0,z.jsxs)(`div`,{className:`rounded-lg bg-[#f6f8fa] px-3 py-2`,children:[(0,z.jsx)(`span`,{className:`block font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:e}),(0,z.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap break-words text-[12px] leading-5 text-[#30343b]`,children:dt(t)})]},e))})]})}function ft({pluginName:e,busy:t,error:n,onCancel:r,onConfirm:i}){let a=W(!0,r,t);return(0,z.jsx)(`div`,{className:`plugin-confirm-backdrop`,onClick:()=>{t||r()},children:(0,z.jsxs)(`div`,{"aria-label":`确认卸载插件`,"aria-modal":`true`,className:`plugin-confirm-dialog`,onClick:e=>e.stopPropagation(),ref:a,role:`dialog`,tabIndex:-1,children:[(0,z.jsx)(`header`,{children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:`卸载插件?`}),(0,z.jsx)(`small`,{children:`将从运行配置中移除,之后可以从插件市场重新安装。`})]})}),(0,z.jsx)(`code`,{children:e}),n&&(0,z.jsx)(`p`,{className:`plugin-confirm-error`,role:`alert`,children:n}),(0,z.jsxs)(`footer`,{children:[(0,z.jsx)(`button`,{"data-dialog-initial-focus":!0,disabled:t,onClick:r,type:`button`,children:`取消`}),(0,z.jsx)(`button`,{className:`danger`,disabled:t,onClick:i,type:`button`,children:t?`卸载中…`:`确认卸载`})]})]})})}function pt({plugins:e,panels:t,catalog:n,onMarketplace:r,onOpenDetail:i,onToml:o,onToggle:s,onUninstall:c}){let l=(0,a.useMemo)(()=>new Map(n.map(e=>[e.packageName,e])),[n]),u=(0,a.useMemo)(()=>new Set(t.map(e=>e.pluginId)),[t]),d=(0,a.useMemo)(()=>e.filter(e=>e.removable||u.has(e.name)),[u,e]),[f,p]=(0,a.useState)(``),[m,h]=(0,a.useState)(``),[g,_]=(0,a.useState)(),[v,y]=(0,a.useState)(``),[b,x]=(0,a.useState)(),S=(0,a.useRef)(null),C=(0,a.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 Be([...e.values()].sort((e,t)=>t.count-e.count||e.label.localeCompare(t.label,`zh-CN`)))},[l,d]),w=(0,a.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,Qe(e.name),t?.category.label,...t?.capabilities??[],e.category?.label,Ze(e.name)];return Ke(f,r)}),[l,m,d,f]);(0,a.useEffect)(()=>{S.current?.scrollTo({top:0})},[m,f]),(0,a.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,z.jsx)(`section`,{className:`view-panel plugins-view`,children:(0,z.jsxs)(`div`,{className:`plugins-page`,children:[(0,z.jsxs)(`div`,{className:`subnav`,children:[(0,z.jsxs)(`div`,{"aria-label":`插件目录`,className:`segmented`,children:[(0,z.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:`已安装`}),(0,z.jsx)(`button`,{"aria-pressed":`false`,onClick:r,type:`button`,children:`插件市场`})]}),(0,z.jsx)(`span`,{children:`已安装插件`}),(0,z.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),o()},children:`查看运行配置`})]}),(0,z.jsxs)(`div`,{className:`plugins-toolbar`,children:[(0,z.jsx)(`input`,{"aria-label":`搜索已安装插件`,onChange:e=>p(e.target.value),placeholder:`搜索名称、包名或能力…`,type:`search`,value:f}),(0,z.jsxs)(`span`,{"aria-live":`polite`,children:[f.trim()||m?`${w.length} / ${d.length}`:`${d.length}`,` 个插件`]})]}),(0,z.jsx)(`nav`,{"aria-label":`已安装插件分类`,className:`marketplace-categories`,children:C.map(e=>{let t=m===e.id;return(0,z.jsxs)(`button`,{"aria-pressed":t,className:`marketplace-category ${t?`active`:``}`,onClick:()=>h(e.id),type:`button`,children:[(0,z.jsx)(`span`,{children:e.label}),(0,z.jsx)(`span`,{className:t?`font-mono text-[10px] text-[#3565c5]`:`font-mono text-[10px] text-[#687381]`,children:e.count})]},e.id||`all`)})}),(0,z.jsxs)(`div`,{className:`plugins-scroll`,ref:S,children:[(0,z.jsxs)(`div`,{className:`plugins-list`,children:[w.map(e=>{let t=l.get(e.name),n=t?.category.label??e.category?.label,r=Ze(e.name),a=t?.name??Qe(e.name);return(0,z.jsxs)(`article`,{className:`catalog-card plugin-card`,children:[(0,z.jsxs)(`div`,{className:`plugin-card-head`,children:[(0,z.jsx)(`span`,{className:`plugin-icon`,children:`◈`}),(0,z.jsx)(`div`,{className:`plugin-copy`,children:(0,z.jsxs)(`div`,{className:`plugin-heading`,children:[(0,z.jsxs)(`div`,{className:`plugin-title`,children:[(0,z.jsx)(`strong`,{children:a}),(0,z.jsx)(`span`,{className:`plugin-state ${e.enabled?`active`:``}`,children:e.enabled?`运行中`:`已停用`}),n&&(0,z.jsx)(`span`,{className:`capability`,children:n}),n!==r&&(0,z.jsx)(`span`,{className:`capability`,children:r})]}),(0,z.jsx)(`div`,{className:`plugin-actions`,children:e.removable?(0,z.jsxs)(z.Fragment,{children:[(0,z.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,z.jsx)(`span`,{"aria-hidden":`true`,className:`switch ${e.enabled?`on`:``}`,children:(0,z.jsx)(`i`,{})})}),(0,z.jsx)(`button`,{className:`plugin-uninstall`,disabled:g!==void 0,onClick:()=>{y(``),x(e)},type:`button`,children:`卸载`})]}):(0,z.jsx)(`span`,{className:`switch ${e.enabled?`on`:``}`,children:(0,z.jsx)(`i`,{})})})]})})]}),(0,z.jsxs)(`div`,{className:`plugin-card-body`,children:[(0,z.jsx)(`code`,{className:`plugin-package`,children:e.name}),(0,z.jsx)(`p`,{className:`plugin-description`,children:e.enabled?`由当前运行时加载并启用,能力与 hook 已注册。`:`由当前运行时加载但已停用。`}),(0,z.jsxs)(`div`,{className:`hook-list`,children:[(0,z.jsx)(`span`,{children:`loader`}),(0,z.jsx)(`span`,{children:e.state===`active`?`active`:`state:${e.state}`})]})]}),(0,z.jsxs)(`footer`,{className:`plugin-card-footer`,children:[(0,z.jsx)(`a`,{className:`plugin-detail-link`,href:qe(e.name),onClick:t=>{t.preventDefault(),i(e)},children:`查看详情 →`}),u.has(e.name)?(0,z.jsx)(`span`,{children:`实时面板`}):null]})]},e.id)}),d.length?w.length?null:(0,z.jsx)(`div`,{className:`empty-state`,children:`没有匹配当前搜索与分类条件的已安装插件。`}):(0,z.jsx)(`div`,{className:`empty-state`,children:`还没有安装可管理的插件。去插件市场安装一个吧。`})]}),v&&(0,z.jsx)(`p`,{className:`plugin-action-error`,children:v}),t.length>d.length&&(0,z.jsxs)(`section`,{className:`mt-4 border-t border-[#e3e7ee] pt-4`,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex items-baseline justify-between gap-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`其他插件面板`}),(0,z.jsx)(`p`,{className:`mt-1 text-[12px] text-[#687381]`,children:`由已启用插件提供的实时状态。`})]}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.08em] text-[#687381]`,children:`LIVE`})]}),(0,z.jsx)(`div`,{className:`grid gap-3 xl:grid-cols-2`,children:t.filter(e=>!d.some(t=>t.name===e.pluginId)).map(e=>(0,z.jsx)(K,{panel:e},e.id))})]})]}),b&&(0,z.jsx)(ft,{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??Qe(b.name)})]})})}function mt({plugin:e,panel:t,metadata:n,onBack:r,onToggle:i,onUninstall:o}){let[s,c]=(0,a.useState)(),[l,u]=(0,a.useState)(``),[d,f]=(0,a.useState)(!1),p=n?.name??Qe(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,z.jsxs)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,z.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,z.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),r()},children:`← 已安装插件`}),(0,z.jsx)(`span`,{children:`插件详情`})]}),(0,z.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,z.jsxs)(`header`,{className:`border-b border-[#e3e7ee] pb-7`,children:[(0,z.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,z.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,z.jsx)(`span`,{className:`rounded bg-[#f2edff] px-2 py-1 text-[10px] text-[#6d4bc3]`,children:n?.category.label??e.category?.label??`运行时插件`}),(0,z.jsx)(`span`,{className:`rounded bg-[#e4edfd] px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:Ze(e.name)})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[#687381]`,children:`PLUGIN DETAIL`}),(0,z.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[#20252b]`,children:p}),(0,z.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[#687381]`,children:[e.name,n?` · v${n.version}`:``]})]}),e.removable?(0,z.jsxs)(`div`,{className:`plugin-detail-actions`,children:[(0,z.jsx)(`button`,{className:`plugin-detail-action`,disabled:s!==void 0,onClick:()=>void m(`toggle`,()=>i(e)),type:`button`,children:s===`toggle`?`处理中…`:e.enabled?`停用插件`:`启用插件`}),(0,z.jsx)(`button`,{className:`plugin-detail-action danger`,disabled:s!==void 0,onClick:()=>{u(``),f(!0)},type:`button`,children:`卸载插件`})]}):(0,z.jsx)(`span`,{className:`rounded-full bg-[#eef0f3] px-3 py-1.5 text-[11px] text-[#687381]`,children:`内置组件`})]}),(0,z.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[#59636e]`,children:n?.description??(e.enabled?`由当前运行时加载并启用,能力与 hook 已注册。`:`插件保留在运行配置中,但当前处于停用状态。`)}),l&&(0,z.jsxs)(`p`,{className:`mt-3 text-[12px] text-[#b42318]`,role:`alert`,children:[`操作失败:`,l]})]}),(0,z.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,z.jsxs)(`div`,{className:`space-y-4`,children:[(0,z.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,z.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件能力`}),(0,z.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(n?.capabilities.length?n.capabilities:[Ze(e.name)]).map(e=>(0,z.jsx)(`span`,{className:`rounded-md bg-[#f1f4f9] px-2 py-1 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}),n?.hooks.length?(0,z.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,z.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`扩展点`}),(0,z.jsx)(`div`,{className:`mt-4 space-y-2`,children:n.hooks.map(e=>(0,z.jsx)(`div`,{className:`rounded-md bg-[#f8f9fb] px-3 py-2 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}):null,(0,z.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,z.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`实时详情`}),(0,z.jsx)(`p`,{className:`mt-1 text-[12px] text-[#687381]`,children:`当前本机会话中的插件运行状态。`})]}),(0,z.jsx)(`span`,{className:`font-mono text-[10px] uppercase tracking-[0.1em] text-[#687381]`,children:`LIVE`})]}),t?(0,z.jsx)(K,{inline:!0,panel:t}):(0,z.jsx)(`div`,{className:`empty-state`,children:`这个插件暂未提供实时面板。`})]})]}),(0,z.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,z.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件信息`}),(0,z.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:`运行状态`}),(0,z.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.state})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:`配置标识`}),(0,z.jsx)(`dd`,{className:`max-w-[150px] break-all text-right font-mono text-[#3b424b]`,children:e.id})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:`分类`}),(0,z.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.category?.label??`运行时插件`})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:`管理方式`}),(0,z.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.removable?`可配置`:`随运行时加载`})]}),n?(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:`版本`}),(0,z.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:n.version})]}):null]}),n?(0,z.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,z.jsx)(ft,{busy:s===`uninstall`,error:l,onCancel:()=>f(!1),onConfirm:()=>void m(`uninstall`,()=>o(e)).then(e=>{e&&f(!1)}),pluginName:p}):null]})}function ht({plugins:e,capabilities:t,categories:n,total:r,page:i,hasNext:o,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,a.useState)(),[x,S]=(0,a.useState)(``),[C,w]=(0,a.useState)(``),T=Be(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,z.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`subnav`,children:[(0,z.jsxs)(`div`,{"aria-label":`插件目录`,className:`segmented`,children:[(0,z.jsx)(`button`,{"aria-pressed":`false`,onClick:h,type:`button`,children:`已安装`}),(0,z.jsx)(`button`,{"aria-pressed":`true`,className:`active`,type:`button`,children:`插件市场`})]}),(0,z.jsx)(`span`,{children:`已审核插件目录`}),(0,z.jsx)(`a`,{href:`#`,onClick:e=>{e.preventDefault(),g()},children:`查看运行配置`})]}),(0,z.jsxs)(`div`,{className:`marketplace-toolbar`,children:[(0,z.jsx)(`input`,{className:`marketplace-search`,"aria-label":`搜索插件`,onChange:e=>u(e.target.value),placeholder:`搜索名称、包名、能力…`,value:s}),(0,z.jsxs)(`select`,{className:`marketplace-filter`,"aria-label":`按能力筛选`,onChange:e=>d(e.target.value),value:c,children:[(0,z.jsx)(`option`,{value:``,children:`全部能力`}),t.map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))]}),(0,z.jsxs)(`span`,{className:`marketplace-count`,children:[r,` 个已审核条目 · 推荐排序`]})]}),(0,z.jsx)(`nav`,{"aria-label":`插件分类`,className:`marketplace-categories`,children:T.map(e=>{let t=l===e.id;return(0,z.jsxs)(`button`,{"aria-pressed":t,className:`marketplace-category ${t?`active`:``}`,onClick:()=>f(e.id),type:`button`,children:[(0,z.jsx)(`span`,{children:e.label}),(0,z.jsx)(`span`,{className:t?`font-mono text-[10px] text-[#3565c5]`:`font-mono text-[10px] text-[#687381]`,children:e.count})]},e.id||`all`)})}),(0,z.jsxs)(`div`,{className:`marketplace-scroll`,children:[(0,z.jsxs)(`div`,{className:`marketplace-grid`,children:[e.map(e=>(0,z.jsxs)(`article`,{className:`catalog-card marketplace-card`,children:[(0,z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,z.jsx)(`div`,{className:`marketplace-card-mark`,children:`◈`}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,z.jsx)(`strong`,{className:`marketplace-title`,children:e.name}),(0,z.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,z.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,z.jsx)(`span`,{className:`rounded bg-[#f2edff] px-1.5 py-px text-[10px] text-[#6d4bc3]`,children:e.category.label})]}),(0,z.jsxs)(`code`,{className:`marketplace-package`,children:[Qe(e.packageName),` · v`,e.version]}),(0,z.jsx)(`p`,{className:`marketplace-description`,children:e.description}),(0,z.jsxs)(`div`,{className:`marketplace-tags`,children:[e.capabilities.map(e=>(0,z.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,z.jsxs)(`span`,{className:`rounded bg-[#f1f4f9] px-1.5 py-px font-mono text-[10px] text-[#61666b]`,children:[`hook:`,e]},e))]}),e.statistics&&(0,z.jsx)(`div`,{className:`mt-3 grid grid-cols-3 divide-x divide-[#e3e7ee] rounded-md border border-[#e3e7ee] bg-[#f8f9fb]`,children:He(e.statistics).map(e=>(0,z.jsxs)(`span`,{className:`min-w-0 px-2 py-1.5`,title:`${e.label} ${e.value}`,children:[(0,z.jsx)(`small`,{className:`block truncate text-[9px] text-[#687381]`,children:e.label}),(0,z.jsx)(`strong`,{className:`mt-0.5 block truncate font-mono text-[10px] font-medium text-[#3b424b]`,children:e.value})]},e.label))})]})]}),(0,z.jsxs)(`footer`,{className:`marketplace-card-footer`,children:[(0,z.jsxs)(`span`,{children:[e.author,` · `,e.license]}),(0,z.jsx)(`a`,{href:H(e.id),onClick:t=>{t.preventDefault(),m(e)},children:`查看详情 →`}),(0,z.jsx)(`a`,{href:e.repository,target:`_blank`,rel:`noreferrer`,children:`查看源码 ↗`}),(0,z.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,z.jsx)(`div`,{className:`p-7 text-center text-[12px] text-[#687381]`,children:`没有匹配的插件。`})]}),C&&(0,z.jsx)(`p`,{className:`mt-2 text-[11px] text-[#3565c5]`,children:C}),x&&(0,z.jsxs)(`p`,{className:`mt-2 text-[11px] text-[#b42318]`,children:[`安装失败:`,x]}),(0,z.jsxs)(`div`,{className:`marketplace-pagination`,children:[(0,z.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:i===0,onClick:()=>p(i-1),type:`button`,children:`上一页`}),(0,z.jsxs)(`span`,{children:[`第 `,i+1,` 页`]}),(0,z.jsx)(`button`,{className:`marketplace-pagination-button`,disabled:!o,onClick:()=>p(i+1),type:`button`,children:`下一页`})]}),(0,z.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,z.jsx)(`strong`,{className:`text-[12px] text-[#0f1115]`,children:`你有一个 Pi Harness 插件?`}),(0,z.jsx)(`span`,{children:`在 entries 目录新增一个元数据文件,附测试和 README 后提交 PR;审核通过后会出现在这里。`}),(0,z.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 gt({plugin:e,installed:t,onInstall:n,onBack:r}){let[i,o]=(0,a.useState)(!1),[s,c]=(0,a.useState)(``),[l,u]=(0,a.useState)(``),d=async()=>{c(``),u(``),o(!0);try{(await n(e)).restartRequired===!0&&u(`已写入 profile,重启 Pi Harness 后生效。`)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,z.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,z.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,z.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),r()},children:`← 插件市场`}),(0,z.jsx)(`span`,{children:`插件详情`})]}),(0,z.jsxs)(`div`,{className:`plugin-detail-content`,children:[(0,z.jsxs)(`header`,{className:`border-b border-[#e3e7ee] pb-7`,children:[(0,z.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`rounded bg-[#e4edfd] px-2 py-1 font-mono text-[10px] text-[#3565c5]`,children:e.source===`official`?`官方插件`:`社区插件`}),(0,z.jsx)(`span`,{className:`rounded bg-[#f2edff] px-2 py-1 text-[10px] text-[#6d4bc3]`,children:e.category.label}),(0,z.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,z.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-5`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`mb-2 font-mono text-[11px] uppercase tracking-[0.14em] text-[#687381]`,children:`PLUGIN DETAIL`}),(0,z.jsx)(`h1`,{className:`text-3xl font-semibold tracking-[-0.03em] text-[#20252b]`,children:e.name}),(0,z.jsxs)(`code`,{className:`mt-3 block break-all text-[12px] text-[#687381]`,children:[e.packageName,` · v`,e.version]})]}),(0,z.jsx)(`div`,{className:`plugin-detail-actions`,children:(0,z.jsx)(`button`,{className:`plugin-detail-action primary`,disabled:t||i,onClick:()=>void d(),type:`button`,children:t?`已安装`:i?`安装中…`:`安装插件`})})]}),(0,z.jsx)(`p`,{className:`mt-5 max-w-3xl text-[14px] leading-7 text-[#59636e]`,children:e.description}),l&&(0,z.jsx)(`p`,{className:`mt-3 text-[12px] text-[#3565c5]`,children:l}),s&&(0,z.jsxs)(`p`,{className:`mt-3 text-[12px] text-[#b42318]`,children:[`安装失败:`,s]})]}),(0,z.jsxs)(`div`,{className:`grid gap-4 py-6 lg:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,z.jsxs)(`div`,{className:`space-y-4`,children:[(0,z.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,z.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件能力`}),(0,z.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:e.capabilities.map(e=>(0,z.jsx)(`span`,{className:`rounded-md bg-[#f1f4f9] px-2 py-1 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}),(0,z.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,z.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`扩展点`}),(0,z.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.hooks.map(e=>(0,z.jsx)(`div`,{className:`rounded-md bg-[#f8f9fb] px-3 py-2 font-mono text-[11px] text-[#61666b]`,children:e},e))})]}),(0,z.jsxs)(`section`,{className:`rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,z.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`运行配置`}),(0,z.jsx)(`p`,{className:`mt-1 text-[12px] text-[#687381]`,children:`安装后会写入当前运行 profile。`}),(0,z.jsx)(`pre`,{className:`mt-4 overflow-auto rounded-lg bg-[#f7f8fa] p-4 text-[11px] leading-6 text-[#3b424b]`,children:(0,z.jsx)(`code`,{children:JSON.stringify(e.profile,null,2)})})]})]}),(0,z.jsxs)(`aside`,{className:`h-fit rounded-[10px] border border-[#e3e7ee] bg-white p-5`,children:[(0,z.jsx)(`h2`,{className:`text-[13px] font-semibold text-[#20252b]`,children:`插件信息`}),(0,z.jsxs)(`dl`,{className:`mt-4 divide-y divide-[#eef0f3] text-[12px]`,children:[(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:`作者`}),(0,z.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.author})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:`许可证`}),(0,z.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.license})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:`分类`}),(0,z.jsx)(`dd`,{className:`text-right text-[#3b424b]`,children:e.category.label})]}),(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:`版本`}),(0,z.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.version})]}),He(e.statistics).map(e=>(0,z.jsxs)(`div`,{className:`flex justify-between gap-4 py-3`,children:[(0,z.jsx)(`dt`,{className:`text-[#687381]`,children:e.label}),(0,z.jsx)(`dd`,{className:`font-mono text-[#3b424b]`,children:e.value})]},e.label))]}),(0,z.jsx)(`a`,{className:`mt-4 block border-t border-[#eef0f3] pt-4 text-[12px] text-[#3565c5]`,href:e.repository,target:`_blank`,rel:`noreferrer`,children:`查看源码 ↗`})]})]})]})]})})}function _t({data:e,api:t,tab:n,onTab:r,onClose:i,onRefresh:o}){let s=e.status,[c,l]=(0,a.useState)({}),[u,d]=(0,a.useState)({}),[f,p]=(0,a.useState)(!1),[m,h]=(0,a.useState)({provider:``,name:``,baseUrl:``,api:`openai-completions`,apiKey:``,model:``}),[g,_]=(0,a.useState)(),[v,y]=(0,a.useState)(`form`),[b,x]=(0,a.useState)(``),[S,C]=(0,a.useState)(!1),[w,T]=(0,a.useState)(``),E=e.plugins.some(e=>e.name.endsWith(`/cli-notifier`)&&e.enabled),D=W(f,()=>p(!1),u.__add);(0,a.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 O=(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))},ee=(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,z.jsx)(`section`,{className:`view-panel settings-page`,children:(0,z.jsxs)(`div`,{className:`settings-dialog`,children:[(0,z.jsx)(`nav`,{"aria-label":`设置分类`,className:`settings-top-tabs`,children:[`general`,`providers`,`toml`].map(t=>(0,z.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,z.jsxs)(`section`,{children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`button`,{className:`settings-back`,onClick:i,type:`button`,children:`← 返回会话`}),(0,z.jsxs)(`div`,{className:`settings-header-copy`,children:[(0,z.jsx)(`strong`,{children:n===`general`?`通用`:n===`providers`?`提供商`:`运行配置`}),(0,z.jsx)(`small`,{children:n===`toml`?`配置即代码,改完重载`:`运行时状态与快捷键`})]})]}),(0,z.jsxs)(`div`,{className:`settings-body`,children:[n===`general`&&(0,z.jsxs)(z.Fragment,{children:[[[`工作目录`,s?.cwd],[`agent 目录`,s?.agentDir],[`会话`,s?`${s.sessionId} · ${s.messages} 条消息`:`—`],[`快捷键`,`⌘K 命令 · ⌘, 设置 · ⌃C 中断`],[`权限策略`,`当前 API 未提供修改接口`]].map(([e,t])=>(0,z.jsx)(`div`,{className:`general-row`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:e}),(0,z.jsx)(`small`,{children:U(t)})]})},e)),(0,z.jsxs)(`div`,{className:`general-row`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:`任务结束提醒插件`}),(0,z.jsx)(`small`,{children:`由 CLI Notifier 提供,具体目标在插件配置中管理`})]}),(0,z.jsx)(`span`,{className:`setting-status ${E?`on`:``}`,children:E?`已加载`:`未加载`})]}),(0,z.jsxs)(`div`,{className:`general-row`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:`自动压缩上下文`}),(0,z.jsx)(`small`,{children:`接近上下文上限时自动整理历史消息,可在运行配置中修改`}),!g&&w&&w!==`读取中…`?(0,z.jsxs)(`small`,{className:`setting-error`,role:`alert`,children:[`配置读取失败:`,w]}):null]}),(0,z.jsx)(`span`,{className:`setting-status ${g?.settings.compaction.enabled?`on`:``}`,children:g?g.settings.compaction.enabled?`已开启`:`已关闭`:w===`读取中…`?`读取中`:`不可用`})]})]}),n===`providers`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`provider-add-head`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:`已启用提供商`}),(0,z.jsx)(`small`,{children:`模型列表只显示当前会话和已配置提供商。`})]}),(0,z.jsx)(`button`,{className:`primary`,onClick:()=>p(!0),type:`button`,children:`添加提供商`})]}),f&&(0,z.jsx)(`div`,{className:`provider-add-overlay`,onClick:()=>{u.__add||p(!1)},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),u.__add||p(!1))},children:(0,z.jsxs)(`div`,{"aria-busy":u.__add,"aria-label":`添加提供商`,"aria-modal":`true`,className:`provider-add-modal`,onClick:e=>e.stopPropagation(),ref:D,role:`dialog`,tabIndex:-1,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:`添加自定义提供商`}),(0,z.jsx)(`small`,{children:`注册 OpenAI 兼容接口,凭据只提交到本机 Pi runtime。`})]}),(0,z.jsx)(`button`,{"aria-label":`关闭添加提供商`,disabled:u.__add,onClick:()=>p(!1),type:`button`,children:`×`})]}),(0,z.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 o(),p(!1)}).catch(e=>l(t=>({...t,__add:e instanceof Error?e.message:String(e)}))).finally(()=>d(e=>({...e,__add:!1}))))},children:[(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:`提供商 ID`}),(0,z.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,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:`显示名称`}),(0,z.jsx)(`input`,{"aria-label":`提供商名称`,placeholder:`可选`,value:m.name,onChange:e=>h(t=>({...t,name:e.target.value}))})]}),(0,z.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,z.jsx)(`span`,{children:`接口地址`}),(0,z.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,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:`模型 ID`}),(0,z.jsx)(`input`,{"aria-label":`模型 ID`,placeholder:`例如 gpt-4o`,required:!0,value:m.model,onChange:e=>h(t=>({...t,model:e.target.value}))})]}),(0,z.jsxs)(`label`,{children:[(0,z.jsx)(`span`,{children:`协议`}),(0,z.jsxs)(`select`,{"aria-label":`协议`,value:m.api,onChange:e=>h(t=>({...t,api:e.target.value})),children:[(0,z.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Completions`}),(0,z.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`})]})]}),(0,z.jsxs)(`label`,{className:`provider-add-wide`,children:[(0,z.jsx)(`span`,{children:`API key`}),(0,z.jsx)(`input`,{"aria-label":`API key`,placeholder:`只在本机提交,不会回显`,required:!0,type:`password`,value:m.apiKey,onChange:e=>h(t=>({...t,apiKey:e.target.value}))})]}),(0,z.jsxs)(`div`,{className:`provider-add-actions`,children:[(0,z.jsx)(`button`,{className:`primary`,disabled:u.__add,type:`submit`,children:u.__add?`添加中…`:`添加提供商`}),c.__add&&(0,z.jsx)(`small`,{"aria-live":`polite`,children:c.__add})]})]})]})}),(0,z.jsx)(`small`,{children:`已启用提供商 · /api/providers`}),e.providers.length?e.providers.map(e=>(0,z.jsxs)(`article`,{className:`provider-card`,children:[(0,z.jsxs)(`div`,{className:`provider-head`,children:[(0,z.jsx)(`span`,{className:`provider-dot`,children:`●`}),(0,z.jsx)(`strong`,{children:e.name}),(0,z.jsx)(`span`,{className:`provider-state`,children:e.active?`当前会话`:e.auth?.configured===!0?`已配置`:`未配置`})]}),(0,z.jsxs)(`div`,{className:`provider-field`,children:[(0,z.jsx)(`code`,{children:`provider`}),(0,z.jsx)(`input`,{"aria-label":`${e.name} 提供商 ID`,disabled:!0,value:e.provider,readOnly:!0})]}),(0,z.jsxs)(`div`,{className:`provider-field`,children:[(0,z.jsx)(`code`,{children:`model`}),(0,z.jsxs)(`div`,{className:`provider-model-value`,title:e.models.map(e=>e.id).join(`, `)||`暂无模型`,children:[(0,z.jsx)(`span`,{children:e.activeModel?`${e.activeModel.provider}/${e.activeModel.id}`:`未选择模型`}),e.models.length>0&&(0,z.jsxs)(`details`,{className:`provider-models-details`,children:[(0,z.jsxs)(`summary`,{children:[`查看 `,e.models.length,` 个模型`]}),(0,z.jsx)(`div`,{className:`model-chips`,children:e.models.map(e=>(0,z.jsx)(`span`,{children:e.id},e.id))})]})]})]}),(0,z.jsxs)(`div`,{className:`provider-field`,children:[(0,z.jsx)(`code`,{children:`api_key`}),(0,z.jsx)(`input`,{"aria-label":`${e.name} API key 状态`,disabled:!0,value:`不会在浏览器显示`,readOnly:!0})]}),(0,z.jsxs)(`div`,{className:`provider-footer`,children:[(0,z.jsxs)(`code`,{children:[e.models.length,` 个模型`]}),(0,z.jsx)(`button`,{disabled:u[e.provider],onClick:()=>ee(e.provider,`test`),type:`button`,children:u[e.provider]&&c[e.provider]===`测试中…`?`测试中…`:`测试连接`}),(0,z.jsx)(`button`,{className:`link-button`,disabled:u[e.provider],onClick:()=>ee(e.provider,`refresh`),type:`button`,children:u[e.provider]&&c[e.provider]===`刷新中…`?`刷新中…`:`拉取模型`})]}),c[e.provider]&&(0,z.jsx)(`small`,{"aria-live":`polite`,className:`provider-result`,children:c[e.provider]})]},e.provider)):(0,z.jsx)(`div`,{className:`empty-state`,children:`运行时没有注册提供商。`})]}),n===`toml`&&(0,z.jsxs)(`div`,{className:`config-editor`,children:[(0,z.jsxs)(`div`,{className:`toml-toolbar`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:`运行时配置`}),(0,z.jsx)(`span`,{children:g?.path??`~/.pi/agent/settings.json`})]}),(0,z.jsx)(`button`,{className:v===`form`?`active`:``,onClick:()=>y(`form`),type:`button`,children:`表单`}),(0,z.jsx)(`button`,{className:v===`source`?`active`:``,onClick:()=>y(`source`),type:`button`,children:`源码`}),(0,z.jsx)(`button`,{className:`primary`,disabled:S,onClick:()=>{C(!0),T(`重载中…`),t.reloadConfig().then(_).then(()=>T(`已从磁盘重载`)).catch(e=>T(e instanceof Error?e.message:String(e))).finally(()=>C(!1))},type:`button`,children:`重载`})]}),w&&(0,z.jsx)(`div`,{"aria-live":`polite`,className:`config-state ${w.includes(`失败`)||w.includes(`Error`)?`error`:``}`,children:w}),g?v===`source`?(0,z.jsxs)(`div`,{className:`config-source-editor`,children:[(0,z.jsx)(`textarea`,{"aria-label":`settings.json 源码`,className:`config-source`,onChange:e=>x(e.target.value),spellCheck:!1,value:b}),(0,z.jsxs)(`div`,{className:`config-source-actions`,children:[(0,z.jsx)(`small`,{children:`完整 JSON 配置,可编辑未知字段;保存前会校验语法。`}),(0,z.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,z.jsxs)(`div`,{className:`config-sections`,children:[(0,z.jsxs)(`section`,{className:`config-section`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:`模型默认值`}),(0,z.jsx)(`small`,{children:`新会话启动时使用的模型和思考级别`})]}),(0,z.jsxs)(`label`,{className:`config-field`,children:[(0,z.jsx)(`span`,{children:`提供商`}),(0,z.jsxs)(`select`,{disabled:S,onChange:e=>O({defaultProvider:e.target.value},`保存提供商…`),value:g.settings.defaultProvider??``,children:[(0,z.jsx)(`option`,{value:``,children:`跟随运行时`}),e.providers.map(e=>(0,z.jsx)(`option`,{value:e.provider,children:e.name},e.provider))]})]}),(0,z.jsxs)(`label`,{className:`config-field`,children:[(0,z.jsx)(`span`,{children:`模型`}),(0,z.jsxs)(`select`,{disabled:S,onChange:e=>O({defaultModel:e.target.value},`保存模型…`),value:g.settings.defaultModel??``,children:[(0,z.jsx)(`option`,{value:``,children:`跟随提供商`}),e.models.map(e=>(0,z.jsxs)(`option`,{value:e.id,children:[e.provider,`/`,e.name]},`${e.provider}/${e.id}`))]})]}),(0,z.jsxs)(`label`,{className:`config-field`,children:[(0,z.jsx)(`span`,{children:`思考级别`}),(0,z.jsx)(`select`,{disabled:S,onChange:e=>O({defaultThinkingLevel:e.target.value},`保存思考级别…`),value:g.settings.defaultThinkingLevel??`medium`,children:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`].map(e=>(0,z.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,z.jsxs)(`section`,{className:`config-section`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:`运行策略`}),(0,z.jsx)(`small`,{children:`消息队列和网络传输行为`})]}),(0,z.jsxs)(`label`,{className:`config-field`,children:[(0,z.jsx)(`span`,{children:`传输方式`}),(0,z.jsxs)(`select`,{disabled:S,onChange:e=>O({transport:e.target.value},`保存传输方式…`),value:g.settings.transport,children:[(0,z.jsx)(`option`,{value:`auto`,children:`自动`}),(0,z.jsx)(`option`,{value:`sse`,children:`SSE`}),(0,z.jsx)(`option`,{value:`websocket`,children:`WebSocket`})]})]}),(0,z.jsxs)(`label`,{className:`config-field`,children:[(0,z.jsx)(`span`,{children:`Steering 消息`}),(0,z.jsxs)(`select`,{disabled:S,onChange:e=>O({steeringMode:e.target.value},`保存队列策略…`),value:g.settings.steeringMode,children:[(0,z.jsx)(`option`,{value:`one-at-a-time`,children:`逐条发送`}),(0,z.jsx)(`option`,{value:`all`,children:`一次发送全部`})]})]}),(0,z.jsxs)(`label`,{className:`config-field`,children:[(0,z.jsx)(`span`,{children:`Follow-up 消息`}),(0,z.jsxs)(`select`,{disabled:S,onChange:e=>O({followUpMode:e.target.value},`保存跟进策略…`),value:g.settings.followUpMode,children:[(0,z.jsx)(`option`,{value:`one-at-a-time`,children:`逐条发送`}),(0,z.jsx)(`option`,{value:`all`,children:`一次发送全部`})]})]})]}),(0,z.jsxs)(`section`,{className:`config-section`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:`上下文与显示`}),(0,z.jsx)(`small`,{children:`控制思考内容和自动压缩`})]}),(0,z.jsxs)(`label`,{className:`config-toggle`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:`隐藏思考正文`}),(0,z.jsx)(`small`,{children:`只显示可展开的思考摘要`})]}),(0,z.jsx)(`input`,{checked:g.settings.hideThinkingBlock,disabled:S,onChange:e=>O({hideThinkingBlock:e.target.checked},`保存显示设置…`),type:`checkbox`})]}),(0,z.jsxs)(`label`,{className:`config-toggle`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:`自动压缩上下文`}),(0,z.jsx)(`small`,{children:`接近上下文上限时自动整理历史消息`})]}),(0,z.jsx)(`input`,{checked:g.settings.compaction.enabled,disabled:S,onChange:e=>O({compaction:{...g.settings.compaction,enabled:e.target.checked}},`保存压缩设置…`),type:`checkbox`})]}),(0,z.jsxs)(`label`,{className:`config-toggle`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:`自动重试`}),(0,z.jsx)(`small`,{children:`临时网络错误时自动重试请求`})]}),(0,z.jsx)(`input`,{checked:g.settings.retry.enabled,disabled:S,onChange:e=>O({retry:{...g.settings.retry,enabled:e.target.checked}},`保存重试设置…`),type:`checkbox`})]}),(0,z.jsxs)(`label`,{className:`config-toggle`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:`显示图片`}),(0,z.jsx)(`small`,{children:`允许模型响应中的图片渲染`})]}),(0,z.jsx)(`input`,{checked:g.settings.terminal.showImages,disabled:S,onChange:e=>O({terminal:{...g.settings.terminal,showImages:e.target.checked}},`保存图片设置…`),type:`checkbox`})]})]}),(0,z.jsxs)(`section`,{className:`config-section`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:`终端与导航`}),(0,z.jsx)(`small`,{children:`控制命令行界面和消息渲染行为`})]}),(0,z.jsxs)(`label`,{className:`config-toggle`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:`安静启动`}),(0,z.jsx)(`small`,{children:`启动时隐藏版本和更新提示`})]}),(0,z.jsx)(`input`,{checked:g.settings.advanced.quietStartup,disabled:S,onChange:e=>O({advanced:{...g.settings.advanced,quietStartup:e.target.checked}},`保存启动设置…`),type:`checkbox`})]}),(0,z.jsxs)(`label`,{className:`config-field`,children:[(0,z.jsx)(`span`,{children:`项目可信策略`}),(0,z.jsxs)(`select`,{disabled:S,onChange:e=>O({advanced:{...g.settings.advanced,projectTrust:e.target.value}},`保存信任策略…`),value:g.settings.advanced.projectTrust,children:[(0,z.jsx)(`option`,{value:`ask`,children:`每次询问`}),(0,z.jsx)(`option`,{value:`always`,children:`始终信任`}),(0,z.jsx)(`option`,{value:`never`,children:`从不信任`})]})]}),(0,z.jsxs)(`label`,{className:`config-field`,children:[(0,z.jsx)(`span`,{children:`Mermaid 渲染`}),(0,z.jsxs)(`select`,{disabled:S,onChange:e=>O({advanced:{...g.settings.advanced,mermaid:e.target.value}},`保存 Mermaid 设置…`),value:g.settings.advanced.mermaid,children:[(0,z.jsx)(`option`,{value:`off`,children:`关闭`}),(0,z.jsx)(`option`,{value:`final`,children:`完成后渲染`}),(0,z.jsx)(`option`,{value:`streaming`,children:`流式渲染`})]})]}),(0,z.jsxs)(`label`,{className:`config-field`,children:[(0,z.jsx)(`span`,{children:`双击 Escape`}),(0,z.jsxs)(`select`,{disabled:S,onChange:e=>O({advanced:{...g.settings.advanced,doubleEscapeAction:e.target.value}},`保存快捷键设置…`),value:g.settings.advanced.doubleEscapeAction,children:[(0,z.jsx)(`option`,{value:`tree`,children:`打开会话树`}),(0,z.jsx)(`option`,{value:`fork`,children:`创建分支`}),(0,z.jsx)(`option`,{value:`none`,children:`不执行`})]})]})]}),(0,z.jsxs)(`section`,{className:`config-section`,children:[(0,z.jsxs)(`header`,{children:[(0,z.jsx)(`strong`,{children:`诊断与隐私`}),(0,z.jsx)(`small`,{children:`控制缓存提示和匿名数据上报`})]}),(0,z.jsxs)(`label`,{className:`config-toggle`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:`显示缓存未命中`}),(0,z.jsx)(`small`,{children:`在消息中显示模型缓存诊断`})]}),(0,z.jsx)(`input`,{checked:g.settings.advanced.showCacheMissNotices,disabled:S,onChange:e=>O({advanced:{...g.settings.advanced,showCacheMissNotices:e.target.checked}},`保存诊断设置…`),type:`checkbox`})]}),(0,z.jsxs)(`label`,{className:`config-toggle`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:`安装遥测`}),(0,z.jsx)(`small`,{children:`发送匿名安装和版本统计`})]}),(0,z.jsx)(`input`,{checked:g.settings.advanced.enableInstallTelemetry,disabled:S,onChange:e=>O({advanced:{...g.settings.advanced,enableInstallTelemetry:e.target.checked}},`保存隐私设置…`),type:`checkbox`})]})]})]}):(0,z.jsx)(`div`,{className:`empty-state`,children:`正在读取运行时配置…`})]})]})]})]})})}var vt=(e,t)=>{let n=t.trim().toLowerCase();return e.filter(e=>`${e.invocationName} ${e.description??``}`.toLowerCase().includes(n))};function yt({commands:e,query:t,activeIndex:n,onActiveIndexChange:r,onUse:i}){let a=vt(e,t),o=e=>{let t=a[e];t&&i(`/${t.invocationName}`)};return(0,z.jsx)(`div`,{"aria-label":`命令面板`,className:`command-palette`,id:`command-menu`,role:`listbox`,children:(0,z.jsxs)(`div`,{className:`palette-group`,children:[(0,z.jsxs)(`small`,{children:[`COMMANDS `,(0,z.jsx)(`span`,{children:`· RUNTIME REGISTRY`})]}),a.length?a.map((e,t)=>{let i=`/${e.invocationName}`;return(0,z.jsxs)(`button`,{"aria-selected":t===n,onClick:()=>o(t),onMouseEnter:()=>r(t),role:`option`,type:`button`,children:[(0,z.jsx)(`code`,{children:i}),(0,z.jsx)(`span`,{children:e.description??e.source??`由当前运行时注册`})]},`${e.invocationName}:${e.source??`runtime`}`)}):(0,z.jsx)(`div`,{className:`empty-state`,children:e.length?`没有匹配的命令。`:`当前运行时没有可用的命令注册清单。`})]})})}function bt({kind:e,commands:t,files:n,query:r,activeIndex:i,onActiveIndexChange:a,onUse:o}){let s=e===`command`?vt(t,r).slice(0,12):n.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(r.trim().toLowerCase())).slice(0,12);return(0,z.jsxs)(`div`,{"aria-label":e===`command`?`命令补全`:`文件补全`,className:`prompt-completion`,role:`listbox`,children:[(0,z.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,z.jsxs)(`button`,{"aria-selected":n===i,onClick:()=>o(r),onMouseEnter:()=>a(n),role:`option`,type:`button`,children:[(0,z.jsx)(`strong`,{children:r}),(0,z.jsx)(`span`,{children:s})]},`${e}:${r}`)}):(0,z.jsx)(`span`,{className:`prompt-completion-empty`,children:`没有匹配项`})]})}function xt({commands:e,sessions:t,files:n,onClose:r,onUse:i,onOpenSession:o,onOpenFile:s}){let[c,l]=(0,a.useState)(``),[u,d]=(0,a.useState)(0),f=W(!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(`${U(e.name,``)} ${U(e.firstMessage,``)} ${U(e.sessionId,``)}`)).map(e=>({kind:`session`,session:e})),...n.filter(e=>m(`${e.path} ${e.label} ${e.status}`)).map(e=>({kind:`file`,file:e}))];(0,a.useEffect)(()=>d(0),[c]);let g=e=>{e&&(e.kind===`command`?i(`/${e.command.invocationName}`):e.kind===`session`?o(e.session):s(e.file),r())};return(0,z.jsx)(`div`,{className:`global-search`,onClick:e=>{e.target===e.currentTarget&&r()},children:(0,z.jsxs)(`div`,{"aria-label":`全局搜索`,"aria-modal":`true`,className:`global-search-dialog`,ref:f,role:`dialog`,tabIndex:-1,children:[(0,z.jsxs)(`div`,{className:`global-search-heading`,children:[(0,z.jsx)(`strong`,{children:`全局搜索`}),(0,z.jsx)(`small`,{children:`命令 · 会话 · 文件`})]}),(0,z.jsx)(`input`,{"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(),g(h[u]))},placeholder:`搜索命令、会话或文件`,value:c}),(0,z.jsx)(`div`,{className:`global-search-results`,role:`listbox`,children:h.length?[`command`,`session`,`file`].map(e=>{let t=h.filter(t=>t.kind===e);return t.length?(0,z.jsxs)(`section`,{className:`global-search-group`,children:[(0,z.jsx)(`small`,{children:e===`command`?`命令`:e===`session`?`会话`:`文件`}),t.map(e=>{let t=h.indexOf(e),n=e.kind===`command`?`/${e.command.invocationName}`:e.kind===`session`?U(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`?`${U(e.session.messageCount,`0`)} 条消息`:`${e.file.path} · ${e.file.status}`;return(0,z.jsxs)(`button`,{"aria-selected":t===u,onClick:()=>g(e),onMouseEnter:()=>d(t),role:`option`,type:`button`,children:[(0,z.jsx)(`strong`,{children:n}),(0,z.jsx)(`span`,{children:r})]},`${e.kind}:${n}:${t}`)})]},e):null}):(0,z.jsx)(`div`,{className:`empty-state`,children:`没有匹配的命令、会话或文件。`})})]})})}function St({api:e=Ce(),appVersion:t}){let n=(0,a.useMemo)($e,[]),[r,i]=(0,a.useState)({sessions:[],files:[],models:[],providers:[],plugins:[],pluginPanels:[],marketplace:[],marketplaceCapabilities:[],marketplaceCategories:[],marketplaceTotal:0,marketplacePage:0,marketplaceHasNext:!1,commands:[],workspaces:[]}),[o,s]=(0,a.useState)(n.view),[c,l]=(0,a.useState)(n.page),[u,d]=(0,a.useState)(n.settings),[f,p]=(0,a.useState)(),[m,h]=(0,a.useState)(!1),[g,_]=(0,a.useState)(!1),[v,y]=(0,a.useState)(``),[b,x]=(0,a.useState)(0),[S,C]=(0,a.useState)(!1),[w,T]=(0,a.useState)(),[E,D]=(0,a.useState)(!1),[O,ee]=(0,a.useState)(!1),[k,A]=(0,a.useState)(),[te,ne]=(0,a.useState)(``),[re,j]=(0,a.useState)(!1),[ie,ae]=(0,a.useState)(``),[oe,se]=(0,a.useState)(),[M,N]=(0,a.useState)(n.sessionPath),ce=(0,a.useRef)(n.sessionPath),le=(0,a.useRef)(!1),[P,F]=(0,a.useState)(``),[I,ue]=(0,a.useState)([]),[de,fe]=(0,a.useState)(``),[pe,me]=(0,a.useState)(``),[he,ge]=(0,a.useState)(``),_e=(0,a.useRef)(null),[L,ve]=(0,a.useState)(n.marketplaceQuery),[ye,be]=(0,a.useState)(n.marketplaceCapability),[xe,R]=(0,a.useState)(n.marketplaceCategory),[B,Ee]=(0,a.useState)(n.marketplacePlugin),[Oe,ke]=(0,a.useState)(),[Ae,Ne]=(0,a.useState)(n.marketplacePlugin!==void 0),[Fe,V]=(0,a.useState)(``),[Ie,Re]=(0,a.useState)([]),[H,ze]=(0,a.useState)(n.installedPlugin),[Be,Ve]=(0,a.useState)(),[He,We]=(0,a.useState)(n.marketplacePage),[Ge,Ke]=(0,a.useState)(!0),[qe,Je]=(0,a.useState)(!1),[Ye,W]=(0,a.useState)(``),[G,Ze]=(0,a.useState)(!1),[it,dt]=(0,a.useState)(``),[K,ft]=(0,a.useState)(!1),[St,Ct]=(0,a.useState)(!1),[wt,Tt]=(0,a.useState)(0),[Et,Dt]=(0,a.useState)(0),[Ot,kt]=(0,a.useState)(!1),[q,At]=(0,a.useState)(new Set),jt=(0,a.useRef)(null),[J,Mt]=(0,a.useState)(),Nt=(0,a.useRef)(null),Pt=(0,a.useRef)(null),Ft=(0,a.useRef)(!0),It=(0,a.useRef)(void 0),Lt=(0,a.useRef)(!1),[Rt,zt]=(0,a.useState)(0),[Bt,Vt]=(0,a.useState)(!1),[Ht,Ut]=(0,a.useState)(0),[Wt,Gt]=(0,a.useState)(!0),[Kt,qt]=(0,a.useState)([]);(0,a.useEffect)(()=>{let t=!1;return Ue(e).then(e=>{t||Re(e)}).catch(()=>{t||Re([])}),()=>{t=!0}},[e]),(0,a.useEffect)(()=>{!M&&r.session?.sessionFile&&N(r.session.sessionFile)},[r.session?.sessionFile,M]);let Y=(0,a.useMemo)(()=>we(P,Rt),[P,Rt]),Jt=(0,a.useMemo)(()=>Y?Y.kind===`command`?vt(r.commands,Y.query).slice(0,12):r.files.filter(e=>`${e.path} ${e.label} ${e.status}`.toLowerCase().includes(Y.query.trim().toLowerCase())).slice(0,12):[],[r.commands,r.files,Y]),Yt=!!(Y&&!Bt&&Jt.length),Xt=(0,a.useMemo)(()=>new Set(r.plugins.filter(e=>e.removable).map(e=>e.name)),[r.plugins]),Zt=!re&&!!(oe||r.status?.cwd||r.workspaces.find(e=>e.current)?.path||r.session),Qt=(0,a.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,a.useEffect)(()=>{Ut(0)},[Y?.kind,Y?.query]),(0,a.useEffect)(()=>{if(typeof window>`u`)return;let e=new URLSearchParams(window.location.search);e.set(`page`,c),o===`chat`?e.delete(`view`):e.set(`view`,o),u?e.set(`settings`,u):e.delete(`settings`),M?e.set(`session`,M):e.delete(`session`),L?e.set(`marketplaceQuery`,L):e.delete(`marketplaceQuery`),ye?e.set(`capability`,ye):e.delete(`capability`),xe?e.set(`category`,xe):e.delete(`category`),c===`plugins`&&H?e.set(`plugin`,H):c===`marketplace`&&B?e.set(`plugin`,B):e.delete(`plugin`),He>0?e.set(`marketplacePage`,String(He)):e.delete(`marketplacePage`);let t=e.toString();window.history.replaceState(null,``,`${window.location.pathname}${t?`?${t}`:``}${window.location.hash}`)},[H,ye,xe,He,B,L,c,M,u,o]),(0,a.useEffect)(()=>{let e=()=>{let e=$e();h(!1),_(!1),C(!1),p(void 0),l(e.page),s(e.view),d(e.settings),N(e.sessionPath),ve(e.marketplaceQuery),be(e.marketplaceCapability),R(e.marketplaceCategory),We(e.marketplacePage),ze(e.installedPlugin),Ee(e.marketplacePlugin)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]),(0,a.useEffect)(()=>{if(B===void 0){ke(void 0),Ne(!1),V(``);return}let t=r.marketplace.find(e=>e.id===B);if(t!==void 0){ke(t),Ne(!1),V(``);return}let n=!1;return ke(void 0),Ne(!0),V(``),e.listMarketplace(``,``,0,100).then(e=>{if(n)return;let t=e.items.find(e=>e.id===B);t===void 0?V(`没有找到这个市场插件,它可能已下架。`):ke(t)}).catch(e=>{n||V(e instanceof Error?e.message:String(e))}).finally(()=>{n||Ne(!1)}),()=>{n=!0}},[e,r.marketplace,B]),(0,a.useEffect)(()=>{if(H===void 0){Ve(void 0);return}let t=!1;return Ve(void 0),e.listMarketplace(``,``,0,100).then(e=>{t||Ve(e.items.find(e=>e.packageName===H))}).catch(()=>{t||Ve(void 0)}),()=>{t=!0}},[e,H]);let X=(0,a.useCallback)(async()=>{let t=await Promise.allSettled([e.getStatus(),e.getSession(),e.listSessions(wt,30,St),e.getFiles(),e.listModels(),e.listProviders(),e.listPlugins(),e.listPluginPanels(),e.listMarketplace(L,ye,He,24,xe),e.listCommands(),e.listWorkspaces()]),[n,r,a,o,s,c,l,u,d,f,p]=t;qt(Se([`运行状态`,`当前会话`,`会话列表`,`文件`,`模型`,`提供商`,`插件`,`插件面板`,`插件市场`,`命令`,`工作区`],t)),Gt(!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`&&(Dt(a.value.total),kt(a.value.hasNext))},[e,St,ye,xe,He,L,wt]),$t=(0,a.useCallback)(()=>{Lt.current=!0,It.current===void 0&&(It.current=window.setTimeout(()=>{It.current=void 0,Lt.current&&(Lt.current=!1,X())},100))},[X]),en=(0,a.useCallback)(e=>{$t();let t=e.event;if(typeof t!=`object`||!t)return;let n=t;if(n.type===`turn_start`){Mt({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&&Mt(e=>({thinking:(e?.thinking??``)+(i===`thinking_delta`?a:``),text:(e?.text??``)+(i===`text_delta`?a:``)}))},[$t]),tn=(0,a.useCallback)(async t=>{W(``),ae(``);try{let n=await e.createSession(t?.path);n.sessionFile&&N(n.sessionFile),d(void 0),h(!1),_(!1),p(void 0),j(!1),se(t?.path),y(``),l(`session`),s(`chat`),C(!1),await X()}catch(e){let n=e instanceof Error?e.message:String(e);t?ae(n):W(n)}},[e,X]),nn=()=>{W(``),ae(``),se(void 0),j(!0)},rn=(0,a.useCallback)(async()=>{try{let t=await e.pickDirectory(),n=t.split(/[\\/]/).filter(Boolean).pop()??t;await tn({path:t,branch:`directory`,current:!1,name:n})}catch(e){ae(e instanceof Error?e.message:String(e))}},[e,tn]),an=(0,a.useCallback)(async()=>{await rn()},[rn]);(0,a.useEffect)(()=>{X();let t=e.subscribeEvents(en),n=window.setInterval(()=>void X(),5e3);return()=>{t(),window.clearInterval(n),It.current!==void 0&&(window.clearTimeout(It.current),It.current=void 0)}},[e,en,X]),(0,a.useEffect)(()=>{r.status?.status!==`running`&&Mt(void 0)},[r.status?.status]),(0,a.useEffect)(()=>{let t=ce.current;if(!t||le.current||r.sessions.length===0)return;le.current=!0;let n=r.sessions.find(e=>e.path===t);if(!n||typeof n.path!=`string`){N(void 0);return}r.session?.sessionFile!==n.path&&e.openSession(n.path).then(X).catch(e=>W(e instanceof Error?e.message:String(e)))},[e,r.session?.sessionFile,r.sessions,X]),(0,a.useEffect)(()=>{if(x(0),!m)return;let e=window.requestAnimationFrame(()=>_e.current?.focus());return()=>window.cancelAnimationFrame(e)},[m,v]),(0,a.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){if(k){A(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),D(!1),j(!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,k]);let on=r.session?.events??[],sn=(0,a.useMemo)(()=>De(on),[on]);(0,a.useEffect)(()=>{if(!Ft.current)return;let e=window.requestAnimationFrame(()=>{let e=Pt.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[r.session?.messages.length,r.status?.events,it,G]);let cn=r.sessions.filter(e=>!he||U(e.name??e.firstMessage,`未命名会话`).toLowerCase().includes(he.toLowerCase())),ln=t=>{t.preventDefault();let n=P.trim(),r=I.length>0?Le(I,n):n;!r||G||(F(``),W(``),dt(r),Mt(void 0),Ft.current=!0,Ze(!0),e.prompt(r).then(async()=>{ue([]),await X()}).catch(e=>W(e instanceof Error?e.message:String(e))).finally(()=>dt(``)).finally(()=>Ze(!1)))},un=()=>{window.requestAnimationFrame(()=>{let e=window.getSelection()?.toString().trim()??``;e.length>0&&fe(e.slice(0,4e3))})},dn=()=>{let e=de.trim();e&&(ue(t=>[...t,{id:t.length===0?1:Math.max(...t.map(e=>e.id))+1,quote:e,note:pe.trim()}]),fe(``),me(``))},fn=t=>{let n=typeof t.path==`string`?t.path:``;n&&(d(void 0),h(!1),_(!1),l(`session`),s(`chat`),p(void 0),N(n),e.openSession(n).then(X).catch(e=>W(e instanceof Error?e.message:String(e))))},Z=async e=>{if(!K){ft(!0),W(``);try{await e(),await X(),At(new Set),C(!1),T(void 0),D(!1),ee(!1),A(void 0)}catch(e){W(e instanceof Error?e.message:String(e))}finally{ft(!1)}}},Q=r.session?.sessionFile,pn=e=>{At(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},mn=(e,t)=>{N(e),ne(t??``),T(e),C(!0)},hn=()=>{C(!1),T(void 0)},gn=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`),ze(e),Ee(void 0)},_n=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`),ze(void 0),Ee(e)},vn=H===void 0?void 0:r.plugins.find(e=>e.name===H),yn=H===void 0?void 0:r.pluginPanels.find(e=>e.pluginId===H),bn=u?(0,z.jsx)(_t,{api:e,data:r,tab:u,onTab:d,onRefresh:X,onClose:()=>{d(void 0),l(`session`),s(`chat`),p(void 0)}}):c===`plugins`&&H&&vn?(0,z.jsx)(mt,{metadata:Be,onBack:()=>gn(void 0),onToggle:async t=>{await e.togglePlugin(t.id,!t.enabled),await X()},onUninstall:async t=>{await e.uninstallPlugin(t.id);let n=await e.listPlugins();i(e=>({...e,plugins:n.filter(e=>e.id!==t.id)})),gn(void 0)},panel:yn,plugin:vn}):c===`plugins`&&H?(0,z.jsxs)(`section`,{className:`view-panel min-w-0 overflow-auto bg-[#f8f9fb]`,children:[(0,z.jsxs)(`div`,{className:`subnav plugin-detail-subnav bg-white`,children:[(0,z.jsx)(`a`,{href:`?page=plugins`,onClick:e=>{e.preventDefault(),gn(void 0)},children:`← 已安装插件`}),(0,z.jsx)(`span`,{children:`插件详情`})]}),(0,z.jsx)(`div`,{className:`empty-state`,children:r.status?`没有找到这个已安装插件,它可能已被移除。`:`正在读取插件详情…`})]}):c===`plugins`?(0,z.jsx)(pt,{plugins:r.plugins,panels:r.pluginPanels,catalog:Ie.length?Ie:r.marketplace,onMarketplace:()=>_n(void 0),onOpenDetail:e=>gn(e.name),onToml:()=>{p(void 0),d(`toml`)},onToggle:async t=>{await e.togglePlugin(t.id,!t.enabled),await X()},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`?B&&Oe?.id===B?(0,z.jsx)(gt,{plugin:Oe,installed:Xt.has(Oe.packageName),onBack:()=>_n(void 0),onInstall:async t=>{let n=await e.installMarketplace(t.id);return await X(),n}}):B?(0,z.jsx)(`section`,{className:`marketplace-page flex min-w-0 flex-1 flex-col`,children:(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:[(0,z.jsxs)(`div`,{className:`subnav plugin-detail-subnav`,children:[(0,z.jsx)(`a`,{href:`?page=marketplace`,onClick:e=>{e.preventDefault(),_n(void 0)},children:`← 插件市场`}),(0,z.jsx)(`span`,{children:`插件详情`})]}),(0,z.jsx)(`div`,{className:`empty-state`,children:Ae?`正在读取插件详情…`:Fe||`没有找到这个市场插件,它可能已下架。`})]})}):(0,z.jsx)(ht,{plugins:r.marketplace,capabilities:r.marketplaceCapabilities,categories:r.marketplaceCategories,total:r.marketplaceTotal,page:r.marketplacePage,hasNext:r.marketplaceHasNext,query:L,capabilityFilter:ye,categoryFilter:xe,onQueryChange:e=>{ve(e),We(0)},onCapabilityChange:e=>{be(e),We(0)},onCategoryChange:e=>{R(e),We(0)},onOpenDetail:e=>_n(e.id),onPageChange:We,onBack:()=>gn(void 0),onToml:()=>{p(void 0),d(`toml`)},installedPackages:Xt,onInstall:async t=>{let n=await e.installMarketplace(t.id);return await X(),n}}):o===`chat`?(0,z.jsxs)(`section`,{className:`view-panel chat-view`,children:[(0,z.jsxs)(`div`,{className:`chat-scroll ${r.session?.messages.length?``:`is-empty`}`,onScroll:e=>{let t=e.currentTarget;Ft.current=t.scrollHeight-t.scrollTop-t.clientHeight<120},ref:Pt,children:[r.session?.messages.length?Pe(r.session.messages).map((e,t)=>(0,z.jsx)(`article`,{className:`turn ${e.role===`user`?`user`:`text`}`,children:e.role===`user`?(0,z.jsx)(st,{text:e.text}):(0,z.jsxs)(z.Fragment,{children:[e.thinking&&(0,z.jsxs)(`details`,{className:`reasoning message-reasoning`,children:[(0,z.jsx)(`summary`,{className:`reasoning-head`,children:`思考`}),(0,z.jsx)(`div`,{className:`reasoning-body`,children:(0,z.jsx)(je,{text:e.thinking})})]}),e.text&&(0,z.jsx)(je,{onMouseUp:un,text:e.text})]})},t)):(0,z.jsx)(tt,{status:r.status,workspaces:r.workspaces,onCreate:e=>void tn(e),onStarter:F,onToml:()=>{p(void 0),d(`toml`)}}),J&&r.status?.status===`running`&&(0,z.jsxs)(`article`,{className:`turn text streaming-turn`,"aria-live":`polite`,children:[J.thinking&&(0,z.jsxs)(`details`,{className:`reasoning message-reasoning`,children:[(0,z.jsx)(`summary`,{className:`reasoning-head`,children:`思考中…`}),(0,z.jsx)(`div`,{className:`reasoning-body`,children:(0,z.jsx)(je,{text:J.thinking})})]}),!J.thinking&&!J.text&&(0,z.jsx)(`div`,{className:`streaming-placeholder`,children:`正在生成…`}),J.text&&(0,z.jsx)(je,{onMouseUp:un,text:J.text})]}),it&&!r.session?.messages.some(e=>e.role===`user`&&Me(e)===it)&&(0,z.jsx)(`article`,{className:`turn user pending-turn`,children:(0,z.jsx)(st,{text:it})})]}),(0,z.jsxs)(`div`,{className:`composer-wrap`,children:[(0,z.jsxs)(`div`,{className:`context-line`,children:[(0,z.jsx)(`span`,{className:`context-label`,children:`实时上下文`}),(0,z.jsxs)(`div`,{className:`context-metrics`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:r.status?.messages??0}),` 条消息`]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{children:r.status?.events??on.length}),` 个事件`]}),(0,z.jsx)(`span`,{children:(0,z.jsx)(`b`,{children:U(r.status?.model)})})]}),(0,z.jsx)(`button`,{"aria-expanded":qe,onClick:()=>Je(e=>!e),type:`button`,children:qe?`收起`:`展开`})]}),qe&&(0,z.jsxs)(`div`,{className:`context-breakdown`,role:`status`,children:[(0,z.jsxs)(`span`,{children:[`消息 `,(0,z.jsx)(`b`,{children:r.status?.messages??0})]}),(0,z.jsxs)(`span`,{children:[`运行时事件 `,(0,z.jsx)(`b`,{children:r.status?.events??on.length})]}),(0,z.jsxs)(`span`,{children:[`模型 `,(0,z.jsx)(`b`,{children:U(r.status?.model)})]})]}),(0,z.jsxs)(`div`,{className:`composer-stack`,children:[Ye&&(0,z.jsx)(ot,{message:Ye}),de?(0,z.jsxs)(`div`,{"aria-label":`添加批注`,className:`rounded-lg border border-[#cdddf8] bg-[#f6f8ff] px-3 py-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,z.jsx)(`span`,{className:`mt-0.5 shrink-0 rounded bg-[#dce9ff] px-1.5 py-0.5 text-[10px] text-[#315fb8]`,children:`选中片段`}),(0,z.jsx)(`p`,{className:`max-h-16 flex-1 overflow-auto whitespace-pre-wrap text-[11px] text-[#30343b]`,children:de}),(0,z.jsx)(`button`,{"aria-label":`取消批注`,className:`text-[12px] text-[#687381]`,onClick:()=>fe(``),type:`button`,children:`×`})]}),(0,z.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,z.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=>me(e.target.value),placeholder:`备注(可选)`,value:pe}),(0,z.jsx)(`button`,{className:`rounded-md bg-[#3565c5] px-3 py-1.5 text-[11px] font-medium text-white`,onClick:dn,type:`button`,children:`加入批注`})]})]}):null,I.length>0?(0,z.jsxs)(`div`,{className:`flex items-center gap-2 overflow-x-auto text-[10px]`,children:[(0,z.jsxs)(`span`,{className:`shrink-0 rounded-md bg-[#edf3fe] px-2 py-1 font-medium text-[#315fb8]`,children:[`批注 ×`,I.length]}),I.map(e=>(0,z.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:()=>ue(t=>t.filter(t=>t.id!==e.id)),title:`点击移除批注`,type:`button`,children:[`#`,e.id,` `,e.quote]},e.id)),(0,z.jsx)(`button`,{className:`shrink-0 text-[#687381]`,onClick:()=>ue([]),type:`button`,children:`清空`})]}):null,(0,z.jsxs)(`form`,{className:`composer`,onSubmit:ln,children:[(0,z.jsx)(`textarea`,{"aria-label":`Prompt`,onChange:e=>{F(e.target.value),zt(e.currentTarget.selectionStart??e.target.value.length),Vt(!1),e.currentTarget.style.height=`auto`,e.currentTarget.style.height=`${Math.min(e.currentTarget.scrollHeight,180)}px`},onKeyDown:e=>{let t=e.currentTarget.selectionStart??P.length,n=we(e.currentTarget.value,t),i=n?n.kind===`command`?vt(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&&!Bt&&i.length);if(a&&(e.key===`ArrowDown`||e.key===`ArrowUp`)){e.preventDefault(),Ut(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[Ht];if(t&&n){let r=n.kind===`command`?`/${t.invocationName}`:`@${t.path}`,i=Te(e.currentTarget.value,n,`${r} `);F(i.text),zt(i.caret),Vt(!1),requestAnimationFrame(()=>{let e=Nt.current;e?.focus(),e?.setSelectionRange(i.caret,i.caret)})}return}if(e.key===`Escape`&&n&&!Bt){e.preventDefault(),Vt(!0);return}(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},onClick:()=>{Zt||j(!0)},onFocus:e=>{Zt||(e.currentTarget.blur(),j(!0))},placeholder:Zt?`描述要做的改动,⌘↵ 发送;@ 引用文件,/ 调用命令`:`先选择工作区,再描述要做的改动`,readOnly:!Zt,ref:Nt,rows:2,value:P}),Yt&&Y&&(0,z.jsx)(bt,{activeIndex:Ht,commands:r.commands,files:r.files,kind:Y.kind,onActiveIndexChange:Ut,onUse:e=>{let t=Te(P,Y,`${e} `);F(t.text),zt(t.caret),Vt(!1),requestAnimationFrame(()=>{let e=Nt.current;e?.focus(),e?.setSelectionRange(t.caret,t.caret)})},query:Y.query}),(0,z.jsxs)(`div`,{className:`composer-tools`,children:[(0,z.jsx)(`select`,{"aria-label":`模型`,disabled:!r.models.length||G,value:r.status?.model??``,onChange:t=>{let[n,r]=t.target.value.split(`/`);n&&r&&e.selectModel(n,r)},children:r.models.length?r.models.map(e=>(0,z.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,z.jsx)(`option`,{value:``,children:`暂无可用模型`})}),(0,z.jsxs)(`button`,{className:`tool-chip`,onClick:()=>Ke(e=>!e),type:`button`,children:[`● `,Ge?`改动前询问`:`自动允许`]}),(0,z.jsx)(`button`,{className:`tool-chip`,onClick:()=>h(!0),type:`button`,children:`/ 命令`}),(0,z.jsx)(`span`,{className:`composer-hint`,children:`⌘↵ 发送 · ⌘K 命令 · ⌃C 中断`}),(0,z.jsx)(`button`,{"aria-label":G?`发送中`:`发送消息`,className:`send-button`,disabled:G||!P.trim(),title:G?`正在发送`:`发送消息(⌘↵)`,type:`submit`,children:G?`…`:`↑`})]})]})]})]})]}):o===`trajectory`?(0,z.jsx)(lt,{events:sn,onSelect:p}):(0,z.jsx)(ut,{api:e,files:r.files,onDiff:t=>void e.getFileDiff(t).then(e=>p({type:`file_diff`,path:e.path,output:e.diff})),onRefresh:()=>void X()}),xn=et(cn),Sn=!!(r.session&&!he&&!cn.some(e=>e.sessionId===r.session?.sessionId)),Cn=vt(r.commands,v),wn=r.pluginPanels.find(e=>e.id===`better-sidebar-panel`),$=wn?.data!==null&&typeof wn?.data==`object`&&!Array.isArray(wn?.data)?wn.data:void 0,Tn=r.pluginPanels.find(e=>e.id===`theme-studio-panel`),En=Tn?.data!==null&&typeof Tn?.data==`object`&&!Array.isArray(Tn?.data)?Tn.data:void 0,Dn=(0,a.useMemo)(()=>{if(!En?.tokens||typeof En.tokens!=`object`||Array.isArray(En.tokens))return;let e=Object.entries(En.tokens).filter(([e,t])=>e.startsWith(`--`)&&typeof t==`string`);return e.length?Object.fromEntries(e):void 0},[En]),On=typeof En?.theme==`string`?En.theme:void 0,kn=e=>{F(e),h(!1),y(``)};return(0,z.jsxs)(`div`,{className:`app-frame`,"data-theme":On,style:Dn,children:[(0,z.jsxs)(`aside`,{className:`sidebar`,children:[(0,z.jsxs)(`header`,{className:`brand-row`,children:[(0,z.jsx)(`span`,{className:`pi-mark`,"aria-hidden":`true`,children:(0,z.jsx)(`img`,{src:`/icons/svg/mark-white.svg`,alt:``})}),(0,z.jsx)(`strong`,{children:`pi harness`}),t?(0,z.jsx)(`span`,{className:`version`,children:t}):null]}),(0,z.jsxs)(`div`,{className:`sidebar-actions`,children:[(0,z.jsx)(`button`,{className:`new-session`,onClick:nn,type:`button`,"aria-expanded":re,children:`+ 新建会话`}),(0,z.jsxs)(`div`,{className:`session-search`,children:[(0,z.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?/,``)):ge(t)},onKeyDown:e=>{m&&(e.key===`ArrowDown`&&Cn.length?(e.preventDefault(),x(e=>(e+1)%Cn.length)):e.key===`ArrowUp`&&Cn.length?(e.preventDefault(),x(e=>(e-1+Cn.length)%Cn.length)):e.key===`Enter`&&Cn.length&&(e.preventDefault(),kn(`/${Cn[b]?.invocationName??``}`)))},placeholder:m?`输入命令名称或描述`:`搜索会话 · ⌘K 命令`,ref:_e,type:`search`,value:m?`/${v}`:he}),m&&(0,z.jsx)(yt,{activeIndex:b,commands:r.commands,onActiveIndexChange:x,onUse:kn,query:v})]}),(0,z.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&&Z(async()=>{let t=await e.importSession(await n.text(),n.name);t.sessionFile&&N(t.sessionFile)})},ref:jt,type:`file`})]}),(0,z.jsxs)(`div`,{className:`session-list-toolbar`,children:[(0,z.jsxs)(`div`,{className:`session-list-title`,children:[(0,z.jsx)(`strong`,{children:`会话`}),(0,z.jsx)(`span`,{children:Et||r.sessions.length})]}),(0,z.jsxs)(`div`,{className:`session-list-tools`,children:[(0,z.jsx)(`button`,{"aria-pressed":O,className:`session-tool-button ${O?`active`:``}`,onClick:()=>{ee(e=>!e),At(new Set)},type:`button`,children:O?`完成`:`选择`}),(0,z.jsxs)(`div`,{className:`session-tools-wrap`,children:[(0,z.jsx)(`button`,{"aria-expanded":E,"aria-label":`会话工具`,className:`session-tool-button icon`,onClick:()=>D(e=>!e),type:`button`,children:`⋯`}),E&&(0,z.jsxs)(`div`,{className:`session-tools-popover`,children:[(0,z.jsx)(`button`,{onClick:()=>window.location.reload(),type:`button`,children:`刷新列表`}),(0,z.jsx)(`button`,{onClick:()=>jt.current?.click(),type:`button`,children:`导入会话`}),(0,z.jsx)(`button`,{disabled:!Q||K,onClick:()=>{Q&&Z(async()=>{let t=await e.exportSession(Q),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=`${r.session?.sessionId??`session`}.jsonl`,n.click(),URL.revokeObjectURL(n.href)})},type:`button`,children:`导出当前会话`}),(0,z.jsx)(`button`,{onClick:()=>{Ct(e=>!e),D(!1),X()},type:`button`,children:St?`隐藏归档会话`:`显示归档会话`})]})]})]})]}),O&&q.size>0&&(0,z.jsxs)(`div`,{className:`session-batch-bar`,children:[(0,z.jsxs)(`span`,{children:[q.size,` 个已选择`]}),(0,z.jsx)(`button`,{onClick:()=>void Z(()=>e.batchSessions(`archive`,[...q]).then(()=>void 0)),type:`button`,children:`归档`}),(0,z.jsx)(`button`,{onClick:()=>void Z(()=>e.batchSessions(`pin`,[...q]).then(()=>void 0)),type:`button`,children:`置顶`}),(0,z.jsx)(`button`,{className:`danger`,onClick:()=>{A(`batch-delete`)},type:`button`,children:`删除`})]}),(0,z.jsxs)(`div`,{className:`sidebar-scroll`,children:[Sn&&r.session&&(0,z.jsxs)(`div`,{className:`session-group`,children:[(0,z.jsx)(`div`,{className:`group-label`,children:`当前`}),(0,z.jsxs)(`div`,{className:`session-row-wrap current-session-row`,children:[O&&(0,z.jsx)(`input`,{"aria-label":`选择当前会话`,checked:Q?q.has(Q):!1,onChange:()=>Q&&pn(Q),type:`checkbox`}),(0,z.jsxs)(`button`,{className:`session-row active`,onClick:()=>{d(void 0),h(!1),_(!1),l(`session`),s(`chat`),p(void 0),C(!1),X()},type:`button`,children:[(0,z.jsx)(`span`,{className:`session-dot ok`}),(0,z.jsxs)(`span`,{className:`session-copy`,children:[(0,z.jsx)(`strong`,{children:r.session.messages.length?r.session.sessionId.slice(0,12):`新会话`}),(0,z.jsxs)(`small`,{children:[r.session.messages.length,` 条消息`]})]})]}),!O&&Q&&(0,z.jsx)(`button`,{"aria-label":`当前会话操作`,className:`session-row-more`,onClick:()=>mn(Q,r.session?.messages.length?r.session?.sessionId.slice(0,12):`新会话`),type:`button`,children:`⋯`}),!O&&Q&&w===Q&&S&&(0,z.jsx)(at,{busy:K,onArchive:()=>{hn(),A(`archive`)},onDelete:()=>{hn(),A(`delete`)},onFork:()=>void Z(async()=>{let t=await e.forkSession(Q);t.sessionFile&&(N(t.sessionFile),await e.openSession(t.sessionFile))}),onRename:()=>{hn(),A(`rename`)}})]})]}),xn.length?xn.map(([t,n])=>(0,z.jsxs)(`div`,{className:`session-group`,children:[(0,z.jsx)(`div`,{className:`group-label`,children:t}),n.map((t,n)=>(0,z.jsxs)(`div`,{className:`session-row-wrap`,children:[O&&(0,z.jsx)(`input`,{"aria-label":`选择会话 ${U(t.name??t.firstMessage,`未命名会话`)}`,checked:typeof t.path==`string`&&q.has(t.path),onChange:()=>{typeof t.path==`string`&&pn(t.path)},type:`checkbox`}),(0,z.jsxs)(`button`,{className:`session-row ${t.sessionId===r.session?.sessionId?`active`:``}`,onClick:()=>fn(t),type:`button`,children:[(0,z.jsx)(`span`,{className:`session-dot ok`}),(0,z.jsxs)(`span`,{className:`session-copy`,children:[(0,z.jsx)(`strong`,{children:U(t.name??t.firstMessage,`未命名会话`)}),(0,z.jsxs)(`small`,{children:[U(t.messageCount,`0`),` 条消息`,t.pinned===!0?` · 已置顶`:``,t.archived===!0?` · 已归档`:``]})]})]}),!O&&typeof t.path==`string`&&(0,z.jsx)(`button`,{"aria-label":`会话操作 ${U(t.name??t.firstMessage,`未命名会话`)}`,className:`session-row-more`,onClick:e=>{e.stopPropagation(),mn(t.path,U(t.name??t.firstMessage,``))},type:`button`,children:`⋯`}),!O&&typeof t.path==`string`&&w===t.path&&S&&(0,z.jsx)(at,{busy:K,onArchive:()=>{hn(),A(`archive`)},onDelete:()=>{hn(),A(`delete`)},onFork:()=>void Z(async()=>{let n=await e.forkSession(t.path);n.sessionFile&&(N(n.sessionFile),await e.openSession(n.sessionFile))}),onRename:()=>{hn(),A(`rename`)}})]},n))]},t)):Sn?null:(0,z.jsx)(`div`,{className:`empty-state`,children:`暂无已保存会话`}),Et>30&&(0,z.jsxs)(`div`,{className:`session-pagination`,children:[(0,z.jsx)(`button`,{disabled:wt===0,onClick:()=>Tt(e=>Math.max(0,e-1)),type:`button`,children:`上一页`}),(0,z.jsxs)(`span`,{children:[wt+1,` / `,Math.max(1,Math.ceil(Et/30))]}),(0,z.jsx)(`button`,{disabled:!Ot,onClick:()=>Tt(e=>e+1),type:`button`,children:`下一页`})]}),$&&(0,z.jsxs)(`section`,{"aria-label":`工作区概览`,className:`mx-3 mt-3 rounded-lg border border-[#dce5f5] bg-[#f6f8ff] px-3 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`strong`,{className:`text-[11px] font-semibold text-[#253044]`,children:`工作区概览`}),(0,z.jsx)(`span`,{className:`rounded px-1.5 py-0.5 font-mono text-[9px] ${$.clean===!0?`bg-[#eaf8f0] text-[#14733f]`:`bg-[#fff0f0] text-[#b42318]`}`,children:$.clean===!0?`clean`:`${U($.changedCount??0)} 变更`})]}),(0,z.jsx)(`code`,{className:`mt-2 block truncate text-[10px] text-[#315fb8]`,children:U($.cwd??`当前工作区`)}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-[10px] text-[#65707b]`,children:U($.branch??`非 Git 工作区`)}),Array.isArray($.changedFiles)&&$.changedFiles.length>0?(0,z.jsx)(`div`,{className:`mt-2 grid gap-1 border-t border-[#dce5f5] pt-2`,children:$.changedFiles.slice(0,3).map((e,t)=>{let n=typeof e==`object`&&e?e:{};return(0,z.jsxs)(`code`,{className:`truncate text-[9px] text-[#65707b]`,children:[U(n.status??`??`),` `,U(n.path??`未命名`)]},`${U(n.path??`file`)}-${t}`)})}):null]})]}),(0,z.jsxs)(`footer`,{className:`sidebar-footer`,children:[(0,z.jsxs)(`div`,{className:`runtime-cells`,children:[(0,z.jsxs)(`span`,{children:[`model `,(0,z.jsx)(`b`,{children:U(r.status?.model)})]}),(0,z.jsxs)(`span`,{children:[`msgs `,(0,z.jsx)(`b`,{children:r.status?.messages??0})]}),(0,z.jsxs)(`span`,{children:[`status `,(0,z.jsx)(`b`,{children:U(r.status?.status,`connecting`)})]})]}),(0,z.jsx)(`button`,{"aria-label":`新建会话`,className:`sidebar-link compact-new-session`,onClick:nn,title:`新建会话`,type:`button`,children:`+`}),(0,z.jsxs)(`button`,{"aria-label":`插件,已安装 ${Qt} 个`,className:`sidebar-link ${c===`plugins`||c===`marketplace`?`active`:``}`,onClick:()=>gn(void 0),title:`插件 · ${Qt} 个`,type:`button`,children:[`◈ `,(0,z.jsx)(`span`,{children:`插件`}),(0,z.jsx)(`b`,{children:Qt})]}),(0,z.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,z.jsx)(`span`,{children:`设置`})]})]})]}),(0,z.jsxs)(`section`,{className:`main-pane`,children:[(0,z.jsxs)(`header`,{className:`main-header`,children:[(0,z.jsxs)(`div`,{className:`active-heading`,children:[(0,z.jsx)(`strong`,{children:u?`设置`:c===`plugins`?H?`插件详情`:`运行时插件`:c===`marketplace`?B?`插件详情`:`插件市场`:r.session?.messages.length?r.session.sessionId.slice(0,12):`新会话`}),(0,z.jsx)(`small`,{children:u?`运行时状态与配置`:c===`plugins`?H?Be?.name??Qe(H):`已安装插件`:c===`marketplace`?B?Oe?.name??B:`官方与社区 · 已审核目录`:Xe(r.status,r.session)})]}),(0,z.jsx)(`div`,{className:`header-spacer`}),r.status?.status===`running`&&(0,z.jsxs)(`div`,{className:`run-indicator running`,children:[(0,z.jsx)(`span`,{className:`run-dot`}),(0,z.jsx)(`span`,{children:`运行中 · Pi agent`}),(0,z.jsx)(`button`,{className:`stop-button`,onClick:()=>void e.abort().then(X),type:`button`,children:`停止`})]}),!u&&c===`session`&&(0,z.jsx)(`div`,{"aria-label":`会话视图`,className:`view-tabs`,children:[`chat`,`trajectory`,`files`].map(e=>(0,z.jsx)(`button`,{"aria-pressed":o===e,className:`view-tab ${o===e?`active`:``}`,onClick:()=>{s(e),p(void 0)},type:`button`,children:e===`chat`?`对话`:e===`trajectory`?`轨迹`:`产出`},e))}),!u&&c===`session`&&(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`header-divider`}),!u&&c===`session`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{className:`session-menu`,onClick:()=>{T(void 0),C(e=>!e)},type:`button`,"aria-label":`会话操作`,children:`⋯`}),(0,z.jsx)(`button`,{"aria-pressed":f!==void 0,className:`details-toggle`,onClick:()=>p(f?void 0:{}),type:`button`,children:`◨ 详情`})]}),!u&&c===`session`&&S&&!w&&(0,z.jsxs)(`div`,{className:`session-menu-popover compact-session-menu`,children:[(0,z.jsxs)(`button`,{className:`session-action`,disabled:!Q||K,onClick:()=>{ne(r.session?.sessionId?.slice(0,12)??``),A(`rename`),C(!1)},type:`button`,children:[(0,z.jsx)(`strong`,{children:`重命名`}),(0,z.jsx)(`small`,{children:`设置一个容易识别的名称`})]}),(0,z.jsxs)(`button`,{className:`session-action`,disabled:!Q||K,onClick:()=>void Z(async()=>{let t=await e.forkSession(Q);t.sessionFile&&(N(t.sessionFile),await e.openSession(t.sessionFile))}),type:`button`,children:[(0,z.jsx)(`strong`,{children:`复制会话`}),(0,z.jsx)(`small`,{children:`复制上下文并打开副本`})]}),(0,z.jsxs)(`button`,{className:`session-action`,disabled:!Q||K,onClick:()=>{C(!1),A(`archive`)},type:`button`,children:[(0,z.jsx)(`strong`,{children:`归档会话`}),(0,z.jsx)(`small`,{children:`从默认列表隐藏`})]}),(0,z.jsxs)(`button`,{className:`session-action danger`,disabled:!Q||K,onClick:()=>{C(!1),A(`delete`)},type:`button`,children:[(0,z.jsx)(`strong`,{children:`删除会话`}),(0,z.jsx)(`small`,{children:`永久删除本地记录`})]})]})]}),Kt.length>0&&(0,z.jsxs)(`div`,{"aria-live":`polite`,className:`refresh-warning`,role:`status`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`strong`,{children:`部分数据刷新失败`}),Kt.join(`、`),`可能为空或显示上次结果。`]}),(0,z.jsx)(`button`,{onClick:()=>void X(),type:`button`,children:`重试`})]}),(0,z.jsx)(`div`,{className:`view-host`,children:Wt?(0,z.jsxs)(`div`,{"aria-live":`polite`,className:`initial-loading`,role:`status`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`}),`正在连接 Pi runtime…`]}):bn})]}),!u&&c===`session`&&f!==void 0&&(0,z.jsx)(ct,{event:Object.keys(f).length?f:void 0,onClose:()=>p(void 0),onCopy:()=>void navigator.clipboard?.writeText(JSON.stringify(f,null,2))}),g&&(0,z.jsx)(xt,{commands:r.commands,files:r.files,onClose:()=>_(!1),onOpenFile:e=>{l(`session`),s(`files`),p({type:`file`,path:e.path,status:e.status})},onOpenSession:fn,onUse:F,sessions:r.sessions}),re&&(0,z.jsx)(nt,{error:ie,onClose:()=>j(!1),onPickDirectory:an,onSelect:e=>void tn(e),workspaces:r.workspaces}),k&&(0,z.jsx)(rt,{busy:K,count:k===`batch-delete`?q.size:void 0,kind:k,name:k===`rename`?void 0:U(r.session?.sessionId,`当前会话`),onChange:ne,onClose:()=>A(void 0),onConfirm:()=>{k===`rename`&&Q?Z(()=>e.renameSession(Q,te.trim()).then(()=>void 0)):k===`archive`&&Q?Z(async()=>{await e.setSessionMetadata(Q,{archived:!0})}):k===`delete`&&Q?Z(async()=>{await e.deleteSession(Q)}):k===`batch-delete`&&Z(()=>e.batchSessions(`delete`,[...q]).then(()=>void 0))},value:te})]})}var Ct=class{context;root;version;#e;constructor(e,t={}){this.root=e,this.version=t.version,this.context=new R}run(){this.context.provide(`clientRoot`,this.root),this.context.provide(`clientApi`,Ce()),this.#e=(0,o.createRoot)(this.root),this.#e.render((0,a.createElement)(St,{api:this.context.clientApi,appVersion:this.version}))}async dispose(){this.#e?.unmount(),await this.context.fiber.dispose()}},wt=document.getElementById(`root`);if(!(wt instanceof HTMLElement))throw Error(`Pi Harness web app is missing #root`);var Tt=new Ct(wt,{version:`0.1.4`});try{Tt.run()}catch(e){wt.textContent=e instanceof Error?e.message:String(e)}