@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.
- package/LICENSE +9 -0
- package/README.md +31 -7
- package/apps/web/dist/assets/index-BoEwZu6r.css +2 -0
- package/apps/web/dist/assets/index-alZn4u37.js +20 -0
- package/apps/web/dist/assets/markdown-vendor-DUdMWn0M.js +66 -0
- package/apps/web/dist/assets/react-vendor-BD7-wQo9.js +9 -0
- package/apps/web/dist/icons/app/android-192.png +0 -0
- package/apps/web/dist/icons/app/android-512.png +0 -0
- package/apps/web/dist/icons/app/app-blue-512.png +0 -0
- package/apps/web/dist/icons/app/app-store-1024.png +0 -0
- package/apps/web/dist/icons/app/apple-touch-icon-180.png +0 -0
- package/apps/web/dist/icons/app/maskable-512.png +0 -0
- package/apps/web/dist/icons/favicon/favicon-16.png +0 -0
- package/apps/web/dist/icons/favicon/favicon-32.png +0 -0
- package/apps/web/dist/icons/favicon/favicon-48.png +0 -0
- package/apps/web/dist/icons/png-blue/pi-256.png +0 -0
- package/apps/web/dist/icons/png-blue/pi-512.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-1024.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-128.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-16.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-24.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-256.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-32.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-48.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-512.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-64.png +0 -0
- package/apps/web/dist/icons/png-white/pi-1024.png +0 -0
- package/apps/web/dist/icons/png-white/pi-128.png +0 -0
- package/apps/web/dist/icons/png-white/pi-16.png +0 -0
- package/apps/web/dist/icons/png-white/pi-24.png +0 -0
- package/apps/web/dist/icons/png-white/pi-256.png +0 -0
- package/apps/web/dist/icons/png-white/pi-32.png +0 -0
- package/apps/web/dist/icons/png-white/pi-48.png +0 -0
- package/apps/web/dist/icons/png-white/pi-512.png +0 -0
- package/apps/web/dist/icons/png-white/pi-64.png +0 -0
- package/apps/web/dist/icons/social/og-1200x630.png +0 -0
- package/apps/web/dist/icons/svg/app-icon-blue.svg +13 -0
- package/apps/web/dist/icons/svg/app-icon-ink.svg +13 -0
- package/apps/web/dist/icons/svg/favicon.svg +10 -0
- package/apps/web/dist/icons/svg/lockup-horizontal.svg +13 -0
- package/apps/web/dist/icons/svg/mark-blue.svg +10 -0
- package/apps/web/dist/icons/svg/mark-compact.svg +10 -0
- package/apps/web/dist/icons/svg/mark-ink.svg +10 -0
- package/apps/web/dist/icons/svg/mark-white.svg +10 -0
- package/apps/web/dist/icons/svg/mark.svg +10 -0
- package/apps/web/dist/index.html +18 -6
- package/apps/web/dist/manifest.webmanifest +14 -0
- package/apps/web/index.html +14 -4
- package/apps/web/package.json +11 -9
- package/apps/web/profile/cordis.yml +222 -1
- package/apps/web/public/icons/app/android-192.png +0 -0
- package/apps/web/public/icons/app/android-512.png +0 -0
- package/apps/web/public/icons/app/app-blue-512.png +0 -0
- package/apps/web/public/icons/app/app-store-1024.png +0 -0
- package/apps/web/public/icons/app/apple-touch-icon-180.png +0 -0
- package/apps/web/public/icons/app/maskable-512.png +0 -0
- package/apps/web/public/icons/favicon/favicon-16.png +0 -0
- package/apps/web/public/icons/favicon/favicon-32.png +0 -0
- package/apps/web/public/icons/favicon/favicon-48.png +0 -0
- package/apps/web/public/icons/png-blue/pi-256.png +0 -0
- package/apps/web/public/icons/png-blue/pi-512.png +0 -0
- package/apps/web/public/icons/png-ink/pi-1024.png +0 -0
- package/apps/web/public/icons/png-ink/pi-128.png +0 -0
- package/apps/web/public/icons/png-ink/pi-16.png +0 -0
- package/apps/web/public/icons/png-ink/pi-24.png +0 -0
- package/apps/web/public/icons/png-ink/pi-256.png +0 -0
- package/apps/web/public/icons/png-ink/pi-32.png +0 -0
- package/apps/web/public/icons/png-ink/pi-48.png +0 -0
- package/apps/web/public/icons/png-ink/pi-512.png +0 -0
- package/apps/web/public/icons/png-ink/pi-64.png +0 -0
- package/apps/web/public/icons/png-white/pi-1024.png +0 -0
- package/apps/web/public/icons/png-white/pi-128.png +0 -0
- package/apps/web/public/icons/png-white/pi-16.png +0 -0
- package/apps/web/public/icons/png-white/pi-24.png +0 -0
- package/apps/web/public/icons/png-white/pi-256.png +0 -0
- package/apps/web/public/icons/png-white/pi-32.png +0 -0
- package/apps/web/public/icons/png-white/pi-48.png +0 -0
- package/apps/web/public/icons/png-white/pi-512.png +0 -0
- package/apps/web/public/icons/png-white/pi-64.png +0 -0
- package/apps/web/public/icons/social/og-1200x630.png +0 -0
- package/apps/web/public/icons/svg/app-icon-blue.svg +13 -0
- package/apps/web/public/icons/svg/app-icon-ink.svg +13 -0
- package/apps/web/public/icons/svg/favicon.svg +10 -0
- package/apps/web/public/icons/svg/lockup-horizontal.svg +13 -0
- package/apps/web/public/icons/svg/mark-blue.svg +10 -0
- package/apps/web/public/icons/svg/mark-compact.svg +10 -0
- package/apps/web/public/icons/svg/mark-ink.svg +10 -0
- package/apps/web/public/icons/svg/mark-white.svg +10 -0
- package/apps/web/public/icons/svg/mark.svg +10 -0
- package/apps/web/public/manifest.webmanifest +14 -0
- package/apps/web/server-dist/bin.js +19 -6
- package/apps/web/server-dist/bin.js.map +1 -1
- package/apps/web/src/command-palette.ts +28 -7
- package/apps/web/src/file-diff.ts +15 -10
- package/apps/web/src/main.ts +4 -1
- package/apps/web/src/runtime.css +17 -4
- package/apps/web/src/server/bin.ts +24 -7
- package/apps/web/src/style.css +2604 -8
- package/apps/web/src/tailwind.css +25 -0
- package/apps/web/tsconfig.build.json +5 -1
- package/apps/web/tsconfig.json +1 -1
- package/apps/web/vite.config.ts +20 -0
- package/package.json +29 -17
- package/packages/api-gateway/LICENSE +9 -0
- package/packages/api-gateway/dist/index.d.ts.map +1 -1
- package/packages/api-gateway/dist/index.js +1188 -42
- package/packages/api-gateway/dist/index.js.map +1 -1
- package/packages/api-gateway/dist/marketplace-entries/official/agent-teams.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/anchored-standard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/annotation.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/archify.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/at-file.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/auto-mode.json +25 -0
- package/packages/api-gateway/dist/marketplace-entries/official/better-sidebar.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/browser-fetch.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/browser-session.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/canvas-draw.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/change-verifier.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cleaner.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cli-notifier.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/code2skill.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/colleague-skill.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/context-doctor.json +22 -0
- package/packages/api-gateway/dist/marketplace-entries/official/context.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cordis-group.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cordis-logger-console.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cordis-timer.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cost-meter.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/dependency-checker.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/docker-sandbox.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/fail-logger.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/genui.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/git-time-capsule.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/graph-memory.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/history-compressor.json +25 -0
- package/packages/api-gateway/dist/marketplace-entries/official/hol-guard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/i18n-pair.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/image-compressor.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/llm-verifier.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mcp-client.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mcp-panel.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/memory.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mirage-bridge.json +19 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mock-server.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/modlens.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/module-search.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/obsidian-sync.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/openpets.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plan-execute.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-check.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-dev.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-finder.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-radar.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-stars.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/prompt-guard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/prompt-library.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/readme-gen.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/recall-unread.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/reverse-skill.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/reviewer-bot.json +22 -0
- package/packages/api-gateway/dist/marketplace-entries/official/runtime-doctor.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/secure-audit.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-bookmarks.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-bridge.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-compare.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-export.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-insights.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-search.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/skill-catalog.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/skill-guard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/sql-lens.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/synapse.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/tab-manager.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/taskboard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/telemetry-blocker.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/test-harness.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/theme-studio.json +19 -0
- package/packages/api-gateway/dist/marketplace-entries/official/token-guard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/turn-rewind.json +22 -0
- package/packages/api-gateway/dist/marketplace-entries/official/undo-savepoint.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/vision-toolkit.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/web-research.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/workspace-navigator.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/workspace-search.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/yaml-validator.json +16 -0
- package/packages/api-gateway/dist/marketplace.d.ts +40 -2
- package/packages/api-gateway/dist/marketplace.d.ts.map +1 -1
- package/packages/api-gateway/dist/marketplace.js +225 -19
- package/packages/api-gateway/dist/marketplace.js.map +1 -1
- package/packages/api-gateway/dist/workspaces.d.ts +8 -0
- package/packages/api-gateway/dist/workspaces.d.ts.map +1 -0
- package/packages/api-gateway/dist/workspaces.js +14 -0
- package/packages/api-gateway/dist/workspaces.js.map +1 -0
- package/packages/api-gateway/package.json +20 -10
- package/packages/api-gateway/scripts/copy-marketplace-entries.mjs +13 -0
- package/packages/api-gateway/src/index.ts +1258 -61
- package/packages/api-gateway/src/marketplace-entries/official/agent-teams.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/anchored-standard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/annotation.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/archify.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/at-file.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/auto-mode.json +25 -0
- package/packages/api-gateway/src/marketplace-entries/official/better-sidebar.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/browser-fetch.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/browser-session.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/canvas-draw.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/change-verifier.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cleaner.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cli-notifier.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/code2skill.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/colleague-skill.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/context-doctor.json +22 -0
- package/packages/api-gateway/src/marketplace-entries/official/context.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cordis-group.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cordis-logger-console.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cordis-timer.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cost-meter.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/dependency-checker.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/docker-sandbox.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/fail-logger.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/genui.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/git-time-capsule.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/graph-memory.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/history-compressor.json +25 -0
- package/packages/api-gateway/src/marketplace-entries/official/hol-guard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/i18n-pair.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/image-compressor.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/llm-verifier.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/mcp-client.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/mcp-panel.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/memory.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/mirage-bridge.json +19 -0
- package/packages/api-gateway/src/marketplace-entries/official/mock-server.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/modlens.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/module-search.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/obsidian-sync.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/openpets.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plan-execute.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-check.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-dev.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-finder.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-radar.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-stars.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/prompt-guard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/prompt-library.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/readme-gen.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/recall-unread.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/reverse-skill.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/reviewer-bot.json +22 -0
- package/packages/api-gateway/src/marketplace-entries/official/runtime-doctor.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/secure-audit.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-bookmarks.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-bridge.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-compare.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-export.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-insights.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-search.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/skill-catalog.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/skill-guard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/sql-lens.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/synapse.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/tab-manager.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/taskboard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/telemetry-blocker.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/test-harness.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/theme-studio.json +19 -0
- package/packages/api-gateway/src/marketplace-entries/official/token-guard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/turn-rewind.json +22 -0
- package/packages/api-gateway/src/marketplace-entries/official/undo-savepoint.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/vision-toolkit.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/web-research.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/workspace-navigator.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/workspace-search.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/yaml-validator.json +16 -0
- package/packages/api-gateway/src/marketplace.ts +267 -22
- package/packages/api-gateway/src/workspaces.ts +20 -0
- package/packages/api-gateway/test/index.test.ts +483 -33
- package/packages/api-gateway/test/marketplace.test.ts +282 -3
- package/packages/api-gateway/test/workspaces.test.ts +13 -0
- package/packages/api-gateway/tsconfig.build.json +1 -1
- package/packages/api-gateway/tsconfig.json +1 -1
- package/packages/bundle-web-app/LICENSE +9 -0
- package/packages/bundle-web-app/package.json +19 -9
- package/packages/bundle-web-app/tsconfig.build.json +1 -1
- package/packages/bundle-web-app/tsconfig.json +1 -1
- package/packages/cli/LICENSE +9 -0
- package/packages/cli/dist/args.d.ts.map +1 -1
- package/packages/cli/dist/args.js +16 -9
- package/packages/cli/dist/args.js.map +1 -1
- package/packages/cli/dist/bin.js +12 -3
- package/packages/cli/dist/bin.js.map +1 -1
- package/packages/cli/dist/main.d.ts +1 -0
- package/packages/cli/dist/main.d.ts.map +1 -1
- package/packages/cli/dist/main.js +49 -9
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/dist/node-stdio.d.ts +3 -1
- package/packages/cli/dist/node-stdio.d.ts.map +1 -1
- package/packages/cli/dist/node-stdio.js +91 -13
- package/packages/cli/dist/node-stdio.js.map +1 -1
- package/packages/cli/dist/relaunch.d.ts.map +1 -1
- package/packages/cli/dist/relaunch.js +23 -10
- package/packages/cli/dist/relaunch.js.map +1 -1
- package/packages/cli/package.json +18 -8
- package/packages/cli/src/args.ts +16 -10
- package/packages/cli/src/bin.ts +12 -3
- package/packages/cli/src/main.ts +54 -10
- package/packages/cli/src/node-stdio.ts +85 -13
- package/packages/cli/src/relaunch.ts +19 -6
- package/packages/cli/test/args.test.ts +22 -3
- package/packages/cli/test/binary.test.ts +58 -0
- package/packages/cli/test/broken-pipe.test.ts +32 -0
- package/packages/cli/test/cli.test.ts +57 -8
- package/packages/cli/test/node-stdio.test.ts +89 -0
- package/packages/cli/test/relaunch.test.ts +30 -2
- package/packages/cli/test/stdin-shutdown.test.ts +59 -0
- package/packages/cli/tsconfig.build.json +1 -3
- package/packages/cli/tsconfig.json +1 -4
- package/packages/client-web/LICENSE +9 -0
- package/packages/client-web/dist/annotation-ui.d.ts +11 -0
- package/packages/client-web/dist/annotation-ui.d.ts.map +1 -0
- package/packages/client-web/dist/annotation-ui.js +24 -0
- package/packages/client-web/dist/annotation-ui.js.map +1 -0
- package/packages/client-web/dist/browser-session-view.d.ts +7 -0
- package/packages/client-web/dist/browser-session-view.d.ts.map +1 -0
- package/packages/client-web/dist/browser-session-view.js +8 -0
- package/packages/client-web/dist/browser-session-view.js.map +1 -0
- package/packages/client-web/dist/control-room.d.ts +151 -6
- package/packages/client-web/dist/control-room.d.ts.map +1 -1
- package/packages/client-web/dist/control-room.js +156 -11
- package/packages/client-web/dist/control-room.js.map +1 -1
- package/packages/client-web/dist/design-contract.d.ts.map +1 -1
- package/packages/client-web/dist/design-contract.js +178 -19
- package/packages/client-web/dist/design-contract.js.map +1 -1
- package/packages/client-web/dist/index.d.ts +4 -1
- package/packages/client-web/dist/index.d.ts.map +1 -1
- package/packages/client-web/dist/index.js +11 -3
- package/packages/client-web/dist/index.js.map +1 -1
- package/packages/client-web/dist/markdown.d.ts +5 -0
- package/packages/client-web/dist/markdown.d.ts.map +1 -0
- package/packages/client-web/dist/markdown.js +20 -0
- package/packages/client-web/dist/markdown.js.map +1 -0
- package/packages/client-web/dist/marketplace-catalog.d.ts +3 -0
- package/packages/client-web/dist/marketplace-catalog.d.ts.map +1 -0
- package/packages/client-web/dist/marketplace-catalog.js +10 -0
- package/packages/client-web/dist/marketplace-catalog.js.map +1 -0
- package/packages/client-web/dist/marketplace-navigation.d.ts +19 -0
- package/packages/client-web/dist/marketplace-navigation.d.ts.map +1 -0
- package/packages/client-web/dist/marketplace-navigation.js +31 -0
- package/packages/client-web/dist/marketplace-navigation.js.map +1 -0
- package/packages/client-web/dist/message-content.d.ts +9 -0
- package/packages/client-web/dist/message-content.d.ts.map +1 -0
- package/packages/client-web/dist/message-content.js +54 -0
- package/packages/client-web/dist/message-content.js.map +1 -0
- package/packages/client-web/dist/plugin-navigation.d.ts +3 -0
- package/packages/client-web/dist/plugin-navigation.d.ts.map +1 -0
- package/packages/client-web/dist/plugin-navigation.js +10 -0
- package/packages/client-web/dist/plugin-navigation.js.map +1 -0
- package/packages/client-web/dist/plugin-search.d.ts +2 -0
- package/packages/client-web/dist/plugin-search.d.ts.map +1 -0
- package/packages/client-web/dist/plugin-search.js +7 -0
- package/packages/client-web/dist/plugin-search.js.map +1 -0
- package/packages/client-web/dist/plugin-stars-view.d.ts +12 -0
- package/packages/client-web/dist/plugin-stars-view.d.ts.map +1 -0
- package/packages/client-web/dist/plugin-stars-view.js +8 -0
- package/packages/client-web/dist/plugin-stars-view.js.map +1 -0
- package/packages/client-web/dist/prompt-completion.d.ts +13 -0
- package/packages/client-web/dist/prompt-completion.d.ts.map +1 -0
- package/packages/client-web/dist/prompt-completion.js +17 -0
- package/packages/client-web/dist/prompt-completion.js.map +1 -0
- package/packages/client-web/dist/react-room.d.ts +2 -1
- package/packages/client-web/dist/react-room.d.ts.map +1 -1
- package/packages/client-web/dist/react-room.js +2347 -93
- package/packages/client-web/dist/react-room.js.map +1 -1
- package/packages/client-web/dist/runtime-events.d.ts +4 -0
- package/packages/client-web/dist/runtime-events.d.ts.map +1 -0
- package/packages/client-web/dist/runtime-events.js +29 -0
- package/packages/client-web/dist/runtime-events.js.map +1 -0
- package/packages/client-web/package.json +19 -7
- package/packages/client-web/src/annotation-ui.ts +29 -0
- package/packages/client-web/src/browser-session-view.ts +13 -0
- package/packages/client-web/src/control-room.ts +359 -11
- package/packages/client-web/src/design-contract.ts +248 -26
- package/packages/client-web/src/index.ts +17 -4
- package/packages/client-web/src/markdown.tsx +22 -0
- package/packages/client-web/src/marketplace-catalog.ts +10 -0
- package/packages/client-web/src/marketplace-navigation.ts +46 -0
- package/packages/client-web/src/message-content.ts +51 -0
- package/packages/client-web/src/plugin-navigation.ts +9 -0
- package/packages/client-web/src/plugin-search.ts +5 -0
- package/packages/client-web/src/plugin-stars-view.ts +19 -0
- package/packages/client-web/src/prompt-completion.ts +24 -0
- package/packages/client-web/src/react-room.tsx +7358 -54
- package/packages/client-web/src/runtime-events.ts +29 -0
- package/packages/client-web/test/annotation-ui.test.ts +21 -0
- package/packages/client-web/test/browser-session-view.test.ts +17 -0
- package/packages/client-web/test/design-contract.test.ts +46 -1
- package/packages/client-web/test/marketplace-catalog.test.ts +52 -0
- package/packages/client-web/test/message-content.test.ts +43 -0
- package/packages/client-web/test/plugin-navigation.test.ts +16 -0
- package/packages/client-web/test/plugin-search.test.ts +22 -0
- package/packages/client-web/test/plugin-stars-view.test.ts +20 -0
- package/packages/client-web/test/prompt-completion.test.ts +21 -0
- package/packages/client-web/test/runtime-events.test.ts +28 -0
- package/packages/client-web/tsconfig.build.json +13 -1
- package/packages/client-web/tsconfig.json +11 -1
- package/packages/core/LICENSE +9 -0
- package/packages/core/dist/boot.d.ts.map +1 -1
- package/packages/core/dist/boot.js +42 -3
- package/packages/core/dist/boot.js.map +1 -1
- package/packages/core/dist/config.d.ts +2 -0
- package/packages/core/dist/config.d.ts.map +1 -0
- package/packages/core/dist/config.js +8 -0
- package/packages/core/dist/config.js.map +1 -0
- package/packages/core/dist/http.d.ts +8 -0
- package/packages/core/dist/http.d.ts.map +1 -0
- package/packages/core/dist/http.js +27 -0
- package/packages/core/dist/http.js.map +1 -0
- package/packages/core/dist/index.d.ts +2 -0
- package/packages/core/dist/index.d.ts.map +1 -1
- package/packages/core/dist/index.js +2 -0
- package/packages/core/dist/index.js.map +1 -1
- package/packages/core/dist/plugins/agent-teams.d.ts +17 -0
- package/packages/core/dist/plugins/agent-teams.d.ts.map +1 -0
- package/packages/core/dist/plugins/agent-teams.js +298 -0
- package/packages/core/dist/plugins/agent-teams.js.map +1 -0
- package/packages/core/dist/plugins/anchored-standard.d.ts +14 -0
- package/packages/core/dist/plugins/anchored-standard.d.ts.map +1 -0
- package/packages/core/dist/plugins/anchored-standard.js +84 -0
- package/packages/core/dist/plugins/anchored-standard.js.map +1 -0
- package/packages/core/dist/plugins/annotation.d.ts +18 -0
- package/packages/core/dist/plugins/annotation.d.ts.map +1 -0
- package/packages/core/dist/plugins/annotation.js +94 -0
- package/packages/core/dist/plugins/annotation.js.map +1 -0
- package/packages/core/dist/plugins/archify.d.ts +23 -0
- package/packages/core/dist/plugins/archify.d.ts.map +1 -0
- package/packages/core/dist/plugins/archify.js +98 -0
- package/packages/core/dist/plugins/archify.js.map +1 -0
- package/packages/core/dist/plugins/at-file.d.ts +8 -0
- package/packages/core/dist/plugins/at-file.d.ts.map +1 -0
- package/packages/core/dist/plugins/at-file.js +52 -0
- package/packages/core/dist/plugins/at-file.js.map +1 -0
- package/packages/core/dist/plugins/auto-mode.d.ts +15 -0
- package/packages/core/dist/plugins/auto-mode.d.ts.map +1 -0
- package/packages/core/dist/plugins/auto-mode.js +114 -0
- package/packages/core/dist/plugins/auto-mode.js.map +1 -0
- package/packages/core/dist/plugins/better-sidebar.d.ts +37 -0
- package/packages/core/dist/plugins/better-sidebar.d.ts.map +1 -0
- package/packages/core/dist/plugins/better-sidebar.js +89 -0
- package/packages/core/dist/plugins/better-sidebar.js.map +1 -0
- package/packages/core/dist/plugins/browser-fetch.d.ts +14 -0
- package/packages/core/dist/plugins/browser-fetch.d.ts.map +1 -0
- package/packages/core/dist/plugins/browser-fetch.js +167 -0
- package/packages/core/dist/plugins/browser-fetch.js.map +1 -0
- package/packages/core/dist/plugins/browser-session.d.ts +14 -0
- package/packages/core/dist/plugins/browser-session.d.ts.map +1 -0
- package/packages/core/dist/plugins/browser-session.js +265 -0
- package/packages/core/dist/plugins/browser-session.js.map +1 -0
- package/packages/core/dist/plugins/canvas-draw.d.ts +8 -0
- package/packages/core/dist/plugins/canvas-draw.d.ts.map +1 -0
- package/packages/core/dist/plugins/canvas-draw.js +88 -0
- package/packages/core/dist/plugins/canvas-draw.js.map +1 -0
- package/packages/core/dist/plugins/change-verifier.d.ts +8 -0
- package/packages/core/dist/plugins/change-verifier.d.ts.map +1 -0
- package/packages/core/dist/plugins/change-verifier.js +67 -0
- package/packages/core/dist/plugins/change-verifier.js.map +1 -0
- package/packages/core/dist/plugins/cleaner.d.ts +8 -0
- package/packages/core/dist/plugins/cleaner.d.ts.map +1 -0
- package/packages/core/dist/plugins/cleaner.js +56 -0
- package/packages/core/dist/plugins/cleaner.js.map +1 -0
- package/packages/core/dist/plugins/cli-notifier.d.ts +15 -0
- package/packages/core/dist/plugins/cli-notifier.d.ts.map +1 -0
- package/packages/core/dist/plugins/cli-notifier.js +110 -0
- package/packages/core/dist/plugins/cli-notifier.js.map +1 -0
- package/packages/core/dist/plugins/code2skill.d.ts +8 -0
- package/packages/core/dist/plugins/code2skill.d.ts.map +1 -0
- package/packages/core/dist/plugins/code2skill.js +95 -0
- package/packages/core/dist/plugins/code2skill.js.map +1 -0
- package/packages/core/dist/plugins/colleague-skill.d.ts +27 -0
- package/packages/core/dist/plugins/colleague-skill.d.ts.map +1 -0
- package/packages/core/dist/plugins/colleague-skill.js +99 -0
- package/packages/core/dist/plugins/colleague-skill.js.map +1 -0
- package/packages/core/dist/plugins/context-doctor.d.ts +30 -0
- package/packages/core/dist/plugins/context-doctor.d.ts.map +1 -0
- package/packages/core/dist/plugins/context-doctor.js +95 -0
- package/packages/core/dist/plugins/context-doctor.js.map +1 -0
- package/packages/core/dist/plugins/context.d.ts +8 -0
- package/packages/core/dist/plugins/context.d.ts.map +1 -0
- package/packages/core/dist/plugins/context.js +87 -0
- package/packages/core/dist/plugins/context.js.map +1 -0
- package/packages/core/dist/plugins/cost-meter.d.ts +32 -0
- package/packages/core/dist/plugins/cost-meter.d.ts.map +1 -0
- package/packages/core/dist/plugins/cost-meter.js +204 -0
- package/packages/core/dist/plugins/cost-meter.js.map +1 -0
- package/packages/core/dist/plugins/dependency-checker.d.ts +27 -0
- package/packages/core/dist/plugins/dependency-checker.d.ts.map +1 -0
- package/packages/core/dist/plugins/dependency-checker.js +221 -0
- package/packages/core/dist/plugins/dependency-checker.js.map +1 -0
- package/packages/core/dist/plugins/docker-sandbox.d.ts +8 -0
- package/packages/core/dist/plugins/docker-sandbox.d.ts.map +1 -0
- package/packages/core/dist/plugins/docker-sandbox.js +102 -0
- package/packages/core/dist/plugins/docker-sandbox.js.map +1 -0
- package/packages/core/dist/plugins/fail-logger.d.ts +8 -0
- package/packages/core/dist/plugins/fail-logger.d.ts.map +1 -0
- package/packages/core/dist/plugins/fail-logger.js +51 -0
- package/packages/core/dist/plugins/fail-logger.js.map +1 -0
- package/packages/core/dist/plugins/genui.d.ts +8 -0
- package/packages/core/dist/plugins/genui.d.ts.map +1 -0
- package/packages/core/dist/plugins/genui.js +79 -0
- package/packages/core/dist/plugins/genui.js.map +1 -0
- package/packages/core/dist/plugins/git-time-capsule.d.ts +9 -0
- package/packages/core/dist/plugins/git-time-capsule.d.ts.map +1 -0
- package/packages/core/dist/plugins/git-time-capsule.js +90 -0
- package/packages/core/dist/plugins/git-time-capsule.js.map +1 -0
- package/packages/core/dist/plugins/graph-memory.d.ts +16 -0
- package/packages/core/dist/plugins/graph-memory.d.ts.map +1 -0
- package/packages/core/dist/plugins/graph-memory.js +382 -0
- package/packages/core/dist/plugins/graph-memory.js.map +1 -0
- package/packages/core/dist/plugins/history-compressor.d.ts +15 -0
- package/packages/core/dist/plugins/history-compressor.d.ts.map +1 -0
- package/packages/core/dist/plugins/history-compressor.js +80 -0
- package/packages/core/dist/plugins/history-compressor.js.map +1 -0
- package/packages/core/dist/plugins/hol-guard.d.ts +29 -0
- package/packages/core/dist/plugins/hol-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/hol-guard.js +139 -0
- package/packages/core/dist/plugins/hol-guard.js.map +1 -0
- package/packages/core/dist/plugins/i18n-pair.d.ts +8 -0
- package/packages/core/dist/plugins/i18n-pair.d.ts.map +1 -0
- package/packages/core/dist/plugins/i18n-pair.js +76 -0
- package/packages/core/dist/plugins/i18n-pair.js.map +1 -0
- package/packages/core/dist/plugins/image-compressor.d.ts +8 -0
- package/packages/core/dist/plugins/image-compressor.d.ts.map +1 -0
- package/packages/core/dist/plugins/image-compressor.js +150 -0
- package/packages/core/dist/plugins/image-compressor.js.map +1 -0
- package/packages/core/dist/plugins/llm-verifier.d.ts +42 -0
- package/packages/core/dist/plugins/llm-verifier.d.ts.map +1 -0
- package/packages/core/dist/plugins/llm-verifier.js +128 -0
- package/packages/core/dist/plugins/llm-verifier.js.map +1 -0
- package/packages/core/dist/plugins/mcp-client.d.ts +19 -0
- package/packages/core/dist/plugins/mcp-client.d.ts.map +1 -0
- package/packages/core/dist/plugins/mcp-client.js +534 -0
- package/packages/core/dist/plugins/mcp-client.js.map +1 -0
- package/packages/core/dist/plugins/mcp-panel.d.ts +14 -0
- package/packages/core/dist/plugins/mcp-panel.d.ts.map +1 -0
- package/packages/core/dist/plugins/mcp-panel.js +180 -0
- package/packages/core/dist/plugins/mcp-panel.js.map +1 -0
- package/packages/core/dist/plugins/memory.d.ts +15 -0
- package/packages/core/dist/plugins/memory.d.ts.map +1 -0
- package/packages/core/dist/plugins/memory.js +161 -0
- package/packages/core/dist/plugins/memory.js.map +1 -0
- package/packages/core/dist/plugins/mirage-bridge.d.ts +23 -0
- package/packages/core/dist/plugins/mirage-bridge.d.ts.map +1 -0
- package/packages/core/dist/plugins/mirage-bridge.js +149 -0
- package/packages/core/dist/plugins/mirage-bridge.js.map +1 -0
- package/packages/core/dist/plugins/mock-server.d.ts +22 -0
- package/packages/core/dist/plugins/mock-server.d.ts.map +1 -0
- package/packages/core/dist/plugins/mock-server.js +149 -0
- package/packages/core/dist/plugins/mock-server.js.map +1 -0
- package/packages/core/dist/plugins/model.d.ts +1 -1
- package/packages/core/dist/plugins/model.d.ts.map +1 -1
- package/packages/core/dist/plugins/model.js +3 -1
- package/packages/core/dist/plugins/model.js.map +1 -1
- package/packages/core/dist/plugins/models.d.ts.map +1 -1
- package/packages/core/dist/plugins/models.js +5 -2
- package/packages/core/dist/plugins/models.js.map +1 -1
- package/packages/core/dist/plugins/modlens.d.ts +8 -0
- package/packages/core/dist/plugins/modlens.d.ts.map +1 -0
- package/packages/core/dist/plugins/modlens.js +63 -0
- package/packages/core/dist/plugins/modlens.js.map +1 -0
- package/packages/core/dist/plugins/module-search.d.ts +27 -0
- package/packages/core/dist/plugins/module-search.d.ts.map +1 -0
- package/packages/core/dist/plugins/module-search.js +174 -0
- package/packages/core/dist/plugins/module-search.js.map +1 -0
- package/packages/core/dist/plugins/obsidian-sync.d.ts +14 -0
- package/packages/core/dist/plugins/obsidian-sync.d.ts.map +1 -0
- package/packages/core/dist/plugins/obsidian-sync.js +79 -0
- package/packages/core/dist/plugins/obsidian-sync.js.map +1 -0
- package/packages/core/dist/plugins/openpets.d.ts +14 -0
- package/packages/core/dist/plugins/openpets.d.ts.map +1 -0
- package/packages/core/dist/plugins/openpets.js +99 -0
- package/packages/core/dist/plugins/openpets.js.map +1 -0
- package/packages/core/dist/plugins/plan-execute.d.ts +8 -0
- package/packages/core/dist/plugins/plan-execute.d.ts.map +1 -0
- package/packages/core/dist/plugins/plan-execute.js +70 -0
- package/packages/core/dist/plugins/plan-execute.js.map +1 -0
- package/packages/core/dist/plugins/plugin-check.d.ts +38 -0
- package/packages/core/dist/plugins/plugin-check.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-check.js +227 -0
- package/packages/core/dist/plugins/plugin-check.js.map +1 -0
- package/packages/core/dist/plugins/plugin-dev.d.ts +8 -0
- package/packages/core/dist/plugins/plugin-dev.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-dev.js +44 -0
- package/packages/core/dist/plugins/plugin-dev.js.map +1 -0
- package/packages/core/dist/plugins/plugin-finder.d.ts +16 -0
- package/packages/core/dist/plugins/plugin-finder.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-finder.js +98 -0
- package/packages/core/dist/plugins/plugin-finder.js.map +1 -0
- package/packages/core/dist/plugins/plugin-radar.d.ts +29 -0
- package/packages/core/dist/plugins/plugin-radar.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-radar.js +146 -0
- package/packages/core/dist/plugins/plugin-radar.js.map +1 -0
- package/packages/core/dist/plugins/plugin-stars.d.ts +45 -0
- package/packages/core/dist/plugins/plugin-stars.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-stars.js +165 -0
- package/packages/core/dist/plugins/plugin-stars.js.map +1 -0
- package/packages/core/dist/plugins/prompt-guard.d.ts +8 -0
- package/packages/core/dist/plugins/prompt-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/prompt-guard.js +114 -0
- package/packages/core/dist/plugins/prompt-guard.js.map +1 -0
- package/packages/core/dist/plugins/prompt-library.d.ts +25 -0
- package/packages/core/dist/plugins/prompt-library.d.ts.map +1 -0
- package/packages/core/dist/plugins/prompt-library.js +142 -0
- package/packages/core/dist/plugins/prompt-library.js.map +1 -0
- package/packages/core/dist/plugins/readme-gen.d.ts +25 -0
- package/packages/core/dist/plugins/readme-gen.d.ts.map +1 -0
- package/packages/core/dist/plugins/readme-gen.js +139 -0
- package/packages/core/dist/plugins/readme-gen.js.map +1 -0
- package/packages/core/dist/plugins/recall-unread.d.ts +24 -0
- package/packages/core/dist/plugins/recall-unread.d.ts.map +1 -0
- package/packages/core/dist/plugins/recall-unread.js +124 -0
- package/packages/core/dist/plugins/recall-unread.js.map +1 -0
- package/packages/core/dist/plugins/resources.d.ts +1 -0
- package/packages/core/dist/plugins/resources.d.ts.map +1 -1
- package/packages/core/dist/plugins/resources.js +31 -22
- package/packages/core/dist/plugins/resources.js.map +1 -1
- package/packages/core/dist/plugins/reverse-skill.d.ts +23 -0
- package/packages/core/dist/plugins/reverse-skill.d.ts.map +1 -0
- package/packages/core/dist/plugins/reverse-skill.js +60 -0
- package/packages/core/dist/plugins/reverse-skill.js.map +1 -0
- package/packages/core/dist/plugins/reviewer-bot.d.ts +14 -0
- package/packages/core/dist/plugins/reviewer-bot.d.ts.map +1 -0
- package/packages/core/dist/plugins/reviewer-bot.js +133 -0
- package/packages/core/dist/plugins/reviewer-bot.js.map +1 -0
- package/packages/core/dist/plugins/runtime-doctor.d.ts +33 -0
- package/packages/core/dist/plugins/runtime-doctor.d.ts.map +1 -0
- package/packages/core/dist/plugins/runtime-doctor.js +114 -0
- package/packages/core/dist/plugins/runtime-doctor.js.map +1 -0
- package/packages/core/dist/plugins/runtime.d.ts.map +1 -1
- package/packages/core/dist/plugins/runtime.js +63 -14
- package/packages/core/dist/plugins/runtime.js.map +1 -1
- package/packages/core/dist/plugins/secure-audit.d.ts +31 -0
- package/packages/core/dist/plugins/secure-audit.d.ts.map +1 -0
- package/packages/core/dist/plugins/secure-audit.js +121 -0
- package/packages/core/dist/plugins/secure-audit.js.map +1 -0
- package/packages/core/dist/plugins/session-bookmarks.d.ts +15 -0
- package/packages/core/dist/plugins/session-bookmarks.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-bookmarks.js +87 -0
- package/packages/core/dist/plugins/session-bookmarks.js.map +1 -0
- package/packages/core/dist/plugins/session-bridge.d.ts +44 -0
- package/packages/core/dist/plugins/session-bridge.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-bridge.js +265 -0
- package/packages/core/dist/plugins/session-bridge.js.map +1 -0
- package/packages/core/dist/plugins/session-compare.d.ts +33 -0
- package/packages/core/dist/plugins/session-compare.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-compare.js +150 -0
- package/packages/core/dist/plugins/session-compare.js.map +1 -0
- package/packages/core/dist/plugins/session-export.d.ts +9 -0
- package/packages/core/dist/plugins/session-export.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-export.js +93 -0
- package/packages/core/dist/plugins/session-export.js.map +1 -0
- package/packages/core/dist/plugins/session-insights.d.ts +8 -0
- package/packages/core/dist/plugins/session-insights.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-insights.js +47 -0
- package/packages/core/dist/plugins/session-insights.js.map +1 -0
- package/packages/core/dist/plugins/session-search.d.ts +20 -0
- package/packages/core/dist/plugins/session-search.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-search.js +122 -0
- package/packages/core/dist/plugins/session-search.js.map +1 -0
- package/packages/core/dist/plugins/session.d.ts.map +1 -1
- package/packages/core/dist/plugins/session.js +4 -2
- package/packages/core/dist/plugins/session.js.map +1 -1
- package/packages/core/dist/plugins/skill-catalog.d.ts +26 -0
- package/packages/core/dist/plugins/skill-catalog.d.ts.map +1 -0
- package/packages/core/dist/plugins/skill-catalog.js +97 -0
- package/packages/core/dist/plugins/skill-catalog.js.map +1 -0
- package/packages/core/dist/plugins/skill-guard.d.ts +26 -0
- package/packages/core/dist/plugins/skill-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/skill-guard.js +139 -0
- package/packages/core/dist/plugins/skill-guard.js.map +1 -0
- package/packages/core/dist/plugins/sql-lens.d.ts +8 -0
- package/packages/core/dist/plugins/sql-lens.d.ts.map +1 -0
- package/packages/core/dist/plugins/sql-lens.js +85 -0
- package/packages/core/dist/plugins/sql-lens.js.map +1 -0
- package/packages/core/dist/plugins/stdio.d.ts +1 -1
- package/packages/core/dist/plugins/stdio.d.ts.map +1 -1
- package/packages/core/dist/plugins/stdio.js +3 -1
- package/packages/core/dist/plugins/stdio.js.map +1 -1
- package/packages/core/dist/plugins/synapse.d.ts +38 -0
- package/packages/core/dist/plugins/synapse.d.ts.map +1 -0
- package/packages/core/dist/plugins/synapse.js +93 -0
- package/packages/core/dist/plugins/synapse.js.map +1 -0
- package/packages/core/dist/plugins/tab-manager.d.ts +8 -0
- package/packages/core/dist/plugins/tab-manager.d.ts.map +1 -0
- package/packages/core/dist/plugins/tab-manager.js +135 -0
- package/packages/core/dist/plugins/tab-manager.js.map +1 -0
- package/packages/core/dist/plugins/taskboard.d.ts +15 -0
- package/packages/core/dist/plugins/taskboard.d.ts.map +1 -0
- package/packages/core/dist/plugins/taskboard.js +347 -0
- package/packages/core/dist/plugins/taskboard.js.map +1 -0
- package/packages/core/dist/plugins/telemetry-blocker.d.ts +8 -0
- package/packages/core/dist/plugins/telemetry-blocker.d.ts.map +1 -0
- package/packages/core/dist/plugins/telemetry-blocker.js +57 -0
- package/packages/core/dist/plugins/telemetry-blocker.js.map +1 -0
- package/packages/core/dist/plugins/test-harness.d.ts +8 -0
- package/packages/core/dist/plugins/test-harness.d.ts.map +1 -0
- package/packages/core/dist/plugins/test-harness.js +64 -0
- package/packages/core/dist/plugins/test-harness.js.map +1 -0
- package/packages/core/dist/plugins/theme-studio.d.ts +29 -0
- package/packages/core/dist/plugins/theme-studio.d.ts.map +1 -0
- package/packages/core/dist/plugins/theme-studio.js +141 -0
- package/packages/core/dist/plugins/theme-studio.js.map +1 -0
- package/packages/core/dist/plugins/token-guard.d.ts +15 -0
- package/packages/core/dist/plugins/token-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/token-guard.js +78 -0
- package/packages/core/dist/plugins/token-guard.js.map +1 -0
- package/packages/core/dist/plugins/tools.d.ts.map +1 -1
- package/packages/core/dist/plugins/tools.js +5 -2
- package/packages/core/dist/plugins/tools.js.map +1 -1
- package/packages/core/dist/plugins/turn-rewind.d.ts +19 -0
- package/packages/core/dist/plugins/turn-rewind.d.ts.map +1 -0
- package/packages/core/dist/plugins/turn-rewind.js +74 -0
- package/packages/core/dist/plugins/turn-rewind.js.map +1 -0
- package/packages/core/dist/plugins/undo-savepoint.d.ts +17 -0
- package/packages/core/dist/plugins/undo-savepoint.d.ts.map +1 -0
- package/packages/core/dist/plugins/undo-savepoint.js +247 -0
- package/packages/core/dist/plugins/undo-savepoint.js.map +1 -0
- package/packages/core/dist/plugins/vision-toolkit.d.ts +17 -0
- package/packages/core/dist/plugins/vision-toolkit.d.ts.map +1 -0
- package/packages/core/dist/plugins/vision-toolkit.js +145 -0
- package/packages/core/dist/plugins/vision-toolkit.js.map +1 -0
- package/packages/core/dist/plugins/web-research.d.ts +17 -0
- package/packages/core/dist/plugins/web-research.d.ts.map +1 -0
- package/packages/core/dist/plugins/web-research.js +275 -0
- package/packages/core/dist/plugins/web-research.js.map +1 -0
- package/packages/core/dist/plugins/workspace-navigator.d.ts +36 -0
- package/packages/core/dist/plugins/workspace-navigator.d.ts.map +1 -0
- package/packages/core/dist/plugins/workspace-navigator.js +150 -0
- package/packages/core/dist/plugins/workspace-navigator.js.map +1 -0
- package/packages/core/dist/plugins/workspace-search.d.ts +8 -0
- package/packages/core/dist/plugins/workspace-search.d.ts.map +1 -0
- package/packages/core/dist/plugins/workspace-search.js +134 -0
- package/packages/core/dist/plugins/workspace-search.js.map +1 -0
- package/packages/core/dist/plugins/yaml-validator.d.ts +8 -0
- package/packages/core/dist/plugins/yaml-validator.d.ts.map +1 -0
- package/packages/core/dist/plugins/yaml-validator.js +94 -0
- package/packages/core/dist/plugins/yaml-validator.js.map +1 -0
- package/packages/core/dist/profile.d.ts +1 -0
- package/packages/core/dist/profile.d.ts.map +1 -1
- package/packages/core/dist/profile.js +3 -0
- package/packages/core/dist/profile.js.map +1 -1
- package/packages/core/dist/runtime.d.ts.map +1 -1
- package/packages/core/dist/runtime.js +13 -4
- package/packages/core/dist/runtime.js.map +1 -1
- package/packages/core/dist/services.d.ts +55 -0
- package/packages/core/dist/services.d.ts.map +1 -1
- package/packages/core/dist/services.js +58 -2
- package/packages/core/dist/services.js.map +1 -1
- package/packages/core/dist/stdio.d.ts +13 -2
- package/packages/core/dist/stdio.d.ts.map +1 -1
- package/packages/core/dist/stdio.js +75 -9
- package/packages/core/dist/stdio.js.map +1 -1
- package/packages/core/dist/workspace-path.d.ts +12 -0
- package/packages/core/dist/workspace-path.d.ts.map +1 -0
- package/packages/core/dist/workspace-path.js +62 -0
- package/packages/core/dist/workspace-path.js.map +1 -0
- package/packages/core/package.json +18 -8
- package/packages/core/profiles/default/cordis.yml +85 -0
- package/packages/core/profiles/development/cordis.yml +1 -1
- package/packages/core/src/boot.ts +38 -2
- package/packages/core/src/config.ts +5 -0
- package/packages/core/src/http.ts +32 -0
- package/packages/core/src/index.ts +2 -0
- package/packages/core/src/plugins/agent-teams.ts +291 -0
- package/packages/core/src/plugins/anchored-standard.ts +88 -0
- package/packages/core/src/plugins/annotation.ts +106 -0
- package/packages/core/src/plugins/archify.ts +124 -0
- package/packages/core/src/plugins/at-file.ts +54 -0
- package/packages/core/src/plugins/auto-mode.ts +123 -0
- package/packages/core/src/plugins/better-sidebar.ts +117 -0
- package/packages/core/src/plugins/browser-fetch.ts +171 -0
- package/packages/core/src/plugins/browser-session.ts +287 -0
- package/packages/core/src/plugins/canvas-draw.ts +90 -0
- package/packages/core/src/plugins/change-verifier.ts +79 -0
- package/packages/core/src/plugins/cleaner.ts +61 -0
- package/packages/core/src/plugins/cli-notifier.ts +125 -0
- package/packages/core/src/plugins/code2skill.ts +96 -0
- package/packages/core/src/plugins/colleague-skill.ts +122 -0
- package/packages/core/src/plugins/context-doctor.ts +117 -0
- package/packages/core/src/plugins/context.ts +102 -0
- package/packages/core/src/plugins/cost-meter.ts +231 -0
- package/packages/core/src/plugins/dependency-checker.ts +241 -0
- package/packages/core/src/plugins/docker-sandbox.ts +100 -0
- package/packages/core/src/plugins/fail-logger.ts +51 -0
- package/packages/core/src/plugins/genui.ts +88 -0
- package/packages/core/src/plugins/git-time-capsule.ts +97 -0
- package/packages/core/src/plugins/graph-memory.ts +394 -0
- package/packages/core/src/plugins/history-compressor.ts +81 -0
- package/packages/core/src/plugins/hol-guard.ts +153 -0
- package/packages/core/src/plugins/i18n-pair.ts +82 -0
- package/packages/core/src/plugins/image-compressor.ts +144 -0
- package/packages/core/src/plugins/llm-verifier.ts +164 -0
- package/packages/core/src/plugins/mcp-client.ts +559 -0
- package/packages/core/src/plugins/mcp-panel.ts +190 -0
- package/packages/core/src/plugins/memory.ts +176 -0
- package/packages/core/src/plugins/mirage-bridge.ts +179 -0
- package/packages/core/src/plugins/mock-server.ts +158 -0
- package/packages/core/src/plugins/model.ts +3 -1
- package/packages/core/src/plugins/models.ts +5 -2
- package/packages/core/src/plugins/modlens.ts +63 -0
- package/packages/core/src/plugins/module-search.ts +201 -0
- package/packages/core/src/plugins/obsidian-sync.ts +83 -0
- package/packages/core/src/plugins/openpets.ts +109 -0
- package/packages/core/src/plugins/plan-execute.ts +76 -0
- package/packages/core/src/plugins/plugin-check.ts +232 -0
- package/packages/core/src/plugins/plugin-dev.ts +47 -0
- package/packages/core/src/plugins/plugin-finder.ts +108 -0
- package/packages/core/src/plugins/plugin-radar.ts +179 -0
- package/packages/core/src/plugins/plugin-stars.ts +205 -0
- package/packages/core/src/plugins/prompt-guard.ts +122 -0
- package/packages/core/src/plugins/prompt-library.ts +165 -0
- package/packages/core/src/plugins/readme-gen.ts +147 -0
- package/packages/core/src/plugins/recall-unread.ts +142 -0
- package/packages/core/src/plugins/resources.ts +28 -21
- package/packages/core/src/plugins/reverse-skill.ts +79 -0
- package/packages/core/src/plugins/reviewer-bot.ts +146 -0
- package/packages/core/src/plugins/runtime-doctor.ts +137 -0
- package/packages/core/src/plugins/runtime.ts +61 -14
- package/packages/core/src/plugins/secure-audit.ts +146 -0
- package/packages/core/src/plugins/session-bookmarks.ts +89 -0
- package/packages/core/src/plugins/session-bridge.ts +299 -0
- package/packages/core/src/plugins/session-compare.ts +180 -0
- package/packages/core/src/plugins/session-export.ts +99 -0
- package/packages/core/src/plugins/session-insights.ts +47 -0
- package/packages/core/src/plugins/session-search.ts +126 -0
- package/packages/core/src/plugins/session.ts +4 -2
- package/packages/core/src/plugins/skill-catalog.ts +117 -0
- package/packages/core/src/plugins/skill-guard.ts +152 -0
- package/packages/core/src/plugins/sql-lens.ts +92 -0
- package/packages/core/src/plugins/stdio.ts +3 -1
- package/packages/core/src/plugins/synapse.ts +130 -0
- package/packages/core/src/plugins/tab-manager.ts +135 -0
- package/packages/core/src/plugins/taskboard.ts +412 -0
- package/packages/core/src/plugins/telemetry-blocker.ts +62 -0
- package/packages/core/src/plugins/test-harness.ts +67 -0
- package/packages/core/src/plugins/theme-studio.ts +165 -0
- package/packages/core/src/plugins/token-guard.ts +84 -0
- package/packages/core/src/plugins/tools.ts +5 -2
- package/packages/core/src/plugins/turn-rewind.ts +86 -0
- package/packages/core/src/plugins/undo-savepoint.ts +284 -0
- package/packages/core/src/plugins/vision-toolkit.ts +153 -0
- package/packages/core/src/plugins/web-research.ts +289 -0
- package/packages/core/src/plugins/workspace-navigator.ts +164 -0
- package/packages/core/src/plugins/workspace-search.ts +139 -0
- package/packages/core/src/plugins/yaml-validator.ts +97 -0
- package/packages/core/src/profile.ts +3 -0
- package/packages/core/src/runtime.ts +11 -4
- package/packages/core/src/services.ts +110 -3
- package/packages/core/src/stdio.ts +79 -9
- package/packages/core/src/workspace-path.ts +69 -0
- package/packages/core/test/agent-teams.test.ts +24 -0
- package/packages/core/test/archify.test.ts +33 -0
- package/packages/core/test/better-sidebar.test.ts +125 -0
- package/packages/core/test/boot.test.ts +49 -6
- package/packages/core/test/colleague-skill.test.ts +74 -0
- package/packages/core/test/config.test.ts +121 -0
- package/packages/core/test/context-doctor.test.ts +32 -0
- package/packages/core/test/dependency-checker.test.ts +60 -0
- package/packages/core/test/git-time-capsule.test.ts +115 -0
- package/packages/core/test/http.test.ts +34 -0
- package/packages/core/test/llm-verifier.test.ts +72 -0
- package/packages/core/test/mirage-bridge.test.ts +54 -0
- package/packages/core/test/module-search.test.ts +78 -0
- package/packages/core/test/plugin-check.test.ts +16 -0
- package/packages/core/test/plugin-stars.test.ts +55 -0
- package/packages/core/test/profiles.integration.test.ts +49 -15
- package/packages/core/test/prompt-library.test.ts +56 -0
- package/packages/core/test/readme-gen.test.ts +45 -0
- package/packages/core/test/recall-unread.test.ts +35 -0
- package/packages/core/test/registry.test.ts +48 -0
- package/packages/core/test/reverse-skill.test.ts +40 -0
- package/packages/core/test/runtime-doctor.test.ts +55 -0
- package/packages/core/test/runtime-fixture.ts +4 -4
- package/packages/core/test/runtime.test.ts +90 -1
- package/packages/core/test/secure-audit.test.ts +16 -0
- package/packages/core/test/services.test.ts +2024 -5
- package/packages/core/test/session-bookmarks.test.ts +62 -0
- package/packages/core/test/session-bridge.test.ts +103 -0
- package/packages/core/test/session-compare.test.ts +94 -0
- package/packages/core/test/session-export.test.ts +54 -0
- package/packages/core/test/session-search.test.ts +30 -0
- package/packages/core/test/skill-catalog.test.ts +18 -0
- package/packages/core/test/skill-guard.test.ts +21 -0
- package/packages/core/test/stdio-args.test.ts +178 -0
- package/packages/core/test/theme-studio.test.ts +39 -0
- package/packages/core/test/token-guard.test.ts +34 -0
- package/packages/core/test/turn-rewind.test.ts +19 -0
- package/packages/core/test/vision-toolkit.test.ts +38 -0
- package/packages/core/test/workspace-git-status.test.ts +37 -0
- package/packages/core/test/workspace-navigator.test.ts +33 -0
- package/packages/core/test/workspace-path.test.ts +34 -0
- package/packages/core/tsconfig.build.json +1 -3
- package/packages/core/tsconfig.json +1 -4
- package/packages/host-webserver/LICENSE +9 -0
- package/packages/host-webserver/dist/index.js +1 -1
- package/packages/host-webserver/dist/index.js.map +1 -1
- package/packages/host-webserver/package.json +17 -7
- package/packages/host-webserver/src/index.ts +1 -1
- package/packages/host-webserver/test/index.test.ts +4 -1
- package/packages/host-webserver/tsconfig.build.json +1 -1
- package/packages/host-webserver/tsconfig.json +1 -1
- package/apps/web/dist/assets/index-Bwqek8LF.js +0 -20
- package/apps/web/dist/assets/index-DCHSASjq.css +0 -1
- package/packages/api-gateway/dist/marketplace-registry.json +0 -62
- 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
|
+
};
|