@pi-harness/pi-harness 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/README.md +31 -7
- package/apps/web/dist/assets/index-BoEwZu6r.css +2 -0
- package/apps/web/dist/assets/index-alZn4u37.js +20 -0
- package/apps/web/dist/assets/markdown-vendor-DUdMWn0M.js +66 -0
- package/apps/web/dist/assets/react-vendor-BD7-wQo9.js +9 -0
- package/apps/web/dist/icons/app/android-192.png +0 -0
- package/apps/web/dist/icons/app/android-512.png +0 -0
- package/apps/web/dist/icons/app/app-blue-512.png +0 -0
- package/apps/web/dist/icons/app/app-store-1024.png +0 -0
- package/apps/web/dist/icons/app/apple-touch-icon-180.png +0 -0
- package/apps/web/dist/icons/app/maskable-512.png +0 -0
- package/apps/web/dist/icons/favicon/favicon-16.png +0 -0
- package/apps/web/dist/icons/favicon/favicon-32.png +0 -0
- package/apps/web/dist/icons/favicon/favicon-48.png +0 -0
- package/apps/web/dist/icons/png-blue/pi-256.png +0 -0
- package/apps/web/dist/icons/png-blue/pi-512.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-1024.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-128.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-16.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-24.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-256.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-32.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-48.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-512.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-64.png +0 -0
- package/apps/web/dist/icons/png-white/pi-1024.png +0 -0
- package/apps/web/dist/icons/png-white/pi-128.png +0 -0
- package/apps/web/dist/icons/png-white/pi-16.png +0 -0
- package/apps/web/dist/icons/png-white/pi-24.png +0 -0
- package/apps/web/dist/icons/png-white/pi-256.png +0 -0
- package/apps/web/dist/icons/png-white/pi-32.png +0 -0
- package/apps/web/dist/icons/png-white/pi-48.png +0 -0
- package/apps/web/dist/icons/png-white/pi-512.png +0 -0
- package/apps/web/dist/icons/png-white/pi-64.png +0 -0
- package/apps/web/dist/icons/social/og-1200x630.png +0 -0
- package/apps/web/dist/icons/svg/app-icon-blue.svg +13 -0
- package/apps/web/dist/icons/svg/app-icon-ink.svg +13 -0
- package/apps/web/dist/icons/svg/favicon.svg +10 -0
- package/apps/web/dist/icons/svg/lockup-horizontal.svg +13 -0
- package/apps/web/dist/icons/svg/mark-blue.svg +10 -0
- package/apps/web/dist/icons/svg/mark-compact.svg +10 -0
- package/apps/web/dist/icons/svg/mark-ink.svg +10 -0
- package/apps/web/dist/icons/svg/mark-white.svg +10 -0
- package/apps/web/dist/icons/svg/mark.svg +10 -0
- package/apps/web/dist/index.html +18 -6
- package/apps/web/dist/manifest.webmanifest +14 -0
- package/apps/web/index.html +14 -4
- package/apps/web/package.json +11 -9
- package/apps/web/profile/cordis.yml +222 -1
- package/apps/web/public/icons/app/android-192.png +0 -0
- package/apps/web/public/icons/app/android-512.png +0 -0
- package/apps/web/public/icons/app/app-blue-512.png +0 -0
- package/apps/web/public/icons/app/app-store-1024.png +0 -0
- package/apps/web/public/icons/app/apple-touch-icon-180.png +0 -0
- package/apps/web/public/icons/app/maskable-512.png +0 -0
- package/apps/web/public/icons/favicon/favicon-16.png +0 -0
- package/apps/web/public/icons/favicon/favicon-32.png +0 -0
- package/apps/web/public/icons/favicon/favicon-48.png +0 -0
- package/apps/web/public/icons/png-blue/pi-256.png +0 -0
- package/apps/web/public/icons/png-blue/pi-512.png +0 -0
- package/apps/web/public/icons/png-ink/pi-1024.png +0 -0
- package/apps/web/public/icons/png-ink/pi-128.png +0 -0
- package/apps/web/public/icons/png-ink/pi-16.png +0 -0
- package/apps/web/public/icons/png-ink/pi-24.png +0 -0
- package/apps/web/public/icons/png-ink/pi-256.png +0 -0
- package/apps/web/public/icons/png-ink/pi-32.png +0 -0
- package/apps/web/public/icons/png-ink/pi-48.png +0 -0
- package/apps/web/public/icons/png-ink/pi-512.png +0 -0
- package/apps/web/public/icons/png-ink/pi-64.png +0 -0
- package/apps/web/public/icons/png-white/pi-1024.png +0 -0
- package/apps/web/public/icons/png-white/pi-128.png +0 -0
- package/apps/web/public/icons/png-white/pi-16.png +0 -0
- package/apps/web/public/icons/png-white/pi-24.png +0 -0
- package/apps/web/public/icons/png-white/pi-256.png +0 -0
- package/apps/web/public/icons/png-white/pi-32.png +0 -0
- package/apps/web/public/icons/png-white/pi-48.png +0 -0
- package/apps/web/public/icons/png-white/pi-512.png +0 -0
- package/apps/web/public/icons/png-white/pi-64.png +0 -0
- package/apps/web/public/icons/social/og-1200x630.png +0 -0
- package/apps/web/public/icons/svg/app-icon-blue.svg +13 -0
- package/apps/web/public/icons/svg/app-icon-ink.svg +13 -0
- package/apps/web/public/icons/svg/favicon.svg +10 -0
- package/apps/web/public/icons/svg/lockup-horizontal.svg +13 -0
- package/apps/web/public/icons/svg/mark-blue.svg +10 -0
- package/apps/web/public/icons/svg/mark-compact.svg +10 -0
- package/apps/web/public/icons/svg/mark-ink.svg +10 -0
- package/apps/web/public/icons/svg/mark-white.svg +10 -0
- package/apps/web/public/icons/svg/mark.svg +10 -0
- package/apps/web/public/manifest.webmanifest +14 -0
- package/apps/web/server-dist/bin.js +19 -6
- package/apps/web/server-dist/bin.js.map +1 -1
- package/apps/web/src/command-palette.ts +28 -7
- package/apps/web/src/file-diff.ts +15 -10
- package/apps/web/src/main.ts +4 -1
- package/apps/web/src/runtime.css +17 -4
- package/apps/web/src/server/bin.ts +24 -7
- package/apps/web/src/style.css +2604 -8
- package/apps/web/src/tailwind.css +25 -0
- package/apps/web/tsconfig.build.json +5 -1
- package/apps/web/tsconfig.json +1 -1
- package/apps/web/vite.config.ts +20 -0
- package/package.json +29 -17
- package/packages/api-gateway/LICENSE +9 -0
- package/packages/api-gateway/dist/index.d.ts.map +1 -1
- package/packages/api-gateway/dist/index.js +1188 -42
- package/packages/api-gateway/dist/index.js.map +1 -1
- package/packages/api-gateway/dist/marketplace-entries/official/agent-teams.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/anchored-standard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/annotation.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/archify.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/at-file.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/auto-mode.json +25 -0
- package/packages/api-gateway/dist/marketplace-entries/official/better-sidebar.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/browser-fetch.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/browser-session.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/canvas-draw.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/change-verifier.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cleaner.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cli-notifier.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/code2skill.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/colleague-skill.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/context-doctor.json +22 -0
- package/packages/api-gateway/dist/marketplace-entries/official/context.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cordis-group.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cordis-logger-console.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cordis-timer.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cost-meter.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/dependency-checker.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/docker-sandbox.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/fail-logger.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/genui.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/git-time-capsule.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/graph-memory.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/history-compressor.json +25 -0
- package/packages/api-gateway/dist/marketplace-entries/official/hol-guard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/i18n-pair.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/image-compressor.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/llm-verifier.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mcp-client.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mcp-panel.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/memory.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mirage-bridge.json +19 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mock-server.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/modlens.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/module-search.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/obsidian-sync.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/openpets.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plan-execute.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-check.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-dev.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-finder.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-radar.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-stars.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/prompt-guard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/prompt-library.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/readme-gen.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/recall-unread.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/reverse-skill.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/reviewer-bot.json +22 -0
- package/packages/api-gateway/dist/marketplace-entries/official/runtime-doctor.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/secure-audit.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-bookmarks.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-bridge.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-compare.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-export.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-insights.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-search.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/skill-catalog.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/skill-guard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/sql-lens.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/synapse.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/tab-manager.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/taskboard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/telemetry-blocker.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/test-harness.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/theme-studio.json +19 -0
- package/packages/api-gateway/dist/marketplace-entries/official/token-guard.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/turn-rewind.json +22 -0
- package/packages/api-gateway/dist/marketplace-entries/official/undo-savepoint.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/vision-toolkit.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/web-research.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/workspace-navigator.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/workspace-search.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/yaml-validator.json +16 -0
- package/packages/api-gateway/dist/marketplace.d.ts +40 -2
- package/packages/api-gateway/dist/marketplace.d.ts.map +1 -1
- package/packages/api-gateway/dist/marketplace.js +225 -19
- package/packages/api-gateway/dist/marketplace.js.map +1 -1
- package/packages/api-gateway/dist/workspaces.d.ts +8 -0
- package/packages/api-gateway/dist/workspaces.d.ts.map +1 -0
- package/packages/api-gateway/dist/workspaces.js +14 -0
- package/packages/api-gateway/dist/workspaces.js.map +1 -0
- package/packages/api-gateway/package.json +20 -10
- package/packages/api-gateway/scripts/copy-marketplace-entries.mjs +13 -0
- package/packages/api-gateway/src/index.ts +1258 -61
- package/packages/api-gateway/src/marketplace-entries/official/agent-teams.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/anchored-standard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/annotation.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/archify.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/at-file.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/auto-mode.json +25 -0
- package/packages/api-gateway/src/marketplace-entries/official/better-sidebar.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/browser-fetch.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/browser-session.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/canvas-draw.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/change-verifier.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cleaner.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cli-notifier.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/code2skill.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/colleague-skill.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/context-doctor.json +22 -0
- package/packages/api-gateway/src/marketplace-entries/official/context.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cordis-group.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cordis-logger-console.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cordis-timer.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cost-meter.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/dependency-checker.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/docker-sandbox.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/fail-logger.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/genui.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/git-time-capsule.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/graph-memory.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/history-compressor.json +25 -0
- package/packages/api-gateway/src/marketplace-entries/official/hol-guard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/i18n-pair.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/image-compressor.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/llm-verifier.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/mcp-client.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/mcp-panel.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/memory.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/mirage-bridge.json +19 -0
- package/packages/api-gateway/src/marketplace-entries/official/mock-server.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/modlens.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/module-search.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/obsidian-sync.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/openpets.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plan-execute.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-check.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-dev.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-finder.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-radar.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-stars.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/prompt-guard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/prompt-library.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/readme-gen.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/recall-unread.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/reverse-skill.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/reviewer-bot.json +22 -0
- package/packages/api-gateway/src/marketplace-entries/official/runtime-doctor.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/secure-audit.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-bookmarks.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-bridge.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-compare.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-export.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-insights.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-search.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/skill-catalog.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/skill-guard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/sql-lens.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/synapse.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/tab-manager.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/taskboard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/telemetry-blocker.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/test-harness.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/theme-studio.json +19 -0
- package/packages/api-gateway/src/marketplace-entries/official/token-guard.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/turn-rewind.json +22 -0
- package/packages/api-gateway/src/marketplace-entries/official/undo-savepoint.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/vision-toolkit.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/web-research.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/workspace-navigator.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/workspace-search.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/yaml-validator.json +16 -0
- package/packages/api-gateway/src/marketplace.ts +267 -22
- package/packages/api-gateway/src/workspaces.ts +20 -0
- package/packages/api-gateway/test/index.test.ts +483 -33
- package/packages/api-gateway/test/marketplace.test.ts +282 -3
- package/packages/api-gateway/test/workspaces.test.ts +13 -0
- package/packages/api-gateway/tsconfig.build.json +1 -1
- package/packages/api-gateway/tsconfig.json +1 -1
- package/packages/bundle-web-app/LICENSE +9 -0
- package/packages/bundle-web-app/package.json +19 -9
- package/packages/bundle-web-app/tsconfig.build.json +1 -1
- package/packages/bundle-web-app/tsconfig.json +1 -1
- package/packages/cli/LICENSE +9 -0
- package/packages/cli/dist/args.d.ts.map +1 -1
- package/packages/cli/dist/args.js +16 -9
- package/packages/cli/dist/args.js.map +1 -1
- package/packages/cli/dist/bin.js +12 -3
- package/packages/cli/dist/bin.js.map +1 -1
- package/packages/cli/dist/main.d.ts +1 -0
- package/packages/cli/dist/main.d.ts.map +1 -1
- package/packages/cli/dist/main.js +49 -9
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/dist/node-stdio.d.ts +3 -1
- package/packages/cli/dist/node-stdio.d.ts.map +1 -1
- package/packages/cli/dist/node-stdio.js +91 -13
- package/packages/cli/dist/node-stdio.js.map +1 -1
- package/packages/cli/dist/relaunch.d.ts.map +1 -1
- package/packages/cli/dist/relaunch.js +23 -10
- package/packages/cli/dist/relaunch.js.map +1 -1
- package/packages/cli/package.json +18 -8
- package/packages/cli/src/args.ts +16 -10
- package/packages/cli/src/bin.ts +12 -3
- package/packages/cli/src/main.ts +54 -10
- package/packages/cli/src/node-stdio.ts +85 -13
- package/packages/cli/src/relaunch.ts +19 -6
- package/packages/cli/test/args.test.ts +22 -3
- package/packages/cli/test/binary.test.ts +58 -0
- package/packages/cli/test/broken-pipe.test.ts +32 -0
- package/packages/cli/test/cli.test.ts +57 -8
- package/packages/cli/test/node-stdio.test.ts +89 -0
- package/packages/cli/test/relaunch.test.ts +30 -2
- package/packages/cli/test/stdin-shutdown.test.ts +59 -0
- package/packages/cli/tsconfig.build.json +1 -3
- package/packages/cli/tsconfig.json +1 -4
- package/packages/client-web/LICENSE +9 -0
- package/packages/client-web/dist/annotation-ui.d.ts +11 -0
- package/packages/client-web/dist/annotation-ui.d.ts.map +1 -0
- package/packages/client-web/dist/annotation-ui.js +24 -0
- package/packages/client-web/dist/annotation-ui.js.map +1 -0
- package/packages/client-web/dist/browser-session-view.d.ts +7 -0
- package/packages/client-web/dist/browser-session-view.d.ts.map +1 -0
- package/packages/client-web/dist/browser-session-view.js +8 -0
- package/packages/client-web/dist/browser-session-view.js.map +1 -0
- package/packages/client-web/dist/control-room.d.ts +151 -6
- package/packages/client-web/dist/control-room.d.ts.map +1 -1
- package/packages/client-web/dist/control-room.js +156 -11
- package/packages/client-web/dist/control-room.js.map +1 -1
- package/packages/client-web/dist/design-contract.d.ts.map +1 -1
- package/packages/client-web/dist/design-contract.js +178 -19
- package/packages/client-web/dist/design-contract.js.map +1 -1
- package/packages/client-web/dist/index.d.ts +4 -1
- package/packages/client-web/dist/index.d.ts.map +1 -1
- package/packages/client-web/dist/index.js +11 -3
- package/packages/client-web/dist/index.js.map +1 -1
- package/packages/client-web/dist/markdown.d.ts +5 -0
- package/packages/client-web/dist/markdown.d.ts.map +1 -0
- package/packages/client-web/dist/markdown.js +20 -0
- package/packages/client-web/dist/markdown.js.map +1 -0
- package/packages/client-web/dist/marketplace-catalog.d.ts +3 -0
- package/packages/client-web/dist/marketplace-catalog.d.ts.map +1 -0
- package/packages/client-web/dist/marketplace-catalog.js +10 -0
- package/packages/client-web/dist/marketplace-catalog.js.map +1 -0
- package/packages/client-web/dist/marketplace-navigation.d.ts +19 -0
- package/packages/client-web/dist/marketplace-navigation.d.ts.map +1 -0
- package/packages/client-web/dist/marketplace-navigation.js +31 -0
- package/packages/client-web/dist/marketplace-navigation.js.map +1 -0
- package/packages/client-web/dist/message-content.d.ts +9 -0
- package/packages/client-web/dist/message-content.d.ts.map +1 -0
- package/packages/client-web/dist/message-content.js +54 -0
- package/packages/client-web/dist/message-content.js.map +1 -0
- package/packages/client-web/dist/plugin-navigation.d.ts +3 -0
- package/packages/client-web/dist/plugin-navigation.d.ts.map +1 -0
- package/packages/client-web/dist/plugin-navigation.js +10 -0
- package/packages/client-web/dist/plugin-navigation.js.map +1 -0
- package/packages/client-web/dist/plugin-search.d.ts +2 -0
- package/packages/client-web/dist/plugin-search.d.ts.map +1 -0
- package/packages/client-web/dist/plugin-search.js +7 -0
- package/packages/client-web/dist/plugin-search.js.map +1 -0
- package/packages/client-web/dist/plugin-stars-view.d.ts +12 -0
- package/packages/client-web/dist/plugin-stars-view.d.ts.map +1 -0
- package/packages/client-web/dist/plugin-stars-view.js +8 -0
- package/packages/client-web/dist/plugin-stars-view.js.map +1 -0
- package/packages/client-web/dist/prompt-completion.d.ts +13 -0
- package/packages/client-web/dist/prompt-completion.d.ts.map +1 -0
- package/packages/client-web/dist/prompt-completion.js +17 -0
- package/packages/client-web/dist/prompt-completion.js.map +1 -0
- package/packages/client-web/dist/react-room.d.ts +2 -1
- package/packages/client-web/dist/react-room.d.ts.map +1 -1
- package/packages/client-web/dist/react-room.js +2347 -93
- package/packages/client-web/dist/react-room.js.map +1 -1
- package/packages/client-web/dist/runtime-events.d.ts +4 -0
- package/packages/client-web/dist/runtime-events.d.ts.map +1 -0
- package/packages/client-web/dist/runtime-events.js +29 -0
- package/packages/client-web/dist/runtime-events.js.map +1 -0
- package/packages/client-web/package.json +19 -7
- package/packages/client-web/src/annotation-ui.ts +29 -0
- package/packages/client-web/src/browser-session-view.ts +13 -0
- package/packages/client-web/src/control-room.ts +359 -11
- package/packages/client-web/src/design-contract.ts +248 -26
- package/packages/client-web/src/index.ts +17 -4
- package/packages/client-web/src/markdown.tsx +22 -0
- package/packages/client-web/src/marketplace-catalog.ts +10 -0
- package/packages/client-web/src/marketplace-navigation.ts +46 -0
- package/packages/client-web/src/message-content.ts +51 -0
- package/packages/client-web/src/plugin-navigation.ts +9 -0
- package/packages/client-web/src/plugin-search.ts +5 -0
- package/packages/client-web/src/plugin-stars-view.ts +19 -0
- package/packages/client-web/src/prompt-completion.ts +24 -0
- package/packages/client-web/src/react-room.tsx +7358 -54
- package/packages/client-web/src/runtime-events.ts +29 -0
- package/packages/client-web/test/annotation-ui.test.ts +21 -0
- package/packages/client-web/test/browser-session-view.test.ts +17 -0
- package/packages/client-web/test/design-contract.test.ts +46 -1
- package/packages/client-web/test/marketplace-catalog.test.ts +52 -0
- package/packages/client-web/test/message-content.test.ts +43 -0
- package/packages/client-web/test/plugin-navigation.test.ts +16 -0
- package/packages/client-web/test/plugin-search.test.ts +22 -0
- package/packages/client-web/test/plugin-stars-view.test.ts +20 -0
- package/packages/client-web/test/prompt-completion.test.ts +21 -0
- package/packages/client-web/test/runtime-events.test.ts +28 -0
- package/packages/client-web/tsconfig.build.json +13 -1
- package/packages/client-web/tsconfig.json +11 -1
- package/packages/core/LICENSE +9 -0
- package/packages/core/dist/boot.d.ts.map +1 -1
- package/packages/core/dist/boot.js +42 -3
- package/packages/core/dist/boot.js.map +1 -1
- package/packages/core/dist/config.d.ts +2 -0
- package/packages/core/dist/config.d.ts.map +1 -0
- package/packages/core/dist/config.js +8 -0
- package/packages/core/dist/config.js.map +1 -0
- package/packages/core/dist/http.d.ts +8 -0
- package/packages/core/dist/http.d.ts.map +1 -0
- package/packages/core/dist/http.js +27 -0
- package/packages/core/dist/http.js.map +1 -0
- package/packages/core/dist/index.d.ts +2 -0
- package/packages/core/dist/index.d.ts.map +1 -1
- package/packages/core/dist/index.js +2 -0
- package/packages/core/dist/index.js.map +1 -1
- package/packages/core/dist/plugins/agent-teams.d.ts +17 -0
- package/packages/core/dist/plugins/agent-teams.d.ts.map +1 -0
- package/packages/core/dist/plugins/agent-teams.js +298 -0
- package/packages/core/dist/plugins/agent-teams.js.map +1 -0
- package/packages/core/dist/plugins/anchored-standard.d.ts +14 -0
- package/packages/core/dist/plugins/anchored-standard.d.ts.map +1 -0
- package/packages/core/dist/plugins/anchored-standard.js +84 -0
- package/packages/core/dist/plugins/anchored-standard.js.map +1 -0
- package/packages/core/dist/plugins/annotation.d.ts +18 -0
- package/packages/core/dist/plugins/annotation.d.ts.map +1 -0
- package/packages/core/dist/plugins/annotation.js +94 -0
- package/packages/core/dist/plugins/annotation.js.map +1 -0
- package/packages/core/dist/plugins/archify.d.ts +23 -0
- package/packages/core/dist/plugins/archify.d.ts.map +1 -0
- package/packages/core/dist/plugins/archify.js +98 -0
- package/packages/core/dist/plugins/archify.js.map +1 -0
- package/packages/core/dist/plugins/at-file.d.ts +8 -0
- package/packages/core/dist/plugins/at-file.d.ts.map +1 -0
- package/packages/core/dist/plugins/at-file.js +52 -0
- package/packages/core/dist/plugins/at-file.js.map +1 -0
- package/packages/core/dist/plugins/auto-mode.d.ts +15 -0
- package/packages/core/dist/plugins/auto-mode.d.ts.map +1 -0
- package/packages/core/dist/plugins/auto-mode.js +114 -0
- package/packages/core/dist/plugins/auto-mode.js.map +1 -0
- package/packages/core/dist/plugins/better-sidebar.d.ts +37 -0
- package/packages/core/dist/plugins/better-sidebar.d.ts.map +1 -0
- package/packages/core/dist/plugins/better-sidebar.js +89 -0
- package/packages/core/dist/plugins/better-sidebar.js.map +1 -0
- package/packages/core/dist/plugins/browser-fetch.d.ts +14 -0
- package/packages/core/dist/plugins/browser-fetch.d.ts.map +1 -0
- package/packages/core/dist/plugins/browser-fetch.js +167 -0
- package/packages/core/dist/plugins/browser-fetch.js.map +1 -0
- package/packages/core/dist/plugins/browser-session.d.ts +14 -0
- package/packages/core/dist/plugins/browser-session.d.ts.map +1 -0
- package/packages/core/dist/plugins/browser-session.js +265 -0
- package/packages/core/dist/plugins/browser-session.js.map +1 -0
- package/packages/core/dist/plugins/canvas-draw.d.ts +8 -0
- package/packages/core/dist/plugins/canvas-draw.d.ts.map +1 -0
- package/packages/core/dist/plugins/canvas-draw.js +88 -0
- package/packages/core/dist/plugins/canvas-draw.js.map +1 -0
- package/packages/core/dist/plugins/change-verifier.d.ts +8 -0
- package/packages/core/dist/plugins/change-verifier.d.ts.map +1 -0
- package/packages/core/dist/plugins/change-verifier.js +67 -0
- package/packages/core/dist/plugins/change-verifier.js.map +1 -0
- package/packages/core/dist/plugins/cleaner.d.ts +8 -0
- package/packages/core/dist/plugins/cleaner.d.ts.map +1 -0
- package/packages/core/dist/plugins/cleaner.js +56 -0
- package/packages/core/dist/plugins/cleaner.js.map +1 -0
- package/packages/core/dist/plugins/cli-notifier.d.ts +15 -0
- package/packages/core/dist/plugins/cli-notifier.d.ts.map +1 -0
- package/packages/core/dist/plugins/cli-notifier.js +110 -0
- package/packages/core/dist/plugins/cli-notifier.js.map +1 -0
- package/packages/core/dist/plugins/code2skill.d.ts +8 -0
- package/packages/core/dist/plugins/code2skill.d.ts.map +1 -0
- package/packages/core/dist/plugins/code2skill.js +95 -0
- package/packages/core/dist/plugins/code2skill.js.map +1 -0
- package/packages/core/dist/plugins/colleague-skill.d.ts +27 -0
- package/packages/core/dist/plugins/colleague-skill.d.ts.map +1 -0
- package/packages/core/dist/plugins/colleague-skill.js +99 -0
- package/packages/core/dist/plugins/colleague-skill.js.map +1 -0
- package/packages/core/dist/plugins/context-doctor.d.ts +30 -0
- package/packages/core/dist/plugins/context-doctor.d.ts.map +1 -0
- package/packages/core/dist/plugins/context-doctor.js +95 -0
- package/packages/core/dist/plugins/context-doctor.js.map +1 -0
- package/packages/core/dist/plugins/context.d.ts +8 -0
- package/packages/core/dist/plugins/context.d.ts.map +1 -0
- package/packages/core/dist/plugins/context.js +87 -0
- package/packages/core/dist/plugins/context.js.map +1 -0
- package/packages/core/dist/plugins/cost-meter.d.ts +32 -0
- package/packages/core/dist/plugins/cost-meter.d.ts.map +1 -0
- package/packages/core/dist/plugins/cost-meter.js +204 -0
- package/packages/core/dist/plugins/cost-meter.js.map +1 -0
- package/packages/core/dist/plugins/dependency-checker.d.ts +27 -0
- package/packages/core/dist/plugins/dependency-checker.d.ts.map +1 -0
- package/packages/core/dist/plugins/dependency-checker.js +221 -0
- package/packages/core/dist/plugins/dependency-checker.js.map +1 -0
- package/packages/core/dist/plugins/docker-sandbox.d.ts +8 -0
- package/packages/core/dist/plugins/docker-sandbox.d.ts.map +1 -0
- package/packages/core/dist/plugins/docker-sandbox.js +102 -0
- package/packages/core/dist/plugins/docker-sandbox.js.map +1 -0
- package/packages/core/dist/plugins/fail-logger.d.ts +8 -0
- package/packages/core/dist/plugins/fail-logger.d.ts.map +1 -0
- package/packages/core/dist/plugins/fail-logger.js +51 -0
- package/packages/core/dist/plugins/fail-logger.js.map +1 -0
- package/packages/core/dist/plugins/genui.d.ts +8 -0
- package/packages/core/dist/plugins/genui.d.ts.map +1 -0
- package/packages/core/dist/plugins/genui.js +79 -0
- package/packages/core/dist/plugins/genui.js.map +1 -0
- package/packages/core/dist/plugins/git-time-capsule.d.ts +9 -0
- package/packages/core/dist/plugins/git-time-capsule.d.ts.map +1 -0
- package/packages/core/dist/plugins/git-time-capsule.js +90 -0
- package/packages/core/dist/plugins/git-time-capsule.js.map +1 -0
- package/packages/core/dist/plugins/graph-memory.d.ts +16 -0
- package/packages/core/dist/plugins/graph-memory.d.ts.map +1 -0
- package/packages/core/dist/plugins/graph-memory.js +382 -0
- package/packages/core/dist/plugins/graph-memory.js.map +1 -0
- package/packages/core/dist/plugins/history-compressor.d.ts +15 -0
- package/packages/core/dist/plugins/history-compressor.d.ts.map +1 -0
- package/packages/core/dist/plugins/history-compressor.js +80 -0
- package/packages/core/dist/plugins/history-compressor.js.map +1 -0
- package/packages/core/dist/plugins/hol-guard.d.ts +29 -0
- package/packages/core/dist/plugins/hol-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/hol-guard.js +139 -0
- package/packages/core/dist/plugins/hol-guard.js.map +1 -0
- package/packages/core/dist/plugins/i18n-pair.d.ts +8 -0
- package/packages/core/dist/plugins/i18n-pair.d.ts.map +1 -0
- package/packages/core/dist/plugins/i18n-pair.js +76 -0
- package/packages/core/dist/plugins/i18n-pair.js.map +1 -0
- package/packages/core/dist/plugins/image-compressor.d.ts +8 -0
- package/packages/core/dist/plugins/image-compressor.d.ts.map +1 -0
- package/packages/core/dist/plugins/image-compressor.js +150 -0
- package/packages/core/dist/plugins/image-compressor.js.map +1 -0
- package/packages/core/dist/plugins/llm-verifier.d.ts +42 -0
- package/packages/core/dist/plugins/llm-verifier.d.ts.map +1 -0
- package/packages/core/dist/plugins/llm-verifier.js +128 -0
- package/packages/core/dist/plugins/llm-verifier.js.map +1 -0
- package/packages/core/dist/plugins/mcp-client.d.ts +19 -0
- package/packages/core/dist/plugins/mcp-client.d.ts.map +1 -0
- package/packages/core/dist/plugins/mcp-client.js +534 -0
- package/packages/core/dist/plugins/mcp-client.js.map +1 -0
- package/packages/core/dist/plugins/mcp-panel.d.ts +14 -0
- package/packages/core/dist/plugins/mcp-panel.d.ts.map +1 -0
- package/packages/core/dist/plugins/mcp-panel.js +180 -0
- package/packages/core/dist/plugins/mcp-panel.js.map +1 -0
- package/packages/core/dist/plugins/memory.d.ts +15 -0
- package/packages/core/dist/plugins/memory.d.ts.map +1 -0
- package/packages/core/dist/plugins/memory.js +161 -0
- package/packages/core/dist/plugins/memory.js.map +1 -0
- package/packages/core/dist/plugins/mirage-bridge.d.ts +23 -0
- package/packages/core/dist/plugins/mirage-bridge.d.ts.map +1 -0
- package/packages/core/dist/plugins/mirage-bridge.js +149 -0
- package/packages/core/dist/plugins/mirage-bridge.js.map +1 -0
- package/packages/core/dist/plugins/mock-server.d.ts +22 -0
- package/packages/core/dist/plugins/mock-server.d.ts.map +1 -0
- package/packages/core/dist/plugins/mock-server.js +149 -0
- package/packages/core/dist/plugins/mock-server.js.map +1 -0
- package/packages/core/dist/plugins/model.d.ts +1 -1
- package/packages/core/dist/plugins/model.d.ts.map +1 -1
- package/packages/core/dist/plugins/model.js +3 -1
- package/packages/core/dist/plugins/model.js.map +1 -1
- package/packages/core/dist/plugins/models.d.ts.map +1 -1
- package/packages/core/dist/plugins/models.js +5 -2
- package/packages/core/dist/plugins/models.js.map +1 -1
- package/packages/core/dist/plugins/modlens.d.ts +8 -0
- package/packages/core/dist/plugins/modlens.d.ts.map +1 -0
- package/packages/core/dist/plugins/modlens.js +63 -0
- package/packages/core/dist/plugins/modlens.js.map +1 -0
- package/packages/core/dist/plugins/module-search.d.ts +27 -0
- package/packages/core/dist/plugins/module-search.d.ts.map +1 -0
- package/packages/core/dist/plugins/module-search.js +174 -0
- package/packages/core/dist/plugins/module-search.js.map +1 -0
- package/packages/core/dist/plugins/obsidian-sync.d.ts +14 -0
- package/packages/core/dist/plugins/obsidian-sync.d.ts.map +1 -0
- package/packages/core/dist/plugins/obsidian-sync.js +79 -0
- package/packages/core/dist/plugins/obsidian-sync.js.map +1 -0
- package/packages/core/dist/plugins/openpets.d.ts +14 -0
- package/packages/core/dist/plugins/openpets.d.ts.map +1 -0
- package/packages/core/dist/plugins/openpets.js +99 -0
- package/packages/core/dist/plugins/openpets.js.map +1 -0
- package/packages/core/dist/plugins/plan-execute.d.ts +8 -0
- package/packages/core/dist/plugins/plan-execute.d.ts.map +1 -0
- package/packages/core/dist/plugins/plan-execute.js +70 -0
- package/packages/core/dist/plugins/plan-execute.js.map +1 -0
- package/packages/core/dist/plugins/plugin-check.d.ts +38 -0
- package/packages/core/dist/plugins/plugin-check.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-check.js +227 -0
- package/packages/core/dist/plugins/plugin-check.js.map +1 -0
- package/packages/core/dist/plugins/plugin-dev.d.ts +8 -0
- package/packages/core/dist/plugins/plugin-dev.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-dev.js +44 -0
- package/packages/core/dist/plugins/plugin-dev.js.map +1 -0
- package/packages/core/dist/plugins/plugin-finder.d.ts +16 -0
- package/packages/core/dist/plugins/plugin-finder.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-finder.js +98 -0
- package/packages/core/dist/plugins/plugin-finder.js.map +1 -0
- package/packages/core/dist/plugins/plugin-radar.d.ts +29 -0
- package/packages/core/dist/plugins/plugin-radar.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-radar.js +146 -0
- package/packages/core/dist/plugins/plugin-radar.js.map +1 -0
- package/packages/core/dist/plugins/plugin-stars.d.ts +45 -0
- package/packages/core/dist/plugins/plugin-stars.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-stars.js +165 -0
- package/packages/core/dist/plugins/plugin-stars.js.map +1 -0
- package/packages/core/dist/plugins/prompt-guard.d.ts +8 -0
- package/packages/core/dist/plugins/prompt-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/prompt-guard.js +114 -0
- package/packages/core/dist/plugins/prompt-guard.js.map +1 -0
- package/packages/core/dist/plugins/prompt-library.d.ts +25 -0
- package/packages/core/dist/plugins/prompt-library.d.ts.map +1 -0
- package/packages/core/dist/plugins/prompt-library.js +142 -0
- package/packages/core/dist/plugins/prompt-library.js.map +1 -0
- package/packages/core/dist/plugins/readme-gen.d.ts +25 -0
- package/packages/core/dist/plugins/readme-gen.d.ts.map +1 -0
- package/packages/core/dist/plugins/readme-gen.js +139 -0
- package/packages/core/dist/plugins/readme-gen.js.map +1 -0
- package/packages/core/dist/plugins/recall-unread.d.ts +24 -0
- package/packages/core/dist/plugins/recall-unread.d.ts.map +1 -0
- package/packages/core/dist/plugins/recall-unread.js +124 -0
- package/packages/core/dist/plugins/recall-unread.js.map +1 -0
- package/packages/core/dist/plugins/resources.d.ts +1 -0
- package/packages/core/dist/plugins/resources.d.ts.map +1 -1
- package/packages/core/dist/plugins/resources.js +31 -22
- package/packages/core/dist/plugins/resources.js.map +1 -1
- package/packages/core/dist/plugins/reverse-skill.d.ts +23 -0
- package/packages/core/dist/plugins/reverse-skill.d.ts.map +1 -0
- package/packages/core/dist/plugins/reverse-skill.js +60 -0
- package/packages/core/dist/plugins/reverse-skill.js.map +1 -0
- package/packages/core/dist/plugins/reviewer-bot.d.ts +14 -0
- package/packages/core/dist/plugins/reviewer-bot.d.ts.map +1 -0
- package/packages/core/dist/plugins/reviewer-bot.js +133 -0
- package/packages/core/dist/plugins/reviewer-bot.js.map +1 -0
- package/packages/core/dist/plugins/runtime-doctor.d.ts +33 -0
- package/packages/core/dist/plugins/runtime-doctor.d.ts.map +1 -0
- package/packages/core/dist/plugins/runtime-doctor.js +114 -0
- package/packages/core/dist/plugins/runtime-doctor.js.map +1 -0
- package/packages/core/dist/plugins/runtime.d.ts.map +1 -1
- package/packages/core/dist/plugins/runtime.js +63 -14
- package/packages/core/dist/plugins/runtime.js.map +1 -1
- package/packages/core/dist/plugins/secure-audit.d.ts +31 -0
- package/packages/core/dist/plugins/secure-audit.d.ts.map +1 -0
- package/packages/core/dist/plugins/secure-audit.js +121 -0
- package/packages/core/dist/plugins/secure-audit.js.map +1 -0
- package/packages/core/dist/plugins/session-bookmarks.d.ts +15 -0
- package/packages/core/dist/plugins/session-bookmarks.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-bookmarks.js +87 -0
- package/packages/core/dist/plugins/session-bookmarks.js.map +1 -0
- package/packages/core/dist/plugins/session-bridge.d.ts +44 -0
- package/packages/core/dist/plugins/session-bridge.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-bridge.js +265 -0
- package/packages/core/dist/plugins/session-bridge.js.map +1 -0
- package/packages/core/dist/plugins/session-compare.d.ts +33 -0
- package/packages/core/dist/plugins/session-compare.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-compare.js +150 -0
- package/packages/core/dist/plugins/session-compare.js.map +1 -0
- package/packages/core/dist/plugins/session-export.d.ts +9 -0
- package/packages/core/dist/plugins/session-export.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-export.js +93 -0
- package/packages/core/dist/plugins/session-export.js.map +1 -0
- package/packages/core/dist/plugins/session-insights.d.ts +8 -0
- package/packages/core/dist/plugins/session-insights.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-insights.js +47 -0
- package/packages/core/dist/plugins/session-insights.js.map +1 -0
- package/packages/core/dist/plugins/session-search.d.ts +20 -0
- package/packages/core/dist/plugins/session-search.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-search.js +122 -0
- package/packages/core/dist/plugins/session-search.js.map +1 -0
- package/packages/core/dist/plugins/session.d.ts.map +1 -1
- package/packages/core/dist/plugins/session.js +4 -2
- package/packages/core/dist/plugins/session.js.map +1 -1
- package/packages/core/dist/plugins/skill-catalog.d.ts +26 -0
- package/packages/core/dist/plugins/skill-catalog.d.ts.map +1 -0
- package/packages/core/dist/plugins/skill-catalog.js +97 -0
- package/packages/core/dist/plugins/skill-catalog.js.map +1 -0
- package/packages/core/dist/plugins/skill-guard.d.ts +26 -0
- package/packages/core/dist/plugins/skill-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/skill-guard.js +139 -0
- package/packages/core/dist/plugins/skill-guard.js.map +1 -0
- package/packages/core/dist/plugins/sql-lens.d.ts +8 -0
- package/packages/core/dist/plugins/sql-lens.d.ts.map +1 -0
- package/packages/core/dist/plugins/sql-lens.js +85 -0
- package/packages/core/dist/plugins/sql-lens.js.map +1 -0
- package/packages/core/dist/plugins/stdio.d.ts +1 -1
- package/packages/core/dist/plugins/stdio.d.ts.map +1 -1
- package/packages/core/dist/plugins/stdio.js +3 -1
- package/packages/core/dist/plugins/stdio.js.map +1 -1
- package/packages/core/dist/plugins/synapse.d.ts +38 -0
- package/packages/core/dist/plugins/synapse.d.ts.map +1 -0
- package/packages/core/dist/plugins/synapse.js +93 -0
- package/packages/core/dist/plugins/synapse.js.map +1 -0
- package/packages/core/dist/plugins/tab-manager.d.ts +8 -0
- package/packages/core/dist/plugins/tab-manager.d.ts.map +1 -0
- package/packages/core/dist/plugins/tab-manager.js +135 -0
- package/packages/core/dist/plugins/tab-manager.js.map +1 -0
- package/packages/core/dist/plugins/taskboard.d.ts +15 -0
- package/packages/core/dist/plugins/taskboard.d.ts.map +1 -0
- package/packages/core/dist/plugins/taskboard.js +347 -0
- package/packages/core/dist/plugins/taskboard.js.map +1 -0
- package/packages/core/dist/plugins/telemetry-blocker.d.ts +8 -0
- package/packages/core/dist/plugins/telemetry-blocker.d.ts.map +1 -0
- package/packages/core/dist/plugins/telemetry-blocker.js +57 -0
- package/packages/core/dist/plugins/telemetry-blocker.js.map +1 -0
- package/packages/core/dist/plugins/test-harness.d.ts +8 -0
- package/packages/core/dist/plugins/test-harness.d.ts.map +1 -0
- package/packages/core/dist/plugins/test-harness.js +64 -0
- package/packages/core/dist/plugins/test-harness.js.map +1 -0
- package/packages/core/dist/plugins/theme-studio.d.ts +29 -0
- package/packages/core/dist/plugins/theme-studio.d.ts.map +1 -0
- package/packages/core/dist/plugins/theme-studio.js +141 -0
- package/packages/core/dist/plugins/theme-studio.js.map +1 -0
- package/packages/core/dist/plugins/token-guard.d.ts +15 -0
- package/packages/core/dist/plugins/token-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/token-guard.js +78 -0
- package/packages/core/dist/plugins/token-guard.js.map +1 -0
- package/packages/core/dist/plugins/tools.d.ts.map +1 -1
- package/packages/core/dist/plugins/tools.js +5 -2
- package/packages/core/dist/plugins/tools.js.map +1 -1
- package/packages/core/dist/plugins/turn-rewind.d.ts +19 -0
- package/packages/core/dist/plugins/turn-rewind.d.ts.map +1 -0
- package/packages/core/dist/plugins/turn-rewind.js +74 -0
- package/packages/core/dist/plugins/turn-rewind.js.map +1 -0
- package/packages/core/dist/plugins/undo-savepoint.d.ts +17 -0
- package/packages/core/dist/plugins/undo-savepoint.d.ts.map +1 -0
- package/packages/core/dist/plugins/undo-savepoint.js +247 -0
- package/packages/core/dist/plugins/undo-savepoint.js.map +1 -0
- package/packages/core/dist/plugins/vision-toolkit.d.ts +17 -0
- package/packages/core/dist/plugins/vision-toolkit.d.ts.map +1 -0
- package/packages/core/dist/plugins/vision-toolkit.js +145 -0
- package/packages/core/dist/plugins/vision-toolkit.js.map +1 -0
- package/packages/core/dist/plugins/web-research.d.ts +17 -0
- package/packages/core/dist/plugins/web-research.d.ts.map +1 -0
- package/packages/core/dist/plugins/web-research.js +275 -0
- package/packages/core/dist/plugins/web-research.js.map +1 -0
- package/packages/core/dist/plugins/workspace-navigator.d.ts +36 -0
- package/packages/core/dist/plugins/workspace-navigator.d.ts.map +1 -0
- package/packages/core/dist/plugins/workspace-navigator.js +150 -0
- package/packages/core/dist/plugins/workspace-navigator.js.map +1 -0
- package/packages/core/dist/plugins/workspace-search.d.ts +8 -0
- package/packages/core/dist/plugins/workspace-search.d.ts.map +1 -0
- package/packages/core/dist/plugins/workspace-search.js +134 -0
- package/packages/core/dist/plugins/workspace-search.js.map +1 -0
- package/packages/core/dist/plugins/yaml-validator.d.ts +8 -0
- package/packages/core/dist/plugins/yaml-validator.d.ts.map +1 -0
- package/packages/core/dist/plugins/yaml-validator.js +94 -0
- package/packages/core/dist/plugins/yaml-validator.js.map +1 -0
- package/packages/core/dist/profile.d.ts +1 -0
- package/packages/core/dist/profile.d.ts.map +1 -1
- package/packages/core/dist/profile.js +3 -0
- package/packages/core/dist/profile.js.map +1 -1
- package/packages/core/dist/runtime.d.ts.map +1 -1
- package/packages/core/dist/runtime.js +13 -4
- package/packages/core/dist/runtime.js.map +1 -1
- package/packages/core/dist/services.d.ts +55 -0
- package/packages/core/dist/services.d.ts.map +1 -1
- package/packages/core/dist/services.js +58 -2
- package/packages/core/dist/services.js.map +1 -1
- package/packages/core/dist/stdio.d.ts +13 -2
- package/packages/core/dist/stdio.d.ts.map +1 -1
- package/packages/core/dist/stdio.js +75 -9
- package/packages/core/dist/stdio.js.map +1 -1
- package/packages/core/dist/workspace-path.d.ts +12 -0
- package/packages/core/dist/workspace-path.d.ts.map +1 -0
- package/packages/core/dist/workspace-path.js +62 -0
- package/packages/core/dist/workspace-path.js.map +1 -0
- package/packages/core/package.json +18 -8
- package/packages/core/profiles/default/cordis.yml +85 -0
- package/packages/core/profiles/development/cordis.yml +1 -1
- package/packages/core/src/boot.ts +38 -2
- package/packages/core/src/config.ts +5 -0
- package/packages/core/src/http.ts +32 -0
- package/packages/core/src/index.ts +2 -0
- package/packages/core/src/plugins/agent-teams.ts +291 -0
- package/packages/core/src/plugins/anchored-standard.ts +88 -0
- package/packages/core/src/plugins/annotation.ts +106 -0
- package/packages/core/src/plugins/archify.ts +124 -0
- package/packages/core/src/plugins/at-file.ts +54 -0
- package/packages/core/src/plugins/auto-mode.ts +123 -0
- package/packages/core/src/plugins/better-sidebar.ts +117 -0
- package/packages/core/src/plugins/browser-fetch.ts +171 -0
- package/packages/core/src/plugins/browser-session.ts +287 -0
- package/packages/core/src/plugins/canvas-draw.ts +90 -0
- package/packages/core/src/plugins/change-verifier.ts +79 -0
- package/packages/core/src/plugins/cleaner.ts +61 -0
- package/packages/core/src/plugins/cli-notifier.ts +125 -0
- package/packages/core/src/plugins/code2skill.ts +96 -0
- package/packages/core/src/plugins/colleague-skill.ts +122 -0
- package/packages/core/src/plugins/context-doctor.ts +117 -0
- package/packages/core/src/plugins/context.ts +102 -0
- package/packages/core/src/plugins/cost-meter.ts +231 -0
- package/packages/core/src/plugins/dependency-checker.ts +241 -0
- package/packages/core/src/plugins/docker-sandbox.ts +100 -0
- package/packages/core/src/plugins/fail-logger.ts +51 -0
- package/packages/core/src/plugins/genui.ts +88 -0
- package/packages/core/src/plugins/git-time-capsule.ts +97 -0
- package/packages/core/src/plugins/graph-memory.ts +394 -0
- package/packages/core/src/plugins/history-compressor.ts +81 -0
- package/packages/core/src/plugins/hol-guard.ts +153 -0
- package/packages/core/src/plugins/i18n-pair.ts +82 -0
- package/packages/core/src/plugins/image-compressor.ts +144 -0
- package/packages/core/src/plugins/llm-verifier.ts +164 -0
- package/packages/core/src/plugins/mcp-client.ts +559 -0
- package/packages/core/src/plugins/mcp-panel.ts +190 -0
- package/packages/core/src/plugins/memory.ts +176 -0
- package/packages/core/src/plugins/mirage-bridge.ts +179 -0
- package/packages/core/src/plugins/mock-server.ts +158 -0
- package/packages/core/src/plugins/model.ts +3 -1
- package/packages/core/src/plugins/models.ts +5 -2
- package/packages/core/src/plugins/modlens.ts +63 -0
- package/packages/core/src/plugins/module-search.ts +201 -0
- package/packages/core/src/plugins/obsidian-sync.ts +83 -0
- package/packages/core/src/plugins/openpets.ts +109 -0
- package/packages/core/src/plugins/plan-execute.ts +76 -0
- package/packages/core/src/plugins/plugin-check.ts +232 -0
- package/packages/core/src/plugins/plugin-dev.ts +47 -0
- package/packages/core/src/plugins/plugin-finder.ts +108 -0
- package/packages/core/src/plugins/plugin-radar.ts +179 -0
- package/packages/core/src/plugins/plugin-stars.ts +205 -0
- package/packages/core/src/plugins/prompt-guard.ts +122 -0
- package/packages/core/src/plugins/prompt-library.ts +165 -0
- package/packages/core/src/plugins/readme-gen.ts +147 -0
- package/packages/core/src/plugins/recall-unread.ts +142 -0
- package/packages/core/src/plugins/resources.ts +28 -21
- package/packages/core/src/plugins/reverse-skill.ts +79 -0
- package/packages/core/src/plugins/reviewer-bot.ts +146 -0
- package/packages/core/src/plugins/runtime-doctor.ts +137 -0
- package/packages/core/src/plugins/runtime.ts +61 -14
- package/packages/core/src/plugins/secure-audit.ts +146 -0
- package/packages/core/src/plugins/session-bookmarks.ts +89 -0
- package/packages/core/src/plugins/session-bridge.ts +299 -0
- package/packages/core/src/plugins/session-compare.ts +180 -0
- package/packages/core/src/plugins/session-export.ts +99 -0
- package/packages/core/src/plugins/session-insights.ts +47 -0
- package/packages/core/src/plugins/session-search.ts +126 -0
- package/packages/core/src/plugins/session.ts +4 -2
- package/packages/core/src/plugins/skill-catalog.ts +117 -0
- package/packages/core/src/plugins/skill-guard.ts +152 -0
- package/packages/core/src/plugins/sql-lens.ts +92 -0
- package/packages/core/src/plugins/stdio.ts +3 -1
- package/packages/core/src/plugins/synapse.ts +130 -0
- package/packages/core/src/plugins/tab-manager.ts +135 -0
- package/packages/core/src/plugins/taskboard.ts +412 -0
- package/packages/core/src/plugins/telemetry-blocker.ts +62 -0
- package/packages/core/src/plugins/test-harness.ts +67 -0
- package/packages/core/src/plugins/theme-studio.ts +165 -0
- package/packages/core/src/plugins/token-guard.ts +84 -0
- package/packages/core/src/plugins/tools.ts +5 -2
- package/packages/core/src/plugins/turn-rewind.ts +86 -0
- package/packages/core/src/plugins/undo-savepoint.ts +284 -0
- package/packages/core/src/plugins/vision-toolkit.ts +153 -0
- package/packages/core/src/plugins/web-research.ts +289 -0
- package/packages/core/src/plugins/workspace-navigator.ts +164 -0
- package/packages/core/src/plugins/workspace-search.ts +139 -0
- package/packages/core/src/plugins/yaml-validator.ts +97 -0
- package/packages/core/src/profile.ts +3 -0
- package/packages/core/src/runtime.ts +11 -4
- package/packages/core/src/services.ts +110 -3
- package/packages/core/src/stdio.ts +79 -9
- package/packages/core/src/workspace-path.ts +69 -0
- package/packages/core/test/agent-teams.test.ts +24 -0
- package/packages/core/test/archify.test.ts +33 -0
- package/packages/core/test/better-sidebar.test.ts +125 -0
- package/packages/core/test/boot.test.ts +49 -6
- package/packages/core/test/colleague-skill.test.ts +74 -0
- package/packages/core/test/config.test.ts +121 -0
- package/packages/core/test/context-doctor.test.ts +32 -0
- package/packages/core/test/dependency-checker.test.ts +60 -0
- package/packages/core/test/git-time-capsule.test.ts +115 -0
- package/packages/core/test/http.test.ts +34 -0
- package/packages/core/test/llm-verifier.test.ts +72 -0
- package/packages/core/test/mirage-bridge.test.ts +54 -0
- package/packages/core/test/module-search.test.ts +78 -0
- package/packages/core/test/plugin-check.test.ts +16 -0
- package/packages/core/test/plugin-stars.test.ts +55 -0
- package/packages/core/test/profiles.integration.test.ts +49 -15
- package/packages/core/test/prompt-library.test.ts +56 -0
- package/packages/core/test/readme-gen.test.ts +45 -0
- package/packages/core/test/recall-unread.test.ts +35 -0
- package/packages/core/test/registry.test.ts +48 -0
- package/packages/core/test/reverse-skill.test.ts +40 -0
- package/packages/core/test/runtime-doctor.test.ts +55 -0
- package/packages/core/test/runtime-fixture.ts +4 -4
- package/packages/core/test/runtime.test.ts +90 -1
- package/packages/core/test/secure-audit.test.ts +16 -0
- package/packages/core/test/services.test.ts +2024 -5
- package/packages/core/test/session-bookmarks.test.ts +62 -0
- package/packages/core/test/session-bridge.test.ts +103 -0
- package/packages/core/test/session-compare.test.ts +94 -0
- package/packages/core/test/session-export.test.ts +54 -0
- package/packages/core/test/session-search.test.ts +30 -0
- package/packages/core/test/skill-catalog.test.ts +18 -0
- package/packages/core/test/skill-guard.test.ts +21 -0
- package/packages/core/test/stdio-args.test.ts +178 -0
- package/packages/core/test/theme-studio.test.ts +39 -0
- package/packages/core/test/token-guard.test.ts +34 -0
- package/packages/core/test/turn-rewind.test.ts +19 -0
- package/packages/core/test/vision-toolkit.test.ts +38 -0
- package/packages/core/test/workspace-git-status.test.ts +37 -0
- package/packages/core/test/workspace-navigator.test.ts +33 -0
- package/packages/core/test/workspace-path.test.ts +34 -0
- package/packages/core/tsconfig.build.json +1 -3
- package/packages/core/tsconfig.json +1 -4
- package/packages/host-webserver/LICENSE +9 -0
- package/packages/host-webserver/dist/index.js +1 -1
- package/packages/host-webserver/dist/index.js.map +1 -1
- package/packages/host-webserver/package.json +17 -7
- package/packages/host-webserver/src/index.ts +1 -1
- package/packages/host-webserver/test/index.test.ts +4 -1
- package/packages/host-webserver/tsconfig.build.json +1 -1
- package/packages/host-webserver/tsconfig.json +1 -1
- package/apps/web/dist/assets/index-Bwqek8LF.js +0 -20
- package/apps/web/dist/assets/index-DCHSASjq.css +0 -1
- package/packages/api-gateway/dist/marketplace-registry.json +0 -62
- package/packages/api-gateway/src/marketplace-registry.json +0 -62
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { readdir, stat, unlink } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
5
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
|
|
7
|
+
const capsuleDirectory = "capsules";
|
|
8
|
+
type Capsule = { name: string; bytes: number };
|
|
9
|
+
|
|
10
|
+
async function listCapsules(directory: string): Promise<Capsule[]> {
|
|
11
|
+
const names = (await readdir(directory).catch(() => [] as string[]))
|
|
12
|
+
.filter((name) => name.endsWith(".patch"))
|
|
13
|
+
.sort()
|
|
14
|
+
.reverse();
|
|
15
|
+
return Promise.all(names.map(async (name) => ({ name, bytes: (await stat(join(directory, name))).size })));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: "pi-cleaner",
|
|
20
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
21
|
+
apply(context: Context) {
|
|
22
|
+
const directory = join(context.piHarnessLaunch.agentDir, capsuleDirectory);
|
|
23
|
+
let lastRemoved = 0;
|
|
24
|
+
const unregisterTool = context.piTools.register(
|
|
25
|
+
defineTool({
|
|
26
|
+
name: "clean_harness_artifacts",
|
|
27
|
+
label: "Clean harness artifacts",
|
|
28
|
+
description: "Remove only Pi Harness Git capsule patch files from the agent data directory. Confirmation is required.",
|
|
29
|
+
promptSnippet: "clean old Pi Harness rollback artifacts",
|
|
30
|
+
parameters: Type.Object({
|
|
31
|
+
confirm: Type.Boolean({ description: "Must be true to remove files" }),
|
|
32
|
+
keep: Type.Optional(Type.Number({ description: "Number of newest capsules to keep" })),
|
|
33
|
+
}),
|
|
34
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<{ removed: number; kept: number }>> {
|
|
35
|
+
if (params.confirm !== true) throw new Error("Cleaning requires confirm=true");
|
|
36
|
+
const keep = Math.max(0, Math.trunc(params.keep ?? 5));
|
|
37
|
+
const capsules = await listCapsules(directory);
|
|
38
|
+
const remove = capsules.slice(keep);
|
|
39
|
+
await Promise.all(remove.map((capsule) => unlink(join(directory, capsule.name))));
|
|
40
|
+
lastRemoved = remove.length;
|
|
41
|
+
return {
|
|
42
|
+
content: [{ type: "text", text: `Removed ${remove.length} Pi Harness capsule(s); kept ${capsules.length - remove.length}.` }],
|
|
43
|
+
details: { removed: remove.length, kept: capsules.length - remove.length },
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
const disposePanel = context.piPluginUi.register({
|
|
49
|
+
id: "cleaner-panel",
|
|
50
|
+
pluginId: "@pi-harness/core/plugins/cleaner",
|
|
51
|
+
title: "Harness Cleaner",
|
|
52
|
+
description: "清理 Pi Harness 自己生成的 Git 快照;默认不会触碰项目文件。",
|
|
53
|
+
icon: "⌫",
|
|
54
|
+
read: async () => ({ directory, capsules: await listCapsules(directory), lastRemoved }),
|
|
55
|
+
});
|
|
56
|
+
context.effect(() => () => {
|
|
57
|
+
unregisterTool();
|
|
58
|
+
disposePanel();
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
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 execFileAsync = promisify(execFile);
|
|
9
|
+
const maxMessageLength = 2048;
|
|
10
|
+
const maxNotifications = 20;
|
|
11
|
+
type Notification = { time: string; title: string; message: string; delivered: boolean; reason?: string };
|
|
12
|
+
type NotificationResult = { title: string; message: string; delivered: boolean; platform: NodeJS.Platform; reason?: string };
|
|
13
|
+
|
|
14
|
+
export interface CliNotifierPluginConfig {
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
title?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Config: z<CliNotifierPluginConfig> = z.object({ enabled: z.boolean().default(true), title: z.string().default("Pi Harness") });
|
|
20
|
+
|
|
21
|
+
function appleScriptString(value: string): string {
|
|
22
|
+
return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("\n", " ")}"`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function deliver(title: string, message: string): Promise<NotificationResult> {
|
|
26
|
+
const platform = process.platform;
|
|
27
|
+
if (platform === "darwin") {
|
|
28
|
+
await execFileAsync("osascript", ["-e", `display notification ${appleScriptString(message)} with title ${appleScriptString(title)}`]);
|
|
29
|
+
return { title, message, delivered: true, platform };
|
|
30
|
+
}
|
|
31
|
+
if (platform === "linux") {
|
|
32
|
+
await execFileAsync("notify-send", [title, message]);
|
|
33
|
+
return { title, message, delivered: true, platform };
|
|
34
|
+
}
|
|
35
|
+
if (platform === "win32") {
|
|
36
|
+
const script = `[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null; $xml = New-Object Windows.Data.Xml.Dom.XmlDocument; $xml.LoadXml('<toast><visual><binding template="ToastText02"><text id="1">${message.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">")}</text><text id="2">${title.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">")}</text></binding></visual></toast>'); [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Pi Harness').Show([Windows.UI.Notifications.ToastNotification]::new($xml))`;
|
|
37
|
+
await execFileAsync("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", script]);
|
|
38
|
+
return { title, message, delivered: true, platform };
|
|
39
|
+
}
|
|
40
|
+
return { title, message, delivered: false, platform, reason: "unsupported-platform" };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
name: "pi-cli-notifier",
|
|
45
|
+
inject: ["piPluginUi", "piTools"],
|
|
46
|
+
Config,
|
|
47
|
+
apply(context: Context, config: CliNotifierPluginConfig) {
|
|
48
|
+
const enabled = config.enabled !== false;
|
|
49
|
+
const defaultTitle = config.title?.trim() || "Pi Harness";
|
|
50
|
+
const notifications: Notification[] = [];
|
|
51
|
+
const notify = async (message: string, title = defaultTitle): Promise<NotificationResult> => {
|
|
52
|
+
if (message.length === 0 || message.length > maxMessageLength)
|
|
53
|
+
throw new Error(`Notification message must be between 1 and ${maxMessageLength} characters`);
|
|
54
|
+
if (title.length === 0 || title.length > 256) throw new Error("Notification title must be between 1 and 256 characters");
|
|
55
|
+
if (!enabled) {
|
|
56
|
+
const result: NotificationResult = { title, message, delivered: false, platform: process.platform, reason: "disabled" };
|
|
57
|
+
notifications.unshift({ time: new Date().toISOString(), ...result });
|
|
58
|
+
notifications.splice(maxNotifications);
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const result = await deliver(title, message);
|
|
63
|
+
notifications.unshift({ time: new Date().toISOString(), ...result });
|
|
64
|
+
notifications.splice(maxNotifications);
|
|
65
|
+
return result;
|
|
66
|
+
} catch (error) {
|
|
67
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
68
|
+
const result: NotificationResult = { title, message, delivered: false, platform: process.platform, reason };
|
|
69
|
+
notifications.unshift({ time: new Date().toISOString(), ...result });
|
|
70
|
+
notifications.splice(maxNotifications);
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const unregisterTool = context.piTools.register(
|
|
75
|
+
defineTool({
|
|
76
|
+
name: "cli_notify",
|
|
77
|
+
label: "CLI notify",
|
|
78
|
+
description: "Send a local desktop notification without invoking a shell.",
|
|
79
|
+
promptSnippet: "send a desktop notification when this task finishes",
|
|
80
|
+
parameters: Type.Object({
|
|
81
|
+
message: Type.String({ description: "Notification body" }),
|
|
82
|
+
title: Type.Optional(Type.String({ description: "Notification title" })),
|
|
83
|
+
}),
|
|
84
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<NotificationResult>> {
|
|
85
|
+
const result = await notify(params.message, params.title ?? defaultTitle);
|
|
86
|
+
return {
|
|
87
|
+
content: [
|
|
88
|
+
{ type: "text", text: result.delivered ? "Desktop notification sent." : `Desktop notification not sent: ${result.reason ?? "unknown reason"}` },
|
|
89
|
+
],
|
|
90
|
+
details: result,
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
const unsubscribeSession = context.on("pi/session-event", (event) => {
|
|
96
|
+
const current = event as {
|
|
97
|
+
type?: string;
|
|
98
|
+
messages?: readonly { role?: string; stopReason?: string; errorMessage?: string }[];
|
|
99
|
+
errorMessage?: string;
|
|
100
|
+
};
|
|
101
|
+
if (current.type === "agent_end") {
|
|
102
|
+
const last = current.messages?.at(-1);
|
|
103
|
+
if (last?.role === "assistant") {
|
|
104
|
+
const message = last.stopReason === "error" ? `Agent failed: ${last.errorMessage ?? "unknown error"}` : "Agent turn completed.";
|
|
105
|
+
void notify(message);
|
|
106
|
+
}
|
|
107
|
+
} else if (current.type === "compaction_end" && current.errorMessage) {
|
|
108
|
+
void notify(`Context compaction failed: ${current.errorMessage}`);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const disposePanel = context.piPluginUi.register({
|
|
112
|
+
id: "cli-notifier-panel",
|
|
113
|
+
pluginId: "@pi-harness/core/plugins/cli-notifier",
|
|
114
|
+
title: "CLI Notifier",
|
|
115
|
+
description: "长任务完成后发送本机桌面通知。",
|
|
116
|
+
icon: "♢",
|
|
117
|
+
read: () => ({ enabled, platform: process.platform, notifications: [...notifications] }),
|
|
118
|
+
});
|
|
119
|
+
context.effect(() => () => {
|
|
120
|
+
unregisterTool();
|
|
121
|
+
unsubscribeSession();
|
|
122
|
+
disposePanel();
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
3
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
5
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
|
|
7
|
+
const maxFiles = 32;
|
|
8
|
+
const maxFileBytes = 256 * 1024;
|
|
9
|
+
const maxTotalBytes = 2 * 1024 * 1024;
|
|
10
|
+
|
|
11
|
+
type SkillFile = { path: string; bytes: number };
|
|
12
|
+
type SkillReport = { slug: string; directory: string; files: SkillFile[]; bytes: number };
|
|
13
|
+
|
|
14
|
+
function slugify(name: string): string {
|
|
15
|
+
const slug = name
|
|
16
|
+
.trim()
|
|
17
|
+
.toLowerCase()
|
|
18
|
+
.replace(/[^a-z0-9]+/gu, "-")
|
|
19
|
+
.replace(/^-+|-+$/gu, "")
|
|
20
|
+
.slice(0, 64);
|
|
21
|
+
if (slug.length === 0) throw new Error("Skill name must contain at least one letter or number");
|
|
22
|
+
return slug;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function resolveWorkspaceFile(cwd: string, input: string): { absolute: string; display: string } {
|
|
26
|
+
if (typeof input !== "string" || input.trim() === "" || isAbsolute(input)) throw new Error("Skill files must be non-empty relative paths");
|
|
27
|
+
const absolute = resolve(cwd, input);
|
|
28
|
+
const display = relative(cwd, absolute);
|
|
29
|
+
if (display === "" || display.startsWith("..") || isAbsolute(display)) throw new Error(`Skill file must stay inside the workspace: ${input}`);
|
|
30
|
+
return { absolute, display };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function createSkill(context: Context, params: { name: string; description: string; files: string[] }): Promise<SkillReport> {
|
|
34
|
+
if (!Array.isArray(params.files) || params.files.length === 0) throw new Error("At least one source file is required");
|
|
35
|
+
if (params.files.length > maxFiles) throw new Error(`A skill can include at most ${maxFiles} files`);
|
|
36
|
+
const cwd = context.piHarnessLaunch.cwd;
|
|
37
|
+
const slug = slugify(params.name);
|
|
38
|
+
const sources = params.files.map((file) => resolveWorkspaceFile(cwd, file));
|
|
39
|
+
const unique = new Set(sources.map((source) => source.display));
|
|
40
|
+
if (unique.size !== sources.length) throw new Error("Skill files must be unique");
|
|
41
|
+
let bytes = 0;
|
|
42
|
+
const files: SkillFile[] = [];
|
|
43
|
+
const output = join(cwd, ".pi", "skills", slug);
|
|
44
|
+
for (const source of sources) {
|
|
45
|
+
const content = await readFile(source.absolute);
|
|
46
|
+
if (content.byteLength > maxFileBytes) throw new Error(`Skill file exceeds ${maxFileBytes} bytes: ${source.display}`);
|
|
47
|
+
bytes += content.byteLength;
|
|
48
|
+
if (bytes > maxTotalBytes) throw new Error(`Skill sources exceed ${maxTotalBytes} bytes`);
|
|
49
|
+
const target = join(output, "references", source.display);
|
|
50
|
+
await mkdir(resolve(target, ".."), { recursive: true });
|
|
51
|
+
await writeFile(target, content);
|
|
52
|
+
files.push({ path: source.display, bytes: content.byteLength });
|
|
53
|
+
}
|
|
54
|
+
const description = params.description.trim();
|
|
55
|
+
if (description.length === 0) throw new Error("Skill description must not be empty");
|
|
56
|
+
const references = files.map((file) => `- [${file.path}](references/${file.path})`).join("\n");
|
|
57
|
+
const markdown = `---\nname: ${slug}\ndescription: ${description.replaceAll("\n", " ")}\n---\n\n# ${params.name.trim()}\n\n${description}\n\n## Reference files\n\n${references}\n`;
|
|
58
|
+
await mkdir(output, { recursive: true });
|
|
59
|
+
await writeFile(join(output, "SKILL.md"), markdown, "utf8");
|
|
60
|
+
return { slug, directory: output, files, bytes };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
name: "pi-code2skill",
|
|
65
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
66
|
+
apply(context: Context) {
|
|
67
|
+
let generated = 0;
|
|
68
|
+
let latest: SkillReport | undefined;
|
|
69
|
+
const unregisterTool = context.piTools.register(
|
|
70
|
+
defineTool({
|
|
71
|
+
name: "skill_pack_create",
|
|
72
|
+
label: "Create skill pack",
|
|
73
|
+
description: "Package selected workspace source files into a local .pi/skills skill with a manifest and references.",
|
|
74
|
+
promptSnippet: "turn selected project files into a reusable skill pack",
|
|
75
|
+
parameters: Type.Object({ name: Type.String(), description: Type.String(), files: Type.Array(Type.String()) }),
|
|
76
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<SkillReport>> {
|
|
77
|
+
latest = await createSkill(context, params);
|
|
78
|
+
generated += 1;
|
|
79
|
+
return { content: [{ type: "text", text: `Skill pack created: ${latest.slug} (${latest.files.length} file(s)).` }], details: latest };
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
const disposePanel = context.piPluginUi.register({
|
|
84
|
+
id: "code2skill-panel",
|
|
85
|
+
pluginId: "@pi-harness/core/plugins/code2skill",
|
|
86
|
+
title: "Code2Skill",
|
|
87
|
+
description: "把工作区代码打包为可复用的 Pi Skill,保留来源文件并生成 SKILL.md。",
|
|
88
|
+
icon: "✦",
|
|
89
|
+
read: () => ({ generated, latest: latest ?? null }),
|
|
90
|
+
});
|
|
91
|
+
context.effect(() => () => {
|
|
92
|
+
unregisterTool();
|
|
93
|
+
disposePanel();
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
};
|
|
@@ -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 customType = "pi-harness/colleague-handoff";
|
|
6
|
+
const maxTextLength = 4_000;
|
|
7
|
+
const maxListItems = 20;
|
|
8
|
+
|
|
9
|
+
export interface ColleagueHandoffInput {
|
|
10
|
+
toRole: string;
|
|
11
|
+
objective: string;
|
|
12
|
+
context?: string;
|
|
13
|
+
constraints?: string[];
|
|
14
|
+
files?: string[];
|
|
15
|
+
acceptance?: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ColleagueHandoff {
|
|
19
|
+
id: string;
|
|
20
|
+
toRole: string;
|
|
21
|
+
objective: string;
|
|
22
|
+
context: string;
|
|
23
|
+
constraints: string[];
|
|
24
|
+
files: string[];
|
|
25
|
+
acceptance: string[];
|
|
26
|
+
createdAt: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function boundedText(value: string | undefined, field: string): string {
|
|
30
|
+
const text = value?.trim() ?? "";
|
|
31
|
+
if (text.length > maxTextLength) throw new Error(`${field} must be ${maxTextLength} characters or fewer`);
|
|
32
|
+
return text;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function boundedList(values: string[] | undefined, field: string): string[] {
|
|
36
|
+
const list = values ?? [];
|
|
37
|
+
if (list.length > maxListItems) throw new Error(`${field} must contain ${maxListItems} items or fewer`);
|
|
38
|
+
return list.map((value) => boundedText(value, `${field} item`)).filter(Boolean);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function createColleagueHandoff(input: ColleagueHandoffInput, id: string, createdAt: string): ColleagueHandoff {
|
|
42
|
+
const toRole = boundedText(input.toRole, "toRole");
|
|
43
|
+
const objective = boundedText(input.objective, "objective");
|
|
44
|
+
if (!toRole) throw new Error("toRole is required");
|
|
45
|
+
if (!objective) throw new Error("objective is required");
|
|
46
|
+
return {
|
|
47
|
+
id,
|
|
48
|
+
toRole,
|
|
49
|
+
objective,
|
|
50
|
+
context: boundedText(input.context, "context"),
|
|
51
|
+
constraints: boundedList(input.constraints, "constraints"),
|
|
52
|
+
files: boundedList(input.files, "files"),
|
|
53
|
+
acceptance: boundedList(input.acceptance, "acceptance"),
|
|
54
|
+
createdAt,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function readLatest(context: Context): ColleagueHandoff | undefined {
|
|
59
|
+
const entries = context.piSession.manager.getEntries();
|
|
60
|
+
const entry = [...entries].reverse().find((item) => item.type === "custom" && item.customType === customType);
|
|
61
|
+
if (entry?.type !== "custom" || entry.data === undefined || entry.data === null || typeof entry.data !== "object") return undefined;
|
|
62
|
+
const value = entry.data as Partial<ColleagueHandoff>;
|
|
63
|
+
if (typeof value.id !== "string" || typeof value.toRole !== "string" || typeof value.objective !== "string" || typeof value.createdAt !== "string")
|
|
64
|
+
return undefined;
|
|
65
|
+
return {
|
|
66
|
+
id: value.id,
|
|
67
|
+
toRole: value.toRole,
|
|
68
|
+
objective: value.objective,
|
|
69
|
+
context: typeof value.context === "string" ? value.context : "",
|
|
70
|
+
constraints: Array.isArray(value.constraints) ? value.constraints.filter((item): item is string => typeof item === "string") : [],
|
|
71
|
+
files: Array.isArray(value.files) ? value.files.filter((item): item is string => typeof item === "string") : [],
|
|
72
|
+
acceptance: Array.isArray(value.acceptance) ? value.acceptance.filter((item): item is string => typeof item === "string") : [],
|
|
73
|
+
createdAt: value.createdAt,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default {
|
|
78
|
+
name: "pi-colleague-skill",
|
|
79
|
+
inject: ["piSession", "piPluginUi", "piTools"],
|
|
80
|
+
apply(context: Context) {
|
|
81
|
+
let latest = readLatest(context);
|
|
82
|
+
const unregister = context.piTools.register(
|
|
83
|
+
defineTool({
|
|
84
|
+
name: "colleague_handoff",
|
|
85
|
+
label: "Colleague handoff",
|
|
86
|
+
description: "Create a durable, structured handoff packet for another role without starting a hidden agent or sending external messages.",
|
|
87
|
+
promptSnippet: "prepare a structured handoff for a colleague role",
|
|
88
|
+
parameters: Type.Object({
|
|
89
|
+
toRole: Type.String({ description: "Receiving role, for example reviewer or frontend" }),
|
|
90
|
+
objective: Type.String({ description: "The concrete outcome the colleague should deliver" }),
|
|
91
|
+
context: Type.Optional(Type.String()),
|
|
92
|
+
constraints: Type.Optional(Type.Array(Type.String())),
|
|
93
|
+
files: Type.Optional(Type.Array(Type.String())),
|
|
94
|
+
acceptance: Type.Optional(Type.Array(Type.String())),
|
|
95
|
+
}),
|
|
96
|
+
execute(_toolCallId, params): Promise<AgentToolResult<ColleagueHandoff>> {
|
|
97
|
+
return Promise.resolve().then(() => {
|
|
98
|
+
const handoff = createColleagueHandoff(params, `handoff-${Date.now()}`, new Date().toISOString());
|
|
99
|
+
context.piSession.manager.appendCustomEntry(customType, handoff);
|
|
100
|
+
latest = handoff;
|
|
101
|
+
return {
|
|
102
|
+
content: [{ type: "text" as const, text: `Handoff ${handoff.id} prepared for ${handoff.toRole}.` }],
|
|
103
|
+
details: handoff,
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
);
|
|
109
|
+
const disposePanel = context.piPluginUi.register({
|
|
110
|
+
id: "colleague-skill-panel",
|
|
111
|
+
pluginId: "@pi-harness/core/plugins/colleague-skill",
|
|
112
|
+
title: "Colleague Skill",
|
|
113
|
+
description: "把任务、上下文、约束和验收条件整理成可追踪的角色交接包。",
|
|
114
|
+
icon: "⇄",
|
|
115
|
+
read: () => ({ latest: latest ?? null }),
|
|
116
|
+
});
|
|
117
|
+
context.effect(() => () => {
|
|
118
|
+
unregister();
|
|
119
|
+
disposePanel();
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
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 ContextDoctorReport = {
|
|
7
|
+
status: "ok" | "warning";
|
|
8
|
+
usagePercent: number | null;
|
|
9
|
+
tokens: number | null;
|
|
10
|
+
contextWindow: number | null;
|
|
11
|
+
messageCount: number;
|
|
12
|
+
oversizedMessages: number;
|
|
13
|
+
toolErrors: number;
|
|
14
|
+
recommendations: string[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export interface ContextDoctorPluginConfig {
|
|
18
|
+
warnPercent?: number;
|
|
19
|
+
maxMessageBytes?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Config: z<ContextDoctorPluginConfig> = z.object({ warnPercent: z.number().default(75), maxMessageBytes: z.number().default(64 * 1024) });
|
|
23
|
+
|
|
24
|
+
function byteLength(value: unknown): number {
|
|
25
|
+
try {
|
|
26
|
+
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
27
|
+
} catch {
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function inspectMessages(
|
|
33
|
+
messages: readonly unknown[],
|
|
34
|
+
usage: { percent?: number | null; tokens?: number | null; contextWindow?: number | null } | undefined,
|
|
35
|
+
warnPercent: number,
|
|
36
|
+
maxMessageBytes: number,
|
|
37
|
+
): ContextDoctorReport {
|
|
38
|
+
const oversizedMessages = messages.filter((message) => byteLength(message) > maxMessageBytes).length;
|
|
39
|
+
const toolErrors = messages.filter(
|
|
40
|
+
(message) =>
|
|
41
|
+
typeof message === "object" &&
|
|
42
|
+
message !== null &&
|
|
43
|
+
(message as Record<string, unknown>).role === "toolResult" &&
|
|
44
|
+
(message as Record<string, unknown>).isError === true,
|
|
45
|
+
).length;
|
|
46
|
+
const usagePercent = typeof usage?.percent === "number" ? usage.percent : null;
|
|
47
|
+
const recommendations: string[] = [];
|
|
48
|
+
if (usagePercent !== null && usagePercent >= warnPercent) recommendations.push("压缩较早的会话历史,释放上下文空间。");
|
|
49
|
+
if (oversizedMessages > 0) recommendations.push(`检查 ${oversizedMessages} 条超大消息,优先引用摘要或文件路径。`);
|
|
50
|
+
if (toolErrors > 0) recommendations.push(`处理 ${toolErrors} 个工具错误后再继续长任务。`);
|
|
51
|
+
return {
|
|
52
|
+
status: recommendations.length === 0 ? "ok" : "warning",
|
|
53
|
+
usagePercent,
|
|
54
|
+
tokens: typeof usage?.tokens === "number" ? usage.tokens : null,
|
|
55
|
+
contextWindow: typeof usage?.contextWindow === "number" ? usage.contextWindow : null,
|
|
56
|
+
messageCount: messages.length,
|
|
57
|
+
oversizedMessages,
|
|
58
|
+
toolErrors,
|
|
59
|
+
recommendations,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
name: "pi-context-doctor",
|
|
65
|
+
inject: ["piPluginUi", "piTools"],
|
|
66
|
+
Config,
|
|
67
|
+
apply(context: Context, config: ContextDoctorPluginConfig) {
|
|
68
|
+
const warnPercent = Math.max(1, Math.min(100, config.warnPercent ?? 75));
|
|
69
|
+
const maxMessageBytes = Math.max(1024, Math.min(1024 * 1024, Math.trunc(config.maxMessageBytes ?? 64 * 1024)));
|
|
70
|
+
const runtime = () => context.get("piRuntime");
|
|
71
|
+
const report = (): ContextDoctorReport => {
|
|
72
|
+
const service = runtime();
|
|
73
|
+
if (service === undefined) return inspectMessages([], undefined, warnPercent, maxMessageBytes);
|
|
74
|
+
return inspectMessages(service.session.messages, service.session.getContextUsage(), warnPercent, maxMessageBytes);
|
|
75
|
+
};
|
|
76
|
+
const unregisterTool = context.piTools.register(
|
|
77
|
+
defineTool({
|
|
78
|
+
name: "context_doctor",
|
|
79
|
+
label: "Context doctor",
|
|
80
|
+
description: "Audit context pressure, oversized messages, and tool errors; optionally compact after confirmation.",
|
|
81
|
+
promptSnippet: "audit context pressure and recommend safe cleanup",
|
|
82
|
+
parameters: Type.Object({
|
|
83
|
+
compact: Type.Optional(Type.Boolean({ description: "Compact the session after the audit" })),
|
|
84
|
+
confirm: Type.Optional(Type.Boolean({ description: "Must be true when compact is requested" })),
|
|
85
|
+
}),
|
|
86
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<ContextDoctorReport & { compacted: boolean }>> {
|
|
87
|
+
if (params.compact === true && params.confirm !== true) throw new Error("Context compaction requires confirm=true");
|
|
88
|
+
const service = runtime();
|
|
89
|
+
if (service === undefined) throw new Error("Pi runtime is not ready");
|
|
90
|
+
if (params.compact === true) await service.session.compact();
|
|
91
|
+
const details = { ...report(), compacted: params.compact === true };
|
|
92
|
+
return {
|
|
93
|
+
content: [
|
|
94
|
+
{
|
|
95
|
+
type: "text",
|
|
96
|
+
text: `${details.status}: ${details.messageCount} messages, ${details.oversizedMessages} oversized, ${details.toolErrors} tool errors.`,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
details,
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
}),
|
|
103
|
+
);
|
|
104
|
+
const disposePanel = context.piPluginUi.register({
|
|
105
|
+
id: "context-doctor-panel",
|
|
106
|
+
pluginId: "@pi-harness/core/plugins/context-doctor",
|
|
107
|
+
title: "Context Doctor",
|
|
108
|
+
description: "审计上下文压力、超大消息和工具错误,并给出压缩建议。",
|
|
109
|
+
icon: "⌁",
|
|
110
|
+
read: report,
|
|
111
|
+
});
|
|
112
|
+
context.effect(() => () => {
|
|
113
|
+
unregisterTool();
|
|
114
|
+
disposePanel();
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { AgentSessionEvent } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
4
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
|
|
6
|
+
type RuntimeEvent = AgentSessionEvent & { readonly type?: string };
|
|
7
|
+
type MessageRole = "user" | "assistant" | "toolResult" | "system" | "other";
|
|
8
|
+
type ContextComposition = Record<MessageRole, number>;
|
|
9
|
+
type ContextInsightReport = {
|
|
10
|
+
tokens: number | null;
|
|
11
|
+
contextWindow: number | null;
|
|
12
|
+
percent: number | null;
|
|
13
|
+
messages: number;
|
|
14
|
+
events: number;
|
|
15
|
+
compactions: number;
|
|
16
|
+
composition: ContextComposition;
|
|
17
|
+
eventTypes: Record<string, number>;
|
|
18
|
+
recentEvents: { type: string; at: number }[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function messageRole(message: unknown): MessageRole {
|
|
22
|
+
if (typeof message !== "object" || message === null) return "other";
|
|
23
|
+
const role = (message as { role?: unknown }).role;
|
|
24
|
+
if (role === "user" || role === "assistant" || role === "toolResult" || role === "system") return role;
|
|
25
|
+
return "other";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: "pi-context",
|
|
30
|
+
inject: ["piPluginUi", "piTools"],
|
|
31
|
+
apply(context: Context) {
|
|
32
|
+
let eventCount = 0;
|
|
33
|
+
let compactionCount = 0;
|
|
34
|
+
const eventTypes = new Map<string, number>();
|
|
35
|
+
const recentEvents: { type: string; at: number }[] = [];
|
|
36
|
+
const onEvent = (event: RuntimeEvent) => {
|
|
37
|
+
eventCount += 1;
|
|
38
|
+
const type = event.type ?? "unknown";
|
|
39
|
+
eventTypes.set(type, (eventTypes.get(type) ?? 0) + 1);
|
|
40
|
+
recentEvents.push({ type, at: Date.now() });
|
|
41
|
+
if (recentEvents.length > 50) recentEvents.shift();
|
|
42
|
+
if (type.startsWith("compaction_")) compactionCount += 1;
|
|
43
|
+
};
|
|
44
|
+
const unsubscribe = context.on("pi/session-event", onEvent);
|
|
45
|
+
const report = (): ContextInsightReport => {
|
|
46
|
+
const runtime = context.get("piRuntime");
|
|
47
|
+
if (runtime === undefined) {
|
|
48
|
+
return {
|
|
49
|
+
tokens: null,
|
|
50
|
+
contextWindow: null,
|
|
51
|
+
percent: null,
|
|
52
|
+
messages: 0,
|
|
53
|
+
events: eventCount,
|
|
54
|
+
compactions: compactionCount,
|
|
55
|
+
composition: { user: 0, assistant: 0, toolResult: 0, system: 0, other: 0 },
|
|
56
|
+
eventTypes: Object.fromEntries(eventTypes),
|
|
57
|
+
recentEvents: recentEvents.map((event) => ({ ...event })),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const usage = runtime.session.getContextUsage();
|
|
61
|
+
const composition: ContextComposition = { user: 0, assistant: 0, toolResult: 0, system: 0, other: 0 };
|
|
62
|
+
for (const message of runtime.session.messages) composition[messageRole(message)] += 1;
|
|
63
|
+
return {
|
|
64
|
+
tokens: usage?.tokens ?? null,
|
|
65
|
+
contextWindow: usage?.contextWindow ?? null,
|
|
66
|
+
percent: usage?.percent ?? null,
|
|
67
|
+
messages: runtime.session.messages.length,
|
|
68
|
+
events: eventCount,
|
|
69
|
+
compactions: compactionCount,
|
|
70
|
+
composition,
|
|
71
|
+
eventTypes: Object.fromEntries(eventTypes),
|
|
72
|
+
recentEvents: recentEvents.map((event) => ({ ...event })),
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
const unregisterTool = context.piTools.register(
|
|
76
|
+
defineTool({
|
|
77
|
+
name: "context_inspect",
|
|
78
|
+
label: "Context inspect",
|
|
79
|
+
description: "Inspect current context usage, message composition, and recent lifecycle events.",
|
|
80
|
+
promptSnippet: "inspect the current context composition and recent events",
|
|
81
|
+
parameters: Type.Object({}),
|
|
82
|
+
execute(): Promise<AgentToolResult<ContextInsightReport>> {
|
|
83
|
+
const details = report();
|
|
84
|
+
return Promise.resolve({ content: [{ type: "text", text: `${details.messages} messages, ${details.events} context events.` }], details });
|
|
85
|
+
},
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
const disposePanel = context.piPluginUi.register({
|
|
89
|
+
id: "context-insight-panel",
|
|
90
|
+
pluginId: "@pi-harness/core/plugins/context",
|
|
91
|
+
title: "上下文洞察",
|
|
92
|
+
description: "查看当前上下文占用、消息规模和压缩事件。",
|
|
93
|
+
icon: "◒",
|
|
94
|
+
read: report,
|
|
95
|
+
});
|
|
96
|
+
context.effect(() => () => {
|
|
97
|
+
unsubscribe();
|
|
98
|
+
unregisterTool();
|
|
99
|
+
disposePanel();
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
};
|