@pi-harness/pi-harness 0.1.2 → 0.1.3

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 (913) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +31 -7
  3. package/apps/web/dist/assets/index-BoEwZu6r.css +2 -0
  4. package/apps/web/dist/assets/index-alZn4u37.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 +2604 -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 +16 -0
  109. package/packages/api-gateway/dist/marketplace-entries/official/anchored-standard.json +16 -0
  110. package/packages/api-gateway/dist/marketplace-entries/official/annotation.json +16 -0
  111. package/packages/api-gateway/dist/marketplace-entries/official/archify.json +16 -0
  112. package/packages/api-gateway/dist/marketplace-entries/official/at-file.json +16 -0
  113. package/packages/api-gateway/dist/marketplace-entries/official/auto-mode.json +25 -0
  114. package/packages/api-gateway/dist/marketplace-entries/official/better-sidebar.json +16 -0
  115. package/packages/api-gateway/dist/marketplace-entries/official/browser-fetch.json +16 -0
  116. package/packages/api-gateway/dist/marketplace-entries/official/browser-session.json +16 -0
  117. package/packages/api-gateway/dist/marketplace-entries/official/canvas-draw.json +16 -0
  118. package/packages/api-gateway/dist/marketplace-entries/official/change-verifier.json +16 -0
  119. package/packages/api-gateway/dist/marketplace-entries/official/cleaner.json +16 -0
  120. package/packages/api-gateway/dist/marketplace-entries/official/cli-notifier.json +16 -0
  121. package/packages/api-gateway/dist/marketplace-entries/official/code2skill.json +16 -0
  122. package/packages/api-gateway/dist/marketplace-entries/official/colleague-skill.json +16 -0
  123. package/packages/api-gateway/dist/marketplace-entries/official/context-doctor.json +22 -0
  124. package/packages/api-gateway/dist/marketplace-entries/official/context.json +16 -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 +16 -0
  129. package/packages/api-gateway/dist/marketplace-entries/official/dependency-checker.json +16 -0
  130. package/packages/api-gateway/dist/marketplace-entries/official/docker-sandbox.json +16 -0
  131. package/packages/api-gateway/dist/marketplace-entries/official/fail-logger.json +16 -0
  132. package/packages/api-gateway/dist/marketplace-entries/official/genui.json +16 -0
  133. package/packages/api-gateway/dist/marketplace-entries/official/git-time-capsule.json +16 -0
  134. package/packages/api-gateway/dist/marketplace-entries/official/graph-memory.json +16 -0
  135. package/packages/api-gateway/dist/marketplace-entries/official/history-compressor.json +25 -0
  136. package/packages/api-gateway/dist/marketplace-entries/official/hol-guard.json +16 -0
  137. package/packages/api-gateway/dist/marketplace-entries/official/i18n-pair.json +16 -0
  138. package/packages/api-gateway/dist/marketplace-entries/official/image-compressor.json +16 -0
  139. package/packages/api-gateway/dist/marketplace-entries/official/llm-verifier.json +16 -0
  140. package/packages/api-gateway/dist/marketplace-entries/official/mcp-client.json +16 -0
  141. package/packages/api-gateway/dist/marketplace-entries/official/mcp-panel.json +16 -0
  142. package/packages/api-gateway/dist/marketplace-entries/official/memory.json +16 -0
  143. package/packages/api-gateway/dist/marketplace-entries/official/mirage-bridge.json +19 -0
  144. package/packages/api-gateway/dist/marketplace-entries/official/mock-server.json +16 -0
  145. package/packages/api-gateway/dist/marketplace-entries/official/modlens.json +16 -0
  146. package/packages/api-gateway/dist/marketplace-entries/official/module-search.json +16 -0
  147. package/packages/api-gateway/dist/marketplace-entries/official/obsidian-sync.json +16 -0
  148. package/packages/api-gateway/dist/marketplace-entries/official/openpets.json +16 -0
  149. package/packages/api-gateway/dist/marketplace-entries/official/plan-execute.json +16 -0
  150. package/packages/api-gateway/dist/marketplace-entries/official/plugin-check.json +16 -0
  151. package/packages/api-gateway/dist/marketplace-entries/official/plugin-dev.json +16 -0
  152. package/packages/api-gateway/dist/marketplace-entries/official/plugin-finder.json +16 -0
  153. package/packages/api-gateway/dist/marketplace-entries/official/plugin-radar.json +16 -0
  154. package/packages/api-gateway/dist/marketplace-entries/official/plugin-stars.json +16 -0
  155. package/packages/api-gateway/dist/marketplace-entries/official/prompt-guard.json +16 -0
  156. package/packages/api-gateway/dist/marketplace-entries/official/prompt-library.json +16 -0
  157. package/packages/api-gateway/dist/marketplace-entries/official/readme-gen.json +16 -0
  158. package/packages/api-gateway/dist/marketplace-entries/official/recall-unread.json +16 -0
  159. package/packages/api-gateway/dist/marketplace-entries/official/reverse-skill.json +16 -0
  160. package/packages/api-gateway/dist/marketplace-entries/official/reviewer-bot.json +22 -0
  161. package/packages/api-gateway/dist/marketplace-entries/official/runtime-doctor.json +16 -0
  162. package/packages/api-gateway/dist/marketplace-entries/official/secure-audit.json +16 -0
  163. package/packages/api-gateway/dist/marketplace-entries/official/session-bookmarks.json +16 -0
  164. package/packages/api-gateway/dist/marketplace-entries/official/session-bridge.json +16 -0
  165. package/packages/api-gateway/dist/marketplace-entries/official/session-compare.json +16 -0
  166. package/packages/api-gateway/dist/marketplace-entries/official/session-export.json +16 -0
  167. package/packages/api-gateway/dist/marketplace-entries/official/session-insights.json +16 -0
  168. package/packages/api-gateway/dist/marketplace-entries/official/session-search.json +16 -0
  169. package/packages/api-gateway/dist/marketplace-entries/official/skill-catalog.json +16 -0
  170. package/packages/api-gateway/dist/marketplace-entries/official/skill-guard.json +16 -0
  171. package/packages/api-gateway/dist/marketplace-entries/official/sql-lens.json +16 -0
  172. package/packages/api-gateway/dist/marketplace-entries/official/synapse.json +16 -0
  173. package/packages/api-gateway/dist/marketplace-entries/official/tab-manager.json +16 -0
  174. package/packages/api-gateway/dist/marketplace-entries/official/taskboard.json +16 -0
  175. package/packages/api-gateway/dist/marketplace-entries/official/telemetry-blocker.json +16 -0
  176. package/packages/api-gateway/dist/marketplace-entries/official/test-harness.json +16 -0
  177. package/packages/api-gateway/dist/marketplace-entries/official/theme-studio.json +19 -0
  178. package/packages/api-gateway/dist/marketplace-entries/official/token-guard.json +16 -0
  179. package/packages/api-gateway/dist/marketplace-entries/official/turn-rewind.json +22 -0
  180. package/packages/api-gateway/dist/marketplace-entries/official/undo-savepoint.json +16 -0
  181. package/packages/api-gateway/dist/marketplace-entries/official/vision-toolkit.json +16 -0
  182. package/packages/api-gateway/dist/marketplace-entries/official/web-research.json +16 -0
  183. package/packages/api-gateway/dist/marketplace-entries/official/workspace-navigator.json +16 -0
  184. package/packages/api-gateway/dist/marketplace-entries/official/workspace-search.json +16 -0
  185. package/packages/api-gateway/dist/marketplace-entries/official/yaml-validator.json +16 -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 +16 -0
  198. package/packages/api-gateway/src/marketplace-entries/official/anchored-standard.json +16 -0
  199. package/packages/api-gateway/src/marketplace-entries/official/annotation.json +16 -0
  200. package/packages/api-gateway/src/marketplace-entries/official/archify.json +16 -0
  201. package/packages/api-gateway/src/marketplace-entries/official/at-file.json +16 -0
  202. package/packages/api-gateway/src/marketplace-entries/official/auto-mode.json +25 -0
  203. package/packages/api-gateway/src/marketplace-entries/official/better-sidebar.json +16 -0
  204. package/packages/api-gateway/src/marketplace-entries/official/browser-fetch.json +16 -0
  205. package/packages/api-gateway/src/marketplace-entries/official/browser-session.json +16 -0
  206. package/packages/api-gateway/src/marketplace-entries/official/canvas-draw.json +16 -0
  207. package/packages/api-gateway/src/marketplace-entries/official/change-verifier.json +16 -0
  208. package/packages/api-gateway/src/marketplace-entries/official/cleaner.json +16 -0
  209. package/packages/api-gateway/src/marketplace-entries/official/cli-notifier.json +16 -0
  210. package/packages/api-gateway/src/marketplace-entries/official/code2skill.json +16 -0
  211. package/packages/api-gateway/src/marketplace-entries/official/colleague-skill.json +16 -0
  212. package/packages/api-gateway/src/marketplace-entries/official/context-doctor.json +22 -0
  213. package/packages/api-gateway/src/marketplace-entries/official/context.json +16 -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 +16 -0
  218. package/packages/api-gateway/src/marketplace-entries/official/dependency-checker.json +16 -0
  219. package/packages/api-gateway/src/marketplace-entries/official/docker-sandbox.json +16 -0
  220. package/packages/api-gateway/src/marketplace-entries/official/fail-logger.json +16 -0
  221. package/packages/api-gateway/src/marketplace-entries/official/genui.json +16 -0
  222. package/packages/api-gateway/src/marketplace-entries/official/git-time-capsule.json +16 -0
  223. package/packages/api-gateway/src/marketplace-entries/official/graph-memory.json +16 -0
  224. package/packages/api-gateway/src/marketplace-entries/official/history-compressor.json +25 -0
  225. package/packages/api-gateway/src/marketplace-entries/official/hol-guard.json +16 -0
  226. package/packages/api-gateway/src/marketplace-entries/official/i18n-pair.json +16 -0
  227. package/packages/api-gateway/src/marketplace-entries/official/image-compressor.json +16 -0
  228. package/packages/api-gateway/src/marketplace-entries/official/llm-verifier.json +16 -0
  229. package/packages/api-gateway/src/marketplace-entries/official/mcp-client.json +16 -0
  230. package/packages/api-gateway/src/marketplace-entries/official/mcp-panel.json +16 -0
  231. package/packages/api-gateway/src/marketplace-entries/official/memory.json +16 -0
  232. package/packages/api-gateway/src/marketplace-entries/official/mirage-bridge.json +19 -0
  233. package/packages/api-gateway/src/marketplace-entries/official/mock-server.json +16 -0
  234. package/packages/api-gateway/src/marketplace-entries/official/modlens.json +16 -0
  235. package/packages/api-gateway/src/marketplace-entries/official/module-search.json +16 -0
  236. package/packages/api-gateway/src/marketplace-entries/official/obsidian-sync.json +16 -0
  237. package/packages/api-gateway/src/marketplace-entries/official/openpets.json +16 -0
  238. package/packages/api-gateway/src/marketplace-entries/official/plan-execute.json +16 -0
  239. package/packages/api-gateway/src/marketplace-entries/official/plugin-check.json +16 -0
  240. package/packages/api-gateway/src/marketplace-entries/official/plugin-dev.json +16 -0
  241. package/packages/api-gateway/src/marketplace-entries/official/plugin-finder.json +16 -0
  242. package/packages/api-gateway/src/marketplace-entries/official/plugin-radar.json +16 -0
  243. package/packages/api-gateway/src/marketplace-entries/official/plugin-stars.json +16 -0
  244. package/packages/api-gateway/src/marketplace-entries/official/prompt-guard.json +16 -0
  245. package/packages/api-gateway/src/marketplace-entries/official/prompt-library.json +16 -0
  246. package/packages/api-gateway/src/marketplace-entries/official/readme-gen.json +16 -0
  247. package/packages/api-gateway/src/marketplace-entries/official/recall-unread.json +16 -0
  248. package/packages/api-gateway/src/marketplace-entries/official/reverse-skill.json +16 -0
  249. package/packages/api-gateway/src/marketplace-entries/official/reviewer-bot.json +22 -0
  250. package/packages/api-gateway/src/marketplace-entries/official/runtime-doctor.json +16 -0
  251. package/packages/api-gateway/src/marketplace-entries/official/secure-audit.json +16 -0
  252. package/packages/api-gateway/src/marketplace-entries/official/session-bookmarks.json +16 -0
  253. package/packages/api-gateway/src/marketplace-entries/official/session-bridge.json +16 -0
  254. package/packages/api-gateway/src/marketplace-entries/official/session-compare.json +16 -0
  255. package/packages/api-gateway/src/marketplace-entries/official/session-export.json +16 -0
  256. package/packages/api-gateway/src/marketplace-entries/official/session-insights.json +16 -0
  257. package/packages/api-gateway/src/marketplace-entries/official/session-search.json +16 -0
  258. package/packages/api-gateway/src/marketplace-entries/official/skill-catalog.json +16 -0
  259. package/packages/api-gateway/src/marketplace-entries/official/skill-guard.json +16 -0
  260. package/packages/api-gateway/src/marketplace-entries/official/sql-lens.json +16 -0
  261. package/packages/api-gateway/src/marketplace-entries/official/synapse.json +16 -0
  262. package/packages/api-gateway/src/marketplace-entries/official/tab-manager.json +16 -0
  263. package/packages/api-gateway/src/marketplace-entries/official/taskboard.json +16 -0
  264. package/packages/api-gateway/src/marketplace-entries/official/telemetry-blocker.json +16 -0
  265. package/packages/api-gateway/src/marketplace-entries/official/test-harness.json +16 -0
  266. package/packages/api-gateway/src/marketplace-entries/official/theme-studio.json +19 -0
  267. package/packages/api-gateway/src/marketplace-entries/official/token-guard.json +16 -0
  268. package/packages/api-gateway/src/marketplace-entries/official/turn-rewind.json +22 -0
  269. package/packages/api-gateway/src/marketplace-entries/official/undo-savepoint.json +16 -0
  270. package/packages/api-gateway/src/marketplace-entries/official/vision-toolkit.json +16 -0
  271. package/packages/api-gateway/src/marketplace-entries/official/web-research.json +16 -0
  272. package/packages/api-gateway/src/marketplace-entries/official/workspace-navigator.json +16 -0
  273. package/packages/api-gateway/src/marketplace-entries/official/workspace-search.json +16 -0
  274. package/packages/api-gateway/src/marketplace-entries/official/yaml-validator.json +16 -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/workspaces.test.ts +13 -0
  280. package/packages/api-gateway/tsconfig.build.json +1 -1
  281. package/packages/api-gateway/tsconfig.json +1 -1
  282. package/packages/bundle-web-app/LICENSE +9 -0
  283. package/packages/bundle-web-app/package.json +19 -9
  284. package/packages/bundle-web-app/tsconfig.build.json +1 -1
  285. package/packages/bundle-web-app/tsconfig.json +1 -1
  286. package/packages/cli/LICENSE +9 -0
  287. package/packages/cli/dist/args.d.ts.map +1 -1
  288. package/packages/cli/dist/args.js +16 -9
  289. package/packages/cli/dist/args.js.map +1 -1
  290. package/packages/cli/dist/bin.js +12 -3
  291. package/packages/cli/dist/bin.js.map +1 -1
  292. package/packages/cli/dist/main.d.ts +1 -0
  293. package/packages/cli/dist/main.d.ts.map +1 -1
  294. package/packages/cli/dist/main.js +49 -9
  295. package/packages/cli/dist/main.js.map +1 -1
  296. package/packages/cli/dist/node-stdio.d.ts +3 -1
  297. package/packages/cli/dist/node-stdio.d.ts.map +1 -1
  298. package/packages/cli/dist/node-stdio.js +91 -13
  299. package/packages/cli/dist/node-stdio.js.map +1 -1
  300. package/packages/cli/dist/relaunch.d.ts.map +1 -1
  301. package/packages/cli/dist/relaunch.js +23 -10
  302. package/packages/cli/dist/relaunch.js.map +1 -1
  303. package/packages/cli/package.json +18 -8
  304. package/packages/cli/src/args.ts +16 -10
  305. package/packages/cli/src/bin.ts +12 -3
  306. package/packages/cli/src/main.ts +54 -10
  307. package/packages/cli/src/node-stdio.ts +85 -13
  308. package/packages/cli/src/relaunch.ts +19 -6
  309. package/packages/cli/test/args.test.ts +22 -3
  310. package/packages/cli/test/binary.test.ts +58 -0
  311. package/packages/cli/test/broken-pipe.test.ts +32 -0
  312. package/packages/cli/test/cli.test.ts +57 -8
  313. package/packages/cli/test/node-stdio.test.ts +89 -0
  314. package/packages/cli/test/relaunch.test.ts +30 -2
  315. package/packages/cli/test/stdin-shutdown.test.ts +59 -0
  316. package/packages/cli/tsconfig.build.json +1 -3
  317. package/packages/cli/tsconfig.json +1 -4
  318. package/packages/client-web/LICENSE +9 -0
  319. package/packages/client-web/dist/annotation-ui.d.ts +11 -0
  320. package/packages/client-web/dist/annotation-ui.d.ts.map +1 -0
  321. package/packages/client-web/dist/annotation-ui.js +24 -0
  322. package/packages/client-web/dist/annotation-ui.js.map +1 -0
  323. package/packages/client-web/dist/browser-session-view.d.ts +7 -0
  324. package/packages/client-web/dist/browser-session-view.d.ts.map +1 -0
  325. package/packages/client-web/dist/browser-session-view.js +8 -0
  326. package/packages/client-web/dist/browser-session-view.js.map +1 -0
  327. package/packages/client-web/dist/control-room.d.ts +151 -6
  328. package/packages/client-web/dist/control-room.d.ts.map +1 -1
  329. package/packages/client-web/dist/control-room.js +156 -11
  330. package/packages/client-web/dist/control-room.js.map +1 -1
  331. package/packages/client-web/dist/design-contract.d.ts.map +1 -1
  332. package/packages/client-web/dist/design-contract.js +178 -19
  333. package/packages/client-web/dist/design-contract.js.map +1 -1
  334. package/packages/client-web/dist/index.d.ts +4 -1
  335. package/packages/client-web/dist/index.d.ts.map +1 -1
  336. package/packages/client-web/dist/index.js +11 -3
  337. package/packages/client-web/dist/index.js.map +1 -1
  338. package/packages/client-web/dist/markdown.d.ts +5 -0
  339. package/packages/client-web/dist/markdown.d.ts.map +1 -0
  340. package/packages/client-web/dist/markdown.js +20 -0
  341. package/packages/client-web/dist/markdown.js.map +1 -0
  342. package/packages/client-web/dist/marketplace-catalog.d.ts +3 -0
  343. package/packages/client-web/dist/marketplace-catalog.d.ts.map +1 -0
  344. package/packages/client-web/dist/marketplace-catalog.js +10 -0
  345. package/packages/client-web/dist/marketplace-catalog.js.map +1 -0
  346. package/packages/client-web/dist/marketplace-navigation.d.ts +19 -0
  347. package/packages/client-web/dist/marketplace-navigation.d.ts.map +1 -0
  348. package/packages/client-web/dist/marketplace-navigation.js +31 -0
  349. package/packages/client-web/dist/marketplace-navigation.js.map +1 -0
  350. package/packages/client-web/dist/message-content.d.ts +9 -0
  351. package/packages/client-web/dist/message-content.d.ts.map +1 -0
  352. package/packages/client-web/dist/message-content.js +54 -0
  353. package/packages/client-web/dist/message-content.js.map +1 -0
  354. package/packages/client-web/dist/plugin-navigation.d.ts +3 -0
  355. package/packages/client-web/dist/plugin-navigation.d.ts.map +1 -0
  356. package/packages/client-web/dist/plugin-navigation.js +10 -0
  357. package/packages/client-web/dist/plugin-navigation.js.map +1 -0
  358. package/packages/client-web/dist/plugin-search.d.ts +2 -0
  359. package/packages/client-web/dist/plugin-search.d.ts.map +1 -0
  360. package/packages/client-web/dist/plugin-search.js +7 -0
  361. package/packages/client-web/dist/plugin-search.js.map +1 -0
  362. package/packages/client-web/dist/plugin-stars-view.d.ts +12 -0
  363. package/packages/client-web/dist/plugin-stars-view.d.ts.map +1 -0
  364. package/packages/client-web/dist/plugin-stars-view.js +8 -0
  365. package/packages/client-web/dist/plugin-stars-view.js.map +1 -0
  366. package/packages/client-web/dist/prompt-completion.d.ts +13 -0
  367. package/packages/client-web/dist/prompt-completion.d.ts.map +1 -0
  368. package/packages/client-web/dist/prompt-completion.js +17 -0
  369. package/packages/client-web/dist/prompt-completion.js.map +1 -0
  370. package/packages/client-web/dist/react-room.d.ts +2 -1
  371. package/packages/client-web/dist/react-room.d.ts.map +1 -1
  372. package/packages/client-web/dist/react-room.js +2347 -93
  373. package/packages/client-web/dist/react-room.js.map +1 -1
  374. package/packages/client-web/dist/runtime-events.d.ts +4 -0
  375. package/packages/client-web/dist/runtime-events.d.ts.map +1 -0
  376. package/packages/client-web/dist/runtime-events.js +29 -0
  377. package/packages/client-web/dist/runtime-events.js.map +1 -0
  378. package/packages/client-web/package.json +19 -7
  379. package/packages/client-web/src/annotation-ui.ts +29 -0
  380. package/packages/client-web/src/browser-session-view.ts +13 -0
  381. package/packages/client-web/src/control-room.ts +359 -11
  382. package/packages/client-web/src/design-contract.ts +248 -26
  383. package/packages/client-web/src/index.ts +17 -4
  384. package/packages/client-web/src/markdown.tsx +22 -0
  385. package/packages/client-web/src/marketplace-catalog.ts +10 -0
  386. package/packages/client-web/src/marketplace-navigation.ts +46 -0
  387. package/packages/client-web/src/message-content.ts +51 -0
  388. package/packages/client-web/src/plugin-navigation.ts +9 -0
  389. package/packages/client-web/src/plugin-search.ts +5 -0
  390. package/packages/client-web/src/plugin-stars-view.ts +19 -0
  391. package/packages/client-web/src/prompt-completion.ts +24 -0
  392. package/packages/client-web/src/react-room.tsx +7358 -54
  393. package/packages/client-web/src/runtime-events.ts +29 -0
  394. package/packages/client-web/test/annotation-ui.test.ts +21 -0
  395. package/packages/client-web/test/browser-session-view.test.ts +17 -0
  396. package/packages/client-web/test/design-contract.test.ts +46 -1
  397. package/packages/client-web/test/marketplace-catalog.test.ts +52 -0
  398. package/packages/client-web/test/message-content.test.ts +43 -0
  399. package/packages/client-web/test/plugin-navigation.test.ts +16 -0
  400. package/packages/client-web/test/plugin-search.test.ts +22 -0
  401. package/packages/client-web/test/plugin-stars-view.test.ts +20 -0
  402. package/packages/client-web/test/prompt-completion.test.ts +21 -0
  403. package/packages/client-web/test/runtime-events.test.ts +28 -0
  404. package/packages/client-web/tsconfig.build.json +13 -1
  405. package/packages/client-web/tsconfig.json +11 -1
  406. package/packages/core/LICENSE +9 -0
  407. package/packages/core/dist/boot.d.ts.map +1 -1
  408. package/packages/core/dist/boot.js +42 -3
  409. package/packages/core/dist/boot.js.map +1 -1
  410. package/packages/core/dist/config.d.ts +2 -0
  411. package/packages/core/dist/config.d.ts.map +1 -0
  412. package/packages/core/dist/config.js +8 -0
  413. package/packages/core/dist/config.js.map +1 -0
  414. package/packages/core/dist/http.d.ts +8 -0
  415. package/packages/core/dist/http.d.ts.map +1 -0
  416. package/packages/core/dist/http.js +27 -0
  417. package/packages/core/dist/http.js.map +1 -0
  418. package/packages/core/dist/index.d.ts +2 -0
  419. package/packages/core/dist/index.d.ts.map +1 -1
  420. package/packages/core/dist/index.js +2 -0
  421. package/packages/core/dist/index.js.map +1 -1
  422. package/packages/core/dist/plugins/agent-teams.d.ts +17 -0
  423. package/packages/core/dist/plugins/agent-teams.d.ts.map +1 -0
  424. package/packages/core/dist/plugins/agent-teams.js +298 -0
  425. package/packages/core/dist/plugins/agent-teams.js.map +1 -0
  426. package/packages/core/dist/plugins/anchored-standard.d.ts +14 -0
  427. package/packages/core/dist/plugins/anchored-standard.d.ts.map +1 -0
  428. package/packages/core/dist/plugins/anchored-standard.js +84 -0
  429. package/packages/core/dist/plugins/anchored-standard.js.map +1 -0
  430. package/packages/core/dist/plugins/annotation.d.ts +18 -0
  431. package/packages/core/dist/plugins/annotation.d.ts.map +1 -0
  432. package/packages/core/dist/plugins/annotation.js +94 -0
  433. package/packages/core/dist/plugins/annotation.js.map +1 -0
  434. package/packages/core/dist/plugins/archify.d.ts +23 -0
  435. package/packages/core/dist/plugins/archify.d.ts.map +1 -0
  436. package/packages/core/dist/plugins/archify.js +98 -0
  437. package/packages/core/dist/plugins/archify.js.map +1 -0
  438. package/packages/core/dist/plugins/at-file.d.ts +8 -0
  439. package/packages/core/dist/plugins/at-file.d.ts.map +1 -0
  440. package/packages/core/dist/plugins/at-file.js +52 -0
  441. package/packages/core/dist/plugins/at-file.js.map +1 -0
  442. package/packages/core/dist/plugins/auto-mode.d.ts +15 -0
  443. package/packages/core/dist/plugins/auto-mode.d.ts.map +1 -0
  444. package/packages/core/dist/plugins/auto-mode.js +114 -0
  445. package/packages/core/dist/plugins/auto-mode.js.map +1 -0
  446. package/packages/core/dist/plugins/better-sidebar.d.ts +37 -0
  447. package/packages/core/dist/plugins/better-sidebar.d.ts.map +1 -0
  448. package/packages/core/dist/plugins/better-sidebar.js +89 -0
  449. package/packages/core/dist/plugins/better-sidebar.js.map +1 -0
  450. package/packages/core/dist/plugins/browser-fetch.d.ts +14 -0
  451. package/packages/core/dist/plugins/browser-fetch.d.ts.map +1 -0
  452. package/packages/core/dist/plugins/browser-fetch.js +167 -0
  453. package/packages/core/dist/plugins/browser-fetch.js.map +1 -0
  454. package/packages/core/dist/plugins/browser-session.d.ts +14 -0
  455. package/packages/core/dist/plugins/browser-session.d.ts.map +1 -0
  456. package/packages/core/dist/plugins/browser-session.js +265 -0
  457. package/packages/core/dist/plugins/browser-session.js.map +1 -0
  458. package/packages/core/dist/plugins/canvas-draw.d.ts +8 -0
  459. package/packages/core/dist/plugins/canvas-draw.d.ts.map +1 -0
  460. package/packages/core/dist/plugins/canvas-draw.js +88 -0
  461. package/packages/core/dist/plugins/canvas-draw.js.map +1 -0
  462. package/packages/core/dist/plugins/change-verifier.d.ts +8 -0
  463. package/packages/core/dist/plugins/change-verifier.d.ts.map +1 -0
  464. package/packages/core/dist/plugins/change-verifier.js +67 -0
  465. package/packages/core/dist/plugins/change-verifier.js.map +1 -0
  466. package/packages/core/dist/plugins/cleaner.d.ts +8 -0
  467. package/packages/core/dist/plugins/cleaner.d.ts.map +1 -0
  468. package/packages/core/dist/plugins/cleaner.js +56 -0
  469. package/packages/core/dist/plugins/cleaner.js.map +1 -0
  470. package/packages/core/dist/plugins/cli-notifier.d.ts +15 -0
  471. package/packages/core/dist/plugins/cli-notifier.d.ts.map +1 -0
  472. package/packages/core/dist/plugins/cli-notifier.js +110 -0
  473. package/packages/core/dist/plugins/cli-notifier.js.map +1 -0
  474. package/packages/core/dist/plugins/code2skill.d.ts +8 -0
  475. package/packages/core/dist/plugins/code2skill.d.ts.map +1 -0
  476. package/packages/core/dist/plugins/code2skill.js +95 -0
  477. package/packages/core/dist/plugins/code2skill.js.map +1 -0
  478. package/packages/core/dist/plugins/colleague-skill.d.ts +27 -0
  479. package/packages/core/dist/plugins/colleague-skill.d.ts.map +1 -0
  480. package/packages/core/dist/plugins/colleague-skill.js +99 -0
  481. package/packages/core/dist/plugins/colleague-skill.js.map +1 -0
  482. package/packages/core/dist/plugins/context-doctor.d.ts +30 -0
  483. package/packages/core/dist/plugins/context-doctor.d.ts.map +1 -0
  484. package/packages/core/dist/plugins/context-doctor.js +95 -0
  485. package/packages/core/dist/plugins/context-doctor.js.map +1 -0
  486. package/packages/core/dist/plugins/context.d.ts +8 -0
  487. package/packages/core/dist/plugins/context.d.ts.map +1 -0
  488. package/packages/core/dist/plugins/context.js +87 -0
  489. package/packages/core/dist/plugins/context.js.map +1 -0
  490. package/packages/core/dist/plugins/cost-meter.d.ts +32 -0
  491. package/packages/core/dist/plugins/cost-meter.d.ts.map +1 -0
  492. package/packages/core/dist/plugins/cost-meter.js +204 -0
  493. package/packages/core/dist/plugins/cost-meter.js.map +1 -0
  494. package/packages/core/dist/plugins/dependency-checker.d.ts +27 -0
  495. package/packages/core/dist/plugins/dependency-checker.d.ts.map +1 -0
  496. package/packages/core/dist/plugins/dependency-checker.js +221 -0
  497. package/packages/core/dist/plugins/dependency-checker.js.map +1 -0
  498. package/packages/core/dist/plugins/docker-sandbox.d.ts +8 -0
  499. package/packages/core/dist/plugins/docker-sandbox.d.ts.map +1 -0
  500. package/packages/core/dist/plugins/docker-sandbox.js +102 -0
  501. package/packages/core/dist/plugins/docker-sandbox.js.map +1 -0
  502. package/packages/core/dist/plugins/fail-logger.d.ts +8 -0
  503. package/packages/core/dist/plugins/fail-logger.d.ts.map +1 -0
  504. package/packages/core/dist/plugins/fail-logger.js +51 -0
  505. package/packages/core/dist/plugins/fail-logger.js.map +1 -0
  506. package/packages/core/dist/plugins/genui.d.ts +8 -0
  507. package/packages/core/dist/plugins/genui.d.ts.map +1 -0
  508. package/packages/core/dist/plugins/genui.js +79 -0
  509. package/packages/core/dist/plugins/genui.js.map +1 -0
  510. package/packages/core/dist/plugins/git-time-capsule.d.ts +9 -0
  511. package/packages/core/dist/plugins/git-time-capsule.d.ts.map +1 -0
  512. package/packages/core/dist/plugins/git-time-capsule.js +90 -0
  513. package/packages/core/dist/plugins/git-time-capsule.js.map +1 -0
  514. package/packages/core/dist/plugins/graph-memory.d.ts +16 -0
  515. package/packages/core/dist/plugins/graph-memory.d.ts.map +1 -0
  516. package/packages/core/dist/plugins/graph-memory.js +382 -0
  517. package/packages/core/dist/plugins/graph-memory.js.map +1 -0
  518. package/packages/core/dist/plugins/history-compressor.d.ts +15 -0
  519. package/packages/core/dist/plugins/history-compressor.d.ts.map +1 -0
  520. package/packages/core/dist/plugins/history-compressor.js +80 -0
  521. package/packages/core/dist/plugins/history-compressor.js.map +1 -0
  522. package/packages/core/dist/plugins/hol-guard.d.ts +29 -0
  523. package/packages/core/dist/plugins/hol-guard.d.ts.map +1 -0
  524. package/packages/core/dist/plugins/hol-guard.js +139 -0
  525. package/packages/core/dist/plugins/hol-guard.js.map +1 -0
  526. package/packages/core/dist/plugins/i18n-pair.d.ts +8 -0
  527. package/packages/core/dist/plugins/i18n-pair.d.ts.map +1 -0
  528. package/packages/core/dist/plugins/i18n-pair.js +76 -0
  529. package/packages/core/dist/plugins/i18n-pair.js.map +1 -0
  530. package/packages/core/dist/plugins/image-compressor.d.ts +8 -0
  531. package/packages/core/dist/plugins/image-compressor.d.ts.map +1 -0
  532. package/packages/core/dist/plugins/image-compressor.js +150 -0
  533. package/packages/core/dist/plugins/image-compressor.js.map +1 -0
  534. package/packages/core/dist/plugins/llm-verifier.d.ts +42 -0
  535. package/packages/core/dist/plugins/llm-verifier.d.ts.map +1 -0
  536. package/packages/core/dist/plugins/llm-verifier.js +128 -0
  537. package/packages/core/dist/plugins/llm-verifier.js.map +1 -0
  538. package/packages/core/dist/plugins/mcp-client.d.ts +19 -0
  539. package/packages/core/dist/plugins/mcp-client.d.ts.map +1 -0
  540. package/packages/core/dist/plugins/mcp-client.js +534 -0
  541. package/packages/core/dist/plugins/mcp-client.js.map +1 -0
  542. package/packages/core/dist/plugins/mcp-panel.d.ts +14 -0
  543. package/packages/core/dist/plugins/mcp-panel.d.ts.map +1 -0
  544. package/packages/core/dist/plugins/mcp-panel.js +180 -0
  545. package/packages/core/dist/plugins/mcp-panel.js.map +1 -0
  546. package/packages/core/dist/plugins/memory.d.ts +15 -0
  547. package/packages/core/dist/plugins/memory.d.ts.map +1 -0
  548. package/packages/core/dist/plugins/memory.js +161 -0
  549. package/packages/core/dist/plugins/memory.js.map +1 -0
  550. package/packages/core/dist/plugins/mirage-bridge.d.ts +23 -0
  551. package/packages/core/dist/plugins/mirage-bridge.d.ts.map +1 -0
  552. package/packages/core/dist/plugins/mirage-bridge.js +149 -0
  553. package/packages/core/dist/plugins/mirage-bridge.js.map +1 -0
  554. package/packages/core/dist/plugins/mock-server.d.ts +22 -0
  555. package/packages/core/dist/plugins/mock-server.d.ts.map +1 -0
  556. package/packages/core/dist/plugins/mock-server.js +149 -0
  557. package/packages/core/dist/plugins/mock-server.js.map +1 -0
  558. package/packages/core/dist/plugins/model.d.ts +1 -1
  559. package/packages/core/dist/plugins/model.d.ts.map +1 -1
  560. package/packages/core/dist/plugins/model.js +3 -1
  561. package/packages/core/dist/plugins/model.js.map +1 -1
  562. package/packages/core/dist/plugins/models.d.ts.map +1 -1
  563. package/packages/core/dist/plugins/models.js +5 -2
  564. package/packages/core/dist/plugins/models.js.map +1 -1
  565. package/packages/core/dist/plugins/modlens.d.ts +8 -0
  566. package/packages/core/dist/plugins/modlens.d.ts.map +1 -0
  567. package/packages/core/dist/plugins/modlens.js +63 -0
  568. package/packages/core/dist/plugins/modlens.js.map +1 -0
  569. package/packages/core/dist/plugins/module-search.d.ts +27 -0
  570. package/packages/core/dist/plugins/module-search.d.ts.map +1 -0
  571. package/packages/core/dist/plugins/module-search.js +174 -0
  572. package/packages/core/dist/plugins/module-search.js.map +1 -0
  573. package/packages/core/dist/plugins/obsidian-sync.d.ts +14 -0
  574. package/packages/core/dist/plugins/obsidian-sync.d.ts.map +1 -0
  575. package/packages/core/dist/plugins/obsidian-sync.js +79 -0
  576. package/packages/core/dist/plugins/obsidian-sync.js.map +1 -0
  577. package/packages/core/dist/plugins/openpets.d.ts +14 -0
  578. package/packages/core/dist/plugins/openpets.d.ts.map +1 -0
  579. package/packages/core/dist/plugins/openpets.js +99 -0
  580. package/packages/core/dist/plugins/openpets.js.map +1 -0
  581. package/packages/core/dist/plugins/plan-execute.d.ts +8 -0
  582. package/packages/core/dist/plugins/plan-execute.d.ts.map +1 -0
  583. package/packages/core/dist/plugins/plan-execute.js +70 -0
  584. package/packages/core/dist/plugins/plan-execute.js.map +1 -0
  585. package/packages/core/dist/plugins/plugin-check.d.ts +38 -0
  586. package/packages/core/dist/plugins/plugin-check.d.ts.map +1 -0
  587. package/packages/core/dist/plugins/plugin-check.js +227 -0
  588. package/packages/core/dist/plugins/plugin-check.js.map +1 -0
  589. package/packages/core/dist/plugins/plugin-dev.d.ts +8 -0
  590. package/packages/core/dist/plugins/plugin-dev.d.ts.map +1 -0
  591. package/packages/core/dist/plugins/plugin-dev.js +44 -0
  592. package/packages/core/dist/plugins/plugin-dev.js.map +1 -0
  593. package/packages/core/dist/plugins/plugin-finder.d.ts +16 -0
  594. package/packages/core/dist/plugins/plugin-finder.d.ts.map +1 -0
  595. package/packages/core/dist/plugins/plugin-finder.js +98 -0
  596. package/packages/core/dist/plugins/plugin-finder.js.map +1 -0
  597. package/packages/core/dist/plugins/plugin-radar.d.ts +29 -0
  598. package/packages/core/dist/plugins/plugin-radar.d.ts.map +1 -0
  599. package/packages/core/dist/plugins/plugin-radar.js +146 -0
  600. package/packages/core/dist/plugins/plugin-radar.js.map +1 -0
  601. package/packages/core/dist/plugins/plugin-stars.d.ts +45 -0
  602. package/packages/core/dist/plugins/plugin-stars.d.ts.map +1 -0
  603. package/packages/core/dist/plugins/plugin-stars.js +165 -0
  604. package/packages/core/dist/plugins/plugin-stars.js.map +1 -0
  605. package/packages/core/dist/plugins/prompt-guard.d.ts +8 -0
  606. package/packages/core/dist/plugins/prompt-guard.d.ts.map +1 -0
  607. package/packages/core/dist/plugins/prompt-guard.js +114 -0
  608. package/packages/core/dist/plugins/prompt-guard.js.map +1 -0
  609. package/packages/core/dist/plugins/prompt-library.d.ts +25 -0
  610. package/packages/core/dist/plugins/prompt-library.d.ts.map +1 -0
  611. package/packages/core/dist/plugins/prompt-library.js +142 -0
  612. package/packages/core/dist/plugins/prompt-library.js.map +1 -0
  613. package/packages/core/dist/plugins/readme-gen.d.ts +25 -0
  614. package/packages/core/dist/plugins/readme-gen.d.ts.map +1 -0
  615. package/packages/core/dist/plugins/readme-gen.js +139 -0
  616. package/packages/core/dist/plugins/readme-gen.js.map +1 -0
  617. package/packages/core/dist/plugins/recall-unread.d.ts +24 -0
  618. package/packages/core/dist/plugins/recall-unread.d.ts.map +1 -0
  619. package/packages/core/dist/plugins/recall-unread.js +124 -0
  620. package/packages/core/dist/plugins/recall-unread.js.map +1 -0
  621. package/packages/core/dist/plugins/resources.d.ts +1 -0
  622. package/packages/core/dist/plugins/resources.d.ts.map +1 -1
  623. package/packages/core/dist/plugins/resources.js +31 -22
  624. package/packages/core/dist/plugins/resources.js.map +1 -1
  625. package/packages/core/dist/plugins/reverse-skill.d.ts +23 -0
  626. package/packages/core/dist/plugins/reverse-skill.d.ts.map +1 -0
  627. package/packages/core/dist/plugins/reverse-skill.js +60 -0
  628. package/packages/core/dist/plugins/reverse-skill.js.map +1 -0
  629. package/packages/core/dist/plugins/reviewer-bot.d.ts +14 -0
  630. package/packages/core/dist/plugins/reviewer-bot.d.ts.map +1 -0
  631. package/packages/core/dist/plugins/reviewer-bot.js +133 -0
  632. package/packages/core/dist/plugins/reviewer-bot.js.map +1 -0
  633. package/packages/core/dist/plugins/runtime-doctor.d.ts +33 -0
  634. package/packages/core/dist/plugins/runtime-doctor.d.ts.map +1 -0
  635. package/packages/core/dist/plugins/runtime-doctor.js +114 -0
  636. package/packages/core/dist/plugins/runtime-doctor.js.map +1 -0
  637. package/packages/core/dist/plugins/runtime.d.ts.map +1 -1
  638. package/packages/core/dist/plugins/runtime.js +63 -14
  639. package/packages/core/dist/plugins/runtime.js.map +1 -1
  640. package/packages/core/dist/plugins/secure-audit.d.ts +31 -0
  641. package/packages/core/dist/plugins/secure-audit.d.ts.map +1 -0
  642. package/packages/core/dist/plugins/secure-audit.js +121 -0
  643. package/packages/core/dist/plugins/secure-audit.js.map +1 -0
  644. package/packages/core/dist/plugins/session-bookmarks.d.ts +15 -0
  645. package/packages/core/dist/plugins/session-bookmarks.d.ts.map +1 -0
  646. package/packages/core/dist/plugins/session-bookmarks.js +87 -0
  647. package/packages/core/dist/plugins/session-bookmarks.js.map +1 -0
  648. package/packages/core/dist/plugins/session-bridge.d.ts +44 -0
  649. package/packages/core/dist/plugins/session-bridge.d.ts.map +1 -0
  650. package/packages/core/dist/plugins/session-bridge.js +265 -0
  651. package/packages/core/dist/plugins/session-bridge.js.map +1 -0
  652. package/packages/core/dist/plugins/session-compare.d.ts +33 -0
  653. package/packages/core/dist/plugins/session-compare.d.ts.map +1 -0
  654. package/packages/core/dist/plugins/session-compare.js +150 -0
  655. package/packages/core/dist/plugins/session-compare.js.map +1 -0
  656. package/packages/core/dist/plugins/session-export.d.ts +9 -0
  657. package/packages/core/dist/plugins/session-export.d.ts.map +1 -0
  658. package/packages/core/dist/plugins/session-export.js +93 -0
  659. package/packages/core/dist/plugins/session-export.js.map +1 -0
  660. package/packages/core/dist/plugins/session-insights.d.ts +8 -0
  661. package/packages/core/dist/plugins/session-insights.d.ts.map +1 -0
  662. package/packages/core/dist/plugins/session-insights.js +47 -0
  663. package/packages/core/dist/plugins/session-insights.js.map +1 -0
  664. package/packages/core/dist/plugins/session-search.d.ts +20 -0
  665. package/packages/core/dist/plugins/session-search.d.ts.map +1 -0
  666. package/packages/core/dist/plugins/session-search.js +122 -0
  667. package/packages/core/dist/plugins/session-search.js.map +1 -0
  668. package/packages/core/dist/plugins/session.d.ts.map +1 -1
  669. package/packages/core/dist/plugins/session.js +4 -2
  670. package/packages/core/dist/plugins/session.js.map +1 -1
  671. package/packages/core/dist/plugins/skill-catalog.d.ts +26 -0
  672. package/packages/core/dist/plugins/skill-catalog.d.ts.map +1 -0
  673. package/packages/core/dist/plugins/skill-catalog.js +97 -0
  674. package/packages/core/dist/plugins/skill-catalog.js.map +1 -0
  675. package/packages/core/dist/plugins/skill-guard.d.ts +26 -0
  676. package/packages/core/dist/plugins/skill-guard.d.ts.map +1 -0
  677. package/packages/core/dist/plugins/skill-guard.js +139 -0
  678. package/packages/core/dist/plugins/skill-guard.js.map +1 -0
  679. package/packages/core/dist/plugins/sql-lens.d.ts +8 -0
  680. package/packages/core/dist/plugins/sql-lens.d.ts.map +1 -0
  681. package/packages/core/dist/plugins/sql-lens.js +85 -0
  682. package/packages/core/dist/plugins/sql-lens.js.map +1 -0
  683. package/packages/core/dist/plugins/stdio.d.ts +1 -1
  684. package/packages/core/dist/plugins/stdio.d.ts.map +1 -1
  685. package/packages/core/dist/plugins/stdio.js +3 -1
  686. package/packages/core/dist/plugins/stdio.js.map +1 -1
  687. package/packages/core/dist/plugins/synapse.d.ts +38 -0
  688. package/packages/core/dist/plugins/synapse.d.ts.map +1 -0
  689. package/packages/core/dist/plugins/synapse.js +93 -0
  690. package/packages/core/dist/plugins/synapse.js.map +1 -0
  691. package/packages/core/dist/plugins/tab-manager.d.ts +8 -0
  692. package/packages/core/dist/plugins/tab-manager.d.ts.map +1 -0
  693. package/packages/core/dist/plugins/tab-manager.js +135 -0
  694. package/packages/core/dist/plugins/tab-manager.js.map +1 -0
  695. package/packages/core/dist/plugins/taskboard.d.ts +15 -0
  696. package/packages/core/dist/plugins/taskboard.d.ts.map +1 -0
  697. package/packages/core/dist/plugins/taskboard.js +347 -0
  698. package/packages/core/dist/plugins/taskboard.js.map +1 -0
  699. package/packages/core/dist/plugins/telemetry-blocker.d.ts +8 -0
  700. package/packages/core/dist/plugins/telemetry-blocker.d.ts.map +1 -0
  701. package/packages/core/dist/plugins/telemetry-blocker.js +57 -0
  702. package/packages/core/dist/plugins/telemetry-blocker.js.map +1 -0
  703. package/packages/core/dist/plugins/test-harness.d.ts +8 -0
  704. package/packages/core/dist/plugins/test-harness.d.ts.map +1 -0
  705. package/packages/core/dist/plugins/test-harness.js +64 -0
  706. package/packages/core/dist/plugins/test-harness.js.map +1 -0
  707. package/packages/core/dist/plugins/theme-studio.d.ts +29 -0
  708. package/packages/core/dist/plugins/theme-studio.d.ts.map +1 -0
  709. package/packages/core/dist/plugins/theme-studio.js +141 -0
  710. package/packages/core/dist/plugins/theme-studio.js.map +1 -0
  711. package/packages/core/dist/plugins/token-guard.d.ts +15 -0
  712. package/packages/core/dist/plugins/token-guard.d.ts.map +1 -0
  713. package/packages/core/dist/plugins/token-guard.js +78 -0
  714. package/packages/core/dist/plugins/token-guard.js.map +1 -0
  715. package/packages/core/dist/plugins/tools.d.ts.map +1 -1
  716. package/packages/core/dist/plugins/tools.js +5 -2
  717. package/packages/core/dist/plugins/tools.js.map +1 -1
  718. package/packages/core/dist/plugins/turn-rewind.d.ts +19 -0
  719. package/packages/core/dist/plugins/turn-rewind.d.ts.map +1 -0
  720. package/packages/core/dist/plugins/turn-rewind.js +74 -0
  721. package/packages/core/dist/plugins/turn-rewind.js.map +1 -0
  722. package/packages/core/dist/plugins/undo-savepoint.d.ts +17 -0
  723. package/packages/core/dist/plugins/undo-savepoint.d.ts.map +1 -0
  724. package/packages/core/dist/plugins/undo-savepoint.js +247 -0
  725. package/packages/core/dist/plugins/undo-savepoint.js.map +1 -0
  726. package/packages/core/dist/plugins/vision-toolkit.d.ts +17 -0
  727. package/packages/core/dist/plugins/vision-toolkit.d.ts.map +1 -0
  728. package/packages/core/dist/plugins/vision-toolkit.js +145 -0
  729. package/packages/core/dist/plugins/vision-toolkit.js.map +1 -0
  730. package/packages/core/dist/plugins/web-research.d.ts +17 -0
  731. package/packages/core/dist/plugins/web-research.d.ts.map +1 -0
  732. package/packages/core/dist/plugins/web-research.js +275 -0
  733. package/packages/core/dist/plugins/web-research.js.map +1 -0
  734. package/packages/core/dist/plugins/workspace-navigator.d.ts +36 -0
  735. package/packages/core/dist/plugins/workspace-navigator.d.ts.map +1 -0
  736. package/packages/core/dist/plugins/workspace-navigator.js +150 -0
  737. package/packages/core/dist/plugins/workspace-navigator.js.map +1 -0
  738. package/packages/core/dist/plugins/workspace-search.d.ts +8 -0
  739. package/packages/core/dist/plugins/workspace-search.d.ts.map +1 -0
  740. package/packages/core/dist/plugins/workspace-search.js +134 -0
  741. package/packages/core/dist/plugins/workspace-search.js.map +1 -0
  742. package/packages/core/dist/plugins/yaml-validator.d.ts +8 -0
  743. package/packages/core/dist/plugins/yaml-validator.d.ts.map +1 -0
  744. package/packages/core/dist/plugins/yaml-validator.js +94 -0
  745. package/packages/core/dist/plugins/yaml-validator.js.map +1 -0
  746. package/packages/core/dist/profile.d.ts +1 -0
  747. package/packages/core/dist/profile.d.ts.map +1 -1
  748. package/packages/core/dist/profile.js +3 -0
  749. package/packages/core/dist/profile.js.map +1 -1
  750. package/packages/core/dist/runtime.d.ts.map +1 -1
  751. package/packages/core/dist/runtime.js +13 -4
  752. package/packages/core/dist/runtime.js.map +1 -1
  753. package/packages/core/dist/services.d.ts +55 -0
  754. package/packages/core/dist/services.d.ts.map +1 -1
  755. package/packages/core/dist/services.js +58 -2
  756. package/packages/core/dist/services.js.map +1 -1
  757. package/packages/core/dist/stdio.d.ts +13 -2
  758. package/packages/core/dist/stdio.d.ts.map +1 -1
  759. package/packages/core/dist/stdio.js +75 -9
  760. package/packages/core/dist/stdio.js.map +1 -1
  761. package/packages/core/dist/workspace-path.d.ts +12 -0
  762. package/packages/core/dist/workspace-path.d.ts.map +1 -0
  763. package/packages/core/dist/workspace-path.js +62 -0
  764. package/packages/core/dist/workspace-path.js.map +1 -0
  765. package/packages/core/package.json +18 -8
  766. package/packages/core/profiles/default/cordis.yml +85 -0
  767. package/packages/core/profiles/development/cordis.yml +1 -1
  768. package/packages/core/src/boot.ts +38 -2
  769. package/packages/core/src/config.ts +5 -0
  770. package/packages/core/src/http.ts +32 -0
  771. package/packages/core/src/index.ts +2 -0
  772. package/packages/core/src/plugins/agent-teams.ts +291 -0
  773. package/packages/core/src/plugins/anchored-standard.ts +88 -0
  774. package/packages/core/src/plugins/annotation.ts +106 -0
  775. package/packages/core/src/plugins/archify.ts +124 -0
  776. package/packages/core/src/plugins/at-file.ts +54 -0
  777. package/packages/core/src/plugins/auto-mode.ts +123 -0
  778. package/packages/core/src/plugins/better-sidebar.ts +117 -0
  779. package/packages/core/src/plugins/browser-fetch.ts +171 -0
  780. package/packages/core/src/plugins/browser-session.ts +287 -0
  781. package/packages/core/src/plugins/canvas-draw.ts +90 -0
  782. package/packages/core/src/plugins/change-verifier.ts +79 -0
  783. package/packages/core/src/plugins/cleaner.ts +61 -0
  784. package/packages/core/src/plugins/cli-notifier.ts +125 -0
  785. package/packages/core/src/plugins/code2skill.ts +96 -0
  786. package/packages/core/src/plugins/colleague-skill.ts +122 -0
  787. package/packages/core/src/plugins/context-doctor.ts +117 -0
  788. package/packages/core/src/plugins/context.ts +102 -0
  789. package/packages/core/src/plugins/cost-meter.ts +231 -0
  790. package/packages/core/src/plugins/dependency-checker.ts +241 -0
  791. package/packages/core/src/plugins/docker-sandbox.ts +100 -0
  792. package/packages/core/src/plugins/fail-logger.ts +51 -0
  793. package/packages/core/src/plugins/genui.ts +88 -0
  794. package/packages/core/src/plugins/git-time-capsule.ts +97 -0
  795. package/packages/core/src/plugins/graph-memory.ts +394 -0
  796. package/packages/core/src/plugins/history-compressor.ts +81 -0
  797. package/packages/core/src/plugins/hol-guard.ts +153 -0
  798. package/packages/core/src/plugins/i18n-pair.ts +82 -0
  799. package/packages/core/src/plugins/image-compressor.ts +144 -0
  800. package/packages/core/src/plugins/llm-verifier.ts +164 -0
  801. package/packages/core/src/plugins/mcp-client.ts +559 -0
  802. package/packages/core/src/plugins/mcp-panel.ts +190 -0
  803. package/packages/core/src/plugins/memory.ts +176 -0
  804. package/packages/core/src/plugins/mirage-bridge.ts +179 -0
  805. package/packages/core/src/plugins/mock-server.ts +158 -0
  806. package/packages/core/src/plugins/model.ts +3 -1
  807. package/packages/core/src/plugins/models.ts +5 -2
  808. package/packages/core/src/plugins/modlens.ts +63 -0
  809. package/packages/core/src/plugins/module-search.ts +201 -0
  810. package/packages/core/src/plugins/obsidian-sync.ts +83 -0
  811. package/packages/core/src/plugins/openpets.ts +109 -0
  812. package/packages/core/src/plugins/plan-execute.ts +76 -0
  813. package/packages/core/src/plugins/plugin-check.ts +232 -0
  814. package/packages/core/src/plugins/plugin-dev.ts +47 -0
  815. package/packages/core/src/plugins/plugin-finder.ts +108 -0
  816. package/packages/core/src/plugins/plugin-radar.ts +179 -0
  817. package/packages/core/src/plugins/plugin-stars.ts +205 -0
  818. package/packages/core/src/plugins/prompt-guard.ts +122 -0
  819. package/packages/core/src/plugins/prompt-library.ts +165 -0
  820. package/packages/core/src/plugins/readme-gen.ts +147 -0
  821. package/packages/core/src/plugins/recall-unread.ts +142 -0
  822. package/packages/core/src/plugins/resources.ts +28 -21
  823. package/packages/core/src/plugins/reverse-skill.ts +79 -0
  824. package/packages/core/src/plugins/reviewer-bot.ts +146 -0
  825. package/packages/core/src/plugins/runtime-doctor.ts +137 -0
  826. package/packages/core/src/plugins/runtime.ts +61 -14
  827. package/packages/core/src/plugins/secure-audit.ts +146 -0
  828. package/packages/core/src/plugins/session-bookmarks.ts +89 -0
  829. package/packages/core/src/plugins/session-bridge.ts +299 -0
  830. package/packages/core/src/plugins/session-compare.ts +180 -0
  831. package/packages/core/src/plugins/session-export.ts +99 -0
  832. package/packages/core/src/plugins/session-insights.ts +47 -0
  833. package/packages/core/src/plugins/session-search.ts +126 -0
  834. package/packages/core/src/plugins/session.ts +4 -2
  835. package/packages/core/src/plugins/skill-catalog.ts +117 -0
  836. package/packages/core/src/plugins/skill-guard.ts +152 -0
  837. package/packages/core/src/plugins/sql-lens.ts +92 -0
  838. package/packages/core/src/plugins/stdio.ts +3 -1
  839. package/packages/core/src/plugins/synapse.ts +130 -0
  840. package/packages/core/src/plugins/tab-manager.ts +135 -0
  841. package/packages/core/src/plugins/taskboard.ts +412 -0
  842. package/packages/core/src/plugins/telemetry-blocker.ts +62 -0
  843. package/packages/core/src/plugins/test-harness.ts +67 -0
  844. package/packages/core/src/plugins/theme-studio.ts +165 -0
  845. package/packages/core/src/plugins/token-guard.ts +84 -0
  846. package/packages/core/src/plugins/tools.ts +5 -2
  847. package/packages/core/src/plugins/turn-rewind.ts +86 -0
  848. package/packages/core/src/plugins/undo-savepoint.ts +284 -0
  849. package/packages/core/src/plugins/vision-toolkit.ts +153 -0
  850. package/packages/core/src/plugins/web-research.ts +289 -0
  851. package/packages/core/src/plugins/workspace-navigator.ts +164 -0
  852. package/packages/core/src/plugins/workspace-search.ts +139 -0
  853. package/packages/core/src/plugins/yaml-validator.ts +97 -0
  854. package/packages/core/src/profile.ts +3 -0
  855. package/packages/core/src/runtime.ts +11 -4
  856. package/packages/core/src/services.ts +110 -3
  857. package/packages/core/src/stdio.ts +79 -9
  858. package/packages/core/src/workspace-path.ts +69 -0
  859. package/packages/core/test/agent-teams.test.ts +24 -0
  860. package/packages/core/test/archify.test.ts +33 -0
  861. package/packages/core/test/better-sidebar.test.ts +125 -0
  862. package/packages/core/test/boot.test.ts +49 -6
  863. package/packages/core/test/colleague-skill.test.ts +74 -0
  864. package/packages/core/test/config.test.ts +121 -0
  865. package/packages/core/test/context-doctor.test.ts +32 -0
  866. package/packages/core/test/dependency-checker.test.ts +60 -0
  867. package/packages/core/test/git-time-capsule.test.ts +115 -0
  868. package/packages/core/test/http.test.ts +34 -0
  869. package/packages/core/test/llm-verifier.test.ts +72 -0
  870. package/packages/core/test/mirage-bridge.test.ts +54 -0
  871. package/packages/core/test/module-search.test.ts +78 -0
  872. package/packages/core/test/plugin-check.test.ts +16 -0
  873. package/packages/core/test/plugin-stars.test.ts +55 -0
  874. package/packages/core/test/profiles.integration.test.ts +49 -15
  875. package/packages/core/test/prompt-library.test.ts +56 -0
  876. package/packages/core/test/readme-gen.test.ts +45 -0
  877. package/packages/core/test/recall-unread.test.ts +35 -0
  878. package/packages/core/test/registry.test.ts +48 -0
  879. package/packages/core/test/reverse-skill.test.ts +40 -0
  880. package/packages/core/test/runtime-doctor.test.ts +55 -0
  881. package/packages/core/test/runtime-fixture.ts +4 -4
  882. package/packages/core/test/runtime.test.ts +90 -1
  883. package/packages/core/test/secure-audit.test.ts +16 -0
  884. package/packages/core/test/services.test.ts +2024 -5
  885. package/packages/core/test/session-bookmarks.test.ts +62 -0
  886. package/packages/core/test/session-bridge.test.ts +103 -0
  887. package/packages/core/test/session-compare.test.ts +94 -0
  888. package/packages/core/test/session-export.test.ts +54 -0
  889. package/packages/core/test/session-search.test.ts +30 -0
  890. package/packages/core/test/skill-catalog.test.ts +18 -0
  891. package/packages/core/test/skill-guard.test.ts +21 -0
  892. package/packages/core/test/stdio-args.test.ts +178 -0
  893. package/packages/core/test/theme-studio.test.ts +39 -0
  894. package/packages/core/test/token-guard.test.ts +34 -0
  895. package/packages/core/test/turn-rewind.test.ts +19 -0
  896. package/packages/core/test/vision-toolkit.test.ts +38 -0
  897. package/packages/core/test/workspace-git-status.test.ts +37 -0
  898. package/packages/core/test/workspace-navigator.test.ts +33 -0
  899. package/packages/core/test/workspace-path.test.ts +34 -0
  900. package/packages/core/tsconfig.build.json +1 -3
  901. package/packages/core/tsconfig.json +1 -4
  902. package/packages/host-webserver/LICENSE +9 -0
  903. package/packages/host-webserver/dist/index.js +1 -1
  904. package/packages/host-webserver/dist/index.js.map +1 -1
  905. package/packages/host-webserver/package.json +17 -7
  906. package/packages/host-webserver/src/index.ts +1 -1
  907. package/packages/host-webserver/test/index.test.ts +4 -1
  908. package/packages/host-webserver/tsconfig.build.json +1 -1
  909. package/packages/host-webserver/tsconfig.json +1 -1
  910. package/apps/web/dist/assets/index-Bwqek8LF.js +0 -20
  911. package/apps/web/dist/assets/index-DCHSASjq.css +0 -1
  912. package/packages/api-gateway/dist/marketplace-registry.json +0 -62
  913. package/packages/api-gateway/src/marketplace-registry.json +0 -62
