@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,171 @@
|
|
|
1
|
+
import { lookup } from "node:dns/promises";
|
|
2
|
+
import { isIP } from "node:net";
|
|
3
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
import z from "@deepseek-ai/schemastery";
|
|
5
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
6
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
|
|
8
|
+
const maxResponseBytes = 512 * 1024;
|
|
9
|
+
const maxRedirects = 3;
|
|
10
|
+
const requestTimeoutMs = 20_000;
|
|
11
|
+
|
|
12
|
+
type BrowserFetchResult = { url: string; finalUrl: string; status: number; contentType: string; bytes: number; truncated: boolean; text: string };
|
|
13
|
+
|
|
14
|
+
function privateIpv4(address: string): boolean {
|
|
15
|
+
const octets = address.split(".").map(Number);
|
|
16
|
+
if (octets.length !== 4 || octets.some((octet) => !Number.isInteger(octet) || octet < 0 || octet > 255)) return true;
|
|
17
|
+
const first = octets[0] ?? -1;
|
|
18
|
+
const second = octets[1] ?? -1;
|
|
19
|
+
return (
|
|
20
|
+
first === 0 ||
|
|
21
|
+
first === 10 ||
|
|
22
|
+
first === 127 ||
|
|
23
|
+
(first === 100 && second >= 64 && second <= 127) ||
|
|
24
|
+
(first === 169 && second === 254) ||
|
|
25
|
+
(first === 172 && second >= 16 && second <= 31) ||
|
|
26
|
+
(first === 192 && second === 0) ||
|
|
27
|
+
(first === 192 && second === 168) ||
|
|
28
|
+
(first === 198 && (second === 18 || second === 19)) ||
|
|
29
|
+
first >= 224
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function privateIp(address: string): boolean {
|
|
34
|
+
if (isIP(address) === 4) return privateIpv4(address);
|
|
35
|
+
const normalized = address.toLowerCase();
|
|
36
|
+
return (
|
|
37
|
+
normalized === "::1" ||
|
|
38
|
+
normalized.startsWith("fc") ||
|
|
39
|
+
normalized.startsWith("fd") ||
|
|
40
|
+
normalized.startsWith("fe8") ||
|
|
41
|
+
normalized.startsWith("fe9") ||
|
|
42
|
+
normalized.startsWith("fea") ||
|
|
43
|
+
normalized.startsWith("feb") ||
|
|
44
|
+
normalized.startsWith("::ffff:10.") ||
|
|
45
|
+
normalized.startsWith("::ffff:192.168.") ||
|
|
46
|
+
normalized.startsWith("::ffff:127.")
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function validateTarget(rawUrl: string, allowPrivate: boolean): Promise<URL> {
|
|
51
|
+
if (rawUrl.length === 0 || rawUrl.length > 4096) throw new Error("Browser URL must be between 1 and 4096 characters");
|
|
52
|
+
let url: URL;
|
|
53
|
+
try {
|
|
54
|
+
url = new URL(rawUrl);
|
|
55
|
+
} catch {
|
|
56
|
+
throw new Error("Browser URL is invalid");
|
|
57
|
+
}
|
|
58
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("Browser fetch only supports http and https URLs");
|
|
59
|
+
if (url.username !== "" || url.password !== "") throw new Error("Browser URL must not contain credentials");
|
|
60
|
+
if (!allowPrivate) {
|
|
61
|
+
const addresses = await lookup(url.hostname, { all: true, verbatim: true });
|
|
62
|
+
if (addresses.some(({ address }) => privateIp(address))) throw new Error("Browser fetch blocked a private or local network target");
|
|
63
|
+
}
|
|
64
|
+
return url;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function readBody(response: Response): Promise<{ bytes: number; truncated: boolean; text: string }> {
|
|
68
|
+
if (response.body === null) return { bytes: 0, truncated: false, text: "" };
|
|
69
|
+
const reader = response.body.getReader();
|
|
70
|
+
const chunks: Uint8Array[] = [];
|
|
71
|
+
let bytes = 0;
|
|
72
|
+
let truncated = false;
|
|
73
|
+
try {
|
|
74
|
+
while (true) {
|
|
75
|
+
const next = await reader.read();
|
|
76
|
+
if (next.done) break;
|
|
77
|
+
const chunk = next.value;
|
|
78
|
+
if (bytes + chunk.byteLength > maxResponseBytes) {
|
|
79
|
+
const remaining = maxResponseBytes - bytes;
|
|
80
|
+
if (remaining > 0) chunks.push(chunk.subarray(0, remaining));
|
|
81
|
+
bytes = maxResponseBytes;
|
|
82
|
+
truncated = true;
|
|
83
|
+
await reader.cancel();
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
chunks.push(chunk);
|
|
87
|
+
bytes += chunk.byteLength;
|
|
88
|
+
}
|
|
89
|
+
} finally {
|
|
90
|
+
reader.releaseLock();
|
|
91
|
+
}
|
|
92
|
+
return { bytes, truncated, text: Buffer.concat(chunks.map((chunk) => Buffer.from(chunk))).toString("utf8") };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async function fetchPage(rawUrl: string, allowPrivate: boolean): Promise<BrowserFetchResult> {
|
|
96
|
+
let current = await validateTarget(rawUrl, allowPrivate);
|
|
97
|
+
const original = current.toString();
|
|
98
|
+
for (let redirect = 0; redirect <= maxRedirects; redirect += 1) {
|
|
99
|
+
const controller = new AbortController();
|
|
100
|
+
const timer = setTimeout(() => controller.abort(), requestTimeoutMs);
|
|
101
|
+
let response: Response;
|
|
102
|
+
try {
|
|
103
|
+
response = await fetch(current, {
|
|
104
|
+
redirect: "manual",
|
|
105
|
+
signal: controller.signal,
|
|
106
|
+
headers: { accept: "text/html, text/plain, application/json;q=0.9, */*;q=0.1", "user-agent": "pi-harness-browser-fetch/0.1" },
|
|
107
|
+
});
|
|
108
|
+
} catch (error) {
|
|
109
|
+
if (error instanceof Error && error.name === "AbortError") throw new Error("Browser fetch timed out after 20 seconds", { cause: error });
|
|
110
|
+
throw error;
|
|
111
|
+
} finally {
|
|
112
|
+
clearTimeout(timer);
|
|
113
|
+
}
|
|
114
|
+
if (response.status >= 300 && response.status < 400) {
|
|
115
|
+
const location = response.headers.get("location");
|
|
116
|
+
if (location === null) throw new Error(`Browser redirect ${response.status} has no Location header`);
|
|
117
|
+
if (redirect === maxRedirects) throw new Error(`Browser fetch exceeded the ${maxRedirects}-redirect limit`);
|
|
118
|
+
current = await validateTarget(new URL(location, current).toString(), allowPrivate);
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const body = await readBody(response);
|
|
122
|
+
return {
|
|
123
|
+
url: original,
|
|
124
|
+
finalUrl: current.toString(),
|
|
125
|
+
status: response.status,
|
|
126
|
+
contentType: (response.headers.get("content-type") ?? "text/plain").split(";", 1)[0]!.trim(),
|
|
127
|
+
...body,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
throw new Error("Browser fetch did not produce a response");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface BrowserFetchPluginConfig {
|
|
134
|
+
allowPrivate?: boolean;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const Config: z<BrowserFetchPluginConfig> = z.object({ allowPrivate: z.boolean().default(false) });
|
|
138
|
+
|
|
139
|
+
export default {
|
|
140
|
+
name: "pi-browser-fetch",
|
|
141
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
142
|
+
Config,
|
|
143
|
+
apply(context: Context, config: BrowserFetchPluginConfig) {
|
|
144
|
+
let latest: BrowserFetchResult | undefined;
|
|
145
|
+
const unregisterTool = context.piTools.register(
|
|
146
|
+
defineTool({
|
|
147
|
+
name: "browser_fetch",
|
|
148
|
+
label: "Browser fetch",
|
|
149
|
+
description: "Fetch a public HTTP or HTTPS page as bounded text without executing page scripts.",
|
|
150
|
+
promptSnippet: "fetch a public web page for inspection",
|
|
151
|
+
parameters: Type.Object({ url: Type.String({ description: "HTTP or HTTPS URL" }) }),
|
|
152
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<BrowserFetchResult>> {
|
|
153
|
+
latest = await fetchPage(params.url, config.allowPrivate === true);
|
|
154
|
+
return { content: [{ type: "text", text: latest.text }], details: latest };
|
|
155
|
+
},
|
|
156
|
+
}),
|
|
157
|
+
);
|
|
158
|
+
const disposePanel = context.piPluginUi.register({
|
|
159
|
+
id: "browser-fetch-panel",
|
|
160
|
+
pluginId: "@pi-harness/core/plugins/browser-fetch",
|
|
161
|
+
title: "Browser Fetch",
|
|
162
|
+
description: "受限抓取公开网页文本,不执行页面脚本。",
|
|
163
|
+
icon: "◎",
|
|
164
|
+
read: () => ({ latest: latest ?? null, allowPrivate: config.allowPrivate === true, maxResponseBytes }),
|
|
165
|
+
});
|
|
166
|
+
context.effect(() => () => {
|
|
167
|
+
unregisterTool();
|
|
168
|
+
disposePanel();
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
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
|
+
type JsonObject = Record<string, unknown>;
|
|
7
|
+
type BrowserTab = { targetId: string; title: string; url: string; type: string; webSocketDebuggerUrl?: string };
|
|
8
|
+
type BrowserSessionResult = {
|
|
9
|
+
targetId: string;
|
|
10
|
+
url: string;
|
|
11
|
+
title: string;
|
|
12
|
+
status?: string;
|
|
13
|
+
truncated?: boolean;
|
|
14
|
+
text?: string;
|
|
15
|
+
clicked?: boolean;
|
|
16
|
+
screenshot?: { data: string; mimeType: string };
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const requestTimeoutMs = 15_000;
|
|
20
|
+
const maxTextBytes = 128 * 1024;
|
|
21
|
+
const maxSelectorLength = 512;
|
|
22
|
+
|
|
23
|
+
function endpointUrl(raw: string): URL {
|
|
24
|
+
let endpoint: URL;
|
|
25
|
+
try {
|
|
26
|
+
endpoint = new URL(raw);
|
|
27
|
+
} catch {
|
|
28
|
+
throw new Error("Browser session endpoint is invalid");
|
|
29
|
+
}
|
|
30
|
+
const host = endpoint.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
31
|
+
if (endpoint.protocol !== "http:" || (host !== "localhost" && host !== "127.0.0.1" && host !== "::1"))
|
|
32
|
+
throw new Error("Browser session endpoint must be a local http://localhost, 127.0.0.1, or ::1 address");
|
|
33
|
+
endpoint.pathname = endpoint.pathname.replace(/\/$/, "");
|
|
34
|
+
return endpoint;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function tabs(endpoint: URL): Promise<BrowserTab[]> {
|
|
38
|
+
const response = await fetch(new URL("/json/list", endpoint));
|
|
39
|
+
if (!response.ok) throw new Error(`Chrome DevTools returned HTTP ${response.status}`);
|
|
40
|
+
const payload = (await response.json()) as unknown;
|
|
41
|
+
if (!Array.isArray(payload)) throw new Error("Chrome DevTools returned an invalid tab list");
|
|
42
|
+
return payload
|
|
43
|
+
.filter((tab): tab is BrowserTab => typeof tab === "object" && tab !== null && typeof (tab as JsonObject).id === "string")
|
|
44
|
+
.map((tab) => {
|
|
45
|
+
const item = tab as JsonObject;
|
|
46
|
+
return {
|
|
47
|
+
targetId: String(item.id),
|
|
48
|
+
title: typeof item.title === "string" ? item.title : "",
|
|
49
|
+
url: typeof item.url === "string" ? item.url : "",
|
|
50
|
+
type: typeof item.type === "string" ? item.type : "",
|
|
51
|
+
...(typeof item.webSocketDebuggerUrl === "string" ? { webSocketDebuggerUrl: item.webSocketDebuggerUrl } : {}),
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function target(endpoint: URL, targetId: string): Promise<BrowserTab> {
|
|
57
|
+
const tab = (await tabs(endpoint)).find((item) => item.targetId === targetId);
|
|
58
|
+
if (tab === undefined) throw new Error(`Browser tab was not found: ${targetId}`);
|
|
59
|
+
if (tab.webSocketDebuggerUrl === undefined) throw new Error(`Browser tab is not debuggable: ${targetId}`);
|
|
60
|
+
return tab;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function cdp(tab: BrowserTab, method: string, params?: JsonObject): Promise<JsonObject> {
|
|
64
|
+
if (tab.webSocketDebuggerUrl === undefined) throw new Error(`Browser tab is not debuggable: ${tab.targetId}`);
|
|
65
|
+
const socket = new WebSocket(tab.webSocketDebuggerUrl);
|
|
66
|
+
return new Promise((resolve, reject) => {
|
|
67
|
+
const id = 1;
|
|
68
|
+
const timer = setTimeout(() => {
|
|
69
|
+
cleanup();
|
|
70
|
+
socket.close();
|
|
71
|
+
reject(new Error(`Chrome DevTools request timed out: ${method}`));
|
|
72
|
+
}, requestTimeoutMs);
|
|
73
|
+
const cleanup = (): void => {
|
|
74
|
+
clearTimeout(timer);
|
|
75
|
+
socket.removeEventListener("open", onOpen);
|
|
76
|
+
socket.removeEventListener("message", onMessage);
|
|
77
|
+
socket.removeEventListener("error", onError);
|
|
78
|
+
socket.removeEventListener("close", onClose);
|
|
79
|
+
};
|
|
80
|
+
const onOpen = (): void => {
|
|
81
|
+
socket.send(JSON.stringify({ id, method, ...(params === undefined ? {} : { params }) }));
|
|
82
|
+
};
|
|
83
|
+
const onMessage = (event: MessageEvent): void => {
|
|
84
|
+
let message: unknown;
|
|
85
|
+
try {
|
|
86
|
+
message = JSON.parse(typeof event.data === "string" ? event.data : String(event.data));
|
|
87
|
+
} catch {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (typeof message !== "object" || message === null || (message as JsonObject).id !== id) return;
|
|
91
|
+
cleanup();
|
|
92
|
+
socket.close();
|
|
93
|
+
const payload = message as JsonObject;
|
|
94
|
+
if (typeof payload.error === "object" && payload.error !== null) {
|
|
95
|
+
const errorMessage = (payload.error as JsonObject).message;
|
|
96
|
+
reject(new Error(typeof errorMessage === "string" ? errorMessage : "Chrome DevTools request failed"));
|
|
97
|
+
} else if (typeof payload.result === "object" && payload.result !== null) resolve(payload.result as JsonObject);
|
|
98
|
+
else reject(new Error("Chrome DevTools returned an invalid response"));
|
|
99
|
+
};
|
|
100
|
+
const onError = (): void => {
|
|
101
|
+
cleanup();
|
|
102
|
+
reject(new Error("Could not connect to the Chrome DevTools tab"));
|
|
103
|
+
};
|
|
104
|
+
const onClose = (): void => {
|
|
105
|
+
cleanup();
|
|
106
|
+
reject(new Error("Chrome DevTools tab connection closed before responding"));
|
|
107
|
+
};
|
|
108
|
+
socket.addEventListener("open", onOpen);
|
|
109
|
+
socket.addEventListener("message", onMessage);
|
|
110
|
+
socket.addEventListener("error", onError);
|
|
111
|
+
socket.addEventListener("close", onClose);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function resultValue(result: JsonObject): unknown {
|
|
116
|
+
const exception = result.exceptionDetails;
|
|
117
|
+
if (exception !== undefined) {
|
|
118
|
+
const exceptionText = typeof exception === "object" && exception !== null ? (exception as JsonObject).text : undefined;
|
|
119
|
+
throw new Error(typeof exceptionText === "string" ? exceptionText : "Page evaluation failed");
|
|
120
|
+
}
|
|
121
|
+
const value = result.result;
|
|
122
|
+
if (typeof value !== "object" || value === null) throw new Error("Page evaluation returned no value");
|
|
123
|
+
return (value as JsonObject).value;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function ready(endpoint: URL, tab: BrowserTab): Promise<void> {
|
|
127
|
+
const deadline = Date.now() + requestTimeoutMs;
|
|
128
|
+
while (Date.now() < deadline) {
|
|
129
|
+
try {
|
|
130
|
+
const result = await cdp(tab, "Runtime.evaluate", { expression: "document.readyState", returnByValue: true });
|
|
131
|
+
if (resultValue(result) === "complete" || resultValue(result) === "interactive") return;
|
|
132
|
+
} catch {
|
|
133
|
+
// The navigation may replace the target briefly; poll until it is ready or the deadline expires.
|
|
134
|
+
}
|
|
135
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
136
|
+
}
|
|
137
|
+
throw new Error("Browser navigation did not become ready within 15 seconds");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function evaluate(tab: BrowserTab, expression: string): Promise<unknown> {
|
|
141
|
+
const result = await cdp(tab, "Runtime.evaluate", { expression, returnByValue: true, awaitPromise: true });
|
|
142
|
+
return resultValue(result);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface BrowserSessionPluginConfig {
|
|
146
|
+
endpoint?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export const Config: z<BrowserSessionPluginConfig> = z.object({ endpoint: z.string().default("http://127.0.0.1:9222") });
|
|
150
|
+
|
|
151
|
+
export default {
|
|
152
|
+
name: "pi-browser-session",
|
|
153
|
+
inject: ["piPluginUi", "piTools"],
|
|
154
|
+
Config,
|
|
155
|
+
apply(context: Context, config: BrowserSessionPluginConfig) {
|
|
156
|
+
const endpoint = endpointUrl(config.endpoint ?? "http://127.0.0.1:9222");
|
|
157
|
+
let latest: BrowserSessionResult | undefined;
|
|
158
|
+
const listTabs = async (): Promise<BrowserTab[]> => tabs(endpoint);
|
|
159
|
+
const getTab = async (targetId: string): Promise<BrowserTab> => target(endpoint, targetId);
|
|
160
|
+
const unregisterTabs = context.piTools.register(
|
|
161
|
+
defineTool({
|
|
162
|
+
name: "browser_tabs",
|
|
163
|
+
label: "Browser tabs",
|
|
164
|
+
description: "List pages in an already-running local Chrome DevTools session.",
|
|
165
|
+
promptSnippet: "list tabs in the connected local browser",
|
|
166
|
+
parameters: Type.Object({}),
|
|
167
|
+
async execute(): Promise<AgentToolResult<{ tabs: BrowserTab[] }>> {
|
|
168
|
+
const items = (await listTabs()).filter((tab) => tab.type === "page");
|
|
169
|
+
return {
|
|
170
|
+
content: [{ type: "text", text: items.map((tab) => `${tab.targetId} ${tab.title} ${tab.url}`).join("\n") || "No browser pages are open." }],
|
|
171
|
+
details: { tabs: items },
|
|
172
|
+
};
|
|
173
|
+
},
|
|
174
|
+
}),
|
|
175
|
+
);
|
|
176
|
+
const unregisterNavigate = context.piTools.register(
|
|
177
|
+
defineTool({
|
|
178
|
+
name: "browser_navigate",
|
|
179
|
+
label: "Browser navigate",
|
|
180
|
+
description: "Navigate a connected browser tab to an HTTP or HTTPS URL.",
|
|
181
|
+
promptSnippet: "navigate the connected browser tab",
|
|
182
|
+
parameters: Type.Object({ targetId: Type.String(), url: Type.String() }),
|
|
183
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<BrowserSessionResult>> {
|
|
184
|
+
const url = new URL(params.url);
|
|
185
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("Browser navigation only supports http and https URLs");
|
|
186
|
+
const tab = await getTab(params.targetId);
|
|
187
|
+
await cdp(tab, "Page.enable");
|
|
188
|
+
await cdp(tab, "Page.navigate", { url: url.toString() });
|
|
189
|
+
await ready(endpoint, { ...tab, url: url.toString() });
|
|
190
|
+
latest = { targetId: tab.targetId, url: url.toString(), title: tab.title };
|
|
191
|
+
return { content: [{ type: "text", text: `Navigated to ${url.toString()}` }], details: { ...latest, status: "navigated" } };
|
|
192
|
+
},
|
|
193
|
+
}),
|
|
194
|
+
);
|
|
195
|
+
const unregisterRead = context.piTools.register(
|
|
196
|
+
defineTool({
|
|
197
|
+
name: "browser_read",
|
|
198
|
+
label: "Browser read",
|
|
199
|
+
description: "Read bounded visible text from a connected browser tab.",
|
|
200
|
+
promptSnippet: "read visible text from the connected browser tab",
|
|
201
|
+
parameters: Type.Object({ targetId: Type.String() }),
|
|
202
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<BrowserSessionResult>> {
|
|
203
|
+
const tab = await getTab(params.targetId);
|
|
204
|
+
const value = await evaluate(tab, "document.body?.innerText ?? ''");
|
|
205
|
+
const text = typeof value === "string" ? value : "";
|
|
206
|
+
const bytes = Buffer.byteLength(text, "utf8");
|
|
207
|
+
const bounded = Buffer.from(text, "utf8").subarray(0, maxTextBytes).toString("utf8");
|
|
208
|
+
latest = { targetId: tab.targetId, url: tab.url, title: tab.title, text: bounded };
|
|
209
|
+
return { content: [{ type: "text", text: bounded }], details: { ...latest, truncated: bytes > maxTextBytes } };
|
|
210
|
+
},
|
|
211
|
+
}),
|
|
212
|
+
);
|
|
213
|
+
const unregisterClick = context.piTools.register(
|
|
214
|
+
defineTool({
|
|
215
|
+
name: "browser_click",
|
|
216
|
+
label: "Browser click",
|
|
217
|
+
description: "Click one visible HTML element in a connected browser tab by CSS selector.",
|
|
218
|
+
promptSnippet: "click a page element in the connected browser",
|
|
219
|
+
parameters: Type.Object({ targetId: Type.String(), selector: Type.String() }),
|
|
220
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<BrowserSessionResult>> {
|
|
221
|
+
if (params.selector.length === 0 || params.selector.length > maxSelectorLength)
|
|
222
|
+
throw new Error("Browser selector must be between 1 and 512 characters");
|
|
223
|
+
const tab = await getTab(params.targetId);
|
|
224
|
+
const selector = JSON.stringify(params.selector);
|
|
225
|
+
const value = await evaluate(
|
|
226
|
+
tab,
|
|
227
|
+
`(() => { const element = document.querySelector(${selector}); if (!(element instanceof HTMLElement)) throw new Error('Element was not found'); element.click(); return true; })()`,
|
|
228
|
+
);
|
|
229
|
+
if (value !== true) throw new Error("Browser click did not complete");
|
|
230
|
+
latest = { targetId: tab.targetId, url: tab.url, title: tab.title, clicked: true };
|
|
231
|
+
return { content: [{ type: "text", text: `Clicked ${params.selector}` }], details: latest };
|
|
232
|
+
},
|
|
233
|
+
}),
|
|
234
|
+
);
|
|
235
|
+
const unregisterScreenshot = context.piTools.register(
|
|
236
|
+
defineTool({
|
|
237
|
+
name: "browser_screenshot",
|
|
238
|
+
label: "Browser screenshot",
|
|
239
|
+
description: "Capture the visible viewport of a connected browser tab as PNG.",
|
|
240
|
+
promptSnippet: "capture a screenshot of the connected browser tab",
|
|
241
|
+
parameters: Type.Object({ targetId: Type.String() }),
|
|
242
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<BrowserSessionResult>> {
|
|
243
|
+
const tab = await getTab(params.targetId);
|
|
244
|
+
const result = await cdp(tab, "Page.captureScreenshot", { format: "png" });
|
|
245
|
+
const data = typeof result.data === "string" ? result.data : "";
|
|
246
|
+
if (data === "") throw new Error("Chrome DevTools returned an empty screenshot");
|
|
247
|
+
latest = { targetId: tab.targetId, url: tab.url, title: tab.title, screenshot: { data, mimeType: "image/png" } };
|
|
248
|
+
return { content: [{ type: "image", data, mimeType: "image/png" }], details: latest };
|
|
249
|
+
},
|
|
250
|
+
}),
|
|
251
|
+
);
|
|
252
|
+
const disposePanel = context.piPluginUi.register({
|
|
253
|
+
id: "browser-session-panel",
|
|
254
|
+
pluginId: "@pi-harness/core/plugins/browser-session",
|
|
255
|
+
title: "Browser Session",
|
|
256
|
+
description: "通过 Chrome DevTools Protocol 连接已启动的本地浏览器。",
|
|
257
|
+
icon: "◉",
|
|
258
|
+
read: async () => {
|
|
259
|
+
try {
|
|
260
|
+
return {
|
|
261
|
+
endpoint: endpoint.toString(),
|
|
262
|
+
tabs: (await listTabs()).filter((tab) => tab.type === "page").map((tab) => ({ targetId: tab.targetId, title: tab.title, url: tab.url })),
|
|
263
|
+
latest: latest ?? null,
|
|
264
|
+
connected: true,
|
|
265
|
+
error: null,
|
|
266
|
+
};
|
|
267
|
+
} catch (error) {
|
|
268
|
+
return {
|
|
269
|
+
endpoint: endpoint.toString(),
|
|
270
|
+
tabs: [],
|
|
271
|
+
latest: latest ?? null,
|
|
272
|
+
connected: false,
|
|
273
|
+
error: error instanceof Error ? error.message : String(error),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
context.effect(() => () => {
|
|
279
|
+
unregisterTabs();
|
|
280
|
+
unregisterNavigate();
|
|
281
|
+
unregisterRead();
|
|
282
|
+
unregisterClick();
|
|
283
|
+
unregisterScreenshot();
|
|
284
|
+
disposePanel();
|
|
285
|
+
});
|
|
286
|
+
},
|
|
287
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
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 maxNodes = 100;
|
|
6
|
+
const maxEdges = 200;
|
|
7
|
+
const maxLabelLength = 256;
|
|
8
|
+
const nodeIdPattern = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
9
|
+
type Direction = "TD" | "LR" | "BT" | "RL";
|
|
10
|
+
type CanvasNode = { id: string; label: string };
|
|
11
|
+
type CanvasEdge = { from: string; to: string; label?: string };
|
|
12
|
+
type CanvasReport = { direction: Direction; nodes: CanvasNode[]; edges: CanvasEdge[]; nodeCount: number; edgeCount: number; mermaid: string };
|
|
13
|
+
|
|
14
|
+
function label(value: string, field: string): string {
|
|
15
|
+
const result = value.trim();
|
|
16
|
+
if (result.length === 0 || result.length > maxLabelLength) throw new Error(`${field} must contain 1-${maxLabelLength} characters`);
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function render(direction: Direction, nodes: CanvasNode[], edges: CanvasEdge[]): string {
|
|
21
|
+
const escape = (value: string): string => value.replace(/["\r\n]/g, (character) => (character === '"' ? """ : " "));
|
|
22
|
+
const lines = [`flowchart ${direction}`];
|
|
23
|
+
for (const node of nodes) lines.push(` ${node.id}["${escape(node.label)}"]`);
|
|
24
|
+
for (const edge of edges) lines.push(` ${edge.from} -->${edge.label === undefined ? "" : `|${escape(edge.label)}|`} ${edge.to}`);
|
|
25
|
+
return lines.join("\n");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: "pi-canvas-draw",
|
|
30
|
+
inject: ["piPluginUi", "piTools"],
|
|
31
|
+
apply(context: Context) {
|
|
32
|
+
let latest: CanvasReport | undefined;
|
|
33
|
+
const unregisterTool = context.piTools.register(
|
|
34
|
+
defineTool({
|
|
35
|
+
name: "canvas_draw",
|
|
36
|
+
label: "Draw canvas",
|
|
37
|
+
description: "Generate a validated Mermaid flowchart from structured nodes and edges without executing or writing files.",
|
|
38
|
+
promptSnippet: "draw a flowchart from these nodes and relationships",
|
|
39
|
+
parameters: Type.Object({
|
|
40
|
+
direction: Type.Optional(Type.Union([Type.Literal("TD"), Type.Literal("LR"), Type.Literal("BT"), Type.Literal("RL")])),
|
|
41
|
+
nodes: Type.Array(Type.Object({ id: Type.String(), label: Type.String() })),
|
|
42
|
+
edges: Type.Array(Type.Object({ from: Type.String(), to: Type.String(), label: Type.Optional(Type.String()) })),
|
|
43
|
+
}),
|
|
44
|
+
execute(_toolCallId, params): Promise<AgentToolResult<CanvasReport>> {
|
|
45
|
+
return Promise.resolve().then(() => {
|
|
46
|
+
const nodes = params.nodes.map((node) => ({ id: node.id.trim(), label: label(node.label, "Node label") }));
|
|
47
|
+
const edges = params.edges.map((edge) => ({
|
|
48
|
+
from: edge.from.trim(),
|
|
49
|
+
to: edge.to.trim(),
|
|
50
|
+
...(edge.label === undefined ? {} : { label: label(edge.label, "Edge label") }),
|
|
51
|
+
}));
|
|
52
|
+
if (nodes.length === 0 || nodes.length > maxNodes) throw new Error(`Canvas must contain 1-${maxNodes} nodes`);
|
|
53
|
+
if (edges.length > maxEdges) throw new Error(`Canvas must contain at most ${maxEdges} edges`);
|
|
54
|
+
const ids = new Set<string>();
|
|
55
|
+
for (const node of nodes) {
|
|
56
|
+
if (!nodeIdPattern.test(node.id)) throw new Error(`Invalid node id: ${node.id}`);
|
|
57
|
+
if (ids.has(node.id)) throw new Error(`Duplicate node id: ${node.id}`);
|
|
58
|
+
ids.add(node.id);
|
|
59
|
+
}
|
|
60
|
+
for (const edge of edges) {
|
|
61
|
+
if (!ids.has(edge.from) || !ids.has(edge.to)) throw new Error(`Canvas edge references an unknown node: ${edge.from} -> ${edge.to}`);
|
|
62
|
+
}
|
|
63
|
+
const report: CanvasReport = {
|
|
64
|
+
direction: params.direction ?? "TD",
|
|
65
|
+
nodes,
|
|
66
|
+
edges,
|
|
67
|
+
nodeCount: nodes.length,
|
|
68
|
+
edgeCount: edges.length,
|
|
69
|
+
mermaid: render(params.direction ?? "TD", nodes, edges),
|
|
70
|
+
};
|
|
71
|
+
latest = report;
|
|
72
|
+
return { content: [{ type: "text" as const, text: report.mermaid }], details: report };
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
const disposePanel = context.piPluginUi.register({
|
|
78
|
+
id: "canvas-draw-panel",
|
|
79
|
+
pluginId: "@pi-harness/core/plugins/canvas-draw",
|
|
80
|
+
title: "Canvas Draw",
|
|
81
|
+
description: "将结构化节点和边转换为可复制的 Mermaid 流程图源码。",
|
|
82
|
+
icon: "⌘",
|
|
83
|
+
read: () => ({ latest: latest ?? null, nodeCount: latest?.nodeCount ?? 0, edgeCount: latest?.edgeCount ?? 0 }),
|
|
84
|
+
});
|
|
85
|
+
context.effect(() => () => {
|
|
86
|
+
unregisterTool();
|
|
87
|
+
disposePanel();
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
3
|
+
import { defineTool, type AgentToolResult, type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
|
|
5
|
+
type GateStatus = "pass" | "warning" | "fail";
|
|
6
|
+
type GateReport = {
|
|
7
|
+
status: GateStatus;
|
|
8
|
+
script: string;
|
|
9
|
+
tests: { exitCode: number; durationMs: number };
|
|
10
|
+
review: { status: string; findings: number };
|
|
11
|
+
checkedAt: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function detailsOf(result: unknown): Record<string, unknown> {
|
|
15
|
+
if (result === null || typeof result !== "object") return {};
|
|
16
|
+
const details = (result as { details?: unknown }).details;
|
|
17
|
+
return details !== null && typeof details === "object" ? (details as Record<string, unknown>) : {};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function requiredTool(context: Context, name: string): ToolDefinition {
|
|
21
|
+
const tool = context.piTools.snapshot().customTools.find((candidate) => candidate.name === name);
|
|
22
|
+
if (tool === undefined) throw new Error(`Change Verifier requires the ${name} tool; enable its provider plugin before pi-runtime`);
|
|
23
|
+
return tool;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default {
|
|
27
|
+
name: "pi-change-verifier",
|
|
28
|
+
inject: ["piPluginUi", "piTools"],
|
|
29
|
+
apply(context: Context) {
|
|
30
|
+
let runs = 0;
|
|
31
|
+
let latest: GateReport | undefined;
|
|
32
|
+
const unregisterTool = context.piTools.register(
|
|
33
|
+
defineTool({
|
|
34
|
+
name: "verify_change_gate",
|
|
35
|
+
label: "Verify change gate",
|
|
36
|
+
description: "Combine the existing project test and Git review tools into one deterministic release gate.",
|
|
37
|
+
promptSnippet: "run the project test and review gate before declaring the change complete",
|
|
38
|
+
parameters: Type.Object({ script: Type.Optional(Type.String({ description: "Approved npm script handled by run_project_tests" })) }),
|
|
39
|
+
async execute(toolCallId, params, signal, _onUpdate, toolContext): Promise<AgentToolResult<GateReport>> {
|
|
40
|
+
const script = params.script?.trim() || "test";
|
|
41
|
+
const reviewTool = requiredTool(context, "review_changes");
|
|
42
|
+
const testTool = requiredTool(context, "run_project_tests");
|
|
43
|
+
const reviewResult = await reviewTool.execute(`${toolCallId}:review`, {}, signal, undefined, toolContext);
|
|
44
|
+
const testResult = await testTool.execute(`${toolCallId}:tests`, { script }, signal, undefined, toolContext);
|
|
45
|
+
const review = detailsOf(reviewResult);
|
|
46
|
+
const tests = detailsOf(testResult);
|
|
47
|
+
const exitCode = typeof tests.exitCode === "number" ? tests.exitCode : 1;
|
|
48
|
+
const reviewStatus = typeof review.status === "string" ? review.status : "error";
|
|
49
|
+
const findings = Array.isArray(review.findings) ? review.findings.length : 0;
|
|
50
|
+
const status: GateStatus = exitCode !== 0 || reviewStatus === "error" ? "fail" : reviewStatus === "warning" ? "warning" : "pass";
|
|
51
|
+
latest = {
|
|
52
|
+
status,
|
|
53
|
+
script,
|
|
54
|
+
tests: { exitCode, durationMs: typeof tests.durationMs === "number" ? tests.durationMs : 0 },
|
|
55
|
+
review: { status: reviewStatus, findings },
|
|
56
|
+
checkedAt: new Date().toISOString(),
|
|
57
|
+
};
|
|
58
|
+
runs += 1;
|
|
59
|
+
return {
|
|
60
|
+
content: [{ type: "text", text: `${status}: tests exit ${exitCode}; review ${reviewStatus} with ${findings} finding(s).` }],
|
|
61
|
+
details: latest,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
}),
|
|
65
|
+
);
|
|
66
|
+
const disposePanel = context.piPluginUi.register({
|
|
67
|
+
id: "change-verifier-panel",
|
|
68
|
+
pluginId: "@pi-harness/core/plugins/change-verifier",
|
|
69
|
+
title: "Change Verifier",
|
|
70
|
+
description: "复用真实测试和代码审查工具,形成统一发布门禁。",
|
|
71
|
+
icon: "✓",
|
|
72
|
+
read: () => ({ runs, latest: latest ?? null }),
|
|
73
|
+
});
|
|
74
|
+
context.effect(() => () => {
|
|
75
|
+
unregisterTool();
|
|
76
|
+
disposePanel();
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
};
|