@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,231 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdir, open, readFile, rename, stat, unlink, writeFile } from "node:fs/promises";
|
|
3
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
4
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
5
|
+
import z from "@deepseek-ai/schemastery";
|
|
6
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
7
|
+
import { defineTool, type AgentToolResult, type SessionStats } from "@earendil-works/pi-coding-agent";
|
|
8
|
+
|
|
9
|
+
const defaultFileName = "cost-meter.json";
|
|
10
|
+
const defaultMaxEntries = 365;
|
|
11
|
+
const maxFileEntries = 2_000;
|
|
12
|
+
|
|
13
|
+
export interface CostMeterPluginConfig {
|
|
14
|
+
fileName?: string;
|
|
15
|
+
dailyBudget?: number;
|
|
16
|
+
maxEntries?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Config: z<CostMeterPluginConfig> = z.object({
|
|
20
|
+
fileName: z.string().default(defaultFileName),
|
|
21
|
+
dailyBudget: z.number().default(0),
|
|
22
|
+
maxEntries: z.number().default(defaultMaxEntries),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export interface CostEntry {
|
|
26
|
+
sessionId: string;
|
|
27
|
+
cost: number;
|
|
28
|
+
tokens: number;
|
|
29
|
+
messages: number;
|
|
30
|
+
recordedAt: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface CostMeterReport {
|
|
34
|
+
sessionCost: number;
|
|
35
|
+
todayCost: number;
|
|
36
|
+
lifetimeCost: number;
|
|
37
|
+
budget: number | null;
|
|
38
|
+
budgetPercent: number | null;
|
|
39
|
+
entries: CostEntry[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface CostFile {
|
|
43
|
+
version: 1;
|
|
44
|
+
entries: CostEntry[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function normalizeFilePath(agentDir: string, fileName: string | undefined): string {
|
|
48
|
+
const name = (fileName ?? defaultFileName).trim();
|
|
49
|
+
if (name === "" || basename(name) !== name || !name.toLowerCase().endsWith(".json")) throw new Error("Cost meter fileName must be a single .json filename");
|
|
50
|
+
return resolve(agentDir, name);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function finiteCost(value: number): number {
|
|
54
|
+
return Number.isFinite(value) && value >= 0 ? Math.round(value * 1_000_000) / 1_000_000 : 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function todayKey(date: Date): string {
|
|
58
|
+
return date.toISOString().slice(0, 10);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function reportFor(entries: readonly CostEntry[], current: SessionStats, budget: number | null): CostMeterReport {
|
|
62
|
+
const today = todayKey(new Date());
|
|
63
|
+
const todayCost = entries.filter((entry) => entry.recordedAt.slice(0, 10) === today).reduce((sum, entry) => sum + entry.cost, 0);
|
|
64
|
+
const lifetimeCost = entries.reduce((sum, entry) => sum + entry.cost, 0);
|
|
65
|
+
const roundedToday = finiteCost(todayCost);
|
|
66
|
+
return {
|
|
67
|
+
sessionCost: finiteCost(current.cost),
|
|
68
|
+
todayCost: roundedToday,
|
|
69
|
+
lifetimeCost: finiteCost(lifetimeCost),
|
|
70
|
+
budget,
|
|
71
|
+
budgetPercent: budget === null || budget === 0 ? null : Math.round((roundedToday / budget) * 10_000) / 100,
|
|
72
|
+
entries: [...entries],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function upsertCostEntry(entries: readonly CostEntry[], entry: CostEntry, limit: number): CostEntry[] {
|
|
77
|
+
return [entry, ...entries.filter((item) => item.sessionId !== entry.sessionId)].slice(0, limit);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
name: "pi-cost-meter",
|
|
82
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
83
|
+
Config,
|
|
84
|
+
apply(context: Context, config: CostMeterPluginConfig) {
|
|
85
|
+
const filePath = normalizeFilePath(context.piHarnessLaunch.agentDir, config.fileName);
|
|
86
|
+
const budgetValue =
|
|
87
|
+
typeof config.dailyBudget === "number" && Number.isFinite(config.dailyBudget) && config.dailyBudget > 0 ? finiteCost(config.dailyBudget) : null;
|
|
88
|
+
const entryLimit = Math.max(1, Math.min(maxFileEntries, Math.trunc(config.maxEntries ?? defaultMaxEntries)));
|
|
89
|
+
let entries: CostEntry[] = [];
|
|
90
|
+
let loaded = false;
|
|
91
|
+
let loading: Promise<void> | undefined;
|
|
92
|
+
let writeQueue = Promise.resolve();
|
|
93
|
+
let pendingRecord: Promise<void> | undefined;
|
|
94
|
+
const runtime = () => {
|
|
95
|
+
const service = context.get("piRuntime");
|
|
96
|
+
if (service === undefined) throw new Error("Pi runtime is not ready");
|
|
97
|
+
return service;
|
|
98
|
+
};
|
|
99
|
+
const load = async (): Promise<void> => {
|
|
100
|
+
if (loaded) return;
|
|
101
|
+
if (loading !== undefined) return loading;
|
|
102
|
+
loading = (async () => {
|
|
103
|
+
try {
|
|
104
|
+
const parsed = JSON.parse(await readFile(filePath, "utf8")) as Partial<CostFile>;
|
|
105
|
+
if (parsed.version !== 1 || !Array.isArray(parsed.entries)) throw new Error("Cost meter file has an unsupported format");
|
|
106
|
+
entries = parsed.entries.filter(
|
|
107
|
+
(entry): entry is CostEntry =>
|
|
108
|
+
typeof entry === "object" &&
|
|
109
|
+
entry !== null &&
|
|
110
|
+
typeof entry.sessionId === "string" &&
|
|
111
|
+
typeof entry.recordedAt === "string" &&
|
|
112
|
+
typeof entry.cost === "number",
|
|
113
|
+
);
|
|
114
|
+
} catch (error) {
|
|
115
|
+
if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
|
|
116
|
+
entries = [];
|
|
117
|
+
}
|
|
118
|
+
loaded = true;
|
|
119
|
+
})();
|
|
120
|
+
return loading;
|
|
121
|
+
};
|
|
122
|
+
const persist = async (): Promise<void> => {
|
|
123
|
+
writeQueue = writeQueue.then(async () => {
|
|
124
|
+
await mkdir(dirname(filePath), { recursive: true });
|
|
125
|
+
const lockPath = `${filePath}.lock`;
|
|
126
|
+
let lock: Awaited<ReturnType<typeof open>> | undefined;
|
|
127
|
+
for (let attempt = 0; attempt < 80; attempt += 1) {
|
|
128
|
+
try {
|
|
129
|
+
lock = await open(lockPath, "wx", 0o600);
|
|
130
|
+
break;
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if ((error as NodeJS.ErrnoException).code !== "EEXIST" || attempt === 79) throw error;
|
|
133
|
+
const lockAge = await stat(lockPath)
|
|
134
|
+
.then((metadata) => Date.now() - metadata.mtimeMs)
|
|
135
|
+
.catch(() => 0);
|
|
136
|
+
if (lockAge > 30_000) await unlink(lockPath).catch(() => {});
|
|
137
|
+
await new Promise((resolveDelay) => setTimeout(resolveDelay, 25));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (lock === undefined) throw new Error("Could not acquire the cost meter persistence lock");
|
|
141
|
+
try {
|
|
142
|
+
const diskEntries = await readFile(filePath, "utf8")
|
|
143
|
+
.then((source) => {
|
|
144
|
+
const parsed = JSON.parse(source) as Partial<CostFile>;
|
|
145
|
+
return parsed.version === 1 && Array.isArray(parsed.entries) ? parsed.entries : [];
|
|
146
|
+
})
|
|
147
|
+
.catch((error: unknown) => {
|
|
148
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return [];
|
|
149
|
+
throw error;
|
|
150
|
+
});
|
|
151
|
+
const merged = new Map(diskEntries.map((entry) => [entry.sessionId, entry]));
|
|
152
|
+
for (const entry of entries) {
|
|
153
|
+
const existing = merged.get(entry.sessionId);
|
|
154
|
+
if (existing === undefined || entry.recordedAt >= existing.recordedAt) merged.set(entry.sessionId, entry);
|
|
155
|
+
}
|
|
156
|
+
entries = [...merged.values()].sort((left, right) => right.recordedAt.localeCompare(left.recordedAt)).slice(0, entryLimit);
|
|
157
|
+
const payload = JSON.stringify({ version: 1, entries } satisfies CostFile, null, 2);
|
|
158
|
+
const temporary = join(dirname(filePath), `.${basename(filePath)}.${randomUUID()}.tmp`);
|
|
159
|
+
let renamed = false;
|
|
160
|
+
try {
|
|
161
|
+
await writeFile(temporary, payload, { encoding: "utf8", mode: 0o600, flag: "wx" });
|
|
162
|
+
await rename(temporary, filePath);
|
|
163
|
+
renamed = true;
|
|
164
|
+
} finally {
|
|
165
|
+
if (!renamed) await unlink(temporary).catch(() => {});
|
|
166
|
+
}
|
|
167
|
+
} finally {
|
|
168
|
+
await lock.close();
|
|
169
|
+
await unlink(lockPath).catch(() => {});
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
await writeQueue;
|
|
173
|
+
};
|
|
174
|
+
const record = async (): Promise<void> => {
|
|
175
|
+
await load();
|
|
176
|
+
const current = runtime().session.getSessionStats();
|
|
177
|
+
const signature = `${current.sessionId}:${current.totalMessages}:${finiteCost(current.cost)}`;
|
|
178
|
+
if (entries.some((entry) => `${entry.sessionId}:${entry.messages}:${entry.cost}` === signature)) return;
|
|
179
|
+
entries = upsertCostEntry(
|
|
180
|
+
entries,
|
|
181
|
+
{
|
|
182
|
+
sessionId: current.sessionId,
|
|
183
|
+
cost: finiteCost(current.cost),
|
|
184
|
+
tokens: current.tokens.total,
|
|
185
|
+
messages: current.totalMessages,
|
|
186
|
+
recordedAt: new Date().toISOString(),
|
|
187
|
+
},
|
|
188
|
+
entryLimit,
|
|
189
|
+
);
|
|
190
|
+
await persist();
|
|
191
|
+
};
|
|
192
|
+
const readReport = async (): Promise<CostMeterReport> => {
|
|
193
|
+
await load();
|
|
194
|
+
await pendingRecord;
|
|
195
|
+
return reportFor(entries, runtime().session.getSessionStats(), budgetValue);
|
|
196
|
+
};
|
|
197
|
+
const unsubscribe = context.on("pi/session-event", (event) => {
|
|
198
|
+
if (event.type === "agent_end") pendingRecord = record();
|
|
199
|
+
});
|
|
200
|
+
const unregister = context.piTools.register(
|
|
201
|
+
defineTool({
|
|
202
|
+
name: "cost_report",
|
|
203
|
+
label: "Cost report",
|
|
204
|
+
description: "Inspect current-session, daily, and persisted local model cost usage with an optional daily budget.",
|
|
205
|
+
promptSnippet: "inspect session and daily model cost usage",
|
|
206
|
+
parameters: Type.Object({ refresh: Type.Optional(Type.Boolean({ description: "Record the current completed session before reporting" })) }),
|
|
207
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<CostMeterReport>> {
|
|
208
|
+
if (params.refresh === true) await record();
|
|
209
|
+
const report = await readReport();
|
|
210
|
+
return {
|
|
211
|
+
content: [{ type: "text", text: `Today cost $${report.todayCost.toFixed(4)}; current session $${report.sessionCost.toFixed(4)}.` }],
|
|
212
|
+
details: report,
|
|
213
|
+
};
|
|
214
|
+
},
|
|
215
|
+
}),
|
|
216
|
+
);
|
|
217
|
+
const disposePanel = context.piPluginUi.register({
|
|
218
|
+
id: "cost-meter-panel",
|
|
219
|
+
pluginId: "@pi-harness/core/plugins/cost-meter",
|
|
220
|
+
title: "Cost Meter",
|
|
221
|
+
description: "查看当前会话、今日和历史成本,并监控每日预算。",
|
|
222
|
+
icon: "¤",
|
|
223
|
+
read: readReport,
|
|
224
|
+
});
|
|
225
|
+
context.effect(() => () => {
|
|
226
|
+
unsubscribe();
|
|
227
|
+
unregister();
|
|
228
|
+
disposePanel();
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
};
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { readdir, readFile, stat } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, join, relative } 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
|
+
export type DependencyConflict = {
|
|
9
|
+
name: string;
|
|
10
|
+
constraints: string[];
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type DependencyReport = {
|
|
14
|
+
manifest: string;
|
|
15
|
+
ecosystem: "npm" | "python";
|
|
16
|
+
declared: number;
|
|
17
|
+
installed: number;
|
|
18
|
+
missing: string[];
|
|
19
|
+
invalid: string[];
|
|
20
|
+
conflicts: DependencyConflict[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type ParsedRequirements = {
|
|
24
|
+
names: string[];
|
|
25
|
+
constraints: DependencyConflict[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function conflictList(entries: readonly { name: string; constraint: string }[]): DependencyConflict[] {
|
|
29
|
+
const grouped = new Map<string, string[]>();
|
|
30
|
+
for (const entry of entries) {
|
|
31
|
+
const values = grouped.get(entry.name) ?? [];
|
|
32
|
+
if (!values.includes(entry.constraint)) values.push(entry.constraint);
|
|
33
|
+
grouped.set(entry.name, values);
|
|
34
|
+
}
|
|
35
|
+
return [...grouped.entries()].filter(([, constraints]) => constraintsConflict(constraints)).map(([name, constraints]) => ({ name, constraints }));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type NumericVersion = readonly number[];
|
|
39
|
+
|
|
40
|
+
function numericVersion(value: string): NumericVersion | undefined {
|
|
41
|
+
const match = /^v?(\d+(?:\.\d+){0,3})(?:[-+].*)?$/u.exec(value.trim());
|
|
42
|
+
return match?.[1]?.split(".").map(Number);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function compareVersions(left: NumericVersion, right: NumericVersion): number {
|
|
46
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
47
|
+
const difference = (left[index] ?? 0) - (right[index] ?? 0);
|
|
48
|
+
if (difference !== 0) return Math.sign(difference);
|
|
49
|
+
}
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function constraintAllows(constraint: string, version: NumericVersion): boolean {
|
|
54
|
+
const parts = constraint
|
|
55
|
+
.split(",")
|
|
56
|
+
.map((part) => part.trim())
|
|
57
|
+
.filter(Boolean);
|
|
58
|
+
return parts.every((part) => {
|
|
59
|
+
const match = /^(===|==|=|>=|<=|>|<|\^|~)?\s*(v?\d+(?:\.\d+){0,3}(?:[-+][^\s]+)?)$/u.exec(part);
|
|
60
|
+
if (match === null) return true;
|
|
61
|
+
const candidate = numericVersion(match[2] ?? "");
|
|
62
|
+
if (candidate === undefined) return true;
|
|
63
|
+
const comparison = compareVersions(version, candidate);
|
|
64
|
+
switch (match[1] ?? "=") {
|
|
65
|
+
case ">=":
|
|
66
|
+
return comparison >= 0;
|
|
67
|
+
case "<=":
|
|
68
|
+
return comparison <= 0;
|
|
69
|
+
case ">":
|
|
70
|
+
return comparison > 0;
|
|
71
|
+
case "<":
|
|
72
|
+
return comparison < 0;
|
|
73
|
+
case "^":
|
|
74
|
+
return (
|
|
75
|
+
comparison >= 0 &&
|
|
76
|
+
version[0] === candidate[0] &&
|
|
77
|
+
((candidate[0] ?? 0) > 0 || (version[1] === candidate[1] && ((candidate[1] ?? 0) > 0 || version[2] === candidate[2])))
|
|
78
|
+
);
|
|
79
|
+
case "~":
|
|
80
|
+
return comparison >= 0 && version[0] === candidate[0] && version[1] === candidate[1];
|
|
81
|
+
default:
|
|
82
|
+
return comparison === 0;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function constraintsConflict(constraints: readonly string[]): boolean {
|
|
88
|
+
if (constraints.length < 2) return false;
|
|
89
|
+
const pinned = constraints.flatMap((constraint) => {
|
|
90
|
+
const match = /^(?:===|==|=)?\s*(v?\d+(?:\.\d+){0,3}(?:[-+][^\s]+)?)$/u.exec(constraint);
|
|
91
|
+
const version = match === null ? undefined : numericVersion(match[1] ?? "");
|
|
92
|
+
return version === undefined ? [] : [version];
|
|
93
|
+
});
|
|
94
|
+
if (pinned.length === 0) return false;
|
|
95
|
+
return pinned.some((version) => constraints.some((constraint) => !constraintAllows(constraint, version)));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function parseRequirements(source: string): ParsedRequirements {
|
|
99
|
+
const entries: { name: string; constraint: string }[] = [];
|
|
100
|
+
for (const rawLine of source.split("\n")) {
|
|
101
|
+
const line = rawLine.trim();
|
|
102
|
+
if (line === "" || line.startsWith("#") || line.startsWith("-") || line.startsWith("git+") || line.startsWith("http://") || line.startsWith("https://"))
|
|
103
|
+
continue;
|
|
104
|
+
const match = /^([A-Za-z0-9][A-Za-z0-9._-]*)(?:\[[^\]]+\])?\s*(.*)$/u.exec(line);
|
|
105
|
+
if (!match) continue;
|
|
106
|
+
const name = match[1]!.toLowerCase().replaceAll("_", "-");
|
|
107
|
+
entries.push({ name, constraint: match[2]?.trim() ?? "" });
|
|
108
|
+
}
|
|
109
|
+
const names = [...new Set(entries.map((entry) => entry.name))];
|
|
110
|
+
return { names, constraints: conflictList(entries) };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async function installedPythonPackage(workspace: string, name: string): Promise<boolean> {
|
|
114
|
+
const normalized = name.toLowerCase().replaceAll("-", "_");
|
|
115
|
+
for (const environment of [".venv", "venv"]) {
|
|
116
|
+
const lib = join(workspace, environment, "lib");
|
|
117
|
+
const versions = await readdir(lib, { withFileTypes: true }).catch(() => []);
|
|
118
|
+
for (const version of versions) {
|
|
119
|
+
if (!version.isDirectory() || !version.name.startsWith("python")) continue;
|
|
120
|
+
const sitePackages = join(lib, version.name, "site-packages");
|
|
121
|
+
const entries = await readdir(sitePackages, { withFileTypes: true }).catch(() => []);
|
|
122
|
+
if (entries.some((entry) => entry.name === normalized || entry.name.startsWith(`${normalized}-`) || entry.name.startsWith(`${normalized}.`))) return true;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function inspectRequirements(workspace: string, target: string): Promise<DependencyReport> {
|
|
129
|
+
const parsed = parseRequirements(await readFile(target, "utf8"));
|
|
130
|
+
const missing: string[] = [];
|
|
131
|
+
for (const name of parsed.names) {
|
|
132
|
+
if (!(await installedPythonPackage(dirname(target), name)) && !(await installedPythonPackage(workspace, name))) missing.push(name);
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
manifest: relative(workspace, target) || ".",
|
|
136
|
+
ecosystem: "python",
|
|
137
|
+
declared: parsed.names.length,
|
|
138
|
+
installed: parsed.names.length - missing.length,
|
|
139
|
+
missing,
|
|
140
|
+
invalid: [],
|
|
141
|
+
conflicts: parsed.constraints,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export async function inspectManifest(workspace: string, requested = "package.json"): Promise<DependencyReport> {
|
|
146
|
+
const resolved = await resolveExistingWorkspacePath(workspace, requested, "Manifest path must stay inside the current workspace");
|
|
147
|
+
const target = resolved.target;
|
|
148
|
+
workspace = resolved.root;
|
|
149
|
+
const source = await readFile(target, "utf8");
|
|
150
|
+
if (basename(target).toLowerCase().startsWith("requirements") && target.toLowerCase().endsWith(".txt")) return inspectRequirements(workspace, target);
|
|
151
|
+
let parsed: unknown;
|
|
152
|
+
try {
|
|
153
|
+
parsed = JSON.parse(source) as unknown;
|
|
154
|
+
} catch (error) {
|
|
155
|
+
throw new Error(`Invalid JSON manifest: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
156
|
+
}
|
|
157
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Manifest root must be an object");
|
|
158
|
+
const record = parsed as Record<string, unknown>;
|
|
159
|
+
const sections = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"];
|
|
160
|
+
const entries = sections.flatMap((section) => {
|
|
161
|
+
const value = record[section];
|
|
162
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
163
|
+
? Object.entries(value).map(([name, constraint]) => ({ name, constraint: typeof constraint === "string" ? constraint : String(constraint) }))
|
|
164
|
+
: [];
|
|
165
|
+
});
|
|
166
|
+
const unique = [...new Set(entries.map((entry) => entry.name))];
|
|
167
|
+
const moduleRoots: string[] = [];
|
|
168
|
+
for (let directory = dirname(target); ; directory = dirname(directory)) {
|
|
169
|
+
moduleRoots.push(join(directory, "node_modules"));
|
|
170
|
+
if (directory === workspace) break;
|
|
171
|
+
}
|
|
172
|
+
const missing: string[] = [];
|
|
173
|
+
const invalid: string[] = [];
|
|
174
|
+
for (const name of unique) {
|
|
175
|
+
let found = false;
|
|
176
|
+
for (const moduleRoot of moduleRoots) {
|
|
177
|
+
try {
|
|
178
|
+
const moduleStat = await stat(join(moduleRoot, ...name.split("/")));
|
|
179
|
+
if (moduleStat.isDirectory()) {
|
|
180
|
+
found = true;
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
invalid.push(name);
|
|
184
|
+
found = true;
|
|
185
|
+
break;
|
|
186
|
+
} catch {
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (!found) missing.push(name);
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
manifest: relative(workspace, target) || ".",
|
|
194
|
+
ecosystem: "npm",
|
|
195
|
+
declared: unique.length,
|
|
196
|
+
installed: unique.length - missing.length - invalid.length,
|
|
197
|
+
missing,
|
|
198
|
+
invalid,
|
|
199
|
+
conflicts: conflictList(entries),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export default {
|
|
204
|
+
name: "pi-dependency-checker",
|
|
205
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
206
|
+
apply(context: Context) {
|
|
207
|
+
let latest: DependencyReport | undefined;
|
|
208
|
+
const inspect = async (manifest?: string): Promise<DependencyReport> => {
|
|
209
|
+
latest = await inspectManifest(context.piHarnessLaunch.cwd, manifest);
|
|
210
|
+
return latest;
|
|
211
|
+
};
|
|
212
|
+
const unregisterTool = context.piTools.register(
|
|
213
|
+
defineTool({
|
|
214
|
+
name: "dependency_check",
|
|
215
|
+
label: "Dependency check",
|
|
216
|
+
description: "Inspect package.json or requirements.txt and report missing dependencies plus conflicting version constraints.",
|
|
217
|
+
promptSnippet: "check local dependency installation and version conflicts",
|
|
218
|
+
parameters: Type.Object({ manifest: Type.Optional(Type.String({ description: "package.json or requirements.txt path relative to the workspace" })) }),
|
|
219
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<DependencyReport>> {
|
|
220
|
+
const report = await inspect(params.manifest);
|
|
221
|
+
return {
|
|
222
|
+
content: [{ type: "text", text: `${report.manifest}: ${report.missing.length} missing dependencies, ${report.conflicts.length} conflicts.` }],
|
|
223
|
+
details: report,
|
|
224
|
+
};
|
|
225
|
+
},
|
|
226
|
+
}),
|
|
227
|
+
);
|
|
228
|
+
const disposePanel = context.piPluginUi.register({
|
|
229
|
+
id: "dependency-checker-panel",
|
|
230
|
+
pluginId: "@pi-harness/core/plugins/dependency-checker",
|
|
231
|
+
title: "Dependency Checker",
|
|
232
|
+
description: "检查 package.json 或 requirements.txt 的依赖安装状态和版本冲突。",
|
|
233
|
+
icon: "⊙",
|
|
234
|
+
read: async () => ({ report: latest ?? (await inspect()) }),
|
|
235
|
+
});
|
|
236
|
+
context.effect(() => () => {
|
|
237
|
+
unregisterTool();
|
|
238
|
+
disposePanel();
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import { promisify } from "node:util";
|
|
4
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
5
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
6
|
+
import { defineTool, type AgentToolResult } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
|
|
8
|
+
const execFileAsync = promisify(execFile);
|
|
9
|
+
const shellCommands = new Set(["sh", "bash", "zsh", "fish", "cmd", "powershell", "pwsh"]);
|
|
10
|
+
type SandboxRun = { image: string; command: string[]; write: boolean; exitCode: number; output: string };
|
|
11
|
+
|
|
12
|
+
function validateImage(image: string): void {
|
|
13
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9._/@:-]*$/.test(image)) throw new Error("Invalid Docker image reference");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: "pi-docker-sandbox",
|
|
18
|
+
inject: ["piHarnessLaunch", "piPluginUi", "piTools"],
|
|
19
|
+
apply(context: Context) {
|
|
20
|
+
let latest: SandboxRun | undefined;
|
|
21
|
+
const unregisterTool = context.piTools.register(
|
|
22
|
+
defineTool({
|
|
23
|
+
name: "sandbox_exec",
|
|
24
|
+
label: "Docker sandbox",
|
|
25
|
+
description: "Run an argv command in a no-network Docker container with the workspace mounted read-only by default.",
|
|
26
|
+
promptSnippet: "run a command in an isolated no-network Docker sandbox",
|
|
27
|
+
parameters: Type.Object({
|
|
28
|
+
command: Type.Array(Type.String(), { description: "Executable and arguments; shell wrappers are rejected" }),
|
|
29
|
+
image: Type.Optional(Type.String({ description: "Local Docker image, default alpine:3.20" })),
|
|
30
|
+
write: Type.Optional(Type.Boolean({ description: "Mount the workspace read-write" })),
|
|
31
|
+
confirmWrite: Type.Optional(Type.Boolean({ description: "Must be true when write is enabled" })),
|
|
32
|
+
}),
|
|
33
|
+
async execute(_toolCallId, params): Promise<AgentToolResult<SandboxRun>> {
|
|
34
|
+
if (params.command.length === 0) throw new Error("Sandbox command cannot be empty");
|
|
35
|
+
const executable = params.command[0];
|
|
36
|
+
if (executable === undefined) throw new Error("Sandbox command cannot be empty");
|
|
37
|
+
if (shellCommands.has(basename(executable).toLowerCase())) throw new Error("Shell wrappers are not allowed; pass an executable argv directly");
|
|
38
|
+
const image = params.image?.trim() || "alpine:3.20";
|
|
39
|
+
validateImage(image);
|
|
40
|
+
const write = params.write === true;
|
|
41
|
+
if (write && params.confirmWrite !== true) throw new Error("Writable sandbox requires confirmWrite=true");
|
|
42
|
+
try {
|
|
43
|
+
await execFileAsync("docker", ["image", "inspect", image], { timeout: 30_000, maxBuffer: 1_000_000 });
|
|
44
|
+
} catch (error) {
|
|
45
|
+
const failure = error as { code?: number | string; message?: string };
|
|
46
|
+
if (failure.code === "ENOENT") throw new Error("Docker executable is not available on PATH", { cause: error });
|
|
47
|
+
throw new Error(`Docker image is not available locally: ${image}`, { cause: error });
|
|
48
|
+
}
|
|
49
|
+
const args = [
|
|
50
|
+
"run",
|
|
51
|
+
"--rm",
|
|
52
|
+
"--network",
|
|
53
|
+
"none",
|
|
54
|
+
"--read-only",
|
|
55
|
+
"--tmpfs",
|
|
56
|
+
"/tmp:rw,noexec,nosuid",
|
|
57
|
+
"--cap-drop",
|
|
58
|
+
"ALL",
|
|
59
|
+
"--security-opt",
|
|
60
|
+
"no-new-privileges",
|
|
61
|
+
"--pids-limit",
|
|
62
|
+
"256",
|
|
63
|
+
"--mount",
|
|
64
|
+
`type=bind,src=${context.piHarnessLaunch.cwd},dst=/workspace${write ? "" : ",readonly"}`,
|
|
65
|
+
"--workdir",
|
|
66
|
+
"/workspace",
|
|
67
|
+
image,
|
|
68
|
+
...params.command,
|
|
69
|
+
];
|
|
70
|
+
try {
|
|
71
|
+
const result = await execFileAsync("docker", args, { cwd: context.piHarnessLaunch.cwd, timeout: 120_000, maxBuffer: 4 * 1024 * 1024 });
|
|
72
|
+
latest = { image, command: [...params.command], write, exitCode: 0, output: `${result.stdout}${result.stderr}`.slice(-12_000) };
|
|
73
|
+
} catch (error) {
|
|
74
|
+
const failure = error as { code?: number | string; stdout?: string; stderr?: string; message?: string };
|
|
75
|
+
latest = {
|
|
76
|
+
image,
|
|
77
|
+
command: [...params.command],
|
|
78
|
+
write,
|
|
79
|
+
exitCode: typeof failure.code === "number" ? failure.code : 1,
|
|
80
|
+
output: `${failure.stdout ?? ""}${failure.stderr ?? failure.message ?? ""}`.slice(-12_000),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return { content: [{ type: "text", text: `Docker sandbox exited with ${latest.exitCode}.\n${latest.output}` }], details: latest };
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
const disposePanel = context.piPluginUi.register({
|
|
88
|
+
id: "docker-sandbox-panel",
|
|
89
|
+
pluginId: "@pi-harness/core/plugins/docker-sandbox",
|
|
90
|
+
title: "Docker Sandbox",
|
|
91
|
+
description: "无网络、只读挂载、去除 Linux capabilities 的隔离执行环境。",
|
|
92
|
+
icon: "⬡",
|
|
93
|
+
read: () => ({ latest: latest ?? null, defaults: { network: "none", workspace: "read-only", image: "alpine:3.20" } }),
|
|
94
|
+
});
|
|
95
|
+
context.effect(() => () => {
|
|
96
|
+
unregisterTool();
|
|
97
|
+
disposePanel();
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
|
|
3
|
+
type Failure = { time: string; source: string; message: string };
|
|
4
|
+
|
|
5
|
+
function messageOf(error: unknown): string {
|
|
6
|
+
if (error instanceof Error) return error.message;
|
|
7
|
+
if (typeof error === "object" && error !== null && "error" in error) {
|
|
8
|
+
const { error: message, extensionPath } = error as { error: unknown; extensionPath?: unknown };
|
|
9
|
+
const text = typeof message === "string" ? message : String(message);
|
|
10
|
+
return typeof extensionPath === "string" ? `${extensionPath}: ${text}` : text;
|
|
11
|
+
}
|
|
12
|
+
return typeof error === "string" ? error : (JSON.stringify(error) ?? String(error));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: "pi-fail-logger",
|
|
17
|
+
inject: ["piPluginUi"],
|
|
18
|
+
apply(context: Context) {
|
|
19
|
+
const failures: Failure[] = [];
|
|
20
|
+
let previous: string | undefined;
|
|
21
|
+
const record = (source: string, error: unknown): void => {
|
|
22
|
+
const message = messageOf(error);
|
|
23
|
+
const fingerprint = `${source}:${message}`;
|
|
24
|
+
if (fingerprint === previous) return;
|
|
25
|
+
previous = fingerprint;
|
|
26
|
+
failures.push({ time: new Date().toISOString(), source, message });
|
|
27
|
+
if (failures.length > 50) failures.shift();
|
|
28
|
+
};
|
|
29
|
+
const unsubscribeExtension = context.on("pi/extension-error", (error) => record("extension", error));
|
|
30
|
+
const unsubscribeSession = context.on("pi/session-event", (event) => {
|
|
31
|
+
const last = event.type === "agent_end" ? event.messages.at(-1) : undefined;
|
|
32
|
+
if (last?.role === "assistant" && last.stopReason === "error") {
|
|
33
|
+
record("agent", last.errorMessage ?? "Agent turn failed");
|
|
34
|
+
}
|
|
35
|
+
if (event.type === "compaction_end" && event.errorMessage) record("compaction", event.errorMessage);
|
|
36
|
+
});
|
|
37
|
+
const disposePanel = context.piPluginUi.register({
|
|
38
|
+
id: "fail-logger-panel",
|
|
39
|
+
pluginId: "@pi-harness/core/plugins/fail-logger",
|
|
40
|
+
title: "Failure Logger",
|
|
41
|
+
description: "集中记录扩展、Agent 和上下文压缩错误,并去重重复故障。",
|
|
42
|
+
icon: "!",
|
|
43
|
+
read: () => ({ total: failures.length, failures: [...failures].reverse() }),
|
|
44
|
+
});
|
|
45
|
+
context.effect(() => () => {
|
|
46
|
+
unsubscribeExtension();
|
|
47
|
+
unsubscribeSession();
|
|
48
|
+
disposePanel();
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
};
|