@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Context } from "@deepseek-ai/cordis";
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
|
-
import { createAgentSessionFromServices, createAgentSessionRuntime, type AgentSession, type CreateAgentSessionRuntimeFactory } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { createAgentSessionFromServices, createAgentSessionRuntime, type AgentSession, type CreateAgentSessionRuntimeFactory, type SessionManager } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import { PiRuntime } from "../runtime.js";
|
|
5
|
+
import { assertKnownConfigKeys } from "../config.js";
|
|
5
6
|
|
|
6
7
|
export interface RuntimePluginConfig {
|
|
7
8
|
thinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
@@ -11,11 +12,30 @@ export const Config: z<RuntimePluginConfig> = z.object({
|
|
|
11
12
|
thinkingLevel: z.union(["off", "minimal", "low", "medium", "high", "xhigh", "max"]).default("medium"),
|
|
12
13
|
});
|
|
13
14
|
|
|
15
|
+
// Cordis disposes the outgoing fiber and applies the replacement concurrently, so an HMR reload
|
|
16
|
+
// would otherwise build a second AgentSession over the same SessionManager while the first is still
|
|
17
|
+
// streaming, interleaving both runs into one JSONL transcript. Each manager therefore has at most
|
|
18
|
+
// one runtime under construction or teardown at a time.
|
|
19
|
+
const sessionManagerGate = new WeakMap<SessionManager, Promise<void>>();
|
|
20
|
+
|
|
21
|
+
function enterSessionManagerGate(manager: SessionManager): { ready: Promise<void>; release: () => void } {
|
|
22
|
+
const ready = sessionManagerGate.get(manager) ?? Promise.resolve();
|
|
23
|
+
let release!: () => void;
|
|
24
|
+
const held = new Promise<void>((resolve) => {
|
|
25
|
+
release = resolve;
|
|
26
|
+
});
|
|
27
|
+
sessionManagerGate.set(manager, ready.then(() => held, () => held));
|
|
28
|
+
return { ready, release };
|
|
29
|
+
}
|
|
30
|
+
|
|
14
31
|
export default {
|
|
15
32
|
name: "pi-runtime",
|
|
16
33
|
inject: ["piModels", "piResources", "piSession", "piTools"],
|
|
17
34
|
Config,
|
|
18
35
|
async apply(context: Context, config: RuntimePluginConfig) {
|
|
36
|
+
assertKnownConfigKeys("pi-runtime", config, ["thinkingLevel"]);
|
|
37
|
+
const gate = enterSessionManagerGate(context.piSession.manager);
|
|
38
|
+
await gate.ready;
|
|
19
39
|
const tools = context.piTools.acquire();
|
|
20
40
|
context.effect(() => () => tools.release());
|
|
21
41
|
const requestedTools = [...tools.names, ...tools.customTools.map((tool) => tool.name)];
|
|
@@ -30,6 +50,10 @@ export default {
|
|
|
30
50
|
tools: requestedTools,
|
|
31
51
|
customTools: tools.customTools,
|
|
32
52
|
});
|
|
53
|
+
if (result.extensionsResult.errors.length > 0) {
|
|
54
|
+
result.session.dispose();
|
|
55
|
+
throw new Error(`Pi extensions failed to load:\n${result.extensionsResult.errors.map((failure) => `${failure.path}: ${failure.error}`).join("\n")}`);
|
|
56
|
+
}
|
|
33
57
|
return { ...result, services, diagnostics: services.diagnostics };
|
|
34
58
|
};
|
|
35
59
|
const sessionRuntime = await createAgentSessionRuntime(createRuntime, {
|
|
@@ -39,9 +63,6 @@ export default {
|
|
|
39
63
|
});
|
|
40
64
|
const runtime = new PiRuntime(sessionRuntime);
|
|
41
65
|
const bindSession = async (session: AgentSession): Promise<void> => {
|
|
42
|
-
const activeTools = new Set(session.getAllTools().map((tool) => tool.name));
|
|
43
|
-
const missingTools = requestedTools.filter((name) => !activeTools.has(name));
|
|
44
|
-
if (missingTools.length > 0) throw new Error(`Pi tools are not registered: ${missingTools.join(", ")}`);
|
|
45
66
|
await session.bindExtensions({
|
|
46
67
|
mode: "print",
|
|
47
68
|
abortHandler: () => {
|
|
@@ -51,23 +72,49 @@ export default {
|
|
|
51
72
|
context.emit("pi/extension-error", error);
|
|
52
73
|
},
|
|
53
74
|
});
|
|
75
|
+
// Reconciled after binding so a tool an extension registers from session_start is visible here.
|
|
76
|
+
const registeredTools = session.getAllTools().map((tool) => tool.name);
|
|
77
|
+
const missingTools = requestedTools.filter((name) => !registeredTools.includes(name));
|
|
78
|
+
if (missingTools.length > 0) throw new Error(`Pi tools are not registered: ${missingTools.join(", ")}`);
|
|
79
|
+
// Pi treats the tool list as an allowlist, so anything an extension contributed but the
|
|
80
|
+
// profile did not name is dropped. Report it rather than letting the tool vanish silently.
|
|
81
|
+
const activeTools = new Set(session.getActiveToolNames());
|
|
82
|
+
const droppedTools = registeredTools.filter((name) => !activeTools.has(name));
|
|
83
|
+
if (droppedTools.length > 0) context.emit("pi/extension-error", { extensionPath: "pi-tools", event: "session_start", error: `Pi tools registered by extensions are not enabled because the profile does not list them: ${droppedTools.join(", ")}; add them to the pi-tools names option to enable them` });
|
|
54
84
|
};
|
|
55
|
-
context.provide("piRuntime", runtime);
|
|
56
85
|
let unsubscribe: (() => void) | undefined;
|
|
57
86
|
const rebindSession = async (session: AgentSession): Promise<void> => {
|
|
58
87
|
unsubscribe?.();
|
|
59
88
|
await bindSession(session);
|
|
60
89
|
unsubscribe = session.subscribe((event) => {
|
|
61
|
-
|
|
90
|
+
// A throwing listener must not unwind back into Pi's event dispatch and kill the run.
|
|
91
|
+
try {
|
|
92
|
+
context.emit("pi/session-event", event);
|
|
93
|
+
} catch (error) {
|
|
94
|
+
context.emit("pi/extension-error", { extensionPath: "pi/session-event", event: event.type, error: error instanceof Error ? error.message : String(error) });
|
|
95
|
+
}
|
|
62
96
|
});
|
|
63
97
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
98
|
+
try {
|
|
99
|
+
context.effect(() => {
|
|
100
|
+
return async () => {
|
|
101
|
+
unsubscribe?.();
|
|
102
|
+
try {
|
|
103
|
+
await runtime.dispose();
|
|
104
|
+
} finally {
|
|
105
|
+
// Released only once teardown has finished, so a replacement fiber cannot build a
|
|
106
|
+
// second session over this SessionManager while this one is still writing to it.
|
|
107
|
+
gate.release();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
context.provide("piRuntime", runtime);
|
|
112
|
+
sessionRuntime.setRebindSession(rebindSession);
|
|
113
|
+
await rebindSession(sessionRuntime.session);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
await runtime.dispose();
|
|
116
|
+
gate.release();
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
72
119
|
},
|
|
73
120
|
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { readdir, readFile, stat } from "node:fs/promises";
|
|
2
|
+
import { basename, join, relative, resolve } from "node:path";
|
|
3
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
5
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
import { resolveExistingWorkspacePath } from "../workspace-path.js";
|
|
7
|
+
|
|
8
|
+
const maxFiles = 500;
|
|
9
|
+
const maxFileBytes = 512 * 1024;
|
|
10
|
+
const ignoredDirectories = new Set([".git", ".pi", "node_modules", "dist", "build", "coverage"]);
|
|
11
|
+
|
|
12
|
+
export type AuditSeverity = "critical" | "high" | "medium";
|
|
13
|
+
export type AuditFindingKind = "credential" | "private-key" | "shell-pipeline" | "destructive-command";
|
|
14
|
+
|
|
15
|
+
export interface AuditFinding {
|
|
16
|
+
path: string;
|
|
17
|
+
line: number;
|
|
18
|
+
severity: AuditSeverity;
|
|
19
|
+
kind: AuditFindingKind;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AuditSummary {
|
|
24
|
+
root: string;
|
|
25
|
+
scanned: number;
|
|
26
|
+
skipped: number;
|
|
27
|
+
total: number;
|
|
28
|
+
critical: number;
|
|
29
|
+
high: number;
|
|
30
|
+
medium: number;
|
|
31
|
+
changed: boolean;
|
|
32
|
+
findings: AuditFinding[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const credentialPattern = /\b(?:sk-[A-Za-z0-9_-]{10,}|gh[pousr]_[A-Za-z0-9]{10,}|xox[baprs]-[A-Za-z0-9-]{10,}|AKIA[0-9A-Z]{12,})\b/iu;
|
|
36
|
+
const privateKeyPattern = /-----BEGIN (?:RSA|EC|OPENSSH|DSA|PGP )?PRIVATE KEY-----/u;
|
|
37
|
+
const assignmentPattern = /^\s*(?:password|secret|api[_-]?key|token)\s*[:=]\s*["']?[^\s"']{8,}/iu;
|
|
38
|
+
const shellPipelinePattern = /\b(?:curl|wget)\b[^\n|]{0,240}\|\s*(?:sh|bash|zsh)\b/iu;
|
|
39
|
+
const destructiveCommandPattern = /\brm\s+-rf(?:\s|$)/iu;
|
|
40
|
+
|
|
41
|
+
function finding(path: string, line: number, severity: AuditSeverity, kind: AuditFindingKind, message: string): AuditFinding {
|
|
42
|
+
return { path, line, severity, kind, message };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function auditText(path: string, source: string): AuditFinding[] {
|
|
46
|
+
const findings: AuditFinding[] = [];
|
|
47
|
+
source.split("\n").forEach((lineText, index) => {
|
|
48
|
+
const line = index + 1;
|
|
49
|
+
if (privateKeyPattern.test(lineText)) findings.push(finding(path, line, "critical", "private-key", "Private key material is present in source text."));
|
|
50
|
+
else if (credentialPattern.test(lineText) || assignmentPattern.test(lineText))
|
|
51
|
+
findings.push(finding(path, line, "critical", "credential", "A credential-like value is present in source text."));
|
|
52
|
+
if (shellPipelinePattern.test(lineText)) findings.push(finding(path, line, "high", "shell-pipeline", "A remote script is piped directly into a shell."));
|
|
53
|
+
if (destructiveCommandPattern.test(lineText))
|
|
54
|
+
findings.push(finding(path, line, "high", "destructive-command", "A recursive force delete command is present."));
|
|
55
|
+
});
|
|
56
|
+
return findings;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function summarizeAudit(findings: readonly AuditFinding[], root = ".", scanned = 0, skipped = 0): AuditSummary {
|
|
60
|
+
const critical = findings.filter((item) => item.severity === "critical").length;
|
|
61
|
+
const high = findings.filter((item) => item.severity === "high").length;
|
|
62
|
+
const medium = findings.filter((item) => item.severity === "medium").length;
|
|
63
|
+
return { root, scanned, skipped, total: findings.length, critical, high, medium, changed: findings.length > 0, findings: [...findings] };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function workspaceFiles(root: string, current: string, files: string[]): Promise<void> {
|
|
67
|
+
if (files.length >= maxFiles) return;
|
|
68
|
+
const entries = await readdir(current, { withFileTypes: true });
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
if (files.length >= maxFiles) return;
|
|
71
|
+
const fullPath = join(current, entry.name);
|
|
72
|
+
if (entry.isDirectory()) {
|
|
73
|
+
if (!ignoredDirectories.has(entry.name)) await workspaceFiles(root, fullPath, files);
|
|
74
|
+
} else if (entry.isFile()) {
|
|
75
|
+
files.push(relative(root, fullPath));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export async function auditWorkspace(root: string, requested = "."): Promise<AuditSummary> {
|
|
81
|
+
const resolved = await resolveExistingWorkspacePath(root, requested, "Audit path must stay inside the current workspace");
|
|
82
|
+
root = resolved.root;
|
|
83
|
+
const target = resolved.target;
|
|
84
|
+
const metadata = await stat(target);
|
|
85
|
+
const files: string[] = [];
|
|
86
|
+
if (metadata.isFile()) files.push(relative(root, target));
|
|
87
|
+
else if (metadata.isDirectory()) await workspaceFiles(root, target, files);
|
|
88
|
+
else throw new Error("Audit target must be a file or directory");
|
|
89
|
+
const findings: AuditFinding[] = [];
|
|
90
|
+
let skipped = 0;
|
|
91
|
+
for (const file of files) {
|
|
92
|
+
const fullPath = resolve(root, file);
|
|
93
|
+
const fileMetadata = await stat(fullPath);
|
|
94
|
+
if (fileMetadata.size > maxFileBytes) {
|
|
95
|
+
skipped += 1;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const source = await readFile(fullPath, "utf8");
|
|
99
|
+
if (source.includes("\u0000")) {
|
|
100
|
+
skipped += 1;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
findings.push(...auditText(file || basename(fullPath), source));
|
|
104
|
+
}
|
|
105
|
+
return summarizeAudit(findings, relative(root, target) || ".", files.length, skipped);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function emptySummary(): AuditSummary {
|
|
109
|
+
return summarizeAudit([], ".");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default {
|
|
113
|
+
name: "pi-secure-audit",
|
|
114
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
115
|
+
apply(context: Context) {
|
|
116
|
+
let latest: AuditSummary | undefined;
|
|
117
|
+
const unregister = context.piTools.register(
|
|
118
|
+
defineTool({
|
|
119
|
+
name: "security_audit",
|
|
120
|
+
label: "Security audit",
|
|
121
|
+
description: "Read-only scan of workspace text files for exposed credentials and dangerous shell commands; findings are value-redacted.",
|
|
122
|
+
promptSnippet: "audit the workspace for secrets and dangerous commands",
|
|
123
|
+
parameters: Type.Object({ path: Type.Optional(Type.String({ description: "Workspace-relative file or directory to scan" })) }),
|
|
124
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<AuditSummary>> {
|
|
125
|
+
latest = await auditWorkspace(context.piHarnessLaunch.cwd, params.path ?? ".");
|
|
126
|
+
return {
|
|
127
|
+
content: [{ type: "text", text: `${latest.total} findings across ${latest.scanned} files (${latest.critical} critical, ${latest.high} high).` }],
|
|
128
|
+
details: latest,
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
}),
|
|
132
|
+
);
|
|
133
|
+
const disposePanel = context.piPluginUi.register({
|
|
134
|
+
id: "secure-audit-panel",
|
|
135
|
+
pluginId: "@pi-harness/core/plugins/secure-audit",
|
|
136
|
+
title: "Secure Audit",
|
|
137
|
+
description: "只读扫描工作区中的凭据泄露和危险命令,结果不会显示敏感值。",
|
|
138
|
+
icon: "⌕",
|
|
139
|
+
read: () => latest ?? emptySummary(),
|
|
140
|
+
});
|
|
141
|
+
context.effect(() => () => {
|
|
142
|
+
unregister();
|
|
143
|
+
disposePanel();
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
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 maxLabelLength = 120;
|
|
6
|
+
|
|
7
|
+
export type SessionBookmark = { id: string; entryId: string; label: string };
|
|
8
|
+
|
|
9
|
+
export function normalizeBookmarkLabel(value: string): string {
|
|
10
|
+
const normalized = value.trim();
|
|
11
|
+
if (normalized.length < 1 || normalized.length > maxLabelLength) throw new Error("Bookmark label must contain 1-120 characters");
|
|
12
|
+
return normalized;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function record(value: unknown): Record<string, unknown> | undefined {
|
|
16
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? (value as Record<string, unknown>) : undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function listSessionBookmarks(entries: readonly unknown[]): SessionBookmark[] {
|
|
20
|
+
const labels = new Map<string, string>();
|
|
21
|
+
for (const entry of entries) {
|
|
22
|
+
const item = record(entry);
|
|
23
|
+
if (item?.type !== "label" || typeof item.targetId !== "string") continue;
|
|
24
|
+
if (typeof item.label === "string" && item.label.trim() !== "") labels.set(item.targetId, item.label.trim());
|
|
25
|
+
else labels.delete(item.targetId);
|
|
26
|
+
}
|
|
27
|
+
return [...labels].map(([entryId, label]) => ({ id: entryId, entryId, label }));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
name: "pi-session-bookmarks",
|
|
32
|
+
inject: ["piSession", "piPluginUi", "piTools"],
|
|
33
|
+
apply(context: Context) {
|
|
34
|
+
const manager = context.piSession.manager;
|
|
35
|
+
const readBookmarks = (): SessionBookmark[] => listSessionBookmarks(manager.getEntries());
|
|
36
|
+
const unregister = context.piTools.register(
|
|
37
|
+
defineTool({
|
|
38
|
+
name: "session_bookmarks",
|
|
39
|
+
label: "Session bookmarks",
|
|
40
|
+
description: "Add, list, or remove labels on entries in the current Pi session using native session history.",
|
|
41
|
+
promptSnippet: "bookmark an important point in the current session",
|
|
42
|
+
parameters: Type.Object({
|
|
43
|
+
action: Type.Union([Type.Literal("add"), Type.Literal("list"), Type.Literal("remove")]),
|
|
44
|
+
label: Type.Optional(Type.String({ description: "Bookmark label for add" })),
|
|
45
|
+
entryId: Type.Optional(Type.String({ description: "Native session entry id for add" })),
|
|
46
|
+
bookmarkId: Type.Optional(Type.String({ description: "Bookmark id for remove" })),
|
|
47
|
+
}),
|
|
48
|
+
execute(_toolCallId, params): Promise<AgentToolResult<{ bookmarks: SessionBookmark[] }>> {
|
|
49
|
+
return Promise.resolve().then(() => {
|
|
50
|
+
if (params.action === "add") {
|
|
51
|
+
const label = normalizeBookmarkLabel(params.label ?? "");
|
|
52
|
+
const entryId = params.entryId?.trim();
|
|
53
|
+
if (entryId === undefined || entryId === "") throw new Error("Bookmark entryId is required when adding a bookmark");
|
|
54
|
+
manager.appendLabelChange(entryId, label);
|
|
55
|
+
return { content: [{ type: "text", text: `Bookmark added: ${label}` }], details: { bookmarks: readBookmarks() } };
|
|
56
|
+
}
|
|
57
|
+
if (params.action === "remove") {
|
|
58
|
+
const bookmarkId = params.bookmarkId?.trim();
|
|
59
|
+
if (bookmarkId === undefined || bookmarkId === "") throw new Error("Bookmark bookmarkId is required when removing a bookmark");
|
|
60
|
+
const bookmark = readBookmarks().find((item) => item.id === bookmarkId);
|
|
61
|
+
if (bookmark === undefined) throw new Error("Bookmark was not found");
|
|
62
|
+
manager.appendLabelChange(bookmark.entryId, undefined);
|
|
63
|
+
}
|
|
64
|
+
const bookmarks = readBookmarks();
|
|
65
|
+
return {
|
|
66
|
+
content: [{ type: "text", text: bookmarks.map((bookmark) => `${bookmark.id}: ${bookmark.label}`).join("\n") || "No bookmarks found." }],
|
|
67
|
+
details: { bookmarks },
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
const disposePanel = context.piPluginUi.register({
|
|
74
|
+
id: "session-bookmarks-panel",
|
|
75
|
+
pluginId: "@pi-harness/core/plugins/session-bookmarks",
|
|
76
|
+
title: "Session Bookmarks",
|
|
77
|
+
description: "为重要会话节点添加原生持久化标签,不修改已有消息内容。",
|
|
78
|
+
icon: "☆",
|
|
79
|
+
read: () => {
|
|
80
|
+
const bookmarks = readBookmarks();
|
|
81
|
+
return { bookmarks, total: bookmarks.length };
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
context.effect(() => () => {
|
|
85
|
+
unregister();
|
|
86
|
+
disposePanel();
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
};
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
3
|
+
import { defineTool, type AgentToolResult, type SessionManager } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
|
|
5
|
+
const bridgeVersion = 1 as const;
|
|
6
|
+
const maxMessages = 100;
|
|
7
|
+
const maxMessageChars = 16_000;
|
|
8
|
+
const maxTotalChars = 64_000;
|
|
9
|
+
const bridgeType = "pi-harness/session-bridge";
|
|
10
|
+
const roles = new Set(["user", "assistant", "toolResult", "system", "other"]);
|
|
11
|
+
|
|
12
|
+
export interface BridgeSource {
|
|
13
|
+
sessionId: string;
|
|
14
|
+
cwd: string;
|
|
15
|
+
model?: { provider: string; modelId: string };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface BridgeMessage {
|
|
19
|
+
role: "user" | "assistant" | "toolResult" | "system" | "other";
|
|
20
|
+
text: string;
|
|
21
|
+
hasImages: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface BridgePackage {
|
|
25
|
+
version: typeof bridgeVersion;
|
|
26
|
+
source: BridgeSource;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
messageCount: number;
|
|
29
|
+
messages: BridgeMessage[];
|
|
30
|
+
unresolvedAttachments: string[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface HandoffPreview {
|
|
34
|
+
goal: string;
|
|
35
|
+
currentState: string;
|
|
36
|
+
decisions: string[];
|
|
37
|
+
keyFiles: string[];
|
|
38
|
+
nextStep: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type MessageInput = { role?: unknown; content?: unknown };
|
|
42
|
+
|
|
43
|
+
function textContent(content: unknown): { text: string; imageTypes: string[] } {
|
|
44
|
+
if (typeof content === "string") return { text: content, imageTypes: [] };
|
|
45
|
+
if (!Array.isArray(content)) return { text: "", imageTypes: [] };
|
|
46
|
+
const text: string[] = [];
|
|
47
|
+
const imageTypes: string[] = [];
|
|
48
|
+
for (const item of content) {
|
|
49
|
+
if (item === null || typeof item !== "object") continue;
|
|
50
|
+
const value = item as { type?: unknown; text?: unknown; mimeType?: unknown };
|
|
51
|
+
if (value.type === "text" && typeof value.text === "string") text.push(value.text);
|
|
52
|
+
if (value.type === "image") imageTypes.push(typeof value.mimeType === "string" && value.mimeType.trim() !== "" ? value.mimeType : "image/unknown");
|
|
53
|
+
}
|
|
54
|
+
return { text: text.join("\n"), imageTypes };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function role(value: unknown): BridgeMessage["role"] {
|
|
58
|
+
return typeof value === "string" && roles.has(value) ? (value as BridgeMessage["role"]) : "other";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const previewTextLimit = 1_000;
|
|
62
|
+
const previewListLimit = 8;
|
|
63
|
+
|
|
64
|
+
function boundedPreviewText(value: string): string {
|
|
65
|
+
const normalized = value.trim();
|
|
66
|
+
return normalized.length <= previewTextLimit ? normalized : `${normalized.slice(0, previewTextLimit - 1)}…`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function extractKeyFiles(messages: readonly BridgeMessage[]): string[] {
|
|
70
|
+
const files: string[] = [];
|
|
71
|
+
const seen = new Set<string>();
|
|
72
|
+
const pattern =
|
|
73
|
+
/(?:^|[^\w@])((?:\.\.?\/|[\w-]+\/)+[\w.-]+\.[a-z0-9]{1,12}|[\w.-]+\.(?:json|toml|yaml|yml|md|ts|tsx|js|jsx|rs|go|py|swift|css|html))(?![\w])/giu;
|
|
74
|
+
for (const message of messages) {
|
|
75
|
+
for (const match of message.text.matchAll(pattern)) {
|
|
76
|
+
const file = match[1];
|
|
77
|
+
if (file !== undefined && !seen.has(file)) {
|
|
78
|
+
seen.add(file);
|
|
79
|
+
files.push(file);
|
|
80
|
+
if (files.length === previewListLimit) return files;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return files;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function buildHandoffPreview(packageValue: BridgePackage): HandoffPreview {
|
|
88
|
+
const userMessages = packageValue.messages.filter((message) => message.role === "user" && message.text.trim() !== "");
|
|
89
|
+
const assistantMessages = packageValue.messages.filter((message) => message.role === "assistant" && message.text.trim() !== "");
|
|
90
|
+
const goal = boundedPreviewText(userMessages[0]?.text ?? "No explicit goal was found in the source session.");
|
|
91
|
+
const currentState = boundedPreviewText(assistantMessages.at(-1)?.text ?? "No assistant progress message was found.");
|
|
92
|
+
const decisions = userMessages
|
|
93
|
+
.filter((message) => /(?:\b(?:fix|keep|use|avoid|must|should|decide|preserve)\b|不要|保持|使用|改|修复|决定)/iu.test(message.text))
|
|
94
|
+
.slice(0, previewListLimit)
|
|
95
|
+
.map((message) => boundedPreviewText(message.text));
|
|
96
|
+
const nextStep = boundedPreviewText(userMessages.at(-1)?.text ?? "Continue from the current state after reviewing this preview.");
|
|
97
|
+
return { goal, currentState, decisions, keyFiles: extractKeyFiles(packageValue.messages), nextStep };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function buildBridgePackage(source: BridgeSource, input: readonly MessageInput[]): BridgePackage {
|
|
101
|
+
const messages: BridgeMessage[] = [];
|
|
102
|
+
const unresolvedAttachments: string[] = [];
|
|
103
|
+
let totalChars = 0;
|
|
104
|
+
for (const [index, message] of input.slice(-maxMessages).entries()) {
|
|
105
|
+
const content = textContent(message.content);
|
|
106
|
+
const text = content.text.slice(0, maxMessageChars);
|
|
107
|
+
if (text !== "") totalChars += text.length;
|
|
108
|
+
const boundedText = totalChars > maxTotalChars ? text.slice(0, Math.max(0, maxTotalChars - (totalChars - text.length))) : text;
|
|
109
|
+
messages.push({ role: role(message.role), text: boundedText, hasImages: content.imageTypes.length > 0 });
|
|
110
|
+
for (const type of content.imageTypes) unresolvedAttachments.push(`message-${index + 1}:${type}`);
|
|
111
|
+
if (totalChars >= maxTotalChars) break;
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
version: bridgeVersion,
|
|
115
|
+
source: { sessionId: source.sessionId, cwd: source.cwd, ...(source.model === undefined ? {} : { model: { ...source.model } }) },
|
|
116
|
+
createdAt: new Date().toISOString(),
|
|
117
|
+
messageCount: messages.length,
|
|
118
|
+
messages,
|
|
119
|
+
unresolvedAttachments,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function parseBridgePackage(raw: string): BridgePackage {
|
|
124
|
+
if (Buffer.byteLength(raw, "utf8") > 256 * 1024) throw new Error("Session bridge package exceeds the 256 KiB limit");
|
|
125
|
+
let value: unknown;
|
|
126
|
+
try {
|
|
127
|
+
value = JSON.parse(raw) as unknown;
|
|
128
|
+
} catch (error) {
|
|
129
|
+
throw new Error(`Session bridge package is invalid JSON: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
130
|
+
}
|
|
131
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("Session bridge package must be an object");
|
|
132
|
+
const packageValue = value as Record<string, unknown>;
|
|
133
|
+
if (packageValue.version !== bridgeVersion) throw new Error("Session bridge package version must be 1");
|
|
134
|
+
const source = packageValue.source;
|
|
135
|
+
if (source === null || typeof source !== "object" || Array.isArray(source)) throw new Error("Session bridge package source is required");
|
|
136
|
+
const sourceValue = source as Record<string, unknown>;
|
|
137
|
+
if (typeof sourceValue.sessionId !== "string" || typeof sourceValue.cwd !== "string")
|
|
138
|
+
throw new Error("Session bridge package source requires sessionId and cwd");
|
|
139
|
+
const messages = packageValue.messages;
|
|
140
|
+
if (!Array.isArray(messages) || messages.length > maxMessages) throw new Error(`Session bridge package must contain 0-${maxMessages} messages`);
|
|
141
|
+
let totalChars = 0;
|
|
142
|
+
const normalized = messages.map((message, index) => {
|
|
143
|
+
if (message === null || typeof message !== "object" || Array.isArray(message)) throw new Error(`Session bridge message ${index + 1} is invalid`);
|
|
144
|
+
const item = message as Record<string, unknown>;
|
|
145
|
+
if (
|
|
146
|
+
typeof item.role !== "string" ||
|
|
147
|
+
!roles.has(item.role) ||
|
|
148
|
+
typeof item.text !== "string" ||
|
|
149
|
+
item.text.length > maxMessageChars ||
|
|
150
|
+
typeof item.hasImages !== "boolean"
|
|
151
|
+
)
|
|
152
|
+
throw new Error(`Session bridge message ${index + 1} is invalid`);
|
|
153
|
+
totalChars += item.text.length;
|
|
154
|
+
if (totalChars > maxTotalChars) throw new Error("Session bridge message text exceeds the 64 KiB limit");
|
|
155
|
+
return { role: item.role as BridgeMessage["role"], text: item.text, hasImages: item.hasImages };
|
|
156
|
+
});
|
|
157
|
+
const rawAttachments = packageValue.unresolvedAttachments;
|
|
158
|
+
if (!Array.isArray(rawAttachments)) throw new Error("Session bridge attachment markers are invalid");
|
|
159
|
+
const attachments = (rawAttachments as unknown[]).filter((item): item is string => typeof item === "string" && item.length <= 256);
|
|
160
|
+
if (attachments.length !== rawAttachments.length) throw new Error("Session bridge attachment markers are invalid");
|
|
161
|
+
const model = sourceValue.model;
|
|
162
|
+
const modelRecord = model !== null && typeof model === "object" && !Array.isArray(model) ? (model as Record<string, unknown>) : undefined;
|
|
163
|
+
const provider = typeof modelRecord?.provider === "string" ? modelRecord.provider : undefined;
|
|
164
|
+
const modelId = typeof modelRecord?.modelId === "string" ? modelRecord.modelId : undefined;
|
|
165
|
+
const normalizedModel = provider === undefined || modelId === undefined ? undefined : { provider, modelId };
|
|
166
|
+
const sessionId = sourceValue.sessionId;
|
|
167
|
+
const cwd = sourceValue.cwd;
|
|
168
|
+
return {
|
|
169
|
+
version: bridgeVersion,
|
|
170
|
+
source: { sessionId, cwd, ...(normalizedModel === undefined ? {} : { model: normalizedModel }) },
|
|
171
|
+
createdAt: typeof packageValue.createdAt === "string" ? packageValue.createdAt : "",
|
|
172
|
+
messageCount: normalized.length,
|
|
173
|
+
messages: normalized,
|
|
174
|
+
unresolvedAttachments: [...attachments],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function sessionMessages(manager: SessionManager): MessageInput[] {
|
|
179
|
+
return manager.buildSessionContext().messages.map((message) => {
|
|
180
|
+
const value = message as unknown as MessageInput;
|
|
181
|
+
return { role: value.role, content: value.content };
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function importedText(packageValue: BridgePackage): string {
|
|
186
|
+
const model = packageValue.source.model === undefined ? "unknown model" : `${packageValue.source.model.provider}/${packageValue.source.model.modelId}`;
|
|
187
|
+
const lines = [`Session handoff from ${packageValue.source.sessionId} (${packageValue.source.cwd})`, `Source model: ${model}`, ""];
|
|
188
|
+
for (const message of packageValue.messages) {
|
|
189
|
+
lines.push(`[${message.role}]`, message.text || "(no text)");
|
|
190
|
+
if (message.hasImages) lines.push("[unresolved image attachment]");
|
|
191
|
+
lines.push("");
|
|
192
|
+
}
|
|
193
|
+
if (packageValue.unresolvedAttachments.length > 0) lines.push(`Unresolved attachments: ${packageValue.unresolvedAttachments.join(", ")}`);
|
|
194
|
+
return lines.join("\n").trim();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export default {
|
|
198
|
+
name: "pi-session-bridge",
|
|
199
|
+
inject: ["piSession", "piPluginUi", "piTools"],
|
|
200
|
+
apply(context: Context) {
|
|
201
|
+
let latest: { direction: "export" | "import"; sessionId: string; messages: number; attachments: number; at: string } | undefined;
|
|
202
|
+
let latestPreview: { source: BridgeSource; preview: HandoffPreview; at: string } | undefined;
|
|
203
|
+
const exportCurrentSession = (): BridgePackage => {
|
|
204
|
+
const manager = context.get("piRuntime")?.session.sessionManager ?? context.piSession.manager;
|
|
205
|
+
const current = manager.buildSessionContext();
|
|
206
|
+
const model = current.model === null ? undefined : current.model;
|
|
207
|
+
return buildBridgePackage(
|
|
208
|
+
{ sessionId: manager.getSessionId(), cwd: manager.getCwd(), ...(model === undefined ? {} : { model }) },
|
|
209
|
+
sessionMessages(manager),
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
const unregisterExport = context.piTools.register(
|
|
213
|
+
defineTool({
|
|
214
|
+
name: "session_bridge_export",
|
|
215
|
+
label: "Export session handoff",
|
|
216
|
+
description: "Export the active conversation as a bounded, reviewable handoff package without modifying the source session.",
|
|
217
|
+
promptSnippet: "export the current session as a handoff package",
|
|
218
|
+
parameters: Type.Object({}),
|
|
219
|
+
execute(): Promise<AgentToolResult<BridgePackage>> {
|
|
220
|
+
const packageValue = exportCurrentSession();
|
|
221
|
+
latest = {
|
|
222
|
+
direction: "export",
|
|
223
|
+
sessionId: packageValue.source.sessionId,
|
|
224
|
+
messages: packageValue.messageCount,
|
|
225
|
+
attachments: packageValue.unresolvedAttachments.length,
|
|
226
|
+
at: packageValue.createdAt,
|
|
227
|
+
};
|
|
228
|
+
return Promise.resolve({ content: [{ type: "text", text: JSON.stringify(packageValue) }], details: packageValue });
|
|
229
|
+
},
|
|
230
|
+
}),
|
|
231
|
+
);
|
|
232
|
+
const unregisterPreview = context.piTools.register(
|
|
233
|
+
defineTool({
|
|
234
|
+
name: "session_bridge_preview",
|
|
235
|
+
label: "Preview session handoff",
|
|
236
|
+
description: "Create a bounded five-part handoff preview without creating a target session or changing the source session.",
|
|
237
|
+
promptSnippet: "preview the current session handoff before migration",
|
|
238
|
+
parameters: Type.Object({ package: Type.Optional(Type.String({ description: "Optional JSON produced by session_bridge_export" })) }),
|
|
239
|
+
execute(_toolCallId, params): Promise<AgentToolResult<{ source: BridgeSource; preview: HandoffPreview }>> {
|
|
240
|
+
const packageValue = params.package === undefined ? exportCurrentSession() : parseBridgePackage(params.package);
|
|
241
|
+
const preview = buildHandoffPreview(packageValue);
|
|
242
|
+
latestPreview = { source: packageValue.source, preview, at: new Date().toISOString() };
|
|
243
|
+
return Promise.resolve({
|
|
244
|
+
content: [{ type: "text", text: `Prepared a five-part handoff preview for ${packageValue.source.sessionId}.` }],
|
|
245
|
+
details: { source: packageValue.source, preview },
|
|
246
|
+
});
|
|
247
|
+
},
|
|
248
|
+
}),
|
|
249
|
+
);
|
|
250
|
+
const unregisterImport = context.piTools.register(
|
|
251
|
+
defineTool({
|
|
252
|
+
name: "session_bridge_import",
|
|
253
|
+
label: "Import session handoff",
|
|
254
|
+
description: "Validate a handoff package and append it to the current session as a visible context message; the source session remains untouched.",
|
|
255
|
+
promptSnippet: "import a validated session handoff package",
|
|
256
|
+
parameters: Type.Object({ package: Type.String({ description: "JSON produced by session_bridge_export" }) }),
|
|
257
|
+
execute(_toolCallId, params): Promise<AgentToolResult<{ imported: true; source: BridgeSource; messages: number }>> {
|
|
258
|
+
const packageValue = parseBridgePackage(params.package);
|
|
259
|
+
context.piSession.manager.appendCustomMessageEntry(bridgeType, importedText(packageValue), true, {
|
|
260
|
+
source: packageValue.source,
|
|
261
|
+
messageCount: packageValue.messageCount,
|
|
262
|
+
});
|
|
263
|
+
latest = {
|
|
264
|
+
direction: "import",
|
|
265
|
+
sessionId: packageValue.source.sessionId,
|
|
266
|
+
messages: packageValue.messageCount,
|
|
267
|
+
attachments: packageValue.unresolvedAttachments.length,
|
|
268
|
+
at: new Date().toISOString(),
|
|
269
|
+
};
|
|
270
|
+
return Promise.resolve({
|
|
271
|
+
content: [{ type: "text", text: `Imported ${packageValue.messageCount} handoff message(s).` }],
|
|
272
|
+
details: { imported: true, source: packageValue.source, messages: packageValue.messageCount },
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
}),
|
|
276
|
+
);
|
|
277
|
+
const disposePanel = context.piPluginUi.register({
|
|
278
|
+
id: "session-bridge-panel",
|
|
279
|
+
pluginId: "@pi-harness/core/plugins/session-bridge",
|
|
280
|
+
title: "Session Bridge",
|
|
281
|
+
description: "导出或导入可审查的会话交接包,不改写源会话树。",
|
|
282
|
+
icon: "⇄",
|
|
283
|
+
read: () => ({
|
|
284
|
+
latest: latest ?? null,
|
|
285
|
+
latestPreview: latestPreview ?? null,
|
|
286
|
+
currentPreview: buildHandoffPreview(exportCurrentSession()),
|
|
287
|
+
formatVersion: bridgeVersion,
|
|
288
|
+
maxMessages,
|
|
289
|
+
maxTotalChars,
|
|
290
|
+
}),
|
|
291
|
+
});
|
|
292
|
+
context.effect(() => () => {
|
|
293
|
+
unregisterExport();
|
|
294
|
+
unregisterImport();
|
|
295
|
+
unregisterPreview();
|
|
296
|
+
disposePanel();
|
|
297
|
+
});
|
|
298
|
+
},
|
|
299
|
+
};
|