@pi-harness/pi-harness 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/README.md +31 -7
- package/apps/web/dist/assets/index-CihATCjR.css +2 -0
- package/apps/web/dist/assets/index-NzapJoGa.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 +2618 -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 +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/anchored-standard.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/annotation.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/archify.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/at-file.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/auto-mode.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/better-sidebar.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/browser-fetch.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/browser-session.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/canvas-draw.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/change-verifier.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cleaner.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cli-notifier.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/code2skill.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/colleague-skill.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/context-doctor.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/context.json +28 -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 +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/dependency-checker.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/docker-sandbox.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/fail-logger.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/genui.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/git-time-capsule.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/graph-memory.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/history-compressor.json +33 -0
- package/packages/api-gateway/dist/marketplace-entries/official/hol-guard.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/i18n-pair.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/image-compressor.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/llm-verifier.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mcp-client.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mcp-panel.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/memory.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mirage-bridge.json +33 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mock-server.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/modlens.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/module-search.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/obsidian-sync.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/openpets.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plan-execute.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-check.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-dev.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-finder.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-radar.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-stars.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/prompt-guard.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/prompt-library.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/readme-gen.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/recall-unread.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/reverse-skill.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/reviewer-bot.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/runtime-doctor.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/secure-audit.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-bookmarks.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-bridge.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-compare.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-export.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-insights.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-search.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/skill-catalog.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/skill-guard.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/sql-lens.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/synapse.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/tab-manager.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/taskboard.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/telemetry-blocker.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/test-harness.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/theme-studio.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/token-guard.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/turn-rewind.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/undo-savepoint.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/vision-toolkit.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/web-research.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/workspace-navigator.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/workspace-search.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/yaml-validator.json +29 -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 +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/anchored-standard.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/annotation.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/archify.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/at-file.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/auto-mode.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/better-sidebar.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/browser-fetch.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/browser-session.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/canvas-draw.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/change-verifier.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/cleaner.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/cli-notifier.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/code2skill.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/colleague-skill.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/context-doctor.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/context.json +28 -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 +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/dependency-checker.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/docker-sandbox.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/fail-logger.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/genui.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/git-time-capsule.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/graph-memory.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/history-compressor.json +33 -0
- package/packages/api-gateway/src/marketplace-entries/official/hol-guard.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/i18n-pair.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/image-compressor.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/llm-verifier.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/mcp-client.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/mcp-panel.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/memory.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/mirage-bridge.json +33 -0
- package/packages/api-gateway/src/marketplace-entries/official/mock-server.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/modlens.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/module-search.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/obsidian-sync.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/openpets.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/plan-execute.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-check.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-dev.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-finder.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-radar.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-stars.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/prompt-guard.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/prompt-library.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/readme-gen.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/recall-unread.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/reverse-skill.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/reviewer-bot.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/runtime-doctor.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/secure-audit.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-bookmarks.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-bridge.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-compare.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-export.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-insights.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-search.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/skill-catalog.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/skill-guard.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/sql-lens.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/synapse.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/tab-manager.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/taskboard.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/telemetry-blocker.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/test-harness.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/theme-studio.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/token-guard.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/turn-rewind.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/undo-savepoint.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/vision-toolkit.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/web-research.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/workspace-navigator.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/workspace-search.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/yaml-validator.json +29 -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/release-version.test.ts +71 -0
- 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 +7360 -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,205 @@
|
|
|
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 defaultSourceUrl = "https://raw.githubusercontent.com/ywsldxk/dsh-plugin-stars/main/data/plugins.json";
|
|
7
|
+
const maxResponseBytes = 2 * 1024 * 1024;
|
|
8
|
+
const maxQueryLength = 120;
|
|
9
|
+
const maxLimit = 50;
|
|
10
|
+
|
|
11
|
+
export interface PluginStarsEntry {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
fullName: string;
|
|
15
|
+
description: string;
|
|
16
|
+
htmlUrl: string;
|
|
17
|
+
homepage?: string;
|
|
18
|
+
npmName?: string;
|
|
19
|
+
stars: number;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
license?: string;
|
|
22
|
+
topics: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface PluginStarsReport {
|
|
26
|
+
source: string;
|
|
27
|
+
generatedAt: string;
|
|
28
|
+
total: number;
|
|
29
|
+
query: string;
|
|
30
|
+
results: PluginStarsEntry[];
|
|
31
|
+
fetchedAt: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function record(value: unknown): Record<string, unknown> | undefined {
|
|
35
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? (value as Record<string, unknown>) : undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function text(value: unknown): string {
|
|
39
|
+
return typeof value === "string" ? value.trim() : "";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function nonNegativeInteger(value: unknown): number {
|
|
43
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : -1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function topics(value: unknown): string[] {
|
|
47
|
+
return Array.isArray(value)
|
|
48
|
+
? value
|
|
49
|
+
.filter((item): item is string => typeof item === "string" && item.trim() !== "")
|
|
50
|
+
.map((item) => item.trim())
|
|
51
|
+
.slice(0, 24)
|
|
52
|
+
: [];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function normalizedEntry(value: unknown): PluginStarsEntry | undefined {
|
|
56
|
+
const item = record(value);
|
|
57
|
+
if (item === undefined) return undefined;
|
|
58
|
+
const id = text(item.id);
|
|
59
|
+
const name = text(item.name);
|
|
60
|
+
const fullName = text(item.fullName);
|
|
61
|
+
const htmlUrl = text(item.htmlUrl);
|
|
62
|
+
const stars = nonNegativeInteger(item.stars);
|
|
63
|
+
if (id === "" || name === "" || !/^[^/\s]+\/[^/\s]+$/u.test(fullName) || !/^https:\/\/github\.com\//iu.test(htmlUrl) || stars < 0) return undefined;
|
|
64
|
+
const homepage = text(item.homepage);
|
|
65
|
+
const npmName = text(item.npmName);
|
|
66
|
+
const license = text(item.license);
|
|
67
|
+
return {
|
|
68
|
+
id,
|
|
69
|
+
name,
|
|
70
|
+
fullName,
|
|
71
|
+
description: text(item.description),
|
|
72
|
+
htmlUrl,
|
|
73
|
+
...(homepage === "" ? {} : { homepage }),
|
|
74
|
+
...(npmName === "" ? {} : { npmName }),
|
|
75
|
+
stars,
|
|
76
|
+
updatedAt: text(item.updatedAt),
|
|
77
|
+
...(license === "" ? {} : { license }),
|
|
78
|
+
topics: topics(item.topics),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function parsePluginStarsPayload(payload: unknown): { source: string; generatedAt: string; plugins: PluginStarsEntry[] } {
|
|
83
|
+
const root = record(payload);
|
|
84
|
+
const plugins = Array.isArray(root?.plugins)
|
|
85
|
+
? root.plugins.flatMap((item) => {
|
|
86
|
+
const entry = normalizedEntry(item);
|
|
87
|
+
return entry === undefined ? [] : [entry];
|
|
88
|
+
})
|
|
89
|
+
: [];
|
|
90
|
+
return { source: text(root?.source) || "dsh-plugin-stars", generatedAt: text(root?.generatedAt), plugins };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function searchPluginStars(report: { plugins: readonly PluginStarsEntry[] }, query = ""): PluginStarsEntry[] {
|
|
94
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
95
|
+
if (normalizedQuery.length > maxQueryLength) throw new Error(`Plugin stars query must contain 0-${maxQueryLength} characters`);
|
|
96
|
+
return [...report.plugins]
|
|
97
|
+
.filter(
|
|
98
|
+
(entry) => normalizedQuery === "" || [entry.name, entry.fullName, entry.description, ...entry.topics].join(" ").toLowerCase().includes(normalizedQuery),
|
|
99
|
+
)
|
|
100
|
+
.sort((left, right) => right.stars - left.stars || left.fullName.localeCompare(right.fullName));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function sourceUrl(raw: string): string {
|
|
104
|
+
let url: URL;
|
|
105
|
+
try {
|
|
106
|
+
url = new URL(raw.trim());
|
|
107
|
+
} catch {
|
|
108
|
+
throw new Error("Plugin stars source URL is invalid");
|
|
109
|
+
}
|
|
110
|
+
if (url.protocol !== "https:" || url.username !== "" || url.password !== "") throw new Error("Plugin stars source URL must be HTTPS without credentials");
|
|
111
|
+
return url.toString();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async function fetchReport(
|
|
115
|
+
url: string,
|
|
116
|
+
timeoutMs: number,
|
|
117
|
+
signal?: AbortSignal,
|
|
118
|
+
): Promise<{ source: string; generatedAt: string; plugins: PluginStarsEntry[] }> {
|
|
119
|
+
const controller = new AbortController();
|
|
120
|
+
const onAbort = (): void => controller.abort(signal?.reason);
|
|
121
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
122
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
123
|
+
try {
|
|
124
|
+
const response = await fetch(url, { signal: controller.signal, headers: { accept: "application/json", "user-agent": "pi-harness-plugin-stars" } });
|
|
125
|
+
if (!response.ok) throw new Error(`Plugin stars source returned HTTP ${response.status}`);
|
|
126
|
+
const body = await response.text();
|
|
127
|
+
if (Buffer.byteLength(body, "utf8") > maxResponseBytes) throw new Error("Plugin stars source exceeded the 2 MiB limit");
|
|
128
|
+
let payload: unknown;
|
|
129
|
+
try {
|
|
130
|
+
payload = JSON.parse(body) as unknown;
|
|
131
|
+
} catch (error) {
|
|
132
|
+
throw new Error(`Plugin stars source returned invalid JSON: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
133
|
+
}
|
|
134
|
+
return parsePluginStarsPayload(payload);
|
|
135
|
+
} catch (error) {
|
|
136
|
+
if (controller.signal.aborted)
|
|
137
|
+
throw new Error(signal?.aborted ? "Plugin stars request was cancelled" : `Plugin stars request timed out after ${timeoutMs} ms`, { cause: error });
|
|
138
|
+
throw error;
|
|
139
|
+
} finally {
|
|
140
|
+
clearTimeout(timer);
|
|
141
|
+
signal?.removeEventListener("abort", onAbort);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface PluginStarsConfig {
|
|
146
|
+
sourceUrl?: string;
|
|
147
|
+
limit?: number;
|
|
148
|
+
timeoutMs?: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export const Config: z<PluginStarsConfig> = z.object({
|
|
152
|
+
sourceUrl: z.string().default(defaultSourceUrl),
|
|
153
|
+
limit: z.number().default(10),
|
|
154
|
+
timeoutMs: z.number().default(15_000),
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
export default {
|
|
158
|
+
name: "pi-plugin-stars",
|
|
159
|
+
inject: ["piPluginUi", "piTools"],
|
|
160
|
+
Config,
|
|
161
|
+
apply(context: Context, config: PluginStarsConfig) {
|
|
162
|
+
const source = sourceUrl(config.sourceUrl ?? defaultSourceUrl);
|
|
163
|
+
const limit = Math.max(1, Math.min(maxLimit, Math.trunc(config.limit ?? 10)));
|
|
164
|
+
const timeoutMs = Math.max(1_000, Math.min(60_000, Math.trunc(config.timeoutMs ?? 15_000)));
|
|
165
|
+
let latest: PluginStarsReport | undefined;
|
|
166
|
+
const unregister = context.piTools.register(
|
|
167
|
+
defineTool({
|
|
168
|
+
name: "plugin_stars_search",
|
|
169
|
+
label: "Plugin Stars",
|
|
170
|
+
description: "Read the curated DSH Plugin Stars ranking, filter it locally, and return sorted repository evidence. Never installs plugins.",
|
|
171
|
+
promptSnippet: "search the curated DSH plugin ranking",
|
|
172
|
+
parameters: Type.Object({ query: Type.Optional(Type.String({ description: "Plugin name, repository, capability, or topic" })) }),
|
|
173
|
+
async execute(_toolCallId, params, signal): Promise<AgentToolResult<PluginStarsReport>> {
|
|
174
|
+
const payload = await fetchReport(source, timeoutMs, signal);
|
|
175
|
+
const query = params.query?.trim() ?? "";
|
|
176
|
+
const results = searchPluginStars(payload, query).slice(0, limit);
|
|
177
|
+
latest = { source: payload.source, generatedAt: payload.generatedAt, total: results.length, query, results, fetchedAt: new Date().toISOString() };
|
|
178
|
+
return {
|
|
179
|
+
content: [
|
|
180
|
+
{
|
|
181
|
+
type: "text",
|
|
182
|
+
text:
|
|
183
|
+
results.map((entry, index) => `${index + 1}. ${entry.fullName} · ${entry.stars} stars\n${entry.htmlUrl}`).join("\n\n") ||
|
|
184
|
+
"No ranked plugins matched.",
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
details: latest,
|
|
188
|
+
};
|
|
189
|
+
},
|
|
190
|
+
}),
|
|
191
|
+
);
|
|
192
|
+
const disposePanel = context.piPluginUi.register({
|
|
193
|
+
id: "plugin-stars-panel",
|
|
194
|
+
pluginId: "@pi-harness/core/plugins/plugin-stars",
|
|
195
|
+
title: "Plugin Stars",
|
|
196
|
+
description: "读取 dsh-plugin-stars 策展榜单,按 Star 和关键词查看社区插件,不自动安装。",
|
|
197
|
+
icon: "★",
|
|
198
|
+
read: () => ({ source, limit, timeoutMs, latest: latest ?? null }),
|
|
199
|
+
});
|
|
200
|
+
context.effect(() => () => {
|
|
201
|
+
unregister();
|
|
202
|
+
disposePanel();
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
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 maxPromptBytes = 128 * 1024;
|
|
6
|
+
type Risk = "safe" | "review" | "blocked";
|
|
7
|
+
type Finding = { code: string; severity: "medium" | "high"; message: string };
|
|
8
|
+
type PromptGuardReport = { source: string; risk: Risk; score: number; scannedChars: number; findings: Finding[] };
|
|
9
|
+
type Pattern = { code: string; severity: Finding["severity"]; score: number; message: string; pattern: RegExp };
|
|
10
|
+
|
|
11
|
+
const patterns: readonly Pattern[] = [
|
|
12
|
+
{
|
|
13
|
+
code: "instruction_override",
|
|
14
|
+
severity: "high",
|
|
15
|
+
score: 5,
|
|
16
|
+
message: "检测到试图覆盖已有指令的文本。",
|
|
17
|
+
pattern: /\bignore\s+(?:all\s+)?(?:previous|earlier|above)\s+instructions\b/iu,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
code: "secret_exfiltration",
|
|
21
|
+
severity: "high",
|
|
22
|
+
score: 5,
|
|
23
|
+
message: "检测到可能要求外传 API key、token 或密码的文本。",
|
|
24
|
+
pattern: /\b(?:api[\s_-]?key|token|password|secret)\b.{0,120}\b(?:send|upload|post|share|curl|wget)\b/iu,
|
|
25
|
+
},
|
|
26
|
+
{ code: "remote_payload", severity: "medium", score: 2, message: "检测到从远程地址加载或执行内容的文本。", pattern: /\b(?:curl|wget)\s+https?:\/\//iu },
|
|
27
|
+
{
|
|
28
|
+
code: "system_prompt_probe",
|
|
29
|
+
severity: "medium",
|
|
30
|
+
score: 2,
|
|
31
|
+
message: "检测到探测系统或开发者提示词的文本。",
|
|
32
|
+
pattern: /\b(?:system|developer)\s+(?:prompt|message|instruction)s?\b/iu,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
code: "hidden_instruction",
|
|
36
|
+
severity: "medium",
|
|
37
|
+
score: 2,
|
|
38
|
+
message: "检测到要求隐藏执行意图或绕过披露的文本。",
|
|
39
|
+
pattern: /\b(?:do not|don't)\s+(?:tell|show|disclose)\s+(?:the\s+)?(?:user|human)\b/iu,
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
function inspect(text: string, source: string): PromptGuardReport {
|
|
44
|
+
if (Buffer.byteLength(text, "utf8") > maxPromptBytes) throw new Error(`Prompt guard input must be at most ${maxPromptBytes} bytes`);
|
|
45
|
+
const findings = patterns.filter((item) => item.pattern.test(text)).map(({ code, severity, message }) => ({ code, severity, message }));
|
|
46
|
+
const score = findings.reduce((total, finding) => total + (patterns.find((item) => item.code === finding.code)?.score ?? 0), 0);
|
|
47
|
+
const highFindings = findings.filter((finding) => finding.severity === "high").length;
|
|
48
|
+
const risk: Risk = highFindings >= 2 || score >= 8 ? "blocked" : findings.length > 0 ? "review" : "safe";
|
|
49
|
+
return { source: source.trim().slice(0, 64) || "unknown", risk, score, scannedChars: text.length, findings };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function messageText(message: unknown): string {
|
|
53
|
+
if (message === null || typeof message !== "object") return "";
|
|
54
|
+
const content = (message as { content?: unknown }).content;
|
|
55
|
+
if (typeof content === "string") return content;
|
|
56
|
+
if (!Array.isArray(content)) return "";
|
|
57
|
+
return content
|
|
58
|
+
.filter(
|
|
59
|
+
(item): item is { type: "text"; text: string } =>
|
|
60
|
+
item !== null && typeof item === "object" && (item as { type?: unknown }).type === "text" && typeof (item as { text?: unknown }).text === "string",
|
|
61
|
+
)
|
|
62
|
+
.map((item) => item.text)
|
|
63
|
+
.join("\n");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default {
|
|
67
|
+
name: "pi-prompt-guard",
|
|
68
|
+
inject: ["piPluginUi", "piTools"],
|
|
69
|
+
apply(context: Context) {
|
|
70
|
+
let scans = 0;
|
|
71
|
+
let latest: PromptGuardReport | undefined;
|
|
72
|
+
const onSessionEvent = context.on("pi/session-event", (event) => {
|
|
73
|
+
if (event.type !== "message_start" || event.message.role !== "user") return;
|
|
74
|
+
try {
|
|
75
|
+
latest = inspect(messageText(event.message), "message_start");
|
|
76
|
+
scans += 1;
|
|
77
|
+
} catch {
|
|
78
|
+
latest = {
|
|
79
|
+
source: "message_start",
|
|
80
|
+
risk: "review",
|
|
81
|
+
score: 0,
|
|
82
|
+
scannedChars: 0,
|
|
83
|
+
findings: [{ code: "input_limit", severity: "medium", message: "输入超过 Prompt Guard 扫描上限。" }],
|
|
84
|
+
};
|
|
85
|
+
scans += 1;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const unregisterTool = context.piTools.register(
|
|
89
|
+
defineTool({
|
|
90
|
+
name: "prompt_guard_scan",
|
|
91
|
+
label: "Prompt guard scan",
|
|
92
|
+
description: "Scan text for prompt injection, secret exfiltration, and remote payload indicators without retaining the source text.",
|
|
93
|
+
promptSnippet: "scan untrusted text for prompt injection risks",
|
|
94
|
+
parameters: Type.Object({ text: Type.String(), source: Type.Optional(Type.String()) }),
|
|
95
|
+
execute(_toolCallId, params): Promise<AgentToolResult<PromptGuardReport>> {
|
|
96
|
+
return Promise.resolve().then(() => {
|
|
97
|
+
const report = inspect(params.text, params.source ?? "tool");
|
|
98
|
+
latest = report;
|
|
99
|
+
scans += 1;
|
|
100
|
+
return {
|
|
101
|
+
content: [{ type: "text" as const, text: `${report.risk}: ${report.findings.length} finding(s), score ${report.score}.` }],
|
|
102
|
+
details: report,
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
}),
|
|
107
|
+
);
|
|
108
|
+
const disposePanel = context.piPluginUi.register({
|
|
109
|
+
id: "prompt-guard-panel",
|
|
110
|
+
pluginId: "@pi-harness/core/plugins/prompt-guard",
|
|
111
|
+
title: "Prompt Guard",
|
|
112
|
+
description: "扫描潜在提示词注入和秘密外传风险,只保留摘要,不保存原文。",
|
|
113
|
+
icon: "⊘",
|
|
114
|
+
read: () => ({ scans, risk: latest?.risk ?? "safe", latest: latest ?? null }),
|
|
115
|
+
});
|
|
116
|
+
context.effect(() => () => {
|
|
117
|
+
onSessionEvent();
|
|
118
|
+
unregisterTool();
|
|
119
|
+
disposePanel();
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
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 customType = "pi-harness/prompt-library";
|
|
6
|
+
const maxTitleLength = 120;
|
|
7
|
+
const maxPromptLength = 8_000;
|
|
8
|
+
const maxTagLength = 40;
|
|
9
|
+
const maxTags = 10;
|
|
10
|
+
const maxTemplates = 100;
|
|
11
|
+
|
|
12
|
+
export interface PromptTemplateInput {
|
|
13
|
+
title: string;
|
|
14
|
+
prompt: string;
|
|
15
|
+
tags?: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface PromptTemplate {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
prompt: string;
|
|
22
|
+
tags: string[];
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface PromptLibraryState {
|
|
28
|
+
templates: PromptTemplate[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function bounded(value: string, field: string, maxLength: number): string {
|
|
32
|
+
const text = value.trim();
|
|
33
|
+
if (!text) throw new Error(`${field} is required`);
|
|
34
|
+
if (text.length > maxLength) throw new Error(`${field} must be ${maxLength.toLocaleString()} characters or fewer`);
|
|
35
|
+
return text;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function normalizeTags(values: string[] | undefined): string[] {
|
|
39
|
+
const tags = values ?? [];
|
|
40
|
+
if (tags.length > maxTags) throw new Error(`tags must contain ${maxTags} items or fewer`);
|
|
41
|
+
return [...new Set(tags.map((tag) => tag.trim()).filter(Boolean))].map((tag) => bounded(tag, "tag", maxTagLength));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function createPromptTemplate(input: PromptTemplateInput, id: string, timestamp: string): PromptTemplate {
|
|
45
|
+
return {
|
|
46
|
+
id,
|
|
47
|
+
title: bounded(input.title, "title", maxTitleLength),
|
|
48
|
+
prompt: bounded(input.prompt, "prompt", maxPromptLength),
|
|
49
|
+
tags: normalizeTags(input.tags),
|
|
50
|
+
createdAt: timestamp,
|
|
51
|
+
updatedAt: timestamp,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function readState(context: Context): PromptLibraryState {
|
|
56
|
+
const entry = [...context.piSession.manager.getEntries()].reverse().find((item) => item.type === "custom" && item.customType === customType);
|
|
57
|
+
if (entry?.type !== "custom" || entry.data === undefined || entry.data === null || typeof entry.data !== "object") return { templates: [] };
|
|
58
|
+
const value = entry.data as { templates?: unknown };
|
|
59
|
+
if (!Array.isArray(value.templates)) return { templates: [] };
|
|
60
|
+
const templates = value.templates.flatMap((item): PromptTemplate[] => {
|
|
61
|
+
if (item === null || typeof item !== "object") return [];
|
|
62
|
+
const candidate = item as Partial<PromptTemplate>;
|
|
63
|
+
if (typeof candidate.id !== "string" || typeof candidate.title !== "string" || typeof candidate.prompt !== "string") return [];
|
|
64
|
+
return [
|
|
65
|
+
{
|
|
66
|
+
id: candidate.id,
|
|
67
|
+
title: candidate.title,
|
|
68
|
+
prompt: candidate.prompt,
|
|
69
|
+
tags: Array.isArray(candidate.tags) ? candidate.tags.filter((tag): tag is string => typeof tag === "string") : [],
|
|
70
|
+
createdAt: typeof candidate.createdAt === "string" ? candidate.createdAt : new Date(0).toISOString(),
|
|
71
|
+
updatedAt: typeof candidate.updatedAt === "string" ? candidate.updatedAt : new Date(0).toISOString(),
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
});
|
|
75
|
+
return { templates: templates.slice(-maxTemplates) };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function persist(context: Context, state: PromptLibraryState): void {
|
|
79
|
+
context.piSession.manager.appendCustomEntry(customType, state);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function filterTemplates(state: PromptLibraryState, query: string | undefined): PromptTemplate[] {
|
|
83
|
+
const normalized = query?.trim().toLocaleLowerCase() ?? "";
|
|
84
|
+
if (!normalized) return state.templates;
|
|
85
|
+
return state.templates.filter((template) => `${template.title} ${template.prompt} ${template.tags.join(" ")}`.toLocaleLowerCase().includes(normalized));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
name: "pi-prompt-library",
|
|
90
|
+
inject: ["piSession", "piPluginUi", "piTools"],
|
|
91
|
+
apply(context: Context) {
|
|
92
|
+
let sequence = 0;
|
|
93
|
+
let latest = readState(context);
|
|
94
|
+
const unregister = context.piTools.register(
|
|
95
|
+
defineTool({
|
|
96
|
+
name: "prompt_library",
|
|
97
|
+
label: "Prompt library",
|
|
98
|
+
description: "Save, search, update, and delete reusable prompt templates in the current Pi session.",
|
|
99
|
+
promptSnippet: "manage reusable prompts for the current project",
|
|
100
|
+
parameters: Type.Object({
|
|
101
|
+
action: Type.Union([Type.Literal("save"), Type.Literal("list"), Type.Literal("delete")]),
|
|
102
|
+
id: Type.Optional(Type.String()),
|
|
103
|
+
title: Type.Optional(Type.String()),
|
|
104
|
+
prompt: Type.Optional(Type.String()),
|
|
105
|
+
tags: Type.Optional(Type.Array(Type.String())),
|
|
106
|
+
query: Type.Optional(Type.String()),
|
|
107
|
+
}),
|
|
108
|
+
execute(_toolCallId, params): Promise<AgentToolResult<PromptLibraryState & { selected?: PromptTemplate }>> {
|
|
109
|
+
return Promise.resolve().then(() => {
|
|
110
|
+
const state = readState(context);
|
|
111
|
+
if (params.action === "save") {
|
|
112
|
+
const now = new Date().toISOString();
|
|
113
|
+
const existing = params.id?.trim() ? state.templates.find((template) => template.id === params.id?.trim()) : undefined;
|
|
114
|
+
const template = existing
|
|
115
|
+
? {
|
|
116
|
+
...existing,
|
|
117
|
+
title: bounded(params.title ?? existing.title, "title", maxTitleLength),
|
|
118
|
+
prompt: bounded(params.prompt ?? existing.prompt, "prompt", maxPromptLength),
|
|
119
|
+
tags: normalizeTags(params.tags ?? existing.tags),
|
|
120
|
+
updatedAt: now,
|
|
121
|
+
}
|
|
122
|
+
: createPromptTemplate(
|
|
123
|
+
{ title: params.title ?? "", prompt: params.prompt ?? "", ...(params.tags === undefined ? {} : { tags: params.tags }) },
|
|
124
|
+
`prompt-${Date.now()}-${++sequence}`,
|
|
125
|
+
now,
|
|
126
|
+
);
|
|
127
|
+
const templates = existing
|
|
128
|
+
? state.templates.map((item) => (item.id === existing.id ? template : item))
|
|
129
|
+
: [...state.templates, template].slice(-maxTemplates);
|
|
130
|
+
latest = { templates };
|
|
131
|
+
persist(context, latest);
|
|
132
|
+
return { content: [{ type: "text" as const, text: `Prompt ${template.id} saved.` }], details: { ...latest, selected: template } };
|
|
133
|
+
}
|
|
134
|
+
if (params.action === "delete") {
|
|
135
|
+
const id = params.id?.trim();
|
|
136
|
+
if (!id) throw new Error("id is required when action is delete");
|
|
137
|
+
if (!state.templates.some((template) => template.id === id)) throw new Error(`Prompt was not found: ${id}`);
|
|
138
|
+
latest = { templates: state.templates.filter((template) => template.id !== id) };
|
|
139
|
+
persist(context, latest);
|
|
140
|
+
return { content: [{ type: "text" as const, text: `Prompt ${id} deleted.` }], details: latest };
|
|
141
|
+
}
|
|
142
|
+
latest = state;
|
|
143
|
+
const templates = filterTemplates(state, params.query);
|
|
144
|
+
return {
|
|
145
|
+
content: [{ type: "text" as const, text: templates.map((template) => `${template.id}: ${template.title}`).join("\n") || "No prompts found." }],
|
|
146
|
+
details: { templates },
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
151
|
+
);
|
|
152
|
+
const disposePanel = context.piPluginUi.register({
|
|
153
|
+
id: "prompt-library-panel",
|
|
154
|
+
pluginId: "@pi-harness/core/plugins/prompt-library",
|
|
155
|
+
title: "Prompt Library",
|
|
156
|
+
description: "保存和检索可复用的提示词模板,数据跟随当前会话。",
|
|
157
|
+
icon: "✎",
|
|
158
|
+
read: () => ({ total: latest.templates.length, templates: latest.templates }),
|
|
159
|
+
});
|
|
160
|
+
context.effect(() => () => {
|
|
161
|
+
unregister();
|
|
162
|
+
disposePanel();
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { lstat, mkdir, readFile, realpath, rename, writeFile } from "node:fs/promises";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
4
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
5
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
6
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
|
|
8
|
+
export type ReadmeMetadata = { name: string; version: string; description: string; scripts: string[]; plugins: string[] };
|
|
9
|
+
export type ReadmeReport = ReadmeMetadata & { markdown: string };
|
|
10
|
+
export type ReadmeWriteReport = { path: string; bytes: number; overwritten: boolean };
|
|
11
|
+
|
|
12
|
+
export function renderReadme(metadata: ReadmeMetadata): string {
|
|
13
|
+
const { name, version, description, scripts, plugins } = metadata;
|
|
14
|
+
return [
|
|
15
|
+
`# ${name}`,
|
|
16
|
+
"",
|
|
17
|
+
description,
|
|
18
|
+
"",
|
|
19
|
+
`Version: ${version}`,
|
|
20
|
+
"",
|
|
21
|
+
"## Scripts",
|
|
22
|
+
"",
|
|
23
|
+
...(scripts.length ? scripts.map((script) => `- \`npm run ${script}\``) : ["- No npm scripts declared."]),
|
|
24
|
+
"",
|
|
25
|
+
"## Runtime plugins",
|
|
26
|
+
"",
|
|
27
|
+
...(plugins.length ? plugins.map((plugin) => `- \`${plugin}\``) : ["- No runtime plugins reported."]),
|
|
28
|
+
"",
|
|
29
|
+
].join("\n");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function generate(context: Context): Promise<ReadmeReport> {
|
|
33
|
+
const path = join(context.piHarnessLaunch.cwd, "package.json");
|
|
34
|
+
const source = await readFile(path, "utf8");
|
|
35
|
+
let parsed: unknown;
|
|
36
|
+
try {
|
|
37
|
+
parsed = JSON.parse(source) as unknown;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
throw new Error(`Invalid package.json: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
40
|
+
}
|
|
41
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("package.json root must be an object");
|
|
42
|
+
const packageJson = parsed as Record<string, unknown>;
|
|
43
|
+
const name = typeof packageJson.name === "string" ? packageJson.name : "Unnamed project";
|
|
44
|
+
const version = typeof packageJson.version === "string" ? packageJson.version : "unknown";
|
|
45
|
+
const description = typeof packageJson.description === "string" ? packageJson.description : "";
|
|
46
|
+
const scripts =
|
|
47
|
+
packageJson.scripts !== null && typeof packageJson.scripts === "object" && !Array.isArray(packageJson.scripts)
|
|
48
|
+
? Object.keys(packageJson.scripts).sort()
|
|
49
|
+
: [];
|
|
50
|
+
const loader = context.get("loader") as { entries(): Iterable<{ disabled?: boolean | null; options: { name: string } }> } | undefined;
|
|
51
|
+
const plugins =
|
|
52
|
+
loader === undefined
|
|
53
|
+
? []
|
|
54
|
+
: [...loader.entries()]
|
|
55
|
+
.filter((entry) => !entry.disabled)
|
|
56
|
+
.map((entry) => entry.options.name)
|
|
57
|
+
.filter((plugin) => !plugin.startsWith("cordis:"))
|
|
58
|
+
.sort();
|
|
59
|
+
const metadata = { name, version, description, scripts, plugins };
|
|
60
|
+
return { ...metadata, markdown: renderReadme(metadata) };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function outputPath(root: string, requested: string): string {
|
|
64
|
+
const value = requested.trim() || "README.generated.md";
|
|
65
|
+
if (value.length > 512 || value.includes("\\")) throw new Error("README output path must be a relative POSIX path of at most 512 characters");
|
|
66
|
+
const resolvedRoot = resolve(root);
|
|
67
|
+
const target = resolve(resolvedRoot, value);
|
|
68
|
+
const remainder = relative(resolvedRoot, target);
|
|
69
|
+
if (remainder === ".." || remainder.startsWith(`..${"/"}`) || remainder.startsWith("/")) throw new Error("README output path must stay inside the workspace");
|
|
70
|
+
return target;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function writeReadmeFile(root: string, markdown: string, requestedPath: string, confirm: boolean): Promise<ReadmeWriteReport> {
|
|
74
|
+
if (!confirm) throw new Error("Writing a README requires confirm=true");
|
|
75
|
+
const workspace = await realpath(resolve(root));
|
|
76
|
+
const target = outputPath(workspace, requestedPath);
|
|
77
|
+
const parent = dirname(target);
|
|
78
|
+
await mkdir(parent, { recursive: true });
|
|
79
|
+
const realParent = await realpath(parent);
|
|
80
|
+
const parentRemainder = relative(workspace, realParent);
|
|
81
|
+
if (parentRemainder === ".." || parentRemainder.startsWith(`..${"/"}`) || parentRemainder.startsWith("/"))
|
|
82
|
+
throw new Error("README output path must stay inside the workspace");
|
|
83
|
+
let overwritten = false;
|
|
84
|
+
try {
|
|
85
|
+
const metadata = await lstat(target);
|
|
86
|
+
if (metadata.isSymbolicLink() || !metadata.isFile()) throw new Error("README output path must be a regular file and cannot be a symbolic link");
|
|
87
|
+
overwritten = true;
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
|
90
|
+
}
|
|
91
|
+
const temporary = join(parent, `.${basename(target)}.${randomUUID()}.tmp`);
|
|
92
|
+
await writeFile(temporary, markdown, { encoding: "utf8", mode: 0o600 });
|
|
93
|
+
await rename(temporary, target);
|
|
94
|
+
return { path: relative(workspace, target), bytes: Buffer.byteLength(markdown, "utf8"), overwritten };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default {
|
|
98
|
+
name: "pi-readme-gen",
|
|
99
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
100
|
+
apply(context: Context) {
|
|
101
|
+
let latest: ReadmeReport | undefined;
|
|
102
|
+
let lastWrite: ReadmeWriteReport | undefined;
|
|
103
|
+
const unregisterTool = context.piTools.register(
|
|
104
|
+
defineTool({
|
|
105
|
+
name: "readme_report",
|
|
106
|
+
label: "README report",
|
|
107
|
+
description: "Generate a Markdown project overview from the local package manifest and active Pi runtime plugins.",
|
|
108
|
+
promptSnippet: "generate a project README overview",
|
|
109
|
+
parameters: Type.Object({}),
|
|
110
|
+
async execute(): Promise<AgentToolResult<ReadmeReport>> {
|
|
111
|
+
latest = await generate(context);
|
|
112
|
+
return { content: [{ type: "text", text: latest.markdown }], details: latest };
|
|
113
|
+
},
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
const unregisterWrite = context.piTools.register(
|
|
117
|
+
defineTool({
|
|
118
|
+
name: "readme_write",
|
|
119
|
+
label: "Write README",
|
|
120
|
+
description: "Write the generated Markdown to a workspace file only after explicit confirmation; defaults to README.generated.md.",
|
|
121
|
+
promptSnippet: "write the generated README to a confirmed workspace path",
|
|
122
|
+
parameters: Type.Object({ outputPath: Type.Optional(Type.String()), confirm: Type.Boolean() }),
|
|
123
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<ReadmeWriteReport>> {
|
|
124
|
+
const report = latest ?? (latest = await generate(context));
|
|
125
|
+
lastWrite = await writeReadmeFile(context.piHarnessLaunch.cwd, report.markdown, params.outputPath ?? "README.generated.md", params.confirm);
|
|
126
|
+
return { content: [{ type: "text", text: `README written: ${lastWrite.path} (${lastWrite.bytes} bytes)` }], details: lastWrite };
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
130
|
+
const disposePanel = context.piPluginUi.register({
|
|
131
|
+
id: "readme-gen-panel",
|
|
132
|
+
pluginId: "@pi-harness/core/plugins/readme-gen",
|
|
133
|
+
title: "README Generator",
|
|
134
|
+
description: "从当前项目清单生成 Markdown 概览;写入文件需要显式确认,默认不会覆盖 README。",
|
|
135
|
+
icon: "▰",
|
|
136
|
+
read: () =>
|
|
137
|
+
latest === undefined
|
|
138
|
+
? { generated: false, lastWrite: lastWrite ?? null }
|
|
139
|
+
: { generated: true, name: latest.name, scripts: latest.scripts.length, plugins: latest.plugins.length, lastWrite: lastWrite ?? null },
|
|
140
|
+
});
|
|
141
|
+
context.effect(() => () => {
|
|
142
|
+
unregisterTool();
|
|
143
|
+
unregisterWrite();
|
|
144
|
+
disposePanel();
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
};
|