@pi-harness/pi-harness 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/README.md +31 -7
- package/apps/web/dist/assets/index-CihATCjR.css +2 -0
- package/apps/web/dist/assets/index-NzapJoGa.js +20 -0
- package/apps/web/dist/assets/markdown-vendor-DUdMWn0M.js +66 -0
- package/apps/web/dist/assets/react-vendor-BD7-wQo9.js +9 -0
- package/apps/web/dist/icons/app/android-192.png +0 -0
- package/apps/web/dist/icons/app/android-512.png +0 -0
- package/apps/web/dist/icons/app/app-blue-512.png +0 -0
- package/apps/web/dist/icons/app/app-store-1024.png +0 -0
- package/apps/web/dist/icons/app/apple-touch-icon-180.png +0 -0
- package/apps/web/dist/icons/app/maskable-512.png +0 -0
- package/apps/web/dist/icons/favicon/favicon-16.png +0 -0
- package/apps/web/dist/icons/favicon/favicon-32.png +0 -0
- package/apps/web/dist/icons/favicon/favicon-48.png +0 -0
- package/apps/web/dist/icons/png-blue/pi-256.png +0 -0
- package/apps/web/dist/icons/png-blue/pi-512.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-1024.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-128.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-16.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-24.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-256.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-32.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-48.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-512.png +0 -0
- package/apps/web/dist/icons/png-ink/pi-64.png +0 -0
- package/apps/web/dist/icons/png-white/pi-1024.png +0 -0
- package/apps/web/dist/icons/png-white/pi-128.png +0 -0
- package/apps/web/dist/icons/png-white/pi-16.png +0 -0
- package/apps/web/dist/icons/png-white/pi-24.png +0 -0
- package/apps/web/dist/icons/png-white/pi-256.png +0 -0
- package/apps/web/dist/icons/png-white/pi-32.png +0 -0
- package/apps/web/dist/icons/png-white/pi-48.png +0 -0
- package/apps/web/dist/icons/png-white/pi-512.png +0 -0
- package/apps/web/dist/icons/png-white/pi-64.png +0 -0
- package/apps/web/dist/icons/social/og-1200x630.png +0 -0
- package/apps/web/dist/icons/svg/app-icon-blue.svg +13 -0
- package/apps/web/dist/icons/svg/app-icon-ink.svg +13 -0
- package/apps/web/dist/icons/svg/favicon.svg +10 -0
- package/apps/web/dist/icons/svg/lockup-horizontal.svg +13 -0
- package/apps/web/dist/icons/svg/mark-blue.svg +10 -0
- package/apps/web/dist/icons/svg/mark-compact.svg +10 -0
- package/apps/web/dist/icons/svg/mark-ink.svg +10 -0
- package/apps/web/dist/icons/svg/mark-white.svg +10 -0
- package/apps/web/dist/icons/svg/mark.svg +10 -0
- package/apps/web/dist/index.html +18 -6
- package/apps/web/dist/manifest.webmanifest +14 -0
- package/apps/web/index.html +14 -4
- package/apps/web/package.json +11 -9
- package/apps/web/profile/cordis.yml +222 -1
- package/apps/web/public/icons/app/android-192.png +0 -0
- package/apps/web/public/icons/app/android-512.png +0 -0
- package/apps/web/public/icons/app/app-blue-512.png +0 -0
- package/apps/web/public/icons/app/app-store-1024.png +0 -0
- package/apps/web/public/icons/app/apple-touch-icon-180.png +0 -0
- package/apps/web/public/icons/app/maskable-512.png +0 -0
- package/apps/web/public/icons/favicon/favicon-16.png +0 -0
- package/apps/web/public/icons/favicon/favicon-32.png +0 -0
- package/apps/web/public/icons/favicon/favicon-48.png +0 -0
- package/apps/web/public/icons/png-blue/pi-256.png +0 -0
- package/apps/web/public/icons/png-blue/pi-512.png +0 -0
- package/apps/web/public/icons/png-ink/pi-1024.png +0 -0
- package/apps/web/public/icons/png-ink/pi-128.png +0 -0
- package/apps/web/public/icons/png-ink/pi-16.png +0 -0
- package/apps/web/public/icons/png-ink/pi-24.png +0 -0
- package/apps/web/public/icons/png-ink/pi-256.png +0 -0
- package/apps/web/public/icons/png-ink/pi-32.png +0 -0
- package/apps/web/public/icons/png-ink/pi-48.png +0 -0
- package/apps/web/public/icons/png-ink/pi-512.png +0 -0
- package/apps/web/public/icons/png-ink/pi-64.png +0 -0
- package/apps/web/public/icons/png-white/pi-1024.png +0 -0
- package/apps/web/public/icons/png-white/pi-128.png +0 -0
- package/apps/web/public/icons/png-white/pi-16.png +0 -0
- package/apps/web/public/icons/png-white/pi-24.png +0 -0
- package/apps/web/public/icons/png-white/pi-256.png +0 -0
- package/apps/web/public/icons/png-white/pi-32.png +0 -0
- package/apps/web/public/icons/png-white/pi-48.png +0 -0
- package/apps/web/public/icons/png-white/pi-512.png +0 -0
- package/apps/web/public/icons/png-white/pi-64.png +0 -0
- package/apps/web/public/icons/social/og-1200x630.png +0 -0
- package/apps/web/public/icons/svg/app-icon-blue.svg +13 -0
- package/apps/web/public/icons/svg/app-icon-ink.svg +13 -0
- package/apps/web/public/icons/svg/favicon.svg +10 -0
- package/apps/web/public/icons/svg/lockup-horizontal.svg +13 -0
- package/apps/web/public/icons/svg/mark-blue.svg +10 -0
- package/apps/web/public/icons/svg/mark-compact.svg +10 -0
- package/apps/web/public/icons/svg/mark-ink.svg +10 -0
- package/apps/web/public/icons/svg/mark-white.svg +10 -0
- package/apps/web/public/icons/svg/mark.svg +10 -0
- package/apps/web/public/manifest.webmanifest +14 -0
- package/apps/web/server-dist/bin.js +19 -6
- package/apps/web/server-dist/bin.js.map +1 -1
- package/apps/web/src/command-palette.ts +28 -7
- package/apps/web/src/file-diff.ts +15 -10
- package/apps/web/src/main.ts +4 -1
- package/apps/web/src/runtime.css +17 -4
- package/apps/web/src/server/bin.ts +24 -7
- package/apps/web/src/style.css +2618 -8
- package/apps/web/src/tailwind.css +25 -0
- package/apps/web/tsconfig.build.json +5 -1
- package/apps/web/tsconfig.json +1 -1
- package/apps/web/vite.config.ts +20 -0
- package/package.json +29 -17
- package/packages/api-gateway/LICENSE +9 -0
- package/packages/api-gateway/dist/index.d.ts.map +1 -1
- package/packages/api-gateway/dist/index.js +1188 -42
- package/packages/api-gateway/dist/index.js.map +1 -1
- package/packages/api-gateway/dist/marketplace-entries/official/agent-teams.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/anchored-standard.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/annotation.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/archify.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/at-file.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/auto-mode.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/better-sidebar.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/browser-fetch.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/browser-session.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/canvas-draw.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/change-verifier.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cleaner.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cli-notifier.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/code2skill.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/colleague-skill.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/context-doctor.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/context.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cordis-group.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cordis-logger-console.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cordis-timer.json +16 -0
- package/packages/api-gateway/dist/marketplace-entries/official/cost-meter.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/dependency-checker.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/docker-sandbox.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/fail-logger.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/genui.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/git-time-capsule.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/graph-memory.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/history-compressor.json +33 -0
- package/packages/api-gateway/dist/marketplace-entries/official/hol-guard.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/i18n-pair.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/image-compressor.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/llm-verifier.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mcp-client.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mcp-panel.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/memory.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mirage-bridge.json +33 -0
- package/packages/api-gateway/dist/marketplace-entries/official/mock-server.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/modlens.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/module-search.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/obsidian-sync.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/openpets.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plan-execute.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-check.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-dev.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-finder.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-radar.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/plugin-stars.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/prompt-guard.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/prompt-library.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/readme-gen.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/recall-unread.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/reverse-skill.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/reviewer-bot.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/runtime-doctor.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/secure-audit.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-bookmarks.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-bridge.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-compare.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-export.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-insights.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/session-search.json +30 -0
- package/packages/api-gateway/dist/marketplace-entries/official/skill-catalog.json +31 -0
- package/packages/api-gateway/dist/marketplace-entries/official/skill-guard.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/sql-lens.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/synapse.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/tab-manager.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/taskboard.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/telemetry-blocker.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/test-harness.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/theme-studio.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/token-guard.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/turn-rewind.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/undo-savepoint.json +28 -0
- package/packages/api-gateway/dist/marketplace-entries/official/vision-toolkit.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/web-research.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/workspace-navigator.json +32 -0
- package/packages/api-gateway/dist/marketplace-entries/official/workspace-search.json +29 -0
- package/packages/api-gateway/dist/marketplace-entries/official/yaml-validator.json +29 -0
- package/packages/api-gateway/dist/marketplace.d.ts +40 -2
- package/packages/api-gateway/dist/marketplace.d.ts.map +1 -1
- package/packages/api-gateway/dist/marketplace.js +225 -19
- package/packages/api-gateway/dist/marketplace.js.map +1 -1
- package/packages/api-gateway/dist/workspaces.d.ts +8 -0
- package/packages/api-gateway/dist/workspaces.d.ts.map +1 -0
- package/packages/api-gateway/dist/workspaces.js +14 -0
- package/packages/api-gateway/dist/workspaces.js.map +1 -0
- package/packages/api-gateway/package.json +20 -10
- package/packages/api-gateway/scripts/copy-marketplace-entries.mjs +13 -0
- package/packages/api-gateway/src/index.ts +1258 -61
- package/packages/api-gateway/src/marketplace-entries/official/agent-teams.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/anchored-standard.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/annotation.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/archify.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/at-file.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/auto-mode.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/better-sidebar.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/browser-fetch.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/browser-session.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/canvas-draw.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/change-verifier.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/cleaner.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/cli-notifier.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/code2skill.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/colleague-skill.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/context-doctor.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/context.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/cordis-group.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cordis-logger-console.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cordis-timer.json +16 -0
- package/packages/api-gateway/src/marketplace-entries/official/cost-meter.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/dependency-checker.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/docker-sandbox.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/fail-logger.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/genui.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/git-time-capsule.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/graph-memory.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/history-compressor.json +33 -0
- package/packages/api-gateway/src/marketplace-entries/official/hol-guard.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/i18n-pair.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/image-compressor.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/llm-verifier.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/mcp-client.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/mcp-panel.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/memory.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/mirage-bridge.json +33 -0
- package/packages/api-gateway/src/marketplace-entries/official/mock-server.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/modlens.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/module-search.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/obsidian-sync.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/openpets.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/plan-execute.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-check.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-dev.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-finder.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-radar.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/plugin-stars.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/prompt-guard.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/prompt-library.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/readme-gen.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/recall-unread.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/reverse-skill.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/reviewer-bot.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/runtime-doctor.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/secure-audit.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-bookmarks.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-bridge.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-compare.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-export.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-insights.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/session-search.json +30 -0
- package/packages/api-gateway/src/marketplace-entries/official/skill-catalog.json +31 -0
- package/packages/api-gateway/src/marketplace-entries/official/skill-guard.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/sql-lens.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/synapse.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/tab-manager.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/taskboard.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/telemetry-blocker.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/test-harness.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/theme-studio.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/token-guard.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/turn-rewind.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/undo-savepoint.json +28 -0
- package/packages/api-gateway/src/marketplace-entries/official/vision-toolkit.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/web-research.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/workspace-navigator.json +32 -0
- package/packages/api-gateway/src/marketplace-entries/official/workspace-search.json +29 -0
- package/packages/api-gateway/src/marketplace-entries/official/yaml-validator.json +29 -0
- package/packages/api-gateway/src/marketplace.ts +267 -22
- package/packages/api-gateway/src/workspaces.ts +20 -0
- package/packages/api-gateway/test/index.test.ts +483 -33
- package/packages/api-gateway/test/marketplace.test.ts +282 -3
- package/packages/api-gateway/test/release-version.test.ts +71 -0
- package/packages/api-gateway/test/workspaces.test.ts +13 -0
- package/packages/api-gateway/tsconfig.build.json +1 -1
- package/packages/api-gateway/tsconfig.json +1 -1
- package/packages/bundle-web-app/LICENSE +9 -0
- package/packages/bundle-web-app/package.json +19 -9
- package/packages/bundle-web-app/tsconfig.build.json +1 -1
- package/packages/bundle-web-app/tsconfig.json +1 -1
- package/packages/cli/LICENSE +9 -0
- package/packages/cli/dist/args.d.ts.map +1 -1
- package/packages/cli/dist/args.js +16 -9
- package/packages/cli/dist/args.js.map +1 -1
- package/packages/cli/dist/bin.js +12 -3
- package/packages/cli/dist/bin.js.map +1 -1
- package/packages/cli/dist/main.d.ts +1 -0
- package/packages/cli/dist/main.d.ts.map +1 -1
- package/packages/cli/dist/main.js +49 -9
- package/packages/cli/dist/main.js.map +1 -1
- package/packages/cli/dist/node-stdio.d.ts +3 -1
- package/packages/cli/dist/node-stdio.d.ts.map +1 -1
- package/packages/cli/dist/node-stdio.js +91 -13
- package/packages/cli/dist/node-stdio.js.map +1 -1
- package/packages/cli/dist/relaunch.d.ts.map +1 -1
- package/packages/cli/dist/relaunch.js +23 -10
- package/packages/cli/dist/relaunch.js.map +1 -1
- package/packages/cli/package.json +18 -8
- package/packages/cli/src/args.ts +16 -10
- package/packages/cli/src/bin.ts +12 -3
- package/packages/cli/src/main.ts +54 -10
- package/packages/cli/src/node-stdio.ts +85 -13
- package/packages/cli/src/relaunch.ts +19 -6
- package/packages/cli/test/args.test.ts +22 -3
- package/packages/cli/test/binary.test.ts +58 -0
- package/packages/cli/test/broken-pipe.test.ts +32 -0
- package/packages/cli/test/cli.test.ts +57 -8
- package/packages/cli/test/node-stdio.test.ts +89 -0
- package/packages/cli/test/relaunch.test.ts +30 -2
- package/packages/cli/test/stdin-shutdown.test.ts +59 -0
- package/packages/cli/tsconfig.build.json +1 -3
- package/packages/cli/tsconfig.json +1 -4
- package/packages/client-web/LICENSE +9 -0
- package/packages/client-web/dist/annotation-ui.d.ts +11 -0
- package/packages/client-web/dist/annotation-ui.d.ts.map +1 -0
- package/packages/client-web/dist/annotation-ui.js +24 -0
- package/packages/client-web/dist/annotation-ui.js.map +1 -0
- package/packages/client-web/dist/browser-session-view.d.ts +7 -0
- package/packages/client-web/dist/browser-session-view.d.ts.map +1 -0
- package/packages/client-web/dist/browser-session-view.js +8 -0
- package/packages/client-web/dist/browser-session-view.js.map +1 -0
- package/packages/client-web/dist/control-room.d.ts +151 -6
- package/packages/client-web/dist/control-room.d.ts.map +1 -1
- package/packages/client-web/dist/control-room.js +156 -11
- package/packages/client-web/dist/control-room.js.map +1 -1
- package/packages/client-web/dist/design-contract.d.ts.map +1 -1
- package/packages/client-web/dist/design-contract.js +178 -19
- package/packages/client-web/dist/design-contract.js.map +1 -1
- package/packages/client-web/dist/index.d.ts +4 -1
- package/packages/client-web/dist/index.d.ts.map +1 -1
- package/packages/client-web/dist/index.js +11 -3
- package/packages/client-web/dist/index.js.map +1 -1
- package/packages/client-web/dist/markdown.d.ts +5 -0
- package/packages/client-web/dist/markdown.d.ts.map +1 -0
- package/packages/client-web/dist/markdown.js +20 -0
- package/packages/client-web/dist/markdown.js.map +1 -0
- package/packages/client-web/dist/marketplace-catalog.d.ts +3 -0
- package/packages/client-web/dist/marketplace-catalog.d.ts.map +1 -0
- package/packages/client-web/dist/marketplace-catalog.js +10 -0
- package/packages/client-web/dist/marketplace-catalog.js.map +1 -0
- package/packages/client-web/dist/marketplace-navigation.d.ts +19 -0
- package/packages/client-web/dist/marketplace-navigation.d.ts.map +1 -0
- package/packages/client-web/dist/marketplace-navigation.js +31 -0
- package/packages/client-web/dist/marketplace-navigation.js.map +1 -0
- package/packages/client-web/dist/message-content.d.ts +9 -0
- package/packages/client-web/dist/message-content.d.ts.map +1 -0
- package/packages/client-web/dist/message-content.js +54 -0
- package/packages/client-web/dist/message-content.js.map +1 -0
- package/packages/client-web/dist/plugin-navigation.d.ts +3 -0
- package/packages/client-web/dist/plugin-navigation.d.ts.map +1 -0
- package/packages/client-web/dist/plugin-navigation.js +10 -0
- package/packages/client-web/dist/plugin-navigation.js.map +1 -0
- package/packages/client-web/dist/plugin-search.d.ts +2 -0
- package/packages/client-web/dist/plugin-search.d.ts.map +1 -0
- package/packages/client-web/dist/plugin-search.js +7 -0
- package/packages/client-web/dist/plugin-search.js.map +1 -0
- package/packages/client-web/dist/plugin-stars-view.d.ts +12 -0
- package/packages/client-web/dist/plugin-stars-view.d.ts.map +1 -0
- package/packages/client-web/dist/plugin-stars-view.js +8 -0
- package/packages/client-web/dist/plugin-stars-view.js.map +1 -0
- package/packages/client-web/dist/prompt-completion.d.ts +13 -0
- package/packages/client-web/dist/prompt-completion.d.ts.map +1 -0
- package/packages/client-web/dist/prompt-completion.js +17 -0
- package/packages/client-web/dist/prompt-completion.js.map +1 -0
- package/packages/client-web/dist/react-room.d.ts +2 -1
- package/packages/client-web/dist/react-room.d.ts.map +1 -1
- package/packages/client-web/dist/react-room.js +2347 -93
- package/packages/client-web/dist/react-room.js.map +1 -1
- package/packages/client-web/dist/runtime-events.d.ts +4 -0
- package/packages/client-web/dist/runtime-events.d.ts.map +1 -0
- package/packages/client-web/dist/runtime-events.js +29 -0
- package/packages/client-web/dist/runtime-events.js.map +1 -0
- package/packages/client-web/package.json +19 -7
- package/packages/client-web/src/annotation-ui.ts +29 -0
- package/packages/client-web/src/browser-session-view.ts +13 -0
- package/packages/client-web/src/control-room.ts +359 -11
- package/packages/client-web/src/design-contract.ts +248 -26
- package/packages/client-web/src/index.ts +17 -4
- package/packages/client-web/src/markdown.tsx +22 -0
- package/packages/client-web/src/marketplace-catalog.ts +10 -0
- package/packages/client-web/src/marketplace-navigation.ts +46 -0
- package/packages/client-web/src/message-content.ts +51 -0
- package/packages/client-web/src/plugin-navigation.ts +9 -0
- package/packages/client-web/src/plugin-search.ts +5 -0
- package/packages/client-web/src/plugin-stars-view.ts +19 -0
- package/packages/client-web/src/prompt-completion.ts +24 -0
- package/packages/client-web/src/react-room.tsx +7360 -54
- package/packages/client-web/src/runtime-events.ts +29 -0
- package/packages/client-web/test/annotation-ui.test.ts +21 -0
- package/packages/client-web/test/browser-session-view.test.ts +17 -0
- package/packages/client-web/test/design-contract.test.ts +46 -1
- package/packages/client-web/test/marketplace-catalog.test.ts +52 -0
- package/packages/client-web/test/message-content.test.ts +43 -0
- package/packages/client-web/test/plugin-navigation.test.ts +16 -0
- package/packages/client-web/test/plugin-search.test.ts +22 -0
- package/packages/client-web/test/plugin-stars-view.test.ts +20 -0
- package/packages/client-web/test/prompt-completion.test.ts +21 -0
- package/packages/client-web/test/runtime-events.test.ts +28 -0
- package/packages/client-web/tsconfig.build.json +13 -1
- package/packages/client-web/tsconfig.json +11 -1
- package/packages/core/LICENSE +9 -0
- package/packages/core/dist/boot.d.ts.map +1 -1
- package/packages/core/dist/boot.js +42 -3
- package/packages/core/dist/boot.js.map +1 -1
- package/packages/core/dist/config.d.ts +2 -0
- package/packages/core/dist/config.d.ts.map +1 -0
- package/packages/core/dist/config.js +8 -0
- package/packages/core/dist/config.js.map +1 -0
- package/packages/core/dist/http.d.ts +8 -0
- package/packages/core/dist/http.d.ts.map +1 -0
- package/packages/core/dist/http.js +27 -0
- package/packages/core/dist/http.js.map +1 -0
- package/packages/core/dist/index.d.ts +2 -0
- package/packages/core/dist/index.d.ts.map +1 -1
- package/packages/core/dist/index.js +2 -0
- package/packages/core/dist/index.js.map +1 -1
- package/packages/core/dist/plugins/agent-teams.d.ts +17 -0
- package/packages/core/dist/plugins/agent-teams.d.ts.map +1 -0
- package/packages/core/dist/plugins/agent-teams.js +298 -0
- package/packages/core/dist/plugins/agent-teams.js.map +1 -0
- package/packages/core/dist/plugins/anchored-standard.d.ts +14 -0
- package/packages/core/dist/plugins/anchored-standard.d.ts.map +1 -0
- package/packages/core/dist/plugins/anchored-standard.js +84 -0
- package/packages/core/dist/plugins/anchored-standard.js.map +1 -0
- package/packages/core/dist/plugins/annotation.d.ts +18 -0
- package/packages/core/dist/plugins/annotation.d.ts.map +1 -0
- package/packages/core/dist/plugins/annotation.js +94 -0
- package/packages/core/dist/plugins/annotation.js.map +1 -0
- package/packages/core/dist/plugins/archify.d.ts +23 -0
- package/packages/core/dist/plugins/archify.d.ts.map +1 -0
- package/packages/core/dist/plugins/archify.js +98 -0
- package/packages/core/dist/plugins/archify.js.map +1 -0
- package/packages/core/dist/plugins/at-file.d.ts +8 -0
- package/packages/core/dist/plugins/at-file.d.ts.map +1 -0
- package/packages/core/dist/plugins/at-file.js +52 -0
- package/packages/core/dist/plugins/at-file.js.map +1 -0
- package/packages/core/dist/plugins/auto-mode.d.ts +15 -0
- package/packages/core/dist/plugins/auto-mode.d.ts.map +1 -0
- package/packages/core/dist/plugins/auto-mode.js +114 -0
- package/packages/core/dist/plugins/auto-mode.js.map +1 -0
- package/packages/core/dist/plugins/better-sidebar.d.ts +37 -0
- package/packages/core/dist/plugins/better-sidebar.d.ts.map +1 -0
- package/packages/core/dist/plugins/better-sidebar.js +89 -0
- package/packages/core/dist/plugins/better-sidebar.js.map +1 -0
- package/packages/core/dist/plugins/browser-fetch.d.ts +14 -0
- package/packages/core/dist/plugins/browser-fetch.d.ts.map +1 -0
- package/packages/core/dist/plugins/browser-fetch.js +167 -0
- package/packages/core/dist/plugins/browser-fetch.js.map +1 -0
- package/packages/core/dist/plugins/browser-session.d.ts +14 -0
- package/packages/core/dist/plugins/browser-session.d.ts.map +1 -0
- package/packages/core/dist/plugins/browser-session.js +265 -0
- package/packages/core/dist/plugins/browser-session.js.map +1 -0
- package/packages/core/dist/plugins/canvas-draw.d.ts +8 -0
- package/packages/core/dist/plugins/canvas-draw.d.ts.map +1 -0
- package/packages/core/dist/plugins/canvas-draw.js +88 -0
- package/packages/core/dist/plugins/canvas-draw.js.map +1 -0
- package/packages/core/dist/plugins/change-verifier.d.ts +8 -0
- package/packages/core/dist/plugins/change-verifier.d.ts.map +1 -0
- package/packages/core/dist/plugins/change-verifier.js +67 -0
- package/packages/core/dist/plugins/change-verifier.js.map +1 -0
- package/packages/core/dist/plugins/cleaner.d.ts +8 -0
- package/packages/core/dist/plugins/cleaner.d.ts.map +1 -0
- package/packages/core/dist/plugins/cleaner.js +56 -0
- package/packages/core/dist/plugins/cleaner.js.map +1 -0
- package/packages/core/dist/plugins/cli-notifier.d.ts +15 -0
- package/packages/core/dist/plugins/cli-notifier.d.ts.map +1 -0
- package/packages/core/dist/plugins/cli-notifier.js +110 -0
- package/packages/core/dist/plugins/cli-notifier.js.map +1 -0
- package/packages/core/dist/plugins/code2skill.d.ts +8 -0
- package/packages/core/dist/plugins/code2skill.d.ts.map +1 -0
- package/packages/core/dist/plugins/code2skill.js +95 -0
- package/packages/core/dist/plugins/code2skill.js.map +1 -0
- package/packages/core/dist/plugins/colleague-skill.d.ts +27 -0
- package/packages/core/dist/plugins/colleague-skill.d.ts.map +1 -0
- package/packages/core/dist/plugins/colleague-skill.js +99 -0
- package/packages/core/dist/plugins/colleague-skill.js.map +1 -0
- package/packages/core/dist/plugins/context-doctor.d.ts +30 -0
- package/packages/core/dist/plugins/context-doctor.d.ts.map +1 -0
- package/packages/core/dist/plugins/context-doctor.js +95 -0
- package/packages/core/dist/plugins/context-doctor.js.map +1 -0
- package/packages/core/dist/plugins/context.d.ts +8 -0
- package/packages/core/dist/plugins/context.d.ts.map +1 -0
- package/packages/core/dist/plugins/context.js +87 -0
- package/packages/core/dist/plugins/context.js.map +1 -0
- package/packages/core/dist/plugins/cost-meter.d.ts +32 -0
- package/packages/core/dist/plugins/cost-meter.d.ts.map +1 -0
- package/packages/core/dist/plugins/cost-meter.js +204 -0
- package/packages/core/dist/plugins/cost-meter.js.map +1 -0
- package/packages/core/dist/plugins/dependency-checker.d.ts +27 -0
- package/packages/core/dist/plugins/dependency-checker.d.ts.map +1 -0
- package/packages/core/dist/plugins/dependency-checker.js +221 -0
- package/packages/core/dist/plugins/dependency-checker.js.map +1 -0
- package/packages/core/dist/plugins/docker-sandbox.d.ts +8 -0
- package/packages/core/dist/plugins/docker-sandbox.d.ts.map +1 -0
- package/packages/core/dist/plugins/docker-sandbox.js +102 -0
- package/packages/core/dist/plugins/docker-sandbox.js.map +1 -0
- package/packages/core/dist/plugins/fail-logger.d.ts +8 -0
- package/packages/core/dist/plugins/fail-logger.d.ts.map +1 -0
- package/packages/core/dist/plugins/fail-logger.js +51 -0
- package/packages/core/dist/plugins/fail-logger.js.map +1 -0
- package/packages/core/dist/plugins/genui.d.ts +8 -0
- package/packages/core/dist/plugins/genui.d.ts.map +1 -0
- package/packages/core/dist/plugins/genui.js +79 -0
- package/packages/core/dist/plugins/genui.js.map +1 -0
- package/packages/core/dist/plugins/git-time-capsule.d.ts +9 -0
- package/packages/core/dist/plugins/git-time-capsule.d.ts.map +1 -0
- package/packages/core/dist/plugins/git-time-capsule.js +90 -0
- package/packages/core/dist/plugins/git-time-capsule.js.map +1 -0
- package/packages/core/dist/plugins/graph-memory.d.ts +16 -0
- package/packages/core/dist/plugins/graph-memory.d.ts.map +1 -0
- package/packages/core/dist/plugins/graph-memory.js +382 -0
- package/packages/core/dist/plugins/graph-memory.js.map +1 -0
- package/packages/core/dist/plugins/history-compressor.d.ts +15 -0
- package/packages/core/dist/plugins/history-compressor.d.ts.map +1 -0
- package/packages/core/dist/plugins/history-compressor.js +80 -0
- package/packages/core/dist/plugins/history-compressor.js.map +1 -0
- package/packages/core/dist/plugins/hol-guard.d.ts +29 -0
- package/packages/core/dist/plugins/hol-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/hol-guard.js +139 -0
- package/packages/core/dist/plugins/hol-guard.js.map +1 -0
- package/packages/core/dist/plugins/i18n-pair.d.ts +8 -0
- package/packages/core/dist/plugins/i18n-pair.d.ts.map +1 -0
- package/packages/core/dist/plugins/i18n-pair.js +76 -0
- package/packages/core/dist/plugins/i18n-pair.js.map +1 -0
- package/packages/core/dist/plugins/image-compressor.d.ts +8 -0
- package/packages/core/dist/plugins/image-compressor.d.ts.map +1 -0
- package/packages/core/dist/plugins/image-compressor.js +150 -0
- package/packages/core/dist/plugins/image-compressor.js.map +1 -0
- package/packages/core/dist/plugins/llm-verifier.d.ts +42 -0
- package/packages/core/dist/plugins/llm-verifier.d.ts.map +1 -0
- package/packages/core/dist/plugins/llm-verifier.js +128 -0
- package/packages/core/dist/plugins/llm-verifier.js.map +1 -0
- package/packages/core/dist/plugins/mcp-client.d.ts +19 -0
- package/packages/core/dist/plugins/mcp-client.d.ts.map +1 -0
- package/packages/core/dist/plugins/mcp-client.js +534 -0
- package/packages/core/dist/plugins/mcp-client.js.map +1 -0
- package/packages/core/dist/plugins/mcp-panel.d.ts +14 -0
- package/packages/core/dist/plugins/mcp-panel.d.ts.map +1 -0
- package/packages/core/dist/plugins/mcp-panel.js +180 -0
- package/packages/core/dist/plugins/mcp-panel.js.map +1 -0
- package/packages/core/dist/plugins/memory.d.ts +15 -0
- package/packages/core/dist/plugins/memory.d.ts.map +1 -0
- package/packages/core/dist/plugins/memory.js +161 -0
- package/packages/core/dist/plugins/memory.js.map +1 -0
- package/packages/core/dist/plugins/mirage-bridge.d.ts +23 -0
- package/packages/core/dist/plugins/mirage-bridge.d.ts.map +1 -0
- package/packages/core/dist/plugins/mirage-bridge.js +149 -0
- package/packages/core/dist/plugins/mirage-bridge.js.map +1 -0
- package/packages/core/dist/plugins/mock-server.d.ts +22 -0
- package/packages/core/dist/plugins/mock-server.d.ts.map +1 -0
- package/packages/core/dist/plugins/mock-server.js +149 -0
- package/packages/core/dist/plugins/mock-server.js.map +1 -0
- package/packages/core/dist/plugins/model.d.ts +1 -1
- package/packages/core/dist/plugins/model.d.ts.map +1 -1
- package/packages/core/dist/plugins/model.js +3 -1
- package/packages/core/dist/plugins/model.js.map +1 -1
- package/packages/core/dist/plugins/models.d.ts.map +1 -1
- package/packages/core/dist/plugins/models.js +5 -2
- package/packages/core/dist/plugins/models.js.map +1 -1
- package/packages/core/dist/plugins/modlens.d.ts +8 -0
- package/packages/core/dist/plugins/modlens.d.ts.map +1 -0
- package/packages/core/dist/plugins/modlens.js +63 -0
- package/packages/core/dist/plugins/modlens.js.map +1 -0
- package/packages/core/dist/plugins/module-search.d.ts +27 -0
- package/packages/core/dist/plugins/module-search.d.ts.map +1 -0
- package/packages/core/dist/plugins/module-search.js +174 -0
- package/packages/core/dist/plugins/module-search.js.map +1 -0
- package/packages/core/dist/plugins/obsidian-sync.d.ts +14 -0
- package/packages/core/dist/plugins/obsidian-sync.d.ts.map +1 -0
- package/packages/core/dist/plugins/obsidian-sync.js +79 -0
- package/packages/core/dist/plugins/obsidian-sync.js.map +1 -0
- package/packages/core/dist/plugins/openpets.d.ts +14 -0
- package/packages/core/dist/plugins/openpets.d.ts.map +1 -0
- package/packages/core/dist/plugins/openpets.js +99 -0
- package/packages/core/dist/plugins/openpets.js.map +1 -0
- package/packages/core/dist/plugins/plan-execute.d.ts +8 -0
- package/packages/core/dist/plugins/plan-execute.d.ts.map +1 -0
- package/packages/core/dist/plugins/plan-execute.js +70 -0
- package/packages/core/dist/plugins/plan-execute.js.map +1 -0
- package/packages/core/dist/plugins/plugin-check.d.ts +38 -0
- package/packages/core/dist/plugins/plugin-check.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-check.js +227 -0
- package/packages/core/dist/plugins/plugin-check.js.map +1 -0
- package/packages/core/dist/plugins/plugin-dev.d.ts +8 -0
- package/packages/core/dist/plugins/plugin-dev.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-dev.js +44 -0
- package/packages/core/dist/plugins/plugin-dev.js.map +1 -0
- package/packages/core/dist/plugins/plugin-finder.d.ts +16 -0
- package/packages/core/dist/plugins/plugin-finder.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-finder.js +98 -0
- package/packages/core/dist/plugins/plugin-finder.js.map +1 -0
- package/packages/core/dist/plugins/plugin-radar.d.ts +29 -0
- package/packages/core/dist/plugins/plugin-radar.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-radar.js +146 -0
- package/packages/core/dist/plugins/plugin-radar.js.map +1 -0
- package/packages/core/dist/plugins/plugin-stars.d.ts +45 -0
- package/packages/core/dist/plugins/plugin-stars.d.ts.map +1 -0
- package/packages/core/dist/plugins/plugin-stars.js +165 -0
- package/packages/core/dist/plugins/plugin-stars.js.map +1 -0
- package/packages/core/dist/plugins/prompt-guard.d.ts +8 -0
- package/packages/core/dist/plugins/prompt-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/prompt-guard.js +114 -0
- package/packages/core/dist/plugins/prompt-guard.js.map +1 -0
- package/packages/core/dist/plugins/prompt-library.d.ts +25 -0
- package/packages/core/dist/plugins/prompt-library.d.ts.map +1 -0
- package/packages/core/dist/plugins/prompt-library.js +142 -0
- package/packages/core/dist/plugins/prompt-library.js.map +1 -0
- package/packages/core/dist/plugins/readme-gen.d.ts +25 -0
- package/packages/core/dist/plugins/readme-gen.d.ts.map +1 -0
- package/packages/core/dist/plugins/readme-gen.js +139 -0
- package/packages/core/dist/plugins/readme-gen.js.map +1 -0
- package/packages/core/dist/plugins/recall-unread.d.ts +24 -0
- package/packages/core/dist/plugins/recall-unread.d.ts.map +1 -0
- package/packages/core/dist/plugins/recall-unread.js +124 -0
- package/packages/core/dist/plugins/recall-unread.js.map +1 -0
- package/packages/core/dist/plugins/resources.d.ts +1 -0
- package/packages/core/dist/plugins/resources.d.ts.map +1 -1
- package/packages/core/dist/plugins/resources.js +31 -22
- package/packages/core/dist/plugins/resources.js.map +1 -1
- package/packages/core/dist/plugins/reverse-skill.d.ts +23 -0
- package/packages/core/dist/plugins/reverse-skill.d.ts.map +1 -0
- package/packages/core/dist/plugins/reverse-skill.js +60 -0
- package/packages/core/dist/plugins/reverse-skill.js.map +1 -0
- package/packages/core/dist/plugins/reviewer-bot.d.ts +14 -0
- package/packages/core/dist/plugins/reviewer-bot.d.ts.map +1 -0
- package/packages/core/dist/plugins/reviewer-bot.js +133 -0
- package/packages/core/dist/plugins/reviewer-bot.js.map +1 -0
- package/packages/core/dist/plugins/runtime-doctor.d.ts +33 -0
- package/packages/core/dist/plugins/runtime-doctor.d.ts.map +1 -0
- package/packages/core/dist/plugins/runtime-doctor.js +114 -0
- package/packages/core/dist/plugins/runtime-doctor.js.map +1 -0
- package/packages/core/dist/plugins/runtime.d.ts.map +1 -1
- package/packages/core/dist/plugins/runtime.js +63 -14
- package/packages/core/dist/plugins/runtime.js.map +1 -1
- package/packages/core/dist/plugins/secure-audit.d.ts +31 -0
- package/packages/core/dist/plugins/secure-audit.d.ts.map +1 -0
- package/packages/core/dist/plugins/secure-audit.js +121 -0
- package/packages/core/dist/plugins/secure-audit.js.map +1 -0
- package/packages/core/dist/plugins/session-bookmarks.d.ts +15 -0
- package/packages/core/dist/plugins/session-bookmarks.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-bookmarks.js +87 -0
- package/packages/core/dist/plugins/session-bookmarks.js.map +1 -0
- package/packages/core/dist/plugins/session-bridge.d.ts +44 -0
- package/packages/core/dist/plugins/session-bridge.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-bridge.js +265 -0
- package/packages/core/dist/plugins/session-bridge.js.map +1 -0
- package/packages/core/dist/plugins/session-compare.d.ts +33 -0
- package/packages/core/dist/plugins/session-compare.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-compare.js +150 -0
- package/packages/core/dist/plugins/session-compare.js.map +1 -0
- package/packages/core/dist/plugins/session-export.d.ts +9 -0
- package/packages/core/dist/plugins/session-export.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-export.js +93 -0
- package/packages/core/dist/plugins/session-export.js.map +1 -0
- package/packages/core/dist/plugins/session-insights.d.ts +8 -0
- package/packages/core/dist/plugins/session-insights.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-insights.js +47 -0
- package/packages/core/dist/plugins/session-insights.js.map +1 -0
- package/packages/core/dist/plugins/session-search.d.ts +20 -0
- package/packages/core/dist/plugins/session-search.d.ts.map +1 -0
- package/packages/core/dist/plugins/session-search.js +122 -0
- package/packages/core/dist/plugins/session-search.js.map +1 -0
- package/packages/core/dist/plugins/session.d.ts.map +1 -1
- package/packages/core/dist/plugins/session.js +4 -2
- package/packages/core/dist/plugins/session.js.map +1 -1
- package/packages/core/dist/plugins/skill-catalog.d.ts +26 -0
- package/packages/core/dist/plugins/skill-catalog.d.ts.map +1 -0
- package/packages/core/dist/plugins/skill-catalog.js +97 -0
- package/packages/core/dist/plugins/skill-catalog.js.map +1 -0
- package/packages/core/dist/plugins/skill-guard.d.ts +26 -0
- package/packages/core/dist/plugins/skill-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/skill-guard.js +139 -0
- package/packages/core/dist/plugins/skill-guard.js.map +1 -0
- package/packages/core/dist/plugins/sql-lens.d.ts +8 -0
- package/packages/core/dist/plugins/sql-lens.d.ts.map +1 -0
- package/packages/core/dist/plugins/sql-lens.js +85 -0
- package/packages/core/dist/plugins/sql-lens.js.map +1 -0
- package/packages/core/dist/plugins/stdio.d.ts +1 -1
- package/packages/core/dist/plugins/stdio.d.ts.map +1 -1
- package/packages/core/dist/plugins/stdio.js +3 -1
- package/packages/core/dist/plugins/stdio.js.map +1 -1
- package/packages/core/dist/plugins/synapse.d.ts +38 -0
- package/packages/core/dist/plugins/synapse.d.ts.map +1 -0
- package/packages/core/dist/plugins/synapse.js +93 -0
- package/packages/core/dist/plugins/synapse.js.map +1 -0
- package/packages/core/dist/plugins/tab-manager.d.ts +8 -0
- package/packages/core/dist/plugins/tab-manager.d.ts.map +1 -0
- package/packages/core/dist/plugins/tab-manager.js +135 -0
- package/packages/core/dist/plugins/tab-manager.js.map +1 -0
- package/packages/core/dist/plugins/taskboard.d.ts +15 -0
- package/packages/core/dist/plugins/taskboard.d.ts.map +1 -0
- package/packages/core/dist/plugins/taskboard.js +347 -0
- package/packages/core/dist/plugins/taskboard.js.map +1 -0
- package/packages/core/dist/plugins/telemetry-blocker.d.ts +8 -0
- package/packages/core/dist/plugins/telemetry-blocker.d.ts.map +1 -0
- package/packages/core/dist/plugins/telemetry-blocker.js +57 -0
- package/packages/core/dist/plugins/telemetry-blocker.js.map +1 -0
- package/packages/core/dist/plugins/test-harness.d.ts +8 -0
- package/packages/core/dist/plugins/test-harness.d.ts.map +1 -0
- package/packages/core/dist/plugins/test-harness.js +64 -0
- package/packages/core/dist/plugins/test-harness.js.map +1 -0
- package/packages/core/dist/plugins/theme-studio.d.ts +29 -0
- package/packages/core/dist/plugins/theme-studio.d.ts.map +1 -0
- package/packages/core/dist/plugins/theme-studio.js +141 -0
- package/packages/core/dist/plugins/theme-studio.js.map +1 -0
- package/packages/core/dist/plugins/token-guard.d.ts +15 -0
- package/packages/core/dist/plugins/token-guard.d.ts.map +1 -0
- package/packages/core/dist/plugins/token-guard.js +78 -0
- package/packages/core/dist/plugins/token-guard.js.map +1 -0
- package/packages/core/dist/plugins/tools.d.ts.map +1 -1
- package/packages/core/dist/plugins/tools.js +5 -2
- package/packages/core/dist/plugins/tools.js.map +1 -1
- package/packages/core/dist/plugins/turn-rewind.d.ts +19 -0
- package/packages/core/dist/plugins/turn-rewind.d.ts.map +1 -0
- package/packages/core/dist/plugins/turn-rewind.js +74 -0
- package/packages/core/dist/plugins/turn-rewind.js.map +1 -0
- package/packages/core/dist/plugins/undo-savepoint.d.ts +17 -0
- package/packages/core/dist/plugins/undo-savepoint.d.ts.map +1 -0
- package/packages/core/dist/plugins/undo-savepoint.js +247 -0
- package/packages/core/dist/plugins/undo-savepoint.js.map +1 -0
- package/packages/core/dist/plugins/vision-toolkit.d.ts +17 -0
- package/packages/core/dist/plugins/vision-toolkit.d.ts.map +1 -0
- package/packages/core/dist/plugins/vision-toolkit.js +145 -0
- package/packages/core/dist/plugins/vision-toolkit.js.map +1 -0
- package/packages/core/dist/plugins/web-research.d.ts +17 -0
- package/packages/core/dist/plugins/web-research.d.ts.map +1 -0
- package/packages/core/dist/plugins/web-research.js +275 -0
- package/packages/core/dist/plugins/web-research.js.map +1 -0
- package/packages/core/dist/plugins/workspace-navigator.d.ts +36 -0
- package/packages/core/dist/plugins/workspace-navigator.d.ts.map +1 -0
- package/packages/core/dist/plugins/workspace-navigator.js +150 -0
- package/packages/core/dist/plugins/workspace-navigator.js.map +1 -0
- package/packages/core/dist/plugins/workspace-search.d.ts +8 -0
- package/packages/core/dist/plugins/workspace-search.d.ts.map +1 -0
- package/packages/core/dist/plugins/workspace-search.js +134 -0
- package/packages/core/dist/plugins/workspace-search.js.map +1 -0
- package/packages/core/dist/plugins/yaml-validator.d.ts +8 -0
- package/packages/core/dist/plugins/yaml-validator.d.ts.map +1 -0
- package/packages/core/dist/plugins/yaml-validator.js +94 -0
- package/packages/core/dist/plugins/yaml-validator.js.map +1 -0
- package/packages/core/dist/profile.d.ts +1 -0
- package/packages/core/dist/profile.d.ts.map +1 -1
- package/packages/core/dist/profile.js +3 -0
- package/packages/core/dist/profile.js.map +1 -1
- package/packages/core/dist/runtime.d.ts.map +1 -1
- package/packages/core/dist/runtime.js +13 -4
- package/packages/core/dist/runtime.js.map +1 -1
- package/packages/core/dist/services.d.ts +55 -0
- package/packages/core/dist/services.d.ts.map +1 -1
- package/packages/core/dist/services.js +58 -2
- package/packages/core/dist/services.js.map +1 -1
- package/packages/core/dist/stdio.d.ts +13 -2
- package/packages/core/dist/stdio.d.ts.map +1 -1
- package/packages/core/dist/stdio.js +75 -9
- package/packages/core/dist/stdio.js.map +1 -1
- package/packages/core/dist/workspace-path.d.ts +12 -0
- package/packages/core/dist/workspace-path.d.ts.map +1 -0
- package/packages/core/dist/workspace-path.js +62 -0
- package/packages/core/dist/workspace-path.js.map +1 -0
- package/packages/core/package.json +18 -8
- package/packages/core/profiles/default/cordis.yml +85 -0
- package/packages/core/profiles/development/cordis.yml +1 -1
- package/packages/core/src/boot.ts +38 -2
- package/packages/core/src/config.ts +5 -0
- package/packages/core/src/http.ts +32 -0
- package/packages/core/src/index.ts +2 -0
- package/packages/core/src/plugins/agent-teams.ts +291 -0
- package/packages/core/src/plugins/anchored-standard.ts +88 -0
- package/packages/core/src/plugins/annotation.ts +106 -0
- package/packages/core/src/plugins/archify.ts +124 -0
- package/packages/core/src/plugins/at-file.ts +54 -0
- package/packages/core/src/plugins/auto-mode.ts +123 -0
- package/packages/core/src/plugins/better-sidebar.ts +117 -0
- package/packages/core/src/plugins/browser-fetch.ts +171 -0
- package/packages/core/src/plugins/browser-session.ts +287 -0
- package/packages/core/src/plugins/canvas-draw.ts +90 -0
- package/packages/core/src/plugins/change-verifier.ts +79 -0
- package/packages/core/src/plugins/cleaner.ts +61 -0
- package/packages/core/src/plugins/cli-notifier.ts +125 -0
- package/packages/core/src/plugins/code2skill.ts +96 -0
- package/packages/core/src/plugins/colleague-skill.ts +122 -0
- package/packages/core/src/plugins/context-doctor.ts +117 -0
- package/packages/core/src/plugins/context.ts +102 -0
- package/packages/core/src/plugins/cost-meter.ts +231 -0
- package/packages/core/src/plugins/dependency-checker.ts +241 -0
- package/packages/core/src/plugins/docker-sandbox.ts +100 -0
- package/packages/core/src/plugins/fail-logger.ts +51 -0
- package/packages/core/src/plugins/genui.ts +88 -0
- package/packages/core/src/plugins/git-time-capsule.ts +97 -0
- package/packages/core/src/plugins/graph-memory.ts +394 -0
- package/packages/core/src/plugins/history-compressor.ts +81 -0
- package/packages/core/src/plugins/hol-guard.ts +153 -0
- package/packages/core/src/plugins/i18n-pair.ts +82 -0
- package/packages/core/src/plugins/image-compressor.ts +144 -0
- package/packages/core/src/plugins/llm-verifier.ts +164 -0
- package/packages/core/src/plugins/mcp-client.ts +559 -0
- package/packages/core/src/plugins/mcp-panel.ts +190 -0
- package/packages/core/src/plugins/memory.ts +176 -0
- package/packages/core/src/plugins/mirage-bridge.ts +179 -0
- package/packages/core/src/plugins/mock-server.ts +158 -0
- package/packages/core/src/plugins/model.ts +3 -1
- package/packages/core/src/plugins/models.ts +5 -2
- package/packages/core/src/plugins/modlens.ts +63 -0
- package/packages/core/src/plugins/module-search.ts +201 -0
- package/packages/core/src/plugins/obsidian-sync.ts +83 -0
- package/packages/core/src/plugins/openpets.ts +109 -0
- package/packages/core/src/plugins/plan-execute.ts +76 -0
- package/packages/core/src/plugins/plugin-check.ts +232 -0
- package/packages/core/src/plugins/plugin-dev.ts +47 -0
- package/packages/core/src/plugins/plugin-finder.ts +108 -0
- package/packages/core/src/plugins/plugin-radar.ts +179 -0
- package/packages/core/src/plugins/plugin-stars.ts +205 -0
- package/packages/core/src/plugins/prompt-guard.ts +122 -0
- package/packages/core/src/plugins/prompt-library.ts +165 -0
- package/packages/core/src/plugins/readme-gen.ts +147 -0
- package/packages/core/src/plugins/recall-unread.ts +142 -0
- package/packages/core/src/plugins/resources.ts +28 -21
- package/packages/core/src/plugins/reverse-skill.ts +79 -0
- package/packages/core/src/plugins/reviewer-bot.ts +146 -0
- package/packages/core/src/plugins/runtime-doctor.ts +137 -0
- package/packages/core/src/plugins/runtime.ts +61 -14
- package/packages/core/src/plugins/secure-audit.ts +146 -0
- package/packages/core/src/plugins/session-bookmarks.ts +89 -0
- package/packages/core/src/plugins/session-bridge.ts +299 -0
- package/packages/core/src/plugins/session-compare.ts +180 -0
- package/packages/core/src/plugins/session-export.ts +99 -0
- package/packages/core/src/plugins/session-insights.ts +47 -0
- package/packages/core/src/plugins/session-search.ts +126 -0
- package/packages/core/src/plugins/session.ts +4 -2
- package/packages/core/src/plugins/skill-catalog.ts +117 -0
- package/packages/core/src/plugins/skill-guard.ts +152 -0
- package/packages/core/src/plugins/sql-lens.ts +92 -0
- package/packages/core/src/plugins/stdio.ts +3 -1
- package/packages/core/src/plugins/synapse.ts +130 -0
- package/packages/core/src/plugins/tab-manager.ts +135 -0
- package/packages/core/src/plugins/taskboard.ts +412 -0
- package/packages/core/src/plugins/telemetry-blocker.ts +62 -0
- package/packages/core/src/plugins/test-harness.ts +67 -0
- package/packages/core/src/plugins/theme-studio.ts +165 -0
- package/packages/core/src/plugins/token-guard.ts +84 -0
- package/packages/core/src/plugins/tools.ts +5 -2
- package/packages/core/src/plugins/turn-rewind.ts +86 -0
- package/packages/core/src/plugins/undo-savepoint.ts +284 -0
- package/packages/core/src/plugins/vision-toolkit.ts +153 -0
- package/packages/core/src/plugins/web-research.ts +289 -0
- package/packages/core/src/plugins/workspace-navigator.ts +164 -0
- package/packages/core/src/plugins/workspace-search.ts +139 -0
- package/packages/core/src/plugins/yaml-validator.ts +97 -0
- package/packages/core/src/profile.ts +3 -0
- package/packages/core/src/runtime.ts +11 -4
- package/packages/core/src/services.ts +110 -3
- package/packages/core/src/stdio.ts +79 -9
- package/packages/core/src/workspace-path.ts +69 -0
- package/packages/core/test/agent-teams.test.ts +24 -0
- package/packages/core/test/archify.test.ts +33 -0
- package/packages/core/test/better-sidebar.test.ts +125 -0
- package/packages/core/test/boot.test.ts +49 -6
- package/packages/core/test/colleague-skill.test.ts +74 -0
- package/packages/core/test/config.test.ts +121 -0
- package/packages/core/test/context-doctor.test.ts +32 -0
- package/packages/core/test/dependency-checker.test.ts +60 -0
- package/packages/core/test/git-time-capsule.test.ts +115 -0
- package/packages/core/test/http.test.ts +34 -0
- package/packages/core/test/llm-verifier.test.ts +72 -0
- package/packages/core/test/mirage-bridge.test.ts +54 -0
- package/packages/core/test/module-search.test.ts +78 -0
- package/packages/core/test/plugin-check.test.ts +16 -0
- package/packages/core/test/plugin-stars.test.ts +55 -0
- package/packages/core/test/profiles.integration.test.ts +49 -15
- package/packages/core/test/prompt-library.test.ts +56 -0
- package/packages/core/test/readme-gen.test.ts +45 -0
- package/packages/core/test/recall-unread.test.ts +35 -0
- package/packages/core/test/registry.test.ts +48 -0
- package/packages/core/test/reverse-skill.test.ts +40 -0
- package/packages/core/test/runtime-doctor.test.ts +55 -0
- package/packages/core/test/runtime-fixture.ts +4 -4
- package/packages/core/test/runtime.test.ts +90 -1
- package/packages/core/test/secure-audit.test.ts +16 -0
- package/packages/core/test/services.test.ts +2024 -5
- package/packages/core/test/session-bookmarks.test.ts +62 -0
- package/packages/core/test/session-bridge.test.ts +103 -0
- package/packages/core/test/session-compare.test.ts +94 -0
- package/packages/core/test/session-export.test.ts +54 -0
- package/packages/core/test/session-search.test.ts +30 -0
- package/packages/core/test/skill-catalog.test.ts +18 -0
- package/packages/core/test/skill-guard.test.ts +21 -0
- package/packages/core/test/stdio-args.test.ts +178 -0
- package/packages/core/test/theme-studio.test.ts +39 -0
- package/packages/core/test/token-guard.test.ts +34 -0
- package/packages/core/test/turn-rewind.test.ts +19 -0
- package/packages/core/test/vision-toolkit.test.ts +38 -0
- package/packages/core/test/workspace-git-status.test.ts +37 -0
- package/packages/core/test/workspace-navigator.test.ts +33 -0
- package/packages/core/test/workspace-path.test.ts +34 -0
- package/packages/core/tsconfig.build.json +1 -3
- package/packages/core/tsconfig.json +1 -4
- package/packages/host-webserver/LICENSE +9 -0
- package/packages/host-webserver/dist/index.js +1 -1
- package/packages/host-webserver/dist/index.js.map +1 -1
- package/packages/host-webserver/package.json +17 -7
- package/packages/host-webserver/src/index.ts +1 -1
- package/packages/host-webserver/test/index.test.ts +4 -1
- package/packages/host-webserver/tsconfig.build.json +1 -1
- package/packages/host-webserver/tsconfig.json +1 -1
- package/apps/web/dist/assets/index-Bwqek8LF.js +0 -20
- package/apps/web/dist/assets/index-DCHSASjq.css +0 -1
- package/packages/api-gateway/dist/marketplace-registry.json +0 -62
- package/packages/api-gateway/src/marketplace-registry.json +0 -62
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { lstat, readdir, readFile, realpath, stat } from "node:fs/promises";
|
|
2
|
+
import { relative, resolve } from "node:path";
|
|
3
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
5
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
6
|
+
|
|
7
|
+
const maxQueryLength = 256;
|
|
8
|
+
const maxPathLength = 512;
|
|
9
|
+
const maxFileBytes = 2 * 1024 * 1024;
|
|
10
|
+
const maxFiles = 2_000;
|
|
11
|
+
const maxResults = 100;
|
|
12
|
+
const ignoredDirectories = new Set([".git", "node_modules", ".pi", "dist", "build"]);
|
|
13
|
+
type SearchMatch = { path: string; line: number; text: string };
|
|
14
|
+
type SearchReport = { query: string; path: string; matches: SearchMatch[]; matchCount: number; scannedFiles: number; skippedFiles: number; truncated: boolean };
|
|
15
|
+
|
|
16
|
+
function inside(root: string, target: string): boolean {
|
|
17
|
+
const remainder = relative(root, target);
|
|
18
|
+
return remainder === "" || (remainder !== ".." && !remainder.startsWith(`..${"/"}`) && !remainder.startsWith("/"));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function workspacePath(root: string, requested: string): string {
|
|
22
|
+
if (requested.length > maxPathLength || requested.includes("\\"))
|
|
23
|
+
throw new Error("Workspace search path must be a relative POSIX path of at most 512 characters");
|
|
24
|
+
const target = resolve(root, requested || ".");
|
|
25
|
+
if (!inside(root, target)) throw new Error("Workspace search path must stay inside the current workspace");
|
|
26
|
+
return target;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function filesUnder(target: string, root: string, files: string[]): Promise<void> {
|
|
30
|
+
if (files.length >= maxFiles) return;
|
|
31
|
+
const metadata = await lstat(target);
|
|
32
|
+
if (metadata.isSymbolicLink()) return;
|
|
33
|
+
if (metadata.isFile()) {
|
|
34
|
+
files.push(target);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!metadata.isDirectory()) return;
|
|
38
|
+
const entries = (await readdir(target, { withFileTypes: true })).sort((left, right) => left.name.localeCompare(right.name));
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
if (files.length >= maxFiles) return;
|
|
41
|
+
if (entry.isDirectory() && ignoredDirectories.has(entry.name)) continue;
|
|
42
|
+
const child = resolve(target, entry.name);
|
|
43
|
+
if (!inside(root, child)) continue;
|
|
44
|
+
await filesUnder(child, root, files);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
name: "pi-workspace-search",
|
|
50
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
51
|
+
apply(context: Context) {
|
|
52
|
+
let latest: SearchReport | undefined;
|
|
53
|
+
const search = async (
|
|
54
|
+
query: string,
|
|
55
|
+
requestedPath: string | undefined,
|
|
56
|
+
caseSensitive: boolean,
|
|
57
|
+
requestedLimit: number | undefined,
|
|
58
|
+
): Promise<SearchReport> => {
|
|
59
|
+
const normalizedQuery = query.trim();
|
|
60
|
+
if (normalizedQuery.length === 0 || normalizedQuery.length > maxQueryLength)
|
|
61
|
+
throw new Error(`Workspace search query must contain 1-${maxQueryLength} characters`);
|
|
62
|
+
const root = await realpath(context.piHarnessLaunch.cwd);
|
|
63
|
+
const target = workspacePath(root, requestedPath?.trim() ?? ".");
|
|
64
|
+
const targetMetadata = await stat(target);
|
|
65
|
+
const files: string[] = [];
|
|
66
|
+
await filesUnder(target, root, files);
|
|
67
|
+
const limit = Math.max(1, Math.min(maxResults, Math.trunc(requestedLimit ?? maxResults)));
|
|
68
|
+
const needle = caseSensitive ? normalizedQuery : normalizedQuery.toLocaleLowerCase();
|
|
69
|
+
const matches: SearchMatch[] = [];
|
|
70
|
+
let scannedFiles = 0;
|
|
71
|
+
let skippedFiles = targetMetadata.isFile() && targetMetadata.size > maxFileBytes ? 1 : 0;
|
|
72
|
+
for (const file of files) {
|
|
73
|
+
if (matches.length >= limit) break;
|
|
74
|
+
const metadata = await stat(file);
|
|
75
|
+
if (metadata.size > maxFileBytes) {
|
|
76
|
+
skippedFiles += 1;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const source = await readFile(file);
|
|
80
|
+
if (source.includes(0)) {
|
|
81
|
+
skippedFiles += 1;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
scannedFiles += 1;
|
|
85
|
+
const lines = source.toString("utf8").split(/\r?\n/u);
|
|
86
|
+
for (const [index, line] of lines.entries()) {
|
|
87
|
+
if ((caseSensitive ? line : line.toLocaleLowerCase()).includes(needle)) {
|
|
88
|
+
matches.push({ path: relative(root, file), line: index + 1, text: line });
|
|
89
|
+
if (matches.length >= limit) break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const report: SearchReport = {
|
|
94
|
+
query: normalizedQuery,
|
|
95
|
+
path: relative(root, target) || ".",
|
|
96
|
+
matches,
|
|
97
|
+
matchCount: matches.length,
|
|
98
|
+
scannedFiles,
|
|
99
|
+
skippedFiles,
|
|
100
|
+
truncated: matches.length >= limit && files.length > scannedFiles,
|
|
101
|
+
};
|
|
102
|
+
latest = report;
|
|
103
|
+
return report;
|
|
104
|
+
};
|
|
105
|
+
const unregisterTool = context.piTools.register(
|
|
106
|
+
defineTool({
|
|
107
|
+
name: "workspace_search",
|
|
108
|
+
label: "Search workspace",
|
|
109
|
+
description: "Search bounded UTF-8 text files in the current workspace without modifying files or invoking a shell.",
|
|
110
|
+
promptSnippet: "search the workspace for a text pattern",
|
|
111
|
+
parameters: Type.Object({
|
|
112
|
+
query: Type.String(),
|
|
113
|
+
path: Type.Optional(Type.String()),
|
|
114
|
+
caseSensitive: Type.Optional(Type.Boolean()),
|
|
115
|
+
maxResults: Type.Optional(Type.Number()),
|
|
116
|
+
}),
|
|
117
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<SearchReport>> {
|
|
118
|
+
const report = await search(params.query, params.path, params.caseSensitive === true, params.maxResults);
|
|
119
|
+
return {
|
|
120
|
+
content: [{ type: "text", text: report.matches.map((match) => `${match.path}:${match.line}: ${match.text}`).join("\n") || "No matches found." }],
|
|
121
|
+
details: report,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
const disposePanel = context.piPluginUi.register({
|
|
127
|
+
id: "workspace-search-panel",
|
|
128
|
+
pluginId: "@pi-harness/core/plugins/workspace-search",
|
|
129
|
+
title: "Workspace Search",
|
|
130
|
+
description: "在工作区内安全检索文本,跳过依赖、构建产物和版本库目录。",
|
|
131
|
+
icon: "⌕",
|
|
132
|
+
read: () => ({ latest: latest ?? null, query: latest?.query ?? null, matchCount: latest?.matchCount ?? 0, scannedFiles: latest?.scannedFiles ?? 0 }),
|
|
133
|
+
});
|
|
134
|
+
context.effect(() => () => {
|
|
135
|
+
unregisterTool();
|
|
136
|
+
disposePanel();
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { readFile, realpath, stat } from "node:fs/promises";
|
|
2
|
+
import { relative, resolve } from "node:path";
|
|
3
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
4
|
+
import { parseAllDocuments, isMap, isSeq, type YAMLParseError, type YAMLWarning } from "yaml";
|
|
5
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
6
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
|
|
8
|
+
const maxBytes = 512 * 1024;
|
|
9
|
+
type Diagnostic = { message: string; code?: string; line?: number; column?: number };
|
|
10
|
+
type YamlReport = { path: string; valid: boolean; bytes: number; documents: number; rootType: string; errors: Diagnostic[]; warnings: Diagnostic[] };
|
|
11
|
+
|
|
12
|
+
function workspacePath(workspace: string, requested: string): { absolute: string; relative: string } {
|
|
13
|
+
const root = resolve(workspace);
|
|
14
|
+
const target = resolve(root, requested);
|
|
15
|
+
const path = relative(root, target);
|
|
16
|
+
if (path.startsWith("..") || path.includes("/..")) throw new Error("YAML path must stay inside the current workspace");
|
|
17
|
+
return { absolute: target, relative: path || "." };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function diagnostic(issue: YAMLParseError | YAMLWarning): Diagnostic {
|
|
21
|
+
const position = issue.linePos?.[0];
|
|
22
|
+
return {
|
|
23
|
+
message: issue.message,
|
|
24
|
+
...(typeof issue.code === "string" ? { code: issue.code } : {}),
|
|
25
|
+
...(position === undefined ? {} : { line: position.line, column: position.col }),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function rootType(value: unknown): string {
|
|
30
|
+
if (value === null || value === undefined) return "empty";
|
|
31
|
+
if (isMap(value)) return "map";
|
|
32
|
+
if (isSeq(value)) return "seq";
|
|
33
|
+
return "scalar";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
name: "pi-yaml-validator",
|
|
38
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
39
|
+
apply(context: Context) {
|
|
40
|
+
let latest: YamlReport | undefined;
|
|
41
|
+
const validate = async (requested: string): Promise<YamlReport> => {
|
|
42
|
+
const workspace = await realpath(context.piHarnessLaunch.cwd);
|
|
43
|
+
const requestedPath = workspacePath(workspace, requested);
|
|
44
|
+
const absolute = await realpath(requestedPath.absolute);
|
|
45
|
+
const location = workspacePath(workspace, absolute);
|
|
46
|
+
const metadata = await stat(location.absolute);
|
|
47
|
+
if (!metadata.isFile()) throw new Error("YAML path is not a file");
|
|
48
|
+
if (metadata.size > maxBytes) throw new Error("YAML file exceeds the 512 KiB validation limit");
|
|
49
|
+
const source = await readFile(location.absolute, "utf8");
|
|
50
|
+
const documents = parseAllDocuments(source);
|
|
51
|
+
const errors = documents.flatMap((document) => document.errors.map(diagnostic));
|
|
52
|
+
const warnings = documents.flatMap((document) => document.warnings.map(diagnostic));
|
|
53
|
+
const report: YamlReport = {
|
|
54
|
+
path: location.relative,
|
|
55
|
+
valid: errors.length === 0,
|
|
56
|
+
bytes: metadata.size,
|
|
57
|
+
documents: documents.length,
|
|
58
|
+
rootType: rootType(documents[0]?.contents),
|
|
59
|
+
errors,
|
|
60
|
+
warnings,
|
|
61
|
+
};
|
|
62
|
+
latest = report;
|
|
63
|
+
return report;
|
|
64
|
+
};
|
|
65
|
+
const unregisterTool = context.piTools.register(
|
|
66
|
+
defineTool({
|
|
67
|
+
name: "yaml_validate",
|
|
68
|
+
label: "YAML validate",
|
|
69
|
+
description: "Parse a YAML file in the current workspace and report line-aware errors without modifying it.",
|
|
70
|
+
promptSnippet: "validate a YAML file and report syntax diagnostics",
|
|
71
|
+
parameters: Type.Object({ path: Type.String({ description: "YAML path relative to the workspace" }) }),
|
|
72
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<YamlReport>> {
|
|
73
|
+
const report = await validate(params.path);
|
|
74
|
+
const summary = report.valid ? `YAML is valid (${report.documents} document(s)).` : `YAML is invalid with ${report.errors.length} error(s).`;
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{ type: "text", text: `${summary}\n${report.errors.map((issue) => `${issue.line ?? "?"}:${issue.column ?? "?"} ${issue.message}`).join("\n")}` },
|
|
78
|
+
],
|
|
79
|
+
details: report,
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
const disposePanel = context.piPluginUi.register({
|
|
85
|
+
id: "yaml-validator-panel",
|
|
86
|
+
pluginId: "@pi-harness/core/plugins/yaml-validator",
|
|
87
|
+
title: "YAML Validator",
|
|
88
|
+
description: "只读解析工作区 YAML,并展示行列级语法诊断。",
|
|
89
|
+
icon: "⌁",
|
|
90
|
+
read: () => ({ latest: latest ?? null, maxBytes }),
|
|
91
|
+
});
|
|
92
|
+
context.effect(() => () => {
|
|
93
|
+
unregisterTool();
|
|
94
|
+
disposePanel();
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
};
|
|
@@ -2,6 +2,8 @@ import { access } from "node:fs/promises";
|
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
|
+
export const BUILTIN_PROFILES = ["default", "development"] as const;
|
|
6
|
+
|
|
5
7
|
export interface ResolveProfileConfigOptions {
|
|
6
8
|
profile?: string;
|
|
7
9
|
configPath?: string;
|
|
@@ -25,6 +27,7 @@ export async function resolveProfileConfig(_options: ResolveProfileConfigOptions
|
|
|
25
27
|
try {
|
|
26
28
|
await access(configPath);
|
|
27
29
|
} catch (cause) {
|
|
30
|
+
if (options.configPath === undefined) throw new Error(`Pi Harness profile config does not exist or is not readable: ${configPath}; built-in profiles are ${BUILTIN_PROFILES.join(", ")}`, { cause });
|
|
28
31
|
throw new Error(`Pi Harness profile config does not exist or is not readable: ${configPath}`, { cause });
|
|
29
32
|
}
|
|
30
33
|
return configPath;
|
|
@@ -12,6 +12,7 @@ export class PiRuntimeDisposedError extends Error {
|
|
|
12
12
|
export class PiRuntime implements PiRuntimeService {
|
|
13
13
|
readonly sessionRuntime: AgentSessionRuntime;
|
|
14
14
|
#disposed = false;
|
|
15
|
+
#sessionDisposed = false;
|
|
15
16
|
|
|
16
17
|
constructor(sessionRuntime: AgentSessionRuntime) {
|
|
17
18
|
this.sessionRuntime = sessionRuntime;
|
|
@@ -23,17 +24,23 @@ export class PiRuntime implements PiRuntimeService {
|
|
|
23
24
|
|
|
24
25
|
async prompt(text: string): Promise<void> {
|
|
25
26
|
if (this.#disposed) throw new PiRuntimeDisposedError();
|
|
26
|
-
await this.
|
|
27
|
+
await this.session.prompt(text);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
async abort(): Promise<void> {
|
|
30
|
-
if (this.#
|
|
31
|
-
await this.
|
|
31
|
+
if (this.#sessionDisposed) return;
|
|
32
|
+
await this.session.abort();
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
async dispose(): Promise<void> {
|
|
35
36
|
if (this.#disposed) return;
|
|
36
37
|
this.#disposed = true;
|
|
37
|
-
|
|
38
|
+
try {
|
|
39
|
+
// Settle an in-flight turn first so its tool results are persisted before session_shutdown runs.
|
|
40
|
+
if (!this.session.isIdle) await this.session.abort();
|
|
41
|
+
} finally {
|
|
42
|
+
this.#sessionDisposed = true;
|
|
43
|
+
await this.sessionRuntime.dispose();
|
|
44
|
+
}
|
|
38
45
|
}
|
|
39
46
|
}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
import { isAbsolute } from "node:path";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
1
3
|
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
AgentSession,
|
|
6
|
+
AgentSessionEvent,
|
|
7
|
+
AgentSessionRuntime,
|
|
8
|
+
AgentSessionServices,
|
|
9
|
+
ExtensionError,
|
|
10
|
+
SessionManager,
|
|
11
|
+
ToolDefinition,
|
|
12
|
+
} from "@earendil-works/pi-coding-agent";
|
|
3
13
|
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
4
14
|
import type { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
5
15
|
|
|
6
16
|
export interface PiHarnessLaunch {
|
|
7
17
|
readonly cwd: string;
|
|
18
|
+
readonly cwdUrl?: string;
|
|
8
19
|
readonly agentDir: string;
|
|
20
|
+
readonly configPath?: string;
|
|
9
21
|
readonly args: readonly string[];
|
|
10
22
|
requestExit(code: number): void;
|
|
11
23
|
}
|
|
@@ -29,6 +41,17 @@ export interface PiSessionService {
|
|
|
29
41
|
readonly manager: SessionManager;
|
|
30
42
|
}
|
|
31
43
|
|
|
44
|
+
export interface PiMcpServerSnapshot {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly command: readonly string[];
|
|
47
|
+
readonly status: string;
|
|
48
|
+
readonly startedAt: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface PiMcpService {
|
|
52
|
+
snapshot(): { readonly servers: readonly PiMcpServerSnapshot[] };
|
|
53
|
+
}
|
|
54
|
+
|
|
32
55
|
export interface PiRuntimeService {
|
|
33
56
|
readonly session: AgentSession;
|
|
34
57
|
readonly sessionRuntime: AgentSessionRuntime;
|
|
@@ -37,6 +60,17 @@ export interface PiRuntimeService {
|
|
|
37
60
|
dispose(): Promise<void>;
|
|
38
61
|
}
|
|
39
62
|
|
|
63
|
+
export interface PiTelemetryEvent {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly properties?: Readonly<Record<string, unknown>>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface PiTelemetryService {
|
|
69
|
+
readonly enabled: false;
|
|
70
|
+
send(event: PiTelemetryEvent): { blocked: true; name: string };
|
|
71
|
+
snapshot(): { blocked: number; names: readonly string[] };
|
|
72
|
+
}
|
|
73
|
+
|
|
40
74
|
export interface PiToolsSnapshot {
|
|
41
75
|
readonly names: string[];
|
|
42
76
|
readonly customTools: ToolDefinition[];
|
|
@@ -46,6 +80,8 @@ export interface PiToolsLease extends PiToolsSnapshot {
|
|
|
46
80
|
release(): void;
|
|
47
81
|
}
|
|
48
82
|
|
|
83
|
+
const PI_BUILTIN_TOOL_NAMES = ["read", "bash", "powershell", "edit", "write", "grep", "find", "ls"];
|
|
84
|
+
|
|
49
85
|
export class PiToolRegistry {
|
|
50
86
|
readonly #names: string[];
|
|
51
87
|
readonly #customTools = new Map<string, ToolDefinition>();
|
|
@@ -58,9 +94,10 @@ export class PiToolRegistry {
|
|
|
58
94
|
register(tool: ToolDefinition): () => void {
|
|
59
95
|
if (this.#leases > 0) throw new Error(`Pi tool registry is leased by pi-runtime; declare a Cordis injection that activates ${tool.name} before pi-runtime`);
|
|
60
96
|
if (this.#names.includes(tool.name) || this.#customTools.has(tool.name)) throw new Error(`Pi tool is already registered: ${tool.name}`);
|
|
97
|
+
if (PI_BUILTIN_TOOL_NAMES.includes(tool.name)) throw new Error(`Pi tool name is reserved by a built-in tool: ${tool.name}`);
|
|
61
98
|
this.#customTools.set(tool.name, tool);
|
|
62
99
|
return () => {
|
|
63
|
-
this.#customTools.delete(tool.name);
|
|
100
|
+
if (this.#customTools.get(tool.name) === tool) this.#customTools.delete(tool.name);
|
|
64
101
|
};
|
|
65
102
|
}
|
|
66
103
|
|
|
@@ -82,6 +119,70 @@ export class PiToolRegistry {
|
|
|
82
119
|
}
|
|
83
120
|
}
|
|
84
121
|
|
|
122
|
+
export interface PiPluginPanel {
|
|
123
|
+
readonly id: string;
|
|
124
|
+
readonly pluginId: string;
|
|
125
|
+
readonly title: string;
|
|
126
|
+
readonly description?: string;
|
|
127
|
+
readonly icon?: string;
|
|
128
|
+
readonly visible?: () => boolean | Promise<boolean>;
|
|
129
|
+
readonly read: () => unknown;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface PiPluginPanelSnapshot {
|
|
133
|
+
readonly id: string;
|
|
134
|
+
readonly pluginId: string;
|
|
135
|
+
readonly title: string;
|
|
136
|
+
readonly description?: string;
|
|
137
|
+
readonly icon?: string;
|
|
138
|
+
readonly data?: unknown;
|
|
139
|
+
readonly error?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export class PiPluginUiRegistry {
|
|
143
|
+
readonly #panels = new Map<string, PiPluginPanel>();
|
|
144
|
+
|
|
145
|
+
register(panel: PiPluginPanel): () => void {
|
|
146
|
+
if (panel.id.trim() === "" || panel.pluginId.trim() === "" || panel.title.trim() === "")
|
|
147
|
+
throw new Error("Plugin UI panel id, pluginId, and title are required");
|
|
148
|
+
if (this.#panels.has(panel.id)) throw new Error(`Plugin UI panel is already registered: ${panel.id}`);
|
|
149
|
+
this.#panels.set(panel.id, panel);
|
|
150
|
+
let active = true;
|
|
151
|
+
return () => {
|
|
152
|
+
if (!active) return;
|
|
153
|
+
active = false;
|
|
154
|
+
if (this.#panels.get(panel.id) === panel) this.#panels.delete(panel.id);
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async snapshot(): Promise<readonly PiPluginPanelSnapshot[]> {
|
|
159
|
+
const snapshots: PiPluginPanelSnapshot[] = [];
|
|
160
|
+
for (const panel of this.#panels.values()) {
|
|
161
|
+
if (panel.visible !== undefined && !(await panel.visible())) continue;
|
|
162
|
+
try {
|
|
163
|
+
snapshots.push({
|
|
164
|
+
id: panel.id,
|
|
165
|
+
pluginId: panel.pluginId,
|
|
166
|
+
title: panel.title,
|
|
167
|
+
...(panel.description === undefined ? {} : { description: panel.description }),
|
|
168
|
+
...(panel.icon === undefined ? {} : { icon: panel.icon }),
|
|
169
|
+
data: await panel.read(),
|
|
170
|
+
});
|
|
171
|
+
} catch (error) {
|
|
172
|
+
snapshots.push({
|
|
173
|
+
id: panel.id,
|
|
174
|
+
pluginId: panel.pluginId,
|
|
175
|
+
title: panel.title,
|
|
176
|
+
...(panel.description === undefined ? {} : { description: panel.description }),
|
|
177
|
+
...(panel.icon === undefined ? {} : { icon: panel.icon }),
|
|
178
|
+
error: error instanceof Error ? error.message : String(error),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return snapshots;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
85
186
|
declare module "@deepseek-ai/cordis" {
|
|
86
187
|
interface Context {
|
|
87
188
|
piHarnessLaunch: PiHarnessLaunch;
|
|
@@ -89,17 +190,23 @@ declare module "@deepseek-ai/cordis" {
|
|
|
89
190
|
piModels: PiModelsService;
|
|
90
191
|
piResources: PiResourcesService;
|
|
91
192
|
piSession: PiSessionService;
|
|
193
|
+
piMcp: PiMcpService;
|
|
92
194
|
piTools: PiToolRegistry;
|
|
195
|
+
piPluginUi: PiPluginUiRegistry;
|
|
93
196
|
piRuntime: PiRuntimeService;
|
|
197
|
+
piTelemetry: PiTelemetryService;
|
|
94
198
|
}
|
|
95
199
|
|
|
96
200
|
interface Events {
|
|
97
201
|
"pi/session-event"(event: AgentSessionEvent): void;
|
|
98
202
|
"pi/extension-error"(error: ExtensionError): void;
|
|
203
|
+
"pi/telemetry"(event: PiTelemetryEvent): void;
|
|
99
204
|
}
|
|
100
205
|
}
|
|
101
206
|
|
|
102
207
|
export function provideLaunchContext(context: Context, launch: PiHarnessLaunch): () => void {
|
|
103
|
-
|
|
208
|
+
if (!isAbsolute(launch.cwd)) throw new Error(`Pi Harness launch cwd must be an absolute path: ${launch.cwd}`);
|
|
209
|
+
if (!isAbsolute(launch.agentDir)) throw new Error(`Pi Harness agent directory must be an absolute path: ${launch.agentDir}`);
|
|
210
|
+
const value: PiHarnessLaunch = Object.freeze({ ...launch, cwdUrl: pathToFileURL(launch.cwd).href, args: Object.freeze([...launch.args]) });
|
|
104
211
|
return context.provide("piHarnessLaunch", value);
|
|
105
212
|
}
|
|
@@ -2,14 +2,29 @@ import type { Context } from "@deepseek-ai/cordis";
|
|
|
2
2
|
import type { AgentSessionEvent } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import type { PiHarnessLaunch, PiRuntimeService } from "./services.js";
|
|
4
4
|
|
|
5
|
+
export class PiHarnessStdioCancelledError extends Error {
|
|
6
|
+
override readonly name = "PiHarnessStdioCancelledError";
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
super("Prompt input was cancelled");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
export interface PiHarnessStdio {
|
|
6
14
|
readPrompt(): Promise<string>;
|
|
7
15
|
writeOutput(text: string): void;
|
|
8
16
|
writeError(text: string): void;
|
|
17
|
+
/** Resolve once everything written so far has reached the underlying stream. */
|
|
18
|
+
flush?(): Promise<void>;
|
|
9
19
|
}
|
|
10
20
|
|
|
11
21
|
export interface PiHarnessApplication {
|
|
12
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Run the application surface to completion.
|
|
24
|
+
*
|
|
25
|
+
* @param signal - aborted when the host is shutting down; a surface that can block must unwind on it.
|
|
26
|
+
*/
|
|
27
|
+
run(signal?: AbortSignal): Promise<number>;
|
|
13
28
|
}
|
|
14
29
|
|
|
15
30
|
declare module "@deepseek-ai/cordis" {
|
|
@@ -25,22 +40,43 @@ export function provideStdioContext(context: Context, stdio: PiHarnessStdio): ()
|
|
|
25
40
|
|
|
26
41
|
function promptFromArgs(args: readonly string[]): string | undefined {
|
|
27
42
|
if (args.length === 0) return undefined;
|
|
43
|
+
if (args[0] === "--") return args.length === 1 ? undefined : args.slice(1).join(" ");
|
|
28
44
|
if (args[0] === "--prompt") {
|
|
29
45
|
const prompt = args[1];
|
|
30
46
|
if (prompt === undefined) throw new Error("--prompt requires a value");
|
|
31
47
|
if (args.length > 2) throw new Error("--prompt accepts exactly one value");
|
|
32
48
|
return prompt;
|
|
33
49
|
}
|
|
34
|
-
if (args[0]?.startsWith("--prompt="))
|
|
35
|
-
|
|
50
|
+
if (args[0]?.startsWith("--prompt=")) {
|
|
51
|
+
if (args.length > 1) throw new Error("--prompt accepts exactly one value");
|
|
52
|
+
return args[0].slice("--prompt=".length);
|
|
53
|
+
}
|
|
54
|
+
const option = args[0];
|
|
55
|
+
if (option !== undefined && option.startsWith("-")) throw new Error(`Unknown stdio option: ${option}; pass -- before a prompt that starts with a dash`);
|
|
36
56
|
return args.join(" ");
|
|
37
57
|
}
|
|
38
58
|
|
|
59
|
+
const PROMPT_CANCELLED_EXIT_CODE = 130;
|
|
60
|
+
const TOOL_ARGUMENT_SUMMARY_LIMIT = 120;
|
|
61
|
+
|
|
62
|
+
function summarizeToolArguments(args: unknown): string {
|
|
63
|
+
let text: string;
|
|
64
|
+
try {
|
|
65
|
+
text = typeof args === "string" ? args : JSON.stringify(args) ?? "";
|
|
66
|
+
} catch {
|
|
67
|
+
return "";
|
|
68
|
+
}
|
|
69
|
+
const line = text.replace(/\s+/g, " ").trim();
|
|
70
|
+
return line.length > TOOL_ARGUMENT_SUMMARY_LIMIT ? `${line.slice(0, TOOL_ARGUMENT_SUMMARY_LIMIT)}...` : line;
|
|
71
|
+
}
|
|
72
|
+
|
|
39
73
|
export class StdioApplication implements PiHarnessApplication {
|
|
40
74
|
readonly #runtime: PiRuntimeService;
|
|
41
75
|
readonly #launch: PiHarnessLaunch;
|
|
42
76
|
readonly #stdio: PiHarnessStdio;
|
|
43
77
|
#running = false;
|
|
78
|
+
#pendingSeparator = false;
|
|
79
|
+
#wroteOutput = false;
|
|
44
80
|
|
|
45
81
|
constructor(runtime: PiRuntimeService, launch: PiHarnessLaunch, stdio: PiHarnessStdio) {
|
|
46
82
|
this.#runtime = runtime;
|
|
@@ -50,17 +86,42 @@ export class StdioApplication implements PiHarnessApplication {
|
|
|
50
86
|
|
|
51
87
|
writeSessionEvent(event: AgentSessionEvent): void {
|
|
52
88
|
if (!this.#running) return;
|
|
53
|
-
if (event.type === "message_update" && event.assistantMessageEvent.type === "text_delta")
|
|
89
|
+
if (event.type === "message_update" && event.assistantMessageEvent.type === "text_delta") {
|
|
90
|
+
if (this.#pendingSeparator) {
|
|
91
|
+
this.#pendingSeparator = false;
|
|
92
|
+
this.#stdio.writeOutput("\n");
|
|
93
|
+
}
|
|
94
|
+
this.#wroteOutput = true;
|
|
95
|
+
this.#stdio.writeOutput(event.assistantMessageEvent.delta);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (event.type === "tool_execution_start") {
|
|
99
|
+
if (this.#wroteOutput) this.#pendingSeparator = true;
|
|
100
|
+
this.#stdio.writeError(`> ${event.toolName} ${summarizeToolArguments(event.args)}\n`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (event.type === "tool_execution_end") {
|
|
104
|
+
const result = event.result as { isError?: boolean } | undefined;
|
|
105
|
+
if (result?.isError === true) this.#stdio.writeError(`! ${event.toolName} failed\n`);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (event.type === "auto_retry_start") this.#stdio.writeError(`Retrying after ${event.errorMessage} (attempt ${event.attempt}/${event.maxAttempts})\n`);
|
|
54
109
|
}
|
|
55
110
|
|
|
56
|
-
async run(): Promise<number> {
|
|
111
|
+
async run(signal?: AbortSignal): Promise<number> {
|
|
57
112
|
if (this.#running) throw new Error("stdio application is already running");
|
|
58
113
|
this.#running = true;
|
|
114
|
+
const onAbort = () => {
|
|
115
|
+
void this.#runtime.abort().catch(() => {});
|
|
116
|
+
};
|
|
117
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
59
118
|
try {
|
|
119
|
+
if (signal?.aborted === true) return PROMPT_CANCELLED_EXIT_CODE;
|
|
60
120
|
let prompt: string;
|
|
61
121
|
try {
|
|
62
|
-
prompt = promptFromArgs(this.#launch.args) ?? await this.#stdio.readPrompt();
|
|
122
|
+
prompt = promptFromArgs(this.#launch.args) ?? (await this.#stdio.readPrompt());
|
|
63
123
|
} catch (error) {
|
|
124
|
+
if (error instanceof PiHarnessStdioCancelledError) return PROMPT_CANCELLED_EXIT_CODE;
|
|
64
125
|
this.#stdio.writeError(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
65
126
|
return 2;
|
|
66
127
|
}
|
|
@@ -74,15 +135,24 @@ export class StdioApplication implements PiHarnessApplication {
|
|
|
74
135
|
this.#stdio.writeError(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
75
136
|
return 1;
|
|
76
137
|
}
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
138
|
+
const lastAssistantMessage = this.#runtime.session.messages.findLast((message) => message.role === "assistant");
|
|
139
|
+
const stopReason = lastAssistantMessage?.stopReason;
|
|
140
|
+
if (stopReason === "error" || stopReason === "aborted" || stopReason === "length") {
|
|
141
|
+
if (this.#wroteOutput) this.#stdio.writeOutput("\n");
|
|
142
|
+
this.#stdio.writeError(`${lastAssistantMessage?.errorMessage ?? (stopReason === "length" ? "Response was truncated by the model's output limit" : `Request ${stopReason}`)}\n`);
|
|
143
|
+
return 1;
|
|
144
|
+
}
|
|
145
|
+
if (!this.#wroteOutput) {
|
|
146
|
+
this.#stdio.writeError("The agent produced no output\n");
|
|
80
147
|
return 1;
|
|
81
148
|
}
|
|
82
149
|
this.#stdio.writeOutput("\n");
|
|
83
150
|
return 0;
|
|
84
151
|
} finally {
|
|
152
|
+
signal?.removeEventListener("abort", onAbort);
|
|
85
153
|
this.#running = false;
|
|
154
|
+
this.#pendingSeparator = false;
|
|
155
|
+
await this.#stdio.flush?.();
|
|
86
156
|
}
|
|
87
157
|
}
|
|
88
158
|
}
|