@rexvane/piweb 0.3.21 → 0.3.23
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +9 -6
- package/.next/build-manifest.json +5 -5
- package/.next/next-minimal-server.js.nft.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +7 -7
- package/.next/react-loadable-manifest.json +18 -11
- package/.next/required-server-files.js +16 -1
- package/.next/required-server-files.json +16 -1
- package/.next/routes-manifest.json +20 -0
- package/.next/server/app/_global-error/page.js +2 -2
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.meta +8 -0
- package/.next/server/app/_global-error.rsc +15 -11
- package/.next/server/app/_global-error.segments/_full.segment.rsc +15 -11
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +20 -16
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +3 -1
- package/.next/server/app/_not-found/page.js +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.meta +8 -0
- package/.next/server/app/_not-found.rsc +17 -13
- package/.next/server/app/_not-found.segments/_full.segment.rsc +17 -13
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +24 -20
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +4 -2
- package/.next/server/app/api/agent/[id]/events/route.js +2 -2
- package/.next/server/app/api/agent/[id]/events/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/route.js +1 -1
- package/.next/server/app/api/agent/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/[id]/side-chat/route.js +5 -0
- package/.next/server/app/api/agent/[id]/side-chat/route.js.nft.json +1 -0
- package/.next/server/app/api/agent/[id]/side-chat/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/agent/[id]/tree/route.js +1 -1
- package/.next/server/app/api/agent/[id]/tree/route.js.nft.json +1 -1
- package/.next/server/app/api/agent/new/route.js +1 -1
- package/.next/server/app/api/agent/new/route.js.nft.json +1 -1
- package/.next/server/app/api/config/route.js +1 -1
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/files/route.js +1 -1
- package/.next/server/app/api/files/route.js.nft.json +1 -1
- package/.next/server/app/api/fs/route.js +1 -1
- package/.next/server/app/api/fs/route.js.nft.json +1 -1
- package/.next/server/app/api/git/route.js +4 -4
- package/.next/server/app/api/git/route.js.nft.json +1 -1
- package/.next/server/app/api/github/route.js +5 -0
- package/.next/server/app/api/github/route.js.nft.json +1 -0
- package/.next/server/app/api/github/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/growth/route.js +1 -1
- package/.next/server/app/api/growth/route.js.nft.json +1 -1
- package/.next/server/app/api/health/route.js +1 -1
- package/.next/server/app/api/health/route.js.nft.json +1 -1
- package/.next/server/app/api/models/defaults/route.js +1 -0
- package/.next/server/app/api/models/defaults/route.js.nft.json +1 -0
- package/.next/server/app/api/models/defaults/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models/route.js +1 -1
- package/.next/server/app/api/models/route.js.nft.json +1 -1
- package/.next/server/app/api/pi-settings/route.js +1 -1
- package/.next/server/app/api/pi-settings/route.js.nft.json +1 -1
- package/.next/server/app/api/plugins/route.js +1 -1
- package/.next/server/app/api/plugins/route.js.nft.json +1 -1
- package/.next/server/app/api/prompts/route.js +1 -1
- package/.next/server/app/api/prompts/route.js.nft.json +1 -1
- package/.next/server/app/api/remote/route.js +4 -4
- package/.next/server/app/api/remote/route.js.nft.json +1 -1
- package/.next/server/app/api/security/route.js +1 -1
- package/.next/server/app/api/security/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/export/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/[id]/route.js +1 -1
- package/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/import/route.js +2 -2
- package/.next/server/app/api/sessions/import/route.js.nft.json +1 -1
- package/.next/server/app/api/sessions/route.js +1 -1
- package/.next/server/app/api/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +2 -2
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/update/route.js +2 -2
- package/.next/server/app/api/update/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/api/web-auth/route.js +2 -2
- package/.next/server/app/api/web-auth/route.js.nft.json +1 -1
- package/.next/server/app/api/workspaces/route.js +1 -1
- package/.next/server/app/api/workspaces/route.js.nft.json +1 -1
- package/.next/server/app/icon.svg/route.js +1 -1
- package/.next/server/app/icon.svg/route.js.nft.json +1 -1
- package/.next/server/app/icon.svg.meta +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.meta +8 -0
- package/.next/server/app/index.rsc +20 -13
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +26 -19
- package/.next/server/app/index.segments/_full.segment.rsc +20 -13
- package/.next/server/app/index.segments/_tree.segment.rsc +4 -2
- package/.next/server/app/login/page.js +1 -1
- package/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.meta +8 -0
- package/.next/server/app/login.rsc +23 -17
- package/.next/server/app/login.segments/_full.segment.rsc +23 -17
- package/.next/server/app/login.segments/_tree.segment.rsc +4 -2
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +30 -24
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +9 -6
- package/.next/server/chunks/1813.js +23 -0
- package/.next/server/chunks/2430.js +377 -0
- package/.next/server/chunks/2970.js +305 -0
- package/.next/server/chunks/3421.js +1 -0
- package/.next/server/chunks/3924.js +6 -0
- package/.next/server/chunks/4807.js +1 -0
- package/.next/server/chunks/538.js +1 -1
- package/.next/server/chunks/5393.js +1 -0
- package/.next/server/chunks/5802.js +2 -0
- package/.next/server/chunks/6229.js +1 -0
- package/.next/server/chunks/7496.js +1 -0
- package/.next/server/chunks/7662.js +2 -0
- package/.next/server/chunks/8686.js +1 -0
- package/.next/server/chunks/{593.js → 974.js} +1 -1
- package/.next/server/chunks/{920.js → 9920.js} +2 -2
- package/.next/server/functions-config-manifest.json +2 -1
- package/.next/server/instrumentation.js +1 -1
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/middleware.js +185 -23
- package/.next/server/middleware.js.nft.json +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +5 -0
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/server/webpack-runtime.js +1 -1
- package/.next/static/chunks/2716.44fdf1b21454b961.js +1 -0
- package/.next/static/chunks/316-698d10eb465bd8ef.js +1 -0
- package/.next/static/chunks/3794-0978865cda773008.js +52 -0
- package/.next/static/chunks/4673.e261707dce391be7.js +1 -0
- package/.next/static/chunks/4686-0cd87513f9ea3538.js +1 -0
- package/.next/static/chunks/4778.eddd3a5813f85824.js +1 -0
- package/.next/static/chunks/4bd1b696-e199e788e58acf79.js +1 -0
- package/.next/static/chunks/{5173.91ddb803785009f8.js → 5173.dfd1cbb795b9a21c.js} +1 -1
- package/.next/static/chunks/618.949981da99be7182.js +4 -0
- package/.next/static/chunks/7411.5f79671208209b13.js +1 -0
- package/.next/static/chunks/app/_global-error/page-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/events/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/side-chat/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/agent/[id]/tree/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/agent/new/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/config/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/files/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/fs/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/git/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/github/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/growth/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/health/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/models/defaults/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/models/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/pi-settings/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/plugins/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/prompts/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/remote/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/security/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/export/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/sessions/[id]/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/sessions/import/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/skills/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/update/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/version/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/web-auth/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/api/workspaces/route-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/app/page-dc3cb41d91c7432e.js +1 -0
- package/.next/static/chunks/framework-47b723d27f4a4963.js +1 -0
- package/.next/static/chunks/main-5403f0764579e5fe.js +5 -0
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-cbaaee0d7aacb85a.js +1 -0
- package/.next/static/chunks/webpack-2ac3d76b81895f5b.js +1 -0
- package/.next/static/css/9fc559c2c4ad1d0f.css +1 -0
- package/.next/static/css/c6e2227c36ec2fd6.css +1 -0
- package/.next/static/css/{2959bd6b626b7ffe.css → f15a853af8b5127f.css} +1 -1
- package/.next/static/hYPL1-dmhKFjLS3f5yoqN/_buildManifest.js +1 -0
- package/.next/types/app/api/agent/[id]/events/route.ts +3 -1
- package/.next/types/app/api/agent/[id]/route.ts +3 -1
- package/.next/types/app/api/agent/[id]/side-chat/route.ts +355 -0
- package/.next/types/app/api/agent/[id]/tree/route.ts +3 -1
- package/.next/types/app/api/agent/new/route.ts +3 -1
- package/.next/types/app/api/config/route.ts +3 -1
- package/.next/types/app/api/files/route.ts +3 -1
- package/.next/types/app/api/fs/route.ts +3 -1
- package/.next/types/app/api/git/route.ts +3 -1
- package/.next/types/app/api/github/route.ts +355 -0
- package/.next/types/app/api/growth/route.ts +3 -1
- package/.next/types/app/api/health/route.ts +3 -1
- package/.next/types/app/api/models/defaults/route.ts +355 -0
- package/.next/types/app/api/models/route.ts +3 -1
- package/.next/types/app/api/pi-settings/route.ts +3 -1
- package/.next/types/app/api/plugins/route.ts +3 -1
- package/.next/types/app/api/prompts/route.ts +3 -1
- package/.next/types/app/api/remote/route.ts +3 -1
- package/.next/types/app/api/security/route.ts +3 -1
- package/.next/types/app/api/sessions/[id]/export/route.ts +3 -1
- package/.next/types/app/api/sessions/[id]/route.ts +3 -1
- package/.next/types/app/api/sessions/import/route.ts +3 -1
- package/.next/types/app/api/sessions/route.ts +3 -1
- package/.next/types/app/api/skills/route.ts +3 -1
- package/.next/types/app/api/update/route.ts +3 -1
- package/.next/types/app/api/version/route.ts +3 -1
- package/.next/types/app/api/web-auth/route.ts +3 -1
- package/.next/types/app/api/workspaces/route.ts +3 -1
- package/.next/types/app/layout.ts +4 -1
- package/.next/types/app/login/page.ts +4 -1
- package/.next/types/app/page.ts +4 -1
- package/.next/types/cache-life.d.ts +11 -43
- package/.next/types/routes.d.ts +4 -1
- package/.next/types/validator.ts +86 -2
- package/next.config.ts +2 -0
- package/package.json +8 -2
- package/scripts/release.mjs +3 -7
- package/scripts/runtime/check-installed.mjs +66 -0
- package/scripts/runtime/pi-packages.mjs +51 -0
- package/scripts/verify-package.mjs +29 -7
- package/src/app/api/agent/[id]/side-chat/route.ts +77 -0
- package/src/app/api/files/route.ts +5 -2
- package/src/app/api/github/route.ts +26 -0
- package/src/app/api/models/defaults/route.ts +18 -0
- package/src/app/api/models/route.ts +24 -1
- package/src/app/globals.css +1748 -0
- package/src/components/AppShell.tsx +145 -43
- package/src/components/ChatInput.tsx +264 -79
- package/src/components/ChatWindow.tsx +13 -23
- package/src/components/ContextMeter.tsx +213 -144
- package/src/components/DrawerPanel.tsx +1 -1
- package/src/components/FileViewer.tsx +89 -8
- package/src/components/GitPanel.tsx +110 -40
- package/src/components/GrowthTree.tsx +30 -5
- package/src/components/ModelSelector.tsx +21 -5
- package/src/components/ProjectPanel.tsx +55 -30
- package/src/components/PromptPanel.tsx +2 -4
- package/src/components/ProviderSetupModal.module.css +20 -0
- package/src/components/ProviderSetupModal.tsx +134 -29
- package/src/components/SettingsPanel.tsx +252 -27
- package/src/components/TrajectoryView.tsx +4 -6
- package/src/components/chat/reading-anchor.ts +81 -0
- package/src/components/composer/ComposerImages.tsx +326 -0
- package/src/components/side-chat/SideChatPanel.module.css +131 -0
- package/src/components/side-chat/SideChatPanel.tsx +189 -0
- package/src/components/side-chat/icons.tsx +8 -0
- package/src/components/side-chat/request-history.ts +29 -0
- package/src/components/side-chat/store.ts +248 -0
- package/src/hooks/useFileViewer.ts +6 -4
- package/src/hooks/useGrowth.ts +3 -0
- package/src/hooks/usePiWeb.ts +12 -2
- package/src/hooks/useWorkspaceFiles.ts +93 -0
- package/src/i18n.tsx +150 -2
- package/src/lib/agent-manager.ts +135 -104
- package/src/lib/files-service.ts +166 -3
- package/src/lib/format.ts +56 -0
- package/src/lib/git-service.ts +45 -13
- package/src/lib/github-identity.ts +245 -0
- package/src/lib/growth-service.ts +6 -2
- package/src/lib/hero-model-memory.ts +28 -0
- package/src/lib/model-defaults.ts +105 -0
- package/src/lib/model-draft.ts +257 -9
- package/src/lib/model-endpoint.ts +23 -0
- package/src/lib/model-files.ts +33 -0
- package/src/lib/models-service.ts +240 -78
- package/src/lib/path-security.ts +24 -32
- package/src/lib/pi.ts +27 -2
- package/src/lib/process-format.ts +3 -2
- package/src/lib/session/metrics.ts +31 -0
- package/src/lib/session-reader.ts +1 -1
- package/src/lib/side-chat/context.ts +123 -0
- package/src/lib/side-chat/service.ts +191 -0
- package/src/lib/side-chat/types.ts +61 -0
- package/src/lib/thinking-level.ts +39 -0
- package/src/lib/trajectory.ts +17 -3
- package/src/lib/types.ts +12 -1
- package/src/lib/update-service.ts +4 -6
- package/src/lib/workspace-index.ts +270 -0
- package/.next/server/chunks/229.js +0 -1
- package/.next/server/chunks/393.js +0 -1
- package/.next/server/chunks/421.js +0 -1
- package/.next/server/chunks/430.js +0 -193
- package/.next/server/chunks/496.js +0 -1
- package/.next/server/chunks/662.js +0 -2
- package/.next/server/chunks/686.js +0 -1
- package/.next/server/chunks/741.js +0 -165
- package/.next/server/chunks/802.js +0 -2
- package/.next/server/chunks/807.js +0 -1
- package/.next/server/chunks/813.js +0 -1
- package/.next/server/chunks/924.js +0 -6
- package/.next/static/chunks/2716.7ad073038e94a802.js +0 -1
- package/.next/static/chunks/316-5ea443ee6b512aa9.js +0 -1
- package/.next/static/chunks/3794-3679f1c05160977c.js +0 -52
- package/.next/static/chunks/4673.8a5a9e6855350e34.js +0 -1
- package/.next/static/chunks/4686-882531aef1d2e250.js +0 -1
- package/.next/static/chunks/4778.305dc6abb9889627.js +0 -1
- package/.next/static/chunks/4bd1b696-93bf506b236d6248.js +0 -1
- package/.next/static/chunks/618.ee5d5bf1c647e483.js +0 -4
- package/.next/static/chunks/839.bfd2db36483faa3e.js +0 -1
- package/.next/static/chunks/app/_global-error/page-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/events/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/agent/[id]/tree/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/agent/new/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/config/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/files/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/fs/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/git/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/growth/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/health/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/models/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/pi-settings/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/plugins/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/prompts/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/remote/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/security/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/export/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/sessions/[id]/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/sessions/import/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/sessions/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/skills/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/update/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/version/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/web-auth/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/api/workspaces/route-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/app/page-c04af72e549695bd.js +0 -1
- package/.next/static/chunks/framework-c4e651fe89edfa91.js +0 -1
- package/.next/static/chunks/main-6159b22a8cb0b7c5.js +0 -5
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-b179d9f7f6f2daf9.js +0 -1
- package/.next/static/chunks/webpack-9b4bb574e5817654.js +0 -1
- package/.next/static/css/ea27b9e30f76303f.css +0 -1
- package/.next/static/sNX5GQkOWuK5YEID1hT-C/_buildManifest.js +0 -1
- /package/.next/static/{sNX5GQkOWuK5YEID1hT-C → hYPL1-dmhKFjLS3f5yoqN}/_ssgManifest.js +0 -0
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Release gate for the prebuilt artifact: pack the package exactly as
|
|
4
4
|
* `npm publish` would, unpack it somewhere else, and validate the copy with the
|
|
5
|
-
* same check the launcher runs before starting.
|
|
5
|
+
* same check the launcher runs before starting. The CLI also installs the tarball
|
|
6
|
+
* into an empty global prefix and imports the real Pi SDK.
|
|
6
7
|
*
|
|
7
8
|
* `files` is a whitelist, so enumerating Next internals by hand ships a package
|
|
8
9
|
* that installs cleanly and then dies on first start with a missing manifest
|
|
@@ -16,6 +17,7 @@ import { spawnSync } from "node:child_process";
|
|
|
16
17
|
import { fileURLToPath } from "node:url";
|
|
17
18
|
import { readProductionBuild } from "./build-output.mjs";
|
|
18
19
|
import { isMainModule } from "./entrypoint.mjs";
|
|
20
|
+
import { PI_PACKAGE, verifyPiRuntimePins } from "./runtime/pi-packages.mjs";
|
|
19
21
|
|
|
20
22
|
const DEFAULT_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
21
23
|
|
|
@@ -31,17 +33,36 @@ function run(command, args, options = {}) {
|
|
|
31
33
|
* as well as unsafe with paths containing spaces. Whenever npm invoked us (npm test,
|
|
32
34
|
* npm run verify:package, CI) it hands us its own CLI entry, so run that with node.
|
|
33
35
|
*/
|
|
34
|
-
function runNpm(args,
|
|
35
|
-
const cli = process.env.npm_execpath
|
|
36
|
-
|
|
37
|
-
return run(
|
|
36
|
+
function runNpm(args, options) {
|
|
37
|
+
const cli = [process.env.npm_execpath, path.join(path.dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js")]
|
|
38
|
+
.find((file) => file?.endsWith(".js") && fs.existsSync(file));
|
|
39
|
+
if (cli) return run(process.execPath, [cli, ...args], options);
|
|
40
|
+
return run("npm", args, { ...options, shell: process.platform === "win32" });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Install the tarball into an empty global prefix; checkout node_modules cannot hide drift. */
|
|
44
|
+
function verifyInstalledRuntime(tarball, tmp, manifest, log) {
|
|
45
|
+
const prefix = path.join(tmp, "installed");
|
|
46
|
+
const env = { ...process.env, PI_CODING_AGENT_DIR: path.join(tmp, "agent"), PI_OFFLINE: "1" };
|
|
47
|
+
runNpm(["install", "--global", "--prefix", prefix, "--omit=dev", "--ignore-scripts", "--no-audit", "--no-fund", tarball], {
|
|
48
|
+
cwd: tmp, env, timeout: 600_000,
|
|
49
|
+
});
|
|
50
|
+
const modules = process.platform === "win32" ? path.join(prefix, "node_modules") : path.join(prefix, "lib", "node_modules");
|
|
51
|
+
const installed = path.join(modules, ...manifest.name.split("/"));
|
|
52
|
+
run(process.execPath, [path.join(installed, "scripts", "runtime", "check-installed.mjs")], {
|
|
53
|
+
cwd: installed, timeout: 180_000,
|
|
54
|
+
env: { ...env, NODE_ENV: "production", PI_WEB_ROOT: installed, PIWEB_REMOTE_LAN: "0", PI_WEB_AUTH: "0", PI_WEB_UPDATE_CHECK: "0", NEXT_TELEMETRY_DISABLED: "1" },
|
|
55
|
+
});
|
|
56
|
+
log("[piweb] Clean global installation: Pi " + verifyPiRuntimePins(manifest) + " SDK, production startup, home page and first-paint APIs passed");
|
|
38
57
|
}
|
|
39
58
|
|
|
40
59
|
/**
|
|
41
60
|
* @param {string} root
|
|
42
61
|
* @returns {{filename: string, files: string[], buildId: string, bytes: number}}
|
|
43
62
|
*/
|
|
44
|
-
export function verifyPackedPackage(root, { log = console.log } = {}) {
|
|
63
|
+
export function verifyPackedPackage(root, { log = console.log, runtime = false } = {}) {
|
|
64
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf8"));
|
|
65
|
+
if (manifest.dependencies?.[PI_PACKAGE]) verifyPiRuntimePins(manifest);
|
|
45
66
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "piweb-verify-"));
|
|
46
67
|
try {
|
|
47
68
|
const packed = JSON.parse(runNpm(["pack", "--json", "--pack-destination", tmp], { cwd: root }));
|
|
@@ -58,6 +79,7 @@ export function verifyPackedPackage(root, { log = console.log } = {}) {
|
|
|
58
79
|
run("tar", ["-xzf", entry.filename, "-C", "unpacked"], { cwd: tmp });
|
|
59
80
|
// Same validation the launcher applies to an installed package.
|
|
60
81
|
const build = readProductionBuild(path.join(unpacked, "package"), ".next");
|
|
82
|
+
if (runtime) verifyInstalledRuntime(path.join(tmp, entry.filename), tmp, manifest, log);
|
|
61
83
|
const bytes = fs.statSync(path.join(tmp, entry.filename)).size;
|
|
62
84
|
log(`[piweb] ${entry.filename}: ${files.length} files, ${(bytes / 1024 / 1024).toFixed(1)} MB, build ${build.buildId}`);
|
|
63
85
|
return { filename: entry.filename, files, buildId: build.buildId, bytes };
|
|
@@ -68,7 +90,7 @@ export function verifyPackedPackage(root, { log = console.log } = {}) {
|
|
|
68
90
|
|
|
69
91
|
if (isMainModule(import.meta.url)) {
|
|
70
92
|
try {
|
|
71
|
-
verifyPackedPackage(DEFAULT_ROOT);
|
|
93
|
+
verifyPackedPackage(DEFAULT_ROOT, { runtime: true });
|
|
72
94
|
} catch (error) {
|
|
73
95
|
console.error(`[piweb] ${error instanceof Error ? error.message : error}`);
|
|
74
96
|
process.exitCode = 1;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { BoundaryError, resolveSessionPath } from "@/lib/path-security";
|
|
3
|
+
import { parseSideChatRequest } from "@/lib/side-chat/context";
|
|
4
|
+
import { pollSideChat, startSideChat, stopSideChat } from "@/lib/side-chat/service";
|
|
5
|
+
import { isSideChatId, SIDE_CHAT_BODY_LIMIT } from "@/lib/side-chat/types";
|
|
6
|
+
|
|
7
|
+
export const dynamic = "force-dynamic";
|
|
8
|
+
export const runtime = "nodejs";
|
|
9
|
+
type RouteParams = { params: Promise<{ id: string }> };
|
|
10
|
+
const headers = { "Cache-Control": "no-store" };
|
|
11
|
+
|
|
12
|
+
function failure(error: unknown): NextResponse {
|
|
13
|
+
return NextResponse.json({ success: false, error: error instanceof Error ? error.message : "side-chat request failed" }, {
|
|
14
|
+
status: error instanceof BoundaryError || error instanceof SyntaxError ? 400 : 500, headers,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function readBody(req: Request): Promise<unknown> {
|
|
19
|
+
if (!req.body) throw new BoundaryError("missing side-chat request");
|
|
20
|
+
const reader = req.body.getReader();
|
|
21
|
+
const chunks: Uint8Array[] = [];
|
|
22
|
+
let size = 0;
|
|
23
|
+
try {
|
|
24
|
+
for (;;) {
|
|
25
|
+
const chunk = await reader.read();
|
|
26
|
+
if (chunk.done) break;
|
|
27
|
+
size += chunk.value.byteLength;
|
|
28
|
+
if (size > SIDE_CHAT_BODY_LIMIT) {
|
|
29
|
+
await reader.cancel();
|
|
30
|
+
throw new BoundaryError("side-chat history is too large; start a new side chat");
|
|
31
|
+
}
|
|
32
|
+
chunks.push(chunk.value);
|
|
33
|
+
}
|
|
34
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
35
|
+
} finally {
|
|
36
|
+
reader.releaseLock();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function POST(req: Request, { params }: RouteParams) {
|
|
41
|
+
try {
|
|
42
|
+
const { id } = await params;
|
|
43
|
+
const sessionPath = await resolveSessionPath(id, { allowPending: true });
|
|
44
|
+
const request = parseSideChatRequest(await readBody(req));
|
|
45
|
+
if (req.signal.aborted) throw new BoundaryError("side-chat request was cancelled");
|
|
46
|
+
return NextResponse.json({ success: true, data: startSideChat(sessionPath, request) }, { headers });
|
|
47
|
+
} catch (error) {
|
|
48
|
+
return failure(error);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function GET(req: Request, { params }: RouteParams) {
|
|
53
|
+
try {
|
|
54
|
+
const { id } = await params;
|
|
55
|
+
const sessionPath = await resolveSessionPath(id, { allowPending: true });
|
|
56
|
+
const query = new URL(req.url).searchParams;
|
|
57
|
+
const requestId = query.get("requestId");
|
|
58
|
+
const after = Number(query.get("after") ?? "-1");
|
|
59
|
+
if (!isSideChatId(requestId) || !Number.isSafeInteger(after) || after < -1) throw new BoundaryError("invalid side-chat cursor");
|
|
60
|
+
return NextResponse.json({ success: true, data: await pollSideChat(sessionPath, requestId, after, req.signal) }, { headers });
|
|
61
|
+
} catch (error) {
|
|
62
|
+
return failure(error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function DELETE(req: Request, { params }: RouteParams) {
|
|
67
|
+
try {
|
|
68
|
+
const { id } = await params;
|
|
69
|
+
const sessionPath = await resolveSessionPath(id, { allowPending: true });
|
|
70
|
+
const requestId = new URL(req.url).searchParams.get("requestId");
|
|
71
|
+
if (!isSideChatId(requestId)) throw new BoundaryError("invalid side-chat id");
|
|
72
|
+
stopSideChat(sessionPath, requestId);
|
|
73
|
+
return NextResponse.json({ success: true }, { headers });
|
|
74
|
+
} catch (error) {
|
|
75
|
+
return failure(error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { NextResponse } from "next/server";
|
|
2
2
|
import { BoundaryError } from "@/lib/path-security";
|
|
3
|
-
import { listWorkspaceDir, openInEditor, parseUploadLength, readWorkspaceFile, saveUploadStream } from "@/lib/files-service";
|
|
3
|
+
import { listWorkspaceDir, listWorkspaceIndex, openInEditor, parseUploadLength, readWorkspaceFile, saveUploadStream } from "@/lib/files-service";
|
|
4
4
|
|
|
5
5
|
export const dynamic = "force-dynamic";
|
|
6
6
|
|
|
7
|
-
/** 工作区文件浏览:?cwd=&path=(目录列表);?read=1&cwd=&path
|
|
7
|
+
/** 工作区文件浏览:?cwd=&path=(目录列表);?read=1&cwd=&path=(文本预览);?index=1&cwd=(@ 引用候选全量清单) */
|
|
8
8
|
export async function GET(req: Request) {
|
|
9
9
|
const url = new URL(req.url);
|
|
10
10
|
try {
|
|
11
11
|
if (url.searchParams.get("read") === "1") {
|
|
12
12
|
return NextResponse.json({ success: true, data: await readWorkspaceFile(url.searchParams.get("cwd"), url.searchParams.get("path")) });
|
|
13
13
|
}
|
|
14
|
+
if (url.searchParams.get("index") === "1") {
|
|
15
|
+
return NextResponse.json({ success: true, data: await listWorkspaceIndex(url.searchParams.get("cwd")) });
|
|
16
|
+
}
|
|
14
17
|
return NextResponse.json({ success: true, data: await listWorkspaceDir(url.searchParams.get("cwd"), url.searchParams.get("path"), url.searchParams.get("offset")) });
|
|
15
18
|
} catch (err: any) {
|
|
16
19
|
return NextResponse.json(
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { repoRoot } from "@/lib/git-service";
|
|
3
|
+
import { awaitGithubIdentity } from "@/lib/github-identity";
|
|
4
|
+
import { BoundaryError, resolveWorkspacePath } from "@/lib/path-security";
|
|
5
|
+
|
|
6
|
+
export const dynamic = "force-dynamic";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Git 面板头部的 GitHub 身份(头像 + 账号)。
|
|
10
|
+
*
|
|
11
|
+
* 与 /api/git 分开:身份要走网络(gh / 头像),不该拖慢分支与文件状态那条纯本地读取。
|
|
12
|
+
* 取不到就回 identity: null,前端只显示分支信息,不报错。
|
|
13
|
+
*/
|
|
14
|
+
export async function GET(req: Request) {
|
|
15
|
+
const cwd = new URL(req.url).searchParams.get("cwd");
|
|
16
|
+
try {
|
|
17
|
+
const resolved = await resolveWorkspacePath(cwd);
|
|
18
|
+
const { root } = await repoRoot(resolved);
|
|
19
|
+
if (!root) return NextResponse.json({ success: true, data: { identity: null } });
|
|
20
|
+
return NextResponse.json({ success: true, data: { identity: await awaitGithubIdentity(root) } });
|
|
21
|
+
} catch (err: any) {
|
|
22
|
+
if (err instanceof BoundaryError) return NextResponse.json({ success: false, error: err.message }, { status: 400 });
|
|
23
|
+
// 身份只是装饰:任何失败都不该让面板变红
|
|
24
|
+
return NextResponse.json({ success: true, data: { identity: null } });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { newSessionDefaults } from "@/lib/model-defaults";
|
|
3
|
+
import { BoundaryError, resolveWorkspacePath } from "@/lib/path-security";
|
|
4
|
+
|
|
5
|
+
export const dynamic = "force-dynamic";
|
|
6
|
+
|
|
7
|
+
/** 新会话页的默认模型与思考档位:按工作区读 pi 的设置 */
|
|
8
|
+
export async function GET(req: Request) {
|
|
9
|
+
try {
|
|
10
|
+
const cwd = await resolveWorkspacePath(new URL(req.url).searchParams.get("cwd"));
|
|
11
|
+
return NextResponse.json({ success: true, data: await newSessionDefaults(cwd) });
|
|
12
|
+
} catch (error) {
|
|
13
|
+
return NextResponse.json(
|
|
14
|
+
{ success: false, error: error instanceof Error ? error.message : "request failed" },
|
|
15
|
+
{ status: error instanceof BoundaryError ? 400 : 500 },
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -2,7 +2,9 @@ import { gzipSync } from "node:zlib";
|
|
|
2
2
|
import { NextResponse } from "next/server";
|
|
3
3
|
import {
|
|
4
4
|
answerLogin,
|
|
5
|
+
builtinCatalogModelIds,
|
|
5
6
|
cancelLogin,
|
|
7
|
+
contextWindowInfo,
|
|
6
8
|
CustomProvidersConflictError,
|
|
7
9
|
CustomProvidersValidationError,
|
|
8
10
|
discoverModels,
|
|
@@ -14,6 +16,7 @@ import {
|
|
|
14
16
|
readCustomProviders,
|
|
15
17
|
removeApiKey,
|
|
16
18
|
setApiKey,
|
|
19
|
+
setModelContextWindow,
|
|
17
20
|
startLogin,
|
|
18
21
|
writeCustomProviders,
|
|
19
22
|
} from "@/lib/models-service";
|
|
@@ -58,7 +61,13 @@ export async function GET(req: Request) {
|
|
|
58
61
|
const providers = full
|
|
59
62
|
? data.providers
|
|
60
63
|
: data.providers.map((p) => ({ id: p.id, name: p.name, authReady: p.authReady, builtIn: p.builtIn, modelCount: p.modelCount }));
|
|
61
|
-
|
|
64
|
+
// 设置页编辑内置 provider 时据此把「覆盖已有模型」写进 modelOverrides,而不是 models[]
|
|
65
|
+
const catalogModelIds = customProviders ? await builtinCatalogModelIds(customProviders.content, data.models) : undefined;
|
|
66
|
+
return jsonMaybeGzip(
|
|
67
|
+
req,
|
|
68
|
+
{ success: true, data: { providers, models, customProviders, ...(catalogModelIds ? { catalogModelIds } : {}) } },
|
|
69
|
+
`${modelListStamp()}:${custom ? "custom" : full ? "full" : "piweb"}`,
|
|
70
|
+
);
|
|
62
71
|
} catch (err: any) {
|
|
63
72
|
return NextResponse.json({ success: false, error: String(err?.message ?? err) }, { status: 500 });
|
|
64
73
|
}
|
|
@@ -73,11 +82,15 @@ export async function POST(req: Request) {
|
|
|
73
82
|
| "saveCustomProviders"
|
|
74
83
|
| "discoverModels"
|
|
75
84
|
| "providerUsage"
|
|
85
|
+
| "contextWindowInfo"
|
|
86
|
+
| "setContextWindow"
|
|
76
87
|
| "loginStart"
|
|
77
88
|
| "loginState"
|
|
78
89
|
| "loginAnswer"
|
|
79
90
|
| "loginCancel";
|
|
80
91
|
providerId?: string;
|
|
92
|
+
modelId?: string;
|
|
93
|
+
contextWindow?: number;
|
|
81
94
|
apiKey?: string;
|
|
82
95
|
baseUrl?: string;
|
|
83
96
|
api?: string;
|
|
@@ -115,6 +128,16 @@ export async function POST(req: Request) {
|
|
|
115
128
|
const usage = await providerUsage(body.providerId, body.force === true);
|
|
116
129
|
return NextResponse.json({ success: true, data: { usage } });
|
|
117
130
|
}
|
|
131
|
+
if (body.action === "contextWindowInfo" || body.action === "setContextWindow") {
|
|
132
|
+
if (typeof body.providerId !== "string" || !body.providerId || typeof body.modelId !== "string" || !body.modelId) {
|
|
133
|
+
return NextResponse.json({ success: false, error: "missing providerId or modelId" }, { status: 400 });
|
|
134
|
+
}
|
|
135
|
+
if (body.action === "contextWindowInfo") {
|
|
136
|
+
return NextResponse.json({ success: true, data: await contextWindowInfo(body.providerId, body.modelId) });
|
|
137
|
+
}
|
|
138
|
+
if (typeof body.contextWindow !== "number") return NextResponse.json({ success: false, error: "missing contextWindow" }, { status: 400 });
|
|
139
|
+
return NextResponse.json({ success: true, data: await setModelContextWindow(body.providerId, body.modelId, body.contextWindow) });
|
|
140
|
+
}
|
|
118
141
|
if (body.action === "loginStart") {
|
|
119
142
|
if (!body.providerId) return NextResponse.json({ success: false, error: "missing providerId" }, { status: 400 });
|
|
120
143
|
await startLogin(body.providerId);
|