@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,88 @@
|
|
|
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 maxBlocks = 12;
|
|
6
|
+
const maxTextLength = 4000;
|
|
7
|
+
type BlockType = "text" | "badge" | "progress";
|
|
8
|
+
type Tone = "neutral" | "info" | "success" | "warning" | "danger";
|
|
9
|
+
type GenUiBlock = { type: BlockType; label: string; value: string | number; tone: Tone };
|
|
10
|
+
type GenUiReport = { title: string; blocks: GenUiBlock[]; renderedAt: string };
|
|
11
|
+
|
|
12
|
+
function cleanText(value: string, field: string): string {
|
|
13
|
+
const text = value.trim();
|
|
14
|
+
if (text.length === 0) throw new Error(`${field} must not be empty`);
|
|
15
|
+
if (text.length > maxTextLength) throw new Error(`${field} must be at most ${maxTextLength} characters`);
|
|
16
|
+
return text;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function normalizeBlock(block: { type: BlockType; label: string; value: string; tone?: Tone }): GenUiBlock {
|
|
20
|
+
const label = cleanText(block.label, "Block label");
|
|
21
|
+
const rawValue = cleanText(block.value, "Block value");
|
|
22
|
+
if (block.type !== "progress") return { type: block.type, label, value: rawValue, tone: block.tone ?? "neutral" };
|
|
23
|
+
const value = Number(rawValue);
|
|
24
|
+
if (!Number.isFinite(value) || value < 0 || value > 100) throw new Error("Progress value must be a number from 0 to 100");
|
|
25
|
+
return { type: "progress", label, value, tone: block.tone ?? "info" };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
name: "pi-genui",
|
|
30
|
+
inject: ["piPluginUi", "piTools"],
|
|
31
|
+
apply(context: Context) {
|
|
32
|
+
let rendered = 0;
|
|
33
|
+
let latest: GenUiReport | undefined;
|
|
34
|
+
const unregisterTool = context.piTools.register(
|
|
35
|
+
defineTool({
|
|
36
|
+
name: "genui_render",
|
|
37
|
+
label: "Render structured UI",
|
|
38
|
+
description: "Render safe structured text, badge, and progress blocks in the GenUI panel; HTML and scripts are treated as plain text.",
|
|
39
|
+
promptSnippet: "render a structured status card for the user",
|
|
40
|
+
parameters: Type.Object({
|
|
41
|
+
title: Type.String(),
|
|
42
|
+
blocks: Type.Array(
|
|
43
|
+
Type.Object({
|
|
44
|
+
type: Type.Union(["text", "badge", "progress"]),
|
|
45
|
+
label: Type.String(),
|
|
46
|
+
value: Type.String(),
|
|
47
|
+
tone: Type.Optional(Type.Union(["neutral", "info", "success", "warning", "danger"])),
|
|
48
|
+
}),
|
|
49
|
+
),
|
|
50
|
+
}),
|
|
51
|
+
execute(_toolCallId, params): Promise<AgentToolResult<GenUiReport>> {
|
|
52
|
+
return Promise.resolve().then(() => {
|
|
53
|
+
if (params.blocks.length === 0 || params.blocks.length > maxBlocks) throw new Error(`GenUI requires 1 to ${maxBlocks} blocks`);
|
|
54
|
+
latest = {
|
|
55
|
+
title: cleanText(params.title, "Title"),
|
|
56
|
+
blocks: params.blocks.map((block) =>
|
|
57
|
+
normalizeBlock({
|
|
58
|
+
type: block.type as BlockType,
|
|
59
|
+
label: block.label,
|
|
60
|
+
value: block.value,
|
|
61
|
+
...(block.tone === undefined ? {} : { tone: block.tone as Tone }),
|
|
62
|
+
}),
|
|
63
|
+
),
|
|
64
|
+
renderedAt: new Date().toISOString(),
|
|
65
|
+
};
|
|
66
|
+
rendered += 1;
|
|
67
|
+
return {
|
|
68
|
+
content: [{ type: "text" as const, text: `Rendered ${latest.blocks.length} structured UI block(s): ${latest.title}` }],
|
|
69
|
+
details: latest,
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
75
|
+
const disposePanel = context.piPluginUi.register({
|
|
76
|
+
id: "genui-panel",
|
|
77
|
+
pluginId: "@pi-harness/core/plugins/genui",
|
|
78
|
+
title: "GenUI",
|
|
79
|
+
description: "渲染安全的结构化状态卡片;文本中的 HTML 和脚本不会被执行。",
|
|
80
|
+
icon: "▤",
|
|
81
|
+
read: () => ({ rendered, latest: latest ?? null }),
|
|
82
|
+
});
|
|
83
|
+
context.effect(() => () => {
|
|
84
|
+
unregisterTool();
|
|
85
|
+
disposePanel();
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { mkdir, readdir, stat, writeFile } from "node:fs/promises";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
import { basename, join } from "node:path";
|
|
6
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
7
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
8
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
9
|
+
|
|
10
|
+
const execFileAsync = promisify(execFile);
|
|
11
|
+
const capsuleDirectory = "capsules";
|
|
12
|
+
|
|
13
|
+
async function git(cwd: string, args: readonly string[]): Promise<string> {
|
|
14
|
+
const result = await execFileAsync("git", [...args], { cwd, maxBuffer: 8 * 1024 * 1024 });
|
|
15
|
+
return result.stdout;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function applyCapsule(cwd: string, capsulePath: string): Promise<void> {
|
|
19
|
+
try {
|
|
20
|
+
await git(cwd, ["apply", "--reverse", "--check", "--binary", capsulePath]);
|
|
21
|
+
} catch (cause) {
|
|
22
|
+
throw new Error("Git capsule does not apply cleanly", { cause });
|
|
23
|
+
}
|
|
24
|
+
await git(cwd, ["apply", "--reverse", "--binary", capsulePath]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function listCapsules(directory: string): Promise<{ name: string; bytes: number }[]> {
|
|
28
|
+
const names = (await readdir(directory).catch(() => [] as string[]))
|
|
29
|
+
.filter((name) => name.endsWith(".patch"))
|
|
30
|
+
.sort()
|
|
31
|
+
.reverse()
|
|
32
|
+
.slice(0, 20);
|
|
33
|
+
return Promise.all(names.map(async (name) => ({ name, bytes: (await stat(join(directory, name))).size })));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
name: "pi-git-time-capsule",
|
|
38
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
39
|
+
apply(context: Context) {
|
|
40
|
+
const directory = join(context.piHarnessLaunch.agentDir, capsuleDirectory);
|
|
41
|
+
let latest: { name: string; bytes: number; files: number; restored?: boolean } | undefined;
|
|
42
|
+
const unregisterTool = context.piTools.register(
|
|
43
|
+
defineTool({
|
|
44
|
+
name: "git_snapshot",
|
|
45
|
+
label: "Git snapshot",
|
|
46
|
+
description: "Save the current tracked Git diff as a timestamped patch outside the workspace for rollback or review.",
|
|
47
|
+
promptSnippet: "save a rollback patch before changing code",
|
|
48
|
+
parameters: Type.Object({}),
|
|
49
|
+
async execute(): Promise<AgentToolResult<{ path: string; bytes: number; files: number }>> {
|
|
50
|
+
const status = await git(context.piHarnessLaunch.cwd, ["status", "--short"]);
|
|
51
|
+
const patch = await git(context.piHarnessLaunch.cwd, ["diff", "HEAD", "--binary", "--no-ext-diff", "--", ".", ":(exclude).pi-harness/capsules"]);
|
|
52
|
+
await mkdir(directory, { recursive: true });
|
|
53
|
+
const timestamp = new Date().toISOString().replace(/[-:.]/g, "");
|
|
54
|
+
const name = `${timestamp}-${randomUUID().slice(0, 8)}.patch`;
|
|
55
|
+
const path = join(directory, name);
|
|
56
|
+
await writeFile(path, patch, { encoding: "utf8", mode: 0o600, flag: "wx" });
|
|
57
|
+
const files = status.split("\n").filter((line) => line.trim() !== "" && !line.startsWith("??")).length;
|
|
58
|
+
latest = { name, bytes: Buffer.byteLength(patch), files };
|
|
59
|
+
return { content: [{ type: "text", text: `Git snapshot saved: ${name}` }], details: { path, bytes: latest.bytes, files } };
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
);
|
|
63
|
+
const unregisterRestore = context.piTools.register(
|
|
64
|
+
defineTool({
|
|
65
|
+
name: "git_restore",
|
|
66
|
+
label: "Restore Git snapshot",
|
|
67
|
+
description: "Apply a saved Git time capsule after an explicit confirmation; the patch is checked before it changes the workspace.",
|
|
68
|
+
promptSnippet: "restore a previously saved Git snapshot",
|
|
69
|
+
parameters: Type.Object({ name: Type.String({ description: "Capsule filename from the recent snapshots list" }), confirm: Type.Boolean() }),
|
|
70
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<{ name: string; restored: true }>> {
|
|
71
|
+
if (!params.confirm) throw new Error("Git capsule restore writes the workspace and requires confirm=true");
|
|
72
|
+
const name = params.name.trim();
|
|
73
|
+
if (name.length === 0 || name.length > 255 || basename(name) !== name || !name.endsWith(".patch"))
|
|
74
|
+
throw new Error("Capsule name must be a .patch filename");
|
|
75
|
+
const path = join(directory, name);
|
|
76
|
+
await applyCapsule(context.piHarnessLaunch.cwd, path);
|
|
77
|
+
const bytes = (await stat(path)).size;
|
|
78
|
+
latest = { name, bytes, files: 0, restored: true };
|
|
79
|
+
return { content: [{ type: "text", text: `Git snapshot restored: ${name}` }], details: { name, restored: true } };
|
|
80
|
+
},
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
83
|
+
const disposePanel = context.piPluginUi.register({
|
|
84
|
+
id: "git-time-capsule-panel",
|
|
85
|
+
pluginId: "@pi-harness/core/plugins/git-time-capsule",
|
|
86
|
+
title: "Git Time Capsule",
|
|
87
|
+
description: "查看最近的代码快照;快照保存在工作区之外,不会污染项目文件。",
|
|
88
|
+
icon: "◫",
|
|
89
|
+
read: async () => ({ latest: latest ?? null, capsules: await listCapsules(directory) }),
|
|
90
|
+
});
|
|
91
|
+
context.effect(() => () => {
|
|
92
|
+
unregisterTool();
|
|
93
|
+
unregisterRestore();
|
|
94
|
+
disposePanel();
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
};
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
5
|
+
import z from "@deepseek-ai/schemastery";
|
|
6
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
7
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
|
|
9
|
+
const defaultFileName = "graph-memory.json";
|
|
10
|
+
const absoluteNodeLimit = 2_000;
|
|
11
|
+
const absoluteRelationLimit = 5_000;
|
|
12
|
+
const maxLabelLength = 160;
|
|
13
|
+
const maxSummaryBytes = 16 * 1024;
|
|
14
|
+
const maxSourceLength = 512;
|
|
15
|
+
const maxQueryLength = 160;
|
|
16
|
+
const maxFileBytes = 4 * 1024 * 1024;
|
|
17
|
+
const lockRetryMs = 25;
|
|
18
|
+
const lockTimeoutMs = 10_000;
|
|
19
|
+
|
|
20
|
+
type NodeKind = "task" | "skill" | "event";
|
|
21
|
+
type RelationKind = "USED_SKILL" | "SOLVED_BY" | "REQUIRES" | "PATCHES" | "CONFLICTS_WITH" | "RELATED_TO";
|
|
22
|
+
type GraphNode = { id: string; kind: NodeKind; label: string; summary: string; source?: string; createdAt: string; updatedAt: string };
|
|
23
|
+
type GraphRelation = { id: string; from: string; to: string; relation: RelationKind; createdAt: string };
|
|
24
|
+
type GraphFile = { version: 1; nodes: GraphNode[]; relations: GraphRelation[] };
|
|
25
|
+
type GraphSearchReport = { query: string; total: number; nodes: GraphNode[]; relations: GraphRelation[] };
|
|
26
|
+
type GraphState = Pick<GraphFile, "nodes" | "relations">;
|
|
27
|
+
|
|
28
|
+
export interface GraphMemoryPluginConfig {
|
|
29
|
+
fileName?: string;
|
|
30
|
+
maxNodes?: number;
|
|
31
|
+
maxRelations?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Config: z<GraphMemoryPluginConfig> = z.object({
|
|
35
|
+
fileName: z.string().default(defaultFileName),
|
|
36
|
+
maxNodes: z.number().default(absoluteNodeLimit),
|
|
37
|
+
maxRelations: z.number().default(absoluteRelationLimit),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
function normalizeFilePath(agentDir: string, fileName: string | undefined): string {
|
|
41
|
+
const name = (fileName ?? defaultFileName).trim();
|
|
42
|
+
if (name === "" || basename(name) !== name || !name.toLowerCase().endsWith(".json")) throw new Error("Graph memory fileName must be a single .json filename");
|
|
43
|
+
return resolve(agentDir, name);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function normalizeText(value: string, field: string, maxLength: number): string {
|
|
47
|
+
const normalized = value.trim();
|
|
48
|
+
if (normalized.length === 0 || normalized.length > maxLength) throw new Error(`${field} must contain 1-${maxLength} characters`);
|
|
49
|
+
return normalized;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function normalizeSummary(value: string): string {
|
|
53
|
+
const normalized = value.trim();
|
|
54
|
+
if (normalized === "" || Buffer.byteLength(normalized, "utf8") > maxSummaryBytes)
|
|
55
|
+
throw new Error(`Graph memory summary must be non-empty and at most ${maxSummaryBytes} bytes`);
|
|
56
|
+
return normalized;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function isNodeKind(value: unknown): value is NodeKind {
|
|
60
|
+
return value === "task" || value === "skill" || value === "event";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isRelationKind(value: unknown): value is RelationKind {
|
|
64
|
+
return value === "USED_SKILL" || value === "SOLVED_BY" || value === "REQUIRES" || value === "PATCHES" || value === "CONFLICTS_WITH" || value === "RELATED_TO";
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function isGraphNode(value: unknown): value is GraphNode {
|
|
68
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
69
|
+
const node = value as Record<string, unknown>;
|
|
70
|
+
return (
|
|
71
|
+
typeof node.id === "string" &&
|
|
72
|
+
node.id.length > 0 &&
|
|
73
|
+
node.id.length <= maxLabelLength &&
|
|
74
|
+
isNodeKind(node.kind) &&
|
|
75
|
+
typeof node.label === "string" &&
|
|
76
|
+
node.label.trim().length > 0 &&
|
|
77
|
+
node.label.length <= maxLabelLength &&
|
|
78
|
+
typeof node.summary === "string" &&
|
|
79
|
+
node.summary.trim().length > 0 &&
|
|
80
|
+
Buffer.byteLength(node.summary, "utf8") <= maxSummaryBytes &&
|
|
81
|
+
(node.source === undefined || typeof node.source === "string") &&
|
|
82
|
+
(node.source === undefined || (node.source.length > 0 && node.source.length <= maxSourceLength)) &&
|
|
83
|
+
typeof node.createdAt === "string" &&
|
|
84
|
+
Number.isFinite(Date.parse(node.createdAt)) &&
|
|
85
|
+
typeof node.updatedAt === "string" &&
|
|
86
|
+
Number.isFinite(Date.parse(node.updatedAt))
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function isGraphRelation(value: unknown): value is GraphRelation {
|
|
91
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
92
|
+
const relation = value as Record<string, unknown>;
|
|
93
|
+
return (
|
|
94
|
+
typeof relation.id === "string" &&
|
|
95
|
+
relation.id.length > 0 &&
|
|
96
|
+
relation.id.length <= maxLabelLength &&
|
|
97
|
+
typeof relation.from === "string" &&
|
|
98
|
+
typeof relation.to === "string" &&
|
|
99
|
+
isRelationKind(relation.relation) &&
|
|
100
|
+
typeof relation.createdAt === "string" &&
|
|
101
|
+
Number.isFinite(Date.parse(relation.createdAt))
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function readGraphFile(filePath: string, nodeLimit: number, relationLimit: number): Promise<GraphState> {
|
|
106
|
+
let raw: Buffer;
|
|
107
|
+
try {
|
|
108
|
+
raw = await readFile(filePath);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return { nodes: [], relations: [] };
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
if (raw.byteLength > maxFileBytes) throw new Error(`Graph memory file exceeds its ${maxFileBytes}-byte limit`);
|
|
114
|
+
const parsed = JSON.parse(raw.toString("utf8")) as Partial<GraphFile>;
|
|
115
|
+
if (parsed.version !== 1 || !Array.isArray(parsed.nodes) || !Array.isArray(parsed.relations)) throw new Error("Graph memory file has an unsupported format");
|
|
116
|
+
if (!parsed.nodes.every(isGraphNode)) throw new Error("Graph memory file contains invalid nodes");
|
|
117
|
+
if (!parsed.relations.every(isGraphRelation)) throw new Error("Graph memory file contains invalid relations");
|
|
118
|
+
if (parsed.nodes.length > nodeLimit) throw new Error(`Graph memory file exceeds its ${nodeLimit}-node limit`);
|
|
119
|
+
if (parsed.relations.length > relationLimit) throw new Error(`Graph memory file exceeds its ${relationLimit}-relation limit`);
|
|
120
|
+
const nodeIds = new Set(parsed.nodes.map((node) => node.id));
|
|
121
|
+
const relationIds = new Set<string>();
|
|
122
|
+
for (const relation of parsed.relations) {
|
|
123
|
+
if (!nodeIds.has(relation.from) || !nodeIds.has(relation.to)) throw new Error("Graph memory file contains relations with missing nodes");
|
|
124
|
+
if (relation.from === relation.to) throw new Error("Graph memory file contains self-relations");
|
|
125
|
+
if (!relationIds.add(relation.id)) throw new Error("Graph memory file contains duplicate relation ids");
|
|
126
|
+
}
|
|
127
|
+
if (nodeIds.size !== parsed.nodes.length) throw new Error("Graph memory file contains duplicate node ids");
|
|
128
|
+
return { nodes: parsed.nodes, relations: parsed.relations };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async function writeGraphFile(filePath: string, state: GraphState): Promise<void> {
|
|
132
|
+
const payload = JSON.stringify({ version: 1, ...state } satisfies GraphFile, null, 2);
|
|
133
|
+
await mkdir(dirname(filePath), { recursive: true });
|
|
134
|
+
const temporary = join(dirname(filePath), `.${basename(filePath)}.${randomUUID()}.tmp`);
|
|
135
|
+
await writeFile(temporary, payload, { encoding: "utf8", mode: 0o600 });
|
|
136
|
+
await rename(temporary, filePath);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async function acquireGraphLock(lockPath: string): Promise<() => Promise<void>> {
|
|
140
|
+
const deadline = Date.now() + lockTimeoutMs;
|
|
141
|
+
while (true) {
|
|
142
|
+
try {
|
|
143
|
+
await mkdir(lockPath);
|
|
144
|
+
return async () => {
|
|
145
|
+
await rm(lockPath, { recursive: true, force: true });
|
|
146
|
+
};
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if ((error as NodeJS.ErrnoException).code !== "EEXIST" || Date.now() >= deadline)
|
|
149
|
+
throw new Error("Timed out waiting for graph memory file lock", { cause: error });
|
|
150
|
+
await new Promise<void>((resolve) => setTimeout(resolve, lockRetryMs));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default {
|
|
156
|
+
name: "pi-graph-memory",
|
|
157
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
158
|
+
Config,
|
|
159
|
+
apply(context: Context, config: GraphMemoryPluginConfig) {
|
|
160
|
+
const filePath = normalizeFilePath(context.piHarnessLaunch.agentDir, config.fileName);
|
|
161
|
+
const nodeLimit = Math.max(1, Math.min(absoluteNodeLimit, Math.trunc(config.maxNodes ?? absoluteNodeLimit)));
|
|
162
|
+
const relationLimit = Math.max(1, Math.min(absoluteRelationLimit, Math.trunc(config.maxRelations ?? absoluteRelationLimit)));
|
|
163
|
+
let nodes: GraphNode[] = [];
|
|
164
|
+
let relations: GraphRelation[] = [];
|
|
165
|
+
let loaded = false;
|
|
166
|
+
let loading: Promise<void> | undefined;
|
|
167
|
+
let mutationQueue = Promise.resolve();
|
|
168
|
+
let lastSearch: GraphSearchReport | undefined;
|
|
169
|
+
|
|
170
|
+
const load = async (): Promise<void> => {
|
|
171
|
+
if (loaded) return;
|
|
172
|
+
if (loading !== undefined) return loading;
|
|
173
|
+
loading = (async () => {
|
|
174
|
+
const state = await readGraphFile(filePath, nodeLimit, relationLimit);
|
|
175
|
+
nodes = state.nodes;
|
|
176
|
+
relations = state.relations;
|
|
177
|
+
loaded = true;
|
|
178
|
+
})();
|
|
179
|
+
return loading;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const mutate = async <T>(operation: (state: GraphState) => T): Promise<T> => {
|
|
183
|
+
let result: T | undefined;
|
|
184
|
+
const run = async (): Promise<void> => {
|
|
185
|
+
const release = await acquireGraphLock(`${filePath}.lock`);
|
|
186
|
+
try {
|
|
187
|
+
const state = await readGraphFile(filePath, nodeLimit, relationLimit);
|
|
188
|
+
result = operation(state);
|
|
189
|
+
await writeGraphFile(filePath, state);
|
|
190
|
+
nodes = state.nodes;
|
|
191
|
+
relations = state.relations;
|
|
192
|
+
loaded = true;
|
|
193
|
+
} finally {
|
|
194
|
+
await release();
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
mutationQueue = mutationQueue.catch(() => undefined).then(run);
|
|
198
|
+
await mutationQueue;
|
|
199
|
+
return result as T;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const recordTool = defineTool({
|
|
203
|
+
name: "graph_memory_record",
|
|
204
|
+
label: "Record graph memory",
|
|
205
|
+
description: "Persist or update one typed task, skill, or event node with explicit provenance in the local graph memory.",
|
|
206
|
+
promptSnippet: "record durable typed knowledge in the local graph memory",
|
|
207
|
+
parameters: Type.Object({
|
|
208
|
+
kind: Type.Union([Type.Literal("task"), Type.Literal("skill"), Type.Literal("event")]),
|
|
209
|
+
label: Type.String(),
|
|
210
|
+
summary: Type.String(),
|
|
211
|
+
source: Type.Optional(Type.String()),
|
|
212
|
+
}),
|
|
213
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<GraphNode>> {
|
|
214
|
+
const label = normalizeText(params.label, "Graph memory label", maxLabelLength);
|
|
215
|
+
const summary = normalizeSummary(params.summary);
|
|
216
|
+
const source = params.source === undefined ? undefined : normalizeText(params.source, "Graph memory source", maxSourceLength);
|
|
217
|
+
const node = await mutate((state) => {
|
|
218
|
+
const existing = state.nodes.find((candidate) => candidate.kind === params.kind && candidate.label.toLocaleLowerCase() === label.toLocaleLowerCase());
|
|
219
|
+
if (existing === undefined && state.nodes.length >= nodeLimit) throw new Error(`Graph memory reached its ${nodeLimit}-node limit`);
|
|
220
|
+
const now = new Date().toISOString();
|
|
221
|
+
const next: GraphNode =
|
|
222
|
+
existing === undefined
|
|
223
|
+
? { id: randomUUID(), kind: params.kind, label, summary, ...(source === undefined ? {} : { source }), createdAt: now, updatedAt: now }
|
|
224
|
+
: { ...existing, label, summary, ...(source === undefined ? {} : { source }), updatedAt: now };
|
|
225
|
+
state.nodes = [next, ...state.nodes.filter((candidate) => candidate.id !== next.id)];
|
|
226
|
+
return next;
|
|
227
|
+
});
|
|
228
|
+
return { content: [{ type: "text", text: `Graph memory recorded: ${node.id} [${node.kind}] ${node.label}` }], details: node };
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const linkTool = defineTool({
|
|
233
|
+
name: "graph_memory_link",
|
|
234
|
+
label: "Link graph memories",
|
|
235
|
+
description: "Create one typed directed relation between two existing graph-memory nodes.",
|
|
236
|
+
promptSnippet: "link two graph memories with a typed relation",
|
|
237
|
+
parameters: Type.Object({
|
|
238
|
+
from: Type.String(),
|
|
239
|
+
to: Type.String(),
|
|
240
|
+
relation: Type.Union([
|
|
241
|
+
Type.Literal("USED_SKILL"),
|
|
242
|
+
Type.Literal("SOLVED_BY"),
|
|
243
|
+
Type.Literal("REQUIRES"),
|
|
244
|
+
Type.Literal("PATCHES"),
|
|
245
|
+
Type.Literal("CONFLICTS_WITH"),
|
|
246
|
+
Type.Literal("RELATED_TO"),
|
|
247
|
+
]),
|
|
248
|
+
}),
|
|
249
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<GraphRelation>> {
|
|
250
|
+
const from = normalizeText(params.from, "Graph relation source id", maxLabelLength);
|
|
251
|
+
const to = normalizeText(params.to, "Graph relation target id", maxLabelLength);
|
|
252
|
+
if (from === to) throw new Error("Graph memory relations require two different nodes");
|
|
253
|
+
const relation = await mutate((state) => {
|
|
254
|
+
if (!state.nodes.some((node) => node.id === from)) throw new Error(`Graph memory source node not found: ${from}`);
|
|
255
|
+
if (!state.nodes.some((node) => node.id === to)) throw new Error(`Graph memory target node not found: ${to}`);
|
|
256
|
+
const existing = state.relations.find((candidate) => candidate.from === from && candidate.to === to && candidate.relation === params.relation);
|
|
257
|
+
if (existing !== undefined) return existing;
|
|
258
|
+
if (state.relations.length >= relationLimit) throw new Error(`Graph memory reached its ${relationLimit}-relation limit`);
|
|
259
|
+
const next: GraphRelation = { id: randomUUID(), from, to, relation: params.relation, createdAt: new Date().toISOString() };
|
|
260
|
+
state.relations = [next, ...state.relations];
|
|
261
|
+
return next;
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
content: [{ type: "text", text: `Graph relation ${relation.id} ${relation.relation}: ${relation.from} → ${relation.to}` }],
|
|
265
|
+
details: relation,
|
|
266
|
+
};
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
const searchTool = defineTool({
|
|
271
|
+
name: "graph_memory_search",
|
|
272
|
+
label: "Search graph memory",
|
|
273
|
+
description: "Search typed graph-memory nodes by label, summary, provenance, kind, or connected relation.",
|
|
274
|
+
promptSnippet: "search the local cross-session knowledge graph",
|
|
275
|
+
parameters: Type.Object({
|
|
276
|
+
query: Type.String(),
|
|
277
|
+
kind: Type.Optional(Type.Union([Type.Literal("task"), Type.Literal("skill"), Type.Literal("event")])),
|
|
278
|
+
limit: Type.Optional(Type.Number()),
|
|
279
|
+
}),
|
|
280
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<GraphSearchReport>> {
|
|
281
|
+
await load();
|
|
282
|
+
const query = normalizeText(params.query, "Graph memory query", maxQueryLength);
|
|
283
|
+
if (query.length < 2) throw new Error(`Graph memory query must contain 2-${maxQueryLength} characters`);
|
|
284
|
+
const needle = query.toLocaleLowerCase();
|
|
285
|
+
const limit = Math.max(1, Math.min(50, Math.trunc(params.limit ?? 12)));
|
|
286
|
+
const ranked = nodes
|
|
287
|
+
.filter((node) => params.kind === undefined || node.kind === params.kind)
|
|
288
|
+
.map((node) => {
|
|
289
|
+
const label = node.label.toLocaleLowerCase();
|
|
290
|
+
const summary = node.summary.toLocaleLowerCase();
|
|
291
|
+
const source = node.source?.toLocaleLowerCase() ?? "";
|
|
292
|
+
const relationHit = relations.some((relation) => {
|
|
293
|
+
if (relation.from !== node.id && relation.to !== node.id) return false;
|
|
294
|
+
if (relation.relation.toLocaleLowerCase().includes(needle)) return true;
|
|
295
|
+
const neighborId = relation.from === node.id ? relation.to : relation.from;
|
|
296
|
+
return (
|
|
297
|
+
nodes
|
|
298
|
+
.find((candidate) => candidate.id === neighborId)
|
|
299
|
+
?.label.toLocaleLowerCase()
|
|
300
|
+
.includes(needle) ?? false
|
|
301
|
+
);
|
|
302
|
+
});
|
|
303
|
+
const score =
|
|
304
|
+
label === needle ? 100 : label.includes(needle) ? 60 : summary.includes(needle) ? 30 : source.includes(needle) || node.kind === needle ? 15 : 0;
|
|
305
|
+
return { node, score: score > 0 ? score : relationHit ? 20 : 0 };
|
|
306
|
+
})
|
|
307
|
+
.filter((match) => match.score > 0)
|
|
308
|
+
.sort((left, right) => right.score - left.score || right.node.updatedAt.localeCompare(left.node.updatedAt));
|
|
309
|
+
const matches = ranked.slice(0, limit).map((match) => match.node);
|
|
310
|
+
const matchedIds = new Set(matches.map((node) => node.id));
|
|
311
|
+
const matchedRelations = relations.filter((relation) => matchedIds.has(relation.from) || matchedIds.has(relation.to)).slice(0, limit * 4);
|
|
312
|
+
lastSearch = { query, total: ranked.length, nodes: matches, relations: matchedRelations };
|
|
313
|
+
return {
|
|
314
|
+
content: [
|
|
315
|
+
{
|
|
316
|
+
type: "text",
|
|
317
|
+
text:
|
|
318
|
+
matches.length === 0
|
|
319
|
+
? `No graph memories found for ${query}.`
|
|
320
|
+
: matches.map((node) => `${node.id} [${node.kind}] ${node.label}: ${node.summary}`).join("\n"),
|
|
321
|
+
},
|
|
322
|
+
],
|
|
323
|
+
details: lastSearch,
|
|
324
|
+
};
|
|
325
|
+
},
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
const forgetTool = defineTool({
|
|
329
|
+
name: "graph_memory_forget",
|
|
330
|
+
label: "Forget graph memory",
|
|
331
|
+
description: "Delete one graph-memory node and all incident relations after explicit confirmation.",
|
|
332
|
+
promptSnippet: "forget a graph memory after confirmation",
|
|
333
|
+
parameters: Type.Object({ id: Type.String(), confirm: Type.Boolean() }),
|
|
334
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<{ id: string; removed: boolean; removedRelations: number }>> {
|
|
335
|
+
const id = normalizeText(params.id, "Graph memory node id", maxLabelLength);
|
|
336
|
+
if (params.confirm !== true) throw new Error("Deleting a graph memory requires confirm=true");
|
|
337
|
+
const result = await mutate((state) => {
|
|
338
|
+
const beforeNodes = state.nodes.length;
|
|
339
|
+
const beforeRelations = state.relations.length;
|
|
340
|
+
state.nodes = state.nodes.filter((node) => node.id !== id);
|
|
341
|
+
state.relations = state.relations.filter((relation) => relation.from !== id && relation.to !== id);
|
|
342
|
+
return { id, removed: state.nodes.length !== beforeNodes, removedRelations: beforeRelations - state.relations.length };
|
|
343
|
+
});
|
|
344
|
+
return {
|
|
345
|
+
content: [{ type: "text", text: result.removed ? `Graph memory deleted: ${id}` : `Graph memory not found: ${id}` }],
|
|
346
|
+
details: result,
|
|
347
|
+
};
|
|
348
|
+
},
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
const disposers: Array<() => void> = [];
|
|
352
|
+
try {
|
|
353
|
+
disposers.push(context.piTools.register(recordTool));
|
|
354
|
+
disposers.push(context.piTools.register(linkTool));
|
|
355
|
+
disposers.push(context.piTools.register(searchTool));
|
|
356
|
+
disposers.push(context.piTools.register(forgetTool));
|
|
357
|
+
disposers.push(
|
|
358
|
+
context.piPluginUi.register({
|
|
359
|
+
id: "graph-memory-panel",
|
|
360
|
+
pluginId: "@pi-harness/core/plugins/graph-memory",
|
|
361
|
+
title: "Graph Memory",
|
|
362
|
+
description: "显式记录任务、技能与事件关系,保留来源并跨会话查询。",
|
|
363
|
+
icon: "⌬",
|
|
364
|
+
read: async () => {
|
|
365
|
+
await load();
|
|
366
|
+
return {
|
|
367
|
+
filePath,
|
|
368
|
+
nodes: nodes.length,
|
|
369
|
+
relations: relations.length,
|
|
370
|
+
kinds: {
|
|
371
|
+
task: nodes.filter((node) => node.kind === "task").length,
|
|
372
|
+
skill: nodes.filter((node) => node.kind === "skill").length,
|
|
373
|
+
event: nodes.filter((node) => node.kind === "event").length,
|
|
374
|
+
},
|
|
375
|
+
recent: nodes.slice(0, 8),
|
|
376
|
+
recentRelations: relations.slice(0, 8).map((relation) => ({
|
|
377
|
+
...relation,
|
|
378
|
+
fromLabel: nodes.find((node) => node.id === relation.from)?.label ?? relation.from,
|
|
379
|
+
toLabel: nodes.find((node) => node.id === relation.to)?.label ?? relation.to,
|
|
380
|
+
})),
|
|
381
|
+
lastSearch: lastSearch ?? null,
|
|
382
|
+
};
|
|
383
|
+
},
|
|
384
|
+
}),
|
|
385
|
+
);
|
|
386
|
+
} catch (error) {
|
|
387
|
+
for (const dispose of disposers.reverse()) dispose();
|
|
388
|
+
throw error;
|
|
389
|
+
}
|
|
390
|
+
context.effect(() => () => {
|
|
391
|
+
for (const dispose of disposers.reverse()) dispose();
|
|
392
|
+
});
|
|
393
|
+
},
|
|
394
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
import z from "@deepseek-ai/schemastery";
|
|
5
|
+
|
|
6
|
+
type CompressionState = { enabled: boolean; thresholdPercent: number; compactions: number; lastUsagePercent: number | null; lastError: string | null };
|
|
7
|
+
export interface HistoryCompressorPluginConfig {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
thresholdPercent?: number;
|
|
10
|
+
}
|
|
11
|
+
export const Config: z<HistoryCompressorPluginConfig> = z.object({ enabled: z.boolean().default(true), thresholdPercent: z.number().default(85) });
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
name: "pi-history-compressor",
|
|
15
|
+
inject: ["piPluginUi", "piTools"],
|
|
16
|
+
Config,
|
|
17
|
+
apply(context: Context, config: HistoryCompressorPluginConfig) {
|
|
18
|
+
const enabled = config.enabled !== false;
|
|
19
|
+
const thresholdPercent = Math.max(1, Math.min(100, config.thresholdPercent ?? 85));
|
|
20
|
+
const state: CompressionState = { enabled, thresholdPercent, compactions: 0, lastUsagePercent: null, lastError: null };
|
|
21
|
+
let inFlight = false;
|
|
22
|
+
const runtime = () => context.get("piRuntime");
|
|
23
|
+
const compact = async (automatic: boolean): Promise<{ compacted: boolean; automatic: boolean }> => {
|
|
24
|
+
const service = runtime();
|
|
25
|
+
if (service === undefined) throw new Error("Pi runtime is not ready");
|
|
26
|
+
if (automatic && !enabled) return { compacted: false, automatic };
|
|
27
|
+
if (inFlight) return { compacted: false, automatic };
|
|
28
|
+
inFlight = true;
|
|
29
|
+
try {
|
|
30
|
+
await service.session.compact();
|
|
31
|
+
state.compactions += 1;
|
|
32
|
+
state.lastError = null;
|
|
33
|
+
return { compacted: true, automatic };
|
|
34
|
+
} catch (error) {
|
|
35
|
+
state.lastError = error instanceof Error ? error.message : String(error);
|
|
36
|
+
throw error;
|
|
37
|
+
} finally {
|
|
38
|
+
inFlight = false;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const inspectAndMaybeCompact = (): void => {
|
|
42
|
+
const service = runtime();
|
|
43
|
+
const usage = service?.session.getContextUsage();
|
|
44
|
+
state.lastUsagePercent = typeof usage?.percent === "number" ? usage.percent : null;
|
|
45
|
+
if (enabled && state.lastUsagePercent !== null && state.lastUsagePercent >= thresholdPercent) void compact(true).catch(() => undefined);
|
|
46
|
+
};
|
|
47
|
+
const unsubscribe = context.on("pi/session-event", (event) => {
|
|
48
|
+
if ((event as { type?: string }).type === "agent_end") inspectAndMaybeCompact();
|
|
49
|
+
});
|
|
50
|
+
const unregisterTool = context.piTools.register(
|
|
51
|
+
defineTool({
|
|
52
|
+
name: "compress_history",
|
|
53
|
+
label: "Compress history",
|
|
54
|
+
description: "Compact the current Pi session after explicit confirmation.",
|
|
55
|
+
promptSnippet: "compact the current conversation history",
|
|
56
|
+
parameters: Type.Object({ confirm: Type.Boolean({ description: "Must be true to compact history" }) }),
|
|
57
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<{ compacted: boolean; automatic: boolean }>> {
|
|
58
|
+
if (params.confirm !== true) throw new Error("History compaction requires confirm=true");
|
|
59
|
+
const result = await compact(false);
|
|
60
|
+
return {
|
|
61
|
+
content: [{ type: "text", text: result.compacted ? "Session history compacted." : "Session compaction is already running." }],
|
|
62
|
+
details: result,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
const disposePanel = context.piPluginUi.register({
|
|
68
|
+
id: "history-compressor-panel",
|
|
69
|
+
pluginId: "@pi-harness/core/plugins/history-compressor",
|
|
70
|
+
title: "History Compressor",
|
|
71
|
+
description: "在上下文接近阈值时自动压缩历史消息。",
|
|
72
|
+
icon: "↯",
|
|
73
|
+
read: () => ({ ...state }),
|
|
74
|
+
});
|
|
75
|
+
context.effect(() => () => {
|
|
76
|
+
unsubscribe();
|
|
77
|
+
unregisterTool();
|
|
78
|
+
disposePanel();
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
};
|