@@ -0,0 +1,165 @@
1
+ import type { Context } from "@deepseek-ai/cordis";
2
+ import z from "@deepseek-ai/schemastery";
3
+ import { Type } from "@earendil-works/pi-ai";
4
+ import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
5
+
6
+ const customType = "pi-harness/theme-studio";
7
+
8
+ export type ThemeId = "light" | "midnight" | "paper" | "high-contrast";
9
+ export type ThemePreset = { label: string; description: string; tokens: Readonly<Record<string, string>> };
10
+ export type ThemeState = {
11
+ theme: ThemeId;
12
+ label: string;
13
+ description: string;
14
+ tokens: Readonly<Record<string, string>>;
15
+ changed: boolean;
16
+ changedAt: string | null;
17
+ };
18
+
19
+ export const themePresets: Readonly<Record<ThemeId, ThemePreset>> = {
20
+ light: {
21
+ label: "Light",
22
+ description: "默认浅色界面,适合长时间编码。",
23
+ tokens: {
24
+ "--color-ink": "#0f1115",
25
+ "--color-muted": "#65707b",
26
+ "--color-faint": "#8a949f",
27
+ "--color-line": "rgba(15,17,21,0.12)",
28
+ "--color-soft": "#f6f8fa",
29
+ "--color-blue": "#4176e6",
30
+ "--color-blue-soft": "#edf3fe",
31
+ "--color-green": "#22c55e",
32
+ "--color-red": "#ec1313",
33
+ "--color-amber": "#f59e0b",
34
+ "--color-empty": "#9aa0a6",
35
+ "--color-starter-border": "rgba(15,17,21,0.14)",
36
+ },
37
+ },
38
+ midnight: {
39
+ label: "Midnight",
40
+ description: "深色工作台,降低夜间屏幕亮度。",
41
+ tokens: {
42
+ "--color-ink": "#f8fafc",
43
+ "--color-muted": "#b7c2d1",
44
+ "--color-faint": "#8290a3",
45
+ "--color-line": "rgba(226,232,240,0.18)",
46
+ "--color-soft": "#111827",
47
+ "--color-blue": "#8ab4ff",
48
+ "--color-blue-soft": "#1e3a67",
49
+ "--color-green": "#58d68d",
50
+ "--color-red": "#ff8a8a",
51
+ "--color-amber": "#f6c56a",
52
+ "--color-empty": "#778399",
53
+ "--color-starter-border": "rgba(226,232,240,0.22)",
54
+ },
55
+ },
56
+ paper: {
57
+ label: "Paper",
58
+ description: "暖白纸张色调,适合阅读和文档整理。",
59
+ tokens: {
60
+ "--color-ink": "#332b24",
61
+ "--color-muted": "#76695d",
62
+ "--color-faint": "#a09589",
63
+ "--color-line": "rgba(82,63,45,0.16)",
64
+ "--color-soft": "#f5f0e8",
65
+ "--color-blue": "#876334",
66
+ "--color-blue-soft": "#eee2d0",
67
+ "--color-green": "#5f8b61",
68
+ "--color-red": "#b85b4f",
69
+ "--color-amber": "#b17b36",
70
+ "--color-empty": "#a59a8e",
71
+ "--color-starter-border": "rgba(82,63,45,0.18)",
72
+ },
73
+ },
74
+ "high-contrast": {
75
+ label: "High Contrast",
76
+ description: "更清晰的文本和边界,适合低视力场景。",
77
+ tokens: {
78
+ "--color-ink": "#000000",
79
+ "--color-muted": "#262626",
80
+ "--color-faint": "#4a4a4a",
81
+ "--color-line": "rgba(0,0,0,0.36)",
82
+ "--color-soft": "#eeeeee",
83
+ "--color-blue": "#0047b3",
84
+ "--color-blue-soft": "#dbeafe",
85
+ "--color-green": "#0b6b2d",
86
+ "--color-red": "#a40000",
87
+ "--color-amber": "#754c00",
88
+ "--color-empty": "#5c5c5c",
89
+ "--color-starter-border": "rgba(0,0,0,0.42)",
90
+ },
91
+ },
92
+ };
93
+
94
+ export interface ThemeStudioPluginConfig {
95
+ theme?: ThemeId;
96
+ }
97
+
98
+ export const Config: z<ThemeStudioPluginConfig> = z.object({
99
+ theme: z.union(["light", "midnight", "paper", "high-contrast"]).default("light"),
100
+ });
101
+
102
+ function isThemeId(value: unknown): value is ThemeId {
103
+ return typeof value === "string" && Object.hasOwn(themePresets, value);
104
+ }
105
+
106
+ function initialTheme(context: Context, fallback: ThemeId): ThemeId {
107
+ const entries = context.piSession.manager.getEntries();
108
+ const entry = [...entries].reverse().find((item) => item.type === "custom" && item.customType === customType);
109
+ if (entry?.type !== "custom" || entry.data === undefined || typeof entry.data !== "object" || entry.data === null) return fallback;
110
+ const selected = (entry.data as { theme?: unknown }).theme;
111
+ return isThemeId(selected) ? selected : fallback;
112
+ }
113
+
114
+ export default {
115
+ name: "pi-theme-studio",
116
+ inject: ["piSession", "piPluginUi", "piTools"],
117
+ Config,
118
+ apply(context: Context, config: ThemeStudioPluginConfig) {
119
+ let theme = initialTheme(context, config.theme ?? "light");
120
+ let changedAt: string | null = null;
121
+ const state = (): ThemeState => ({ ...themePresets[theme], theme, changed: changedAt !== null, changedAt });
122
+ const unregisterSet = context.piTools.register(
123
+ defineTool({
124
+ name: "theme_set",
125
+ label: "Set UI theme",
126
+ description: "Select one of the bounded Pi Harness theme presets and persist it in the current session.",
127
+ promptSnippet: "switch the Pi Harness UI theme",
128
+ parameters: Type.Object({ theme: Type.Union([Type.Literal("light"), Type.Literal("midnight"), Type.Literal("paper"), Type.Literal("high-contrast")]) }),
129
+ execute(_toolCallId, params): Promise<AgentToolResult<ThemeState>> {
130
+ theme = params.theme;
131
+ changedAt = new Date().toISOString();
132
+ context.piSession.manager.appendCustomEntry(customType, { theme });
133
+ const details = state();
134
+ return Promise.resolve({ content: [{ type: "text", text: `Theme selected: ${details.label}` }], details });
135
+ },
136
+ }),
137
+ );
138
+ const unregisterStatus = context.piTools.register(
139
+ defineTool({
140
+ name: "theme_status",
141
+ label: "Theme status",
142
+ description: "Show the active theme preset and its UI color tokens.",
143
+ promptSnippet: "inspect the active Pi Harness theme",
144
+ parameters: Type.Object({}),
145
+ execute(): Promise<AgentToolResult<ThemeState>> {
146
+ const details = state();
147
+ return Promise.resolve({ content: [{ type: "text", text: `${details.label}: ${details.description}` }], details });
148
+ },
149
+ }),
150
+ );
151
+ const disposePanel = context.piPluginUi.register({
152
+ id: "theme-studio-panel",
153
+ pluginId: "@pi-harness/core/plugins/theme-studio",
154
+ title: "Theme Studio",
155
+ description: "切换可审计的界面主题预设,选择会保存到当前 session。",
156
+ icon: "◐",
157
+ read: () => ({ ...state(), presets: Object.entries(themePresets).map(([id, preset]) => ({ id, label: preset.label, description: preset.description })) }),
158
+ });
159
+ context.effect(() => () => {
160
+ unregisterSet();
161
+ unregisterStatus();
162
+ disposePanel();
163
+ });
164
+ },
165
+ };
@@ -0,0 +1,84 @@
1
+ import type { Context } from "@deepseek-ai/cordis";
2
+ import z from "@deepseek-ai/schemastery";
3
+
4
+ export interface TokenGuardPluginConfig {
5
+ maxPercent?: number;
6
+ maxRunTokens?: number;
7
+ }
8
+
9
+ export const Config: z<TokenGuardPluginConfig> = z.object({ maxPercent: z.number().default(90), maxRunTokens: z.number().default(0) });
10
+
11
+ export default {
12
+ name: "pi-token-guard",
13
+ inject: ["piRuntime", "piPluginUi"],
14
+ Config,
15
+ apply(context: Context, config: TokenGuardPluginConfig) {
16
+ const maxPercent = Math.max(1, Math.min(100, config.maxPercent ?? 90));
17
+ const maxRunTokens = Math.max(0, Math.min(10_000_000, Math.trunc(config.maxRunTokens ?? 0)));
18
+ let abortCount = 0;
19
+ let lastPercent: number | null = null;
20
+ let lastTokens: number | null = null;
21
+ let lastContextWindow = 0;
22
+ let lastExceeded = false;
23
+ let abortIssued = false;
24
+ let runStartTokens: number | null = null;
25
+ let runTokens: number | null = null;
26
+ let runExceeded = false;
27
+ const sessionTokens = (): number | null => {
28
+ const stats = context.piRuntime.session.getSessionStats?.();
29
+ const total = stats?.tokens?.total;
30
+ return typeof total === "number" && Number.isFinite(total) && total >= 0 ? total : null;
31
+ };
32
+ const inspect = (): void => {
33
+ const usage = context.piRuntime.session.getContextUsage();
34
+ lastPercent = usage?.percent ?? null;
35
+ lastTokens = usage?.tokens ?? null;
36
+ lastContextWindow = usage?.contextWindow ?? 0;
37
+ lastExceeded = lastPercent !== null && lastPercent >= maxPercent;
38
+ const currentTokens = sessionTokens();
39
+ runTokens = runStartTokens === null || currentTokens === null ? null : Math.max(0, currentTokens - runStartTokens);
40
+ runExceeded = maxRunTokens > 0 && runTokens !== null && runTokens >= maxRunTokens;
41
+ lastExceeded = lastExceeded || runExceeded;
42
+ if (!lastExceeded) abortIssued = false;
43
+ if (lastExceeded && context.piRuntime.session.isStreaming && !abortIssued) {
44
+ abortIssued = true;
45
+ abortCount += 1;
46
+ void context.piRuntime.abort();
47
+ }
48
+ };
49
+ const unsubscribe = context.on("pi/session-event", (event) => {
50
+ if (event.type === "agent_start") {
51
+ runStartTokens = sessionTokens();
52
+ runTokens = runStartTokens === null ? null : 0;
53
+ runExceeded = false;
54
+ abortIssued = false;
55
+ }
56
+ inspect();
57
+ });
58
+ const disposePanel = context.piPluginUi.register({
59
+ id: "token-guard-panel",
60
+ pluginId: "@pi-harness/core/plugins/token-guard",
61
+ title: "Token Guard",
62
+ description: "在上下文达到预算阈值时自动停止当前运行,避免继续消耗上下文。",
63
+ icon: "◌",
64
+ read: () => {
65
+ inspect();
66
+ return {
67
+ maxPercent,
68
+ maxRunTokens,
69
+ percent: lastPercent,
70
+ tokens: lastTokens,
71
+ contextWindow: lastContextWindow,
72
+ runTokens,
73
+ runExceeded,
74
+ exceeded: lastExceeded,
75
+ aborts: abortCount,
76
+ };
77
+ },
78
+ });
79
+ context.effect(() => () => {
80
+ unsubscribe();
81
+ disposePanel();
82
+ });
83
+ },
84
+ };
@@ -1,6 +1,7 @@
1
1
  import type { Context } from "@deepseek-ai/cordis";
2
2
  import z from "@deepseek-ai/schemastery";
3
- import { PiToolRegistry } from "../services.js";
3
+ import { PiPluginUiRegistry, PiToolRegistry } from "../services.js";
4
+ import { assertKnownConfigKeys } from "../config.js";
4
5
 
5
6
  export interface ToolsPluginConfig {
6
7
  names?: string[];
@@ -9,15 +10,17 @@ export interface ToolsPluginConfig {
9
10
  const DEFAULT_TOOLS = ["read", "bash", "edit", "write"];
10
11
 
11
12
  export const Config: z<ToolsPluginConfig> = z.object({
12
- names: z.array(z.string()).default(DEFAULT_TOOLS),
13
+ names: z.array(z.string().min(1)).default(DEFAULT_TOOLS),
13
14
  });
14
15
 
15
16
  export default {
16
17
  name: "pi-tools",
17
18
  Config,
18
19
  apply(context: Context, config: ToolsPluginConfig) {
20
+ assertKnownConfigKeys("pi-tools", config, ["names"]);
19
21
  const names = config.names ?? DEFAULT_TOOLS;
20
22
  if (new Set(names).size !== names.length) throw new Error("Pi core tool names must be unique");
21
23
  context.provide("piTools", new PiToolRegistry(names));
24
+ context.provide("piPluginUi", new PiPluginUiRegistry());
22
25
  },
23
26
  };
@@ -0,0 +1,86 @@
1
+ import type { Context } from "@deepseek-ai/cordis";
2
+ import { Type } from "@earendil-works/pi-ai";
3
+ import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
4
+
5
+ const maxCandidates = 50;
6
+ const maxText = 500;
7
+
8
+ export interface RewindCandidate {
9
+ entryId: string;
10
+ text: string;
11
+ }
12
+
13
+ export interface RewindResult {
14
+ target: RewindCandidate;
15
+ cancelled: boolean;
16
+ editorText?: string;
17
+ summarized: boolean;
18
+ }
19
+
20
+ export function selectRewindTarget(candidates: readonly RewindCandidate[], turns: number): RewindCandidate | undefined {
21
+ if (!Number.isInteger(turns) || turns < 1 || turns > 20) throw new Error("Turn rewind count must be between 1 and 20");
22
+ if (turns >= candidates.length) return undefined;
23
+ return candidates[candidates.length - turns];
24
+ }
25
+
26
+ function currentCandidates(context: Context): RewindCandidate[] {
27
+ const runtime = context.get("piRuntime");
28
+ if (runtime === undefined) return [];
29
+ return runtime.session
30
+ .getUserMessagesForForking()
31
+ .slice(-maxCandidates)
32
+ .map((item) => ({ entryId: item.entryId, text: item.text.slice(0, maxText) }));
33
+ }
34
+
35
+ export default {
36
+ name: "pi-turn-rewind",
37
+ inject: ["piPluginUi", "piTools"],
38
+ apply(context: Context) {
39
+ let latest: RewindResult | undefined;
40
+ const unregister = context.piTools.register(
41
+ defineTool({
42
+ name: "session_rewind",
43
+ label: "Rewind session turn",
44
+ description: "Navigate the native Pi session tree back to a prior user turn while preserving the abandoned branch.",
45
+ promptSnippet: "rewind the current session to a previous user turn without deleting history",
46
+ parameters: Type.Object({
47
+ turns: Type.Optional(Type.Number({ description: "How many user turns to rewind, from 1 to 20" })),
48
+ entryId: Type.Optional(Type.String({ description: "Exact native session entry ID to navigate to" })),
49
+ summarize: Type.Optional(Type.Boolean({ description: "Ask Pi to summarize the abandoned branch" })),
50
+ }),
51
+ async execute(_toolCallId, params): Promise<AgentToolResult<RewindResult>> {
52
+ const runtime = context.get("piRuntime");
53
+ if (runtime === undefined) throw new Error("Pi runtime is not ready");
54
+ if (runtime.session.isStreaming) throw new Error("Cannot rewind while a prompt is running");
55
+ const candidates = currentCandidates(context);
56
+ const requestedId = params.entryId?.trim();
57
+ const target = requestedId ? candidates.find((candidate) => candidate.entryId === requestedId) : selectRewindTarget(candidates, params.turns ?? 1);
58
+ if (target === undefined) throw new Error("No matching previous user turn was found");
59
+ const result = await runtime.session.navigateTree(target.entryId, { summarize: params.summarize === true });
60
+ latest = {
61
+ target,
62
+ cancelled: result.cancelled,
63
+ ...(result.editorText === undefined ? {} : { editorText: result.editorText }),
64
+ summarized: params.summarize === true,
65
+ };
66
+ return {
67
+ content: [{ type: "text", text: result.cancelled ? "Session rewind was cancelled." : `Session rewound to: ${target.text}` }],
68
+ details: latest,
69
+ };
70
+ },
71
+ }),
72
+ );
73
+ const disposePanel = context.piPluginUi.register({
74
+ id: "turn-rewind-panel",
75
+ pluginId: "@pi-harness/core/plugins/turn-rewind",
76
+ title: "Turn Rewind",
77
+ description: "回到之前的用户轮次并保留原分支,不直接删除会话历史。",
78
+ icon: "↶",
79
+ read: () => ({ candidates: currentCandidates(context), latest: latest ?? null }),
80
+ });
81
+ context.effect(() => () => {
82
+ unregister();
83
+ disposePanel();
84
+ });
85
+ },
86
+ };
@@ -0,0 +1,284 @@
1
+ import { createHash, randomUUID } from "node:crypto";
2
+ import { lstat, mkdir, readFile, readdir, rename, writeFile } from "node:fs/promises";
3
+ import { basename, extname, join, relative, resolve, sep } from "node:path";
4
+ import type { Context } from "@deepseek-ai/cordis";
5
+ import z from "@deepseek-ai/schemastery";
6
+ import { Type } from "@earendil-works/pi-ai";
7
+ import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
8
+ import { isPathInside, prepareWorkspaceFile, resolveExistingWorkspacePath } from "../workspace-path.js";
9
+
10
+ const defaultStoreName = "undo-savepoints";
11
+ const defaultTrackedPaths = ["."];
12
+ const maxSnapshotBytes = 2 * 1024 * 1024;
13
+ const sensitiveNames = new Set([".env", ".env.local", ".env.production", ".credentials", ".credentials.yaml", ".credentials.json"]);
14
+ const ignoredDirectories = new Set([".git", "node_modules", "dist", "build", ".next", ".turbo"]);
15
+
16
+ export interface UndoSavepointPluginConfig {
17
+ storeName?: string;
18
+ trackedPaths?: string[];
19
+ maxFiles?: number;
20
+ maxFileBytes?: number;
21
+ }
22
+
23
+ export const Config: z<UndoSavepointPluginConfig> = z.object({
24
+ storeName: z.string().default(defaultStoreName),
25
+ trackedPaths: z.array(z.string()).default(defaultTrackedPaths),
26
+ maxFiles: z.number().default(400),
27
+ maxFileBytes: z.number().default(256 * 1024),
28
+ });
29
+
30
+ interface SavepointFile {
31
+ path: string;
32
+ bytes: number;
33
+ sha256: string;
34
+ content: string;
35
+ }
36
+
37
+ interface SavepointManifest {
38
+ version: 1;
39
+ id: string;
40
+ reason: string;
41
+ createdAt: string;
42
+ files: SavepointFile[];
43
+ }
44
+
45
+ interface SavepointSummary {
46
+ id: string;
47
+ reason: string;
48
+ createdAt: string;
49
+ fileCount: number;
50
+ }
51
+
52
+ interface SavepointDiff {
53
+ id: string;
54
+ changed: string[];
55
+ missing: string[];
56
+ unchanged: number;
57
+ }
58
+
59
+ function safeStoreName(value: string | undefined): string {
60
+ const name = (value ?? defaultStoreName).trim();
61
+ if (name === "" || basename(name) !== name || name.includes(sep) || name === "." || name === "..")
62
+ throw new Error("storeName must be a single directory name");
63
+ return name;
64
+ }
65
+
66
+ function withinRoot(root: string, candidate: string): boolean {
67
+ return isPathInside(root, candidate);
68
+ }
69
+
70
+ async function normalizedTrackedPaths(cwd: string, paths: readonly string[]): Promise<string[]> {
71
+ const values = paths.length === 0 ? defaultTrackedPaths : paths;
72
+ const resolved = await Promise.all(values.map((item) => resolveExistingWorkspacePath(cwd, item, "Tracked paths must stay inside the current workspace")));
73
+ return [...new Set(resolved.map((item) => item.target))];
74
+ }
75
+
76
+ function relativePath(cwd: string, path: string): string {
77
+ return relative(cwd, path).split(sep).join("/");
78
+ }
79
+
80
+ function isSensitivePath(path: string): boolean {
81
+ const name = basename(path).toLowerCase();
82
+ return sensitiveNames.has(name) || name.endsWith(".pem") || name.endsWith(".key") || name.endsWith(".p12");
83
+ }
84
+
85
+ function isIgnoredPath(path: string): boolean {
86
+ return path.split(sep).some((part) => ignoredDirectories.has(part));
87
+ }
88
+
89
+ function hash(content: Buffer): string {
90
+ return createHash("sha256").update(content).digest("hex");
91
+ }
92
+
93
+ async function collectFiles(root: string, trackedPaths: readonly string[], maxFiles: number, maxFileBytes: number): Promise<SavepointFile[]> {
94
+ const files: SavepointFile[] = [];
95
+ const seen = new Set<string>();
96
+ const visit = async (path: string): Promise<void> => {
97
+ if (files.length >= maxFiles || isIgnoredPath(path) || isSensitivePath(path)) return;
98
+ const info = await lstat(path).catch(() => undefined);
99
+ if (info === undefined) return;
100
+ if (info.isSymbolicLink()) return;
101
+ if (info.isDirectory()) {
102
+ for (const entry of await readdir(path, { withFileTypes: true })) {
103
+ if (entry.isSymbolicLink()) continue;
104
+ await visit(join(path, entry.name));
105
+ if (files.length >= maxFiles) return;
106
+ }
107
+ return;
108
+ }
109
+ if (!info.isFile() || info.size > maxFileBytes) return;
110
+ const content = await readFile(path);
111
+ if (content.includes(0)) return;
112
+ const relativeName = relativePath(root, path);
113
+ if (relativeName === "" || seen.has(relativeName)) return;
114
+ seen.add(relativeName);
115
+ files.push({ path: relativeName, bytes: content.byteLength, sha256: hash(content), content: content.toString("base64") });
116
+ };
117
+ for (const path of trackedPaths) {
118
+ await visit(path);
119
+ if (files.length >= maxFiles) break;
120
+ }
121
+ return files.sort((left, right) => left.path.localeCompare(right.path));
122
+ }
123
+
124
+ async function readManifest(path: string): Promise<SavepointManifest> {
125
+ const parsed = JSON.parse(await readFile(path, "utf8")) as Partial<SavepointManifest>;
126
+ if (parsed.version !== 1 || typeof parsed.id !== "string" || !Array.isArray(parsed.files)) throw new Error(`Invalid savepoint: ${basename(path)}`);
127
+ return {
128
+ version: 1,
129
+ id: parsed.id,
130
+ reason: typeof parsed.reason === "string" ? parsed.reason : "",
131
+ createdAt: typeof parsed.createdAt === "string" ? parsed.createdAt : "",
132
+ files: parsed.files.filter(
133
+ (file): file is SavepointFile =>
134
+ typeof file === "object" &&
135
+ file !== null &&
136
+ typeof file.path === "string" &&
137
+ typeof file.bytes === "number" &&
138
+ typeof file.sha256 === "string" &&
139
+ typeof file.content === "string",
140
+ ),
141
+ };
142
+ }
143
+
144
+ async function listManifests(directory: string): Promise<SavepointSummary[]> {
145
+ const names = (await readdir(directory).catch(() => [] as string[]))
146
+ .filter((name) => extname(name) === ".json")
147
+ .sort()
148
+ .reverse();
149
+ const summaries: SavepointSummary[] = [];
150
+ for (const name of names) {
151
+ const manifest = await readManifest(join(directory, name)).catch(() => undefined);
152
+ if (manifest !== undefined) summaries.push({ id: manifest.id, reason: manifest.reason, createdAt: manifest.createdAt, fileCount: manifest.files.length });
153
+ }
154
+ return summaries;
155
+ }
156
+
157
+ async function diffManifest(root: string, manifest: SavepointManifest): Promise<SavepointDiff> {
158
+ const changed: string[] = [];
159
+ const missing: string[] = [];
160
+ let unchanged = 0;
161
+ for (const file of manifest.files) {
162
+ const path = await resolveExistingWorkspacePath(root, file.path, "Savepoint path must stay inside the workspace").catch(() => undefined);
163
+ if (path === undefined) {
164
+ missing.push(file.path);
165
+ continue;
166
+ }
167
+ const content = await readFile(path.target).catch(() => undefined);
168
+ if (content === undefined) {
169
+ missing.push(file.path);
170
+ } else if (hash(content) === file.sha256) {
171
+ unchanged += 1;
172
+ } else {
173
+ changed.push(file.path);
174
+ }
175
+ }
176
+ return { id: manifest.id, changed, missing, unchanged };
177
+ }
178
+
179
+ export default {
180
+ name: "pi-undo-savepoint",
181
+ inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
182
+ Config,
183
+ async apply(context: Context, config: UndoSavepointPluginConfig) {
184
+ const cwd = (await resolveExistingWorkspacePath(context.piHarnessLaunch.cwd, ".", "Workspace path is invalid")).root;
185
+ const store = join(context.piHarnessLaunch.agentDir, safeStoreName(config.storeName));
186
+ const trackedPaths = await normalizedTrackedPaths(cwd, config.trackedPaths ?? defaultTrackedPaths);
187
+ const maxFiles = Math.max(1, Math.min(2_000, Math.trunc(config.maxFiles ?? 400)));
188
+ const maxFileBytes = Math.max(1, Math.min(maxSnapshotBytes, Math.trunc(config.maxFileBytes ?? 256 * 1024)));
189
+ const manifestPath = (id: string): string => {
190
+ if (!/^\d{17}-[0-9a-f]{8}$/u.test(id)) throw new Error("Invalid savepoint id");
191
+ return join(store, `${id}.json`);
192
+ };
193
+ const load = async (id: string): Promise<SavepointManifest> => readManifest(manifestPath(id));
194
+ const save = async (reason: string): Promise<SavepointManifest> => {
195
+ const createdAt = new Date().toISOString();
196
+ const id = `${createdAt.replace(/[-:.TZ]/gu, "").slice(0, 17)}-${randomUUID().slice(0, 8)}`;
197
+ const manifest: SavepointManifest = {
198
+ version: 1,
199
+ id,
200
+ reason: reason.trim() || "manual savepoint",
201
+ createdAt,
202
+ files: await collectFiles(cwd, trackedPaths, maxFiles, maxFileBytes),
203
+ };
204
+ await mkdir(store, { recursive: true });
205
+ const temporary = join(store, `.${id}.tmp`);
206
+ await writeFile(temporary, JSON.stringify(manifest, null, 2), { encoding: "utf8", mode: 0o600 });
207
+ await rename(temporary, manifestPath(id));
208
+ return manifest;
209
+ };
210
+ const restore = async (manifest: SavepointManifest): Promise<string[]> => {
211
+ const restored: string[] = [];
212
+ for (const file of manifest.files) {
213
+ const lexicalPath = resolve(cwd, ...file.path.split("/"));
214
+ if (!withinRoot(cwd, lexicalPath) || isSensitivePath(lexicalPath)) continue;
215
+ const content = Buffer.from(file.content, "base64");
216
+ if (hash(content) !== file.sha256) throw new Error(`Savepoint integrity check failed: ${file.path}`);
217
+ const prepared = await prepareWorkspaceFile(cwd, file.path, `Savepoint path must stay inside the workspace and target a regular file: ${file.path}`);
218
+ const temporary = `${prepared.target}.${randomUUID()}.tmp`;
219
+ await writeFile(temporary, content, { mode: 0o600 });
220
+ await rename(temporary, prepared.target);
221
+ restored.push(file.path);
222
+ }
223
+ return restored;
224
+ };
225
+ const report = async (): Promise<{ store: string; trackedPaths: string[]; count: number; savepoints: SavepointSummary[] }> => {
226
+ const savepoints = await listManifests(store);
227
+ return { store, trackedPaths: trackedPaths.map((path) => relativePath(cwd, path) || "."), count: savepoints.length, savepoints };
228
+ };
229
+ const unregisterTool = context.piTools.register(
230
+ defineTool({
231
+ name: "undo_savepoint",
232
+ label: "Undo savepoint",
233
+ description: "Create, inspect, diff, list, and explicitly restore safe local workspace savepoints.",
234
+ promptSnippet: "save or restore a workspace savepoint before risky changes",
235
+ parameters: Type.Object({
236
+ action: Type.Union([Type.Literal("save"), Type.Literal("list"), Type.Literal("diff"), Type.Literal("restore")]),
237
+ id: Type.Optional(Type.String({ description: "Savepoint id for diff or restore" })),
238
+ reason: Type.Optional(Type.String({ description: "Why this savepoint is being created" })),
239
+ confirm: Type.Optional(Type.Boolean({ description: "Must be true before restoring files" })),
240
+ }),
241
+ async execute(_toolCallId, params): Promise<AgentToolResult<unknown>> {
242
+ if (params.action === "save") {
243
+ const manifest = await save(params.reason ?? "manual savepoint");
244
+ return {
245
+ content: [{ type: "text", text: `Savepoint ${manifest.id} saved (${manifest.files.length} files).` }],
246
+ details: { action: "save", id: manifest.id, fileCount: manifest.files.length },
247
+ };
248
+ }
249
+ if (params.action === "list") {
250
+ const details = await report();
251
+ return { content: [{ type: "text", text: `${details.savepoints.length} savepoints available.` }], details: { action: "list", ...details } };
252
+ }
253
+ if (params.id === undefined || params.id.trim() === "") throw new Error(`action ${params.action} requires id`);
254
+ const manifest = await load(params.id);
255
+ if (params.action === "diff") {
256
+ const details = await diffManifest(cwd, manifest);
257
+ return {
258
+ content: [{ type: "text", text: `${details.changed.length} changed, ${details.missing.length} missing, ${details.unchanged} unchanged.` }],
259
+ details: { action: "diff", ...details },
260
+ };
261
+ }
262
+ if (params.confirm !== true) throw new Error("Restoring a savepoint requires confirm=true");
263
+ const restored = await restore(manifest);
264
+ return {
265
+ content: [{ type: "text", text: `Restored ${restored.length} files from ${manifest.id}.` }],
266
+ details: { action: "restore", id: manifest.id, restored },
267
+ };
268
+ },
269
+ }),
270
+ );
271
+ const disposePanel = context.piPluginUi.register({
272
+ id: "undo-savepoint-panel",
273
+ pluginId: "@pi-harness/core/plugins/undo-savepoint",
274
+ title: "Undo Savepoints",
275
+ description: "保存工作区文件快照,查看列表与变更,并在确认后恢复。",
276
+ icon: "↶",
277
+ read: report,
278
+ });
279
+ context.effect(() => () => {
280
+ unregisterTool();
281
+ disposePanel();
282
+ });
283
+ },
284
+ };