@rexvane/piweb 0.3.1
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 +21 -0
- package/README.md +128 -0
- package/assets/showcase.png +0 -0
- package/bin/pi.js +50 -0
- package/bin/piweb.js +12 -0
- package/next.config.ts +21 -0
- package/package.json +88 -0
- package/postcss.config.mjs +7 -0
- package/public/file-icons/3d.svg +1 -0
- package/public/file-icons/LICENSE +8 -0
- package/public/file-icons/adobe-illustrator.svg +1 -0
- package/public/file-icons/adobe-photoshop.svg +1 -0
- package/public/file-icons/agent.svg +1 -0
- package/public/file-icons/asciidoc.svg +1 -0
- package/public/file-icons/assembly.svg +1 -0
- package/public/file-icons/astro.svg +1 -0
- package/public/file-icons/audio.svg +1 -0
- package/public/file-icons/authors.svg +1 -0
- package/public/file-icons/babel.svg +1 -0
- package/public/file-icons/bibliography.svg +1 -0
- package/public/file-icons/bicep.svg +1 -0
- package/public/file-icons/blender.svg +1 -0
- package/public/file-icons/bun.svg +1 -0
- package/public/file-icons/c.svg +1 -0
- package/public/file-icons/certificate.svg +1 -0
- package/public/file-icons/changelog.svg +1 -0
- package/public/file-icons/clojure.svg +1 -0
- package/public/file-icons/cmake.svg +1 -0
- package/public/file-icons/codeowners.svg +1 -0
- package/public/file-icons/commitlint.svg +1 -0
- package/public/file-icons/conduct.svg +1 -0
- package/public/file-icons/console.svg +1 -0
- package/public/file-icons/contributing.svg +1 -0
- package/public/file-icons/cpp.svg +1 -0
- package/public/file-icons/csharp.svg +1 -0
- package/public/file-icons/css.svg +1 -0
- package/public/file-icons/cursor.svg +1 -0
- package/public/file-icons/dart.svg +1 -0
- package/public/file-icons/database.svg +1 -0
- package/public/file-icons/deno.svg +1 -0
- package/public/file-icons/diff.svg +1 -0
- package/public/file-icons/docker.svg +1 -0
- package/public/file-icons/document.svg +1 -0
- package/public/file-icons/editorconfig.svg +1 -0
- package/public/file-icons/ejs.svg +1 -0
- package/public/file-icons/elixir.svg +1 -0
- package/public/file-icons/elm.svg +1 -0
- package/public/file-icons/email.svg +1 -0
- package/public/file-icons/erlang.svg +1 -0
- package/public/file-icons/eslint.svg +1 -0
- package/public/file-icons/favicon.svg +1 -0
- package/public/file-icons/file.svg +1 -0
- package/public/file-icons/folder-admin-open.svg +1 -0
- package/public/file-icons/folder-admin.svg +1 -0
- package/public/file-icons/folder-android-open.svg +1 -0
- package/public/file-icons/folder-android.svg +1 -0
- package/public/file-icons/folder-api-open.svg +1 -0
- package/public/file-icons/folder-api.svg +1 -0
- package/public/file-icons/folder-app-open.svg +1 -0
- package/public/file-icons/folder-app.svg +1 -0
- package/public/file-icons/folder-archive-open.svg +1 -0
- package/public/file-icons/folder-archive.svg +1 -0
- package/public/file-icons/folder-atom-open.svg +1 -0
- package/public/file-icons/folder-atom.svg +1 -0
- package/public/file-icons/folder-audio-open.svg +1 -0
- package/public/file-icons/folder-audio.svg +1 -0
- package/public/file-icons/folder-aws-open.svg +1 -0
- package/public/file-icons/folder-aws.svg +1 -0
- package/public/file-icons/folder-backup-open.svg +1 -0
- package/public/file-icons/folder-backup.svg +1 -0
- package/public/file-icons/folder-benchmark-open.svg +1 -0
- package/public/file-icons/folder-benchmark.svg +1 -0
- package/public/file-icons/folder-cart-open.svg +1 -0
- package/public/file-icons/folder-cart.svg +1 -0
- package/public/file-icons/folder-ci-open.svg +1 -0
- package/public/file-icons/folder-ci.svg +1 -0
- package/public/file-icons/folder-circleci-open.svg +1 -0
- package/public/file-icons/folder-circleci.svg +1 -0
- package/public/file-icons/folder-class-open.svg +1 -0
- package/public/file-icons/folder-class.svg +1 -0
- package/public/file-icons/folder-client-open.svg +1 -0
- package/public/file-icons/folder-client.svg +1 -0
- package/public/file-icons/folder-command-open.svg +1 -0
- package/public/file-icons/folder-command.svg +1 -0
- package/public/file-icons/folder-components-open.svg +1 -0
- package/public/file-icons/folder-components.svg +1 -0
- package/public/file-icons/folder-config-open.svg +1 -0
- package/public/file-icons/folder-config.svg +1 -0
- package/public/file-icons/folder-console-open.svg +1 -0
- package/public/file-icons/folder-console.svg +1 -0
- package/public/file-icons/folder-content-open.svg +1 -0
- package/public/file-icons/folder-content.svg +1 -0
- package/public/file-icons/folder-context-open.svg +1 -0
- package/public/file-icons/folder-context.svg +1 -0
- package/public/file-icons/folder-contract-open.svg +1 -0
- package/public/file-icons/folder-contract.svg +1 -0
- package/public/file-icons/folder-controller-open.svg +1 -0
- package/public/file-icons/folder-controller.svg +1 -0
- package/public/file-icons/folder-core-open.svg +1 -0
- package/public/file-icons/folder-core.svg +1 -0
- package/public/file-icons/folder-coverage-open.svg +1 -0
- package/public/file-icons/folder-coverage.svg +1 -0
- package/public/file-icons/folder-css-open.svg +1 -0
- package/public/file-icons/folder-css.svg +1 -0
- package/public/file-icons/folder-database-open.svg +1 -0
- package/public/file-icons/folder-database.svg +1 -0
- package/public/file-icons/folder-debug-open.svg +1 -0
- package/public/file-icons/folder-debug.svg +1 -0
- package/public/file-icons/folder-deprecated-open.svg +1 -0
- package/public/file-icons/folder-deprecated.svg +1 -0
- package/public/file-icons/folder-desktop-open.svg +1 -0
- package/public/file-icons/folder-desktop.svg +1 -0
- package/public/file-icons/folder-dist-open.svg +1 -0
- package/public/file-icons/folder-dist.svg +1 -0
- package/public/file-icons/folder-docker-open.svg +1 -0
- package/public/file-icons/folder-docker.svg +1 -0
- package/public/file-icons/folder-docs-open.svg +1 -0
- package/public/file-icons/folder-docs.svg +1 -0
- package/public/file-icons/folder-element-open.svg +1 -0
- package/public/file-icons/folder-element.svg +1 -0
- package/public/file-icons/folder-environment-open.svg +1 -0
- package/public/file-icons/folder-environment.svg +1 -0
- package/public/file-icons/folder-event-open.svg +1 -0
- package/public/file-icons/folder-event.svg +1 -0
- package/public/file-icons/folder-examples-open.svg +1 -0
- package/public/file-icons/folder-examples.svg +1 -0
- package/public/file-icons/folder-features-open.svg +1 -0
- package/public/file-icons/folder-features.svg +1 -0
- package/public/file-icons/folder-font-open.svg +1 -0
- package/public/file-icons/folder-font.svg +1 -0
- package/public/file-icons/folder-functions-open.svg +1 -0
- package/public/file-icons/folder-functions.svg +1 -0
- package/public/file-icons/folder-generator-open.svg +1 -0
- package/public/file-icons/folder-generator.svg +1 -0
- package/public/file-icons/folder-git-open.svg +1 -0
- package/public/file-icons/folder-git.svg +1 -0
- package/public/file-icons/folder-github-open.svg +1 -0
- package/public/file-icons/folder-github.svg +1 -0
- package/public/file-icons/folder-gitlab-open.svg +1 -0
- package/public/file-icons/folder-gitlab.svg +1 -0
- package/public/file-icons/folder-graphql-open.svg +1 -0
- package/public/file-icons/folder-graphql.svg +1 -0
- package/public/file-icons/folder-helper-open.svg +1 -0
- package/public/file-icons/folder-helper.svg +1 -0
- package/public/file-icons/folder-hook-open.svg +1 -0
- package/public/file-icons/folder-hook.svg +1 -0
- package/public/file-icons/folder-husky-open.svg +1 -0
- package/public/file-icons/folder-husky.svg +1 -0
- package/public/file-icons/folder-i18n-open.svg +1 -0
- package/public/file-icons/folder-i18n.svg +1 -0
- package/public/file-icons/folder-images-open.svg +1 -0
- package/public/file-icons/folder-images.svg +1 -0
- package/public/file-icons/folder-include-open.svg +1 -0
- package/public/file-icons/folder-include.svg +1 -0
- package/public/file-icons/folder-intellij-open.svg +1 -0
- package/public/file-icons/folder-intellij.svg +1 -0
- package/public/file-icons/folder-interface-open.svg +1 -0
- package/public/file-icons/folder-interface.svg +1 -0
- package/public/file-icons/folder-ios-open.svg +1 -0
- package/public/file-icons/folder-ios.svg +1 -0
- package/public/file-icons/folder-java-open.svg +1 -0
- package/public/file-icons/folder-java.svg +1 -0
- package/public/file-icons/folder-job-open.svg +1 -0
- package/public/file-icons/folder-job.svg +1 -0
- package/public/file-icons/folder-jupyter-open.svg +1 -0
- package/public/file-icons/folder-jupyter.svg +1 -0
- package/public/file-icons/folder-keys-open.svg +1 -0
- package/public/file-icons/folder-keys.svg +1 -0
- package/public/file-icons/folder-kubernetes-open.svg +1 -0
- package/public/file-icons/folder-kubernetes.svg +1 -0
- package/public/file-icons/folder-layout-open.svg +1 -0
- package/public/file-icons/folder-layout.svg +1 -0
- package/public/file-icons/folder-less-open.svg +1 -0
- package/public/file-icons/folder-less.svg +1 -0
- package/public/file-icons/folder-lib-open.svg +1 -0
- package/public/file-icons/folder-lib.svg +1 -0
- package/public/file-icons/folder-log-open.svg +1 -0
- package/public/file-icons/folder-log.svg +1 -0
- package/public/file-icons/folder-messages-open.svg +1 -0
- package/public/file-icons/folder-messages.svg +1 -0
- package/public/file-icons/folder-meta-open.svg +1 -0
- package/public/file-icons/folder-meta.svg +1 -0
- package/public/file-icons/folder-middleware-open.svg +1 -0
- package/public/file-icons/folder-middleware.svg +1 -0
- package/public/file-icons/folder-migrations-open.svg +1 -0
- package/public/file-icons/folder-migrations.svg +1 -0
- package/public/file-icons/folder-mobile-open.svg +1 -0
- package/public/file-icons/folder-mobile.svg +1 -0
- package/public/file-icons/folder-mock-open.svg +1 -0
- package/public/file-icons/folder-mock.svg +1 -0
- package/public/file-icons/folder-molecule-open.svg +1 -0
- package/public/file-icons/folder-molecule.svg +1 -0
- package/public/file-icons/folder-next-open.svg +1 -0
- package/public/file-icons/folder-next.svg +1 -0
- package/public/file-icons/folder-node-open.svg +1 -0
- package/public/file-icons/folder-node.svg +1 -0
- package/public/file-icons/folder-nuxt-open.svg +1 -0
- package/public/file-icons/folder-nuxt.svg +1 -0
- package/public/file-icons/folder-open.svg +1 -0
- package/public/file-icons/folder-organism-open.svg +1 -0
- package/public/file-icons/folder-organism.svg +1 -0
- package/public/file-icons/folder-packages-open.svg +1 -0
- package/public/file-icons/folder-packages.svg +1 -0
- package/public/file-icons/folder-plugin-open.svg +1 -0
- package/public/file-icons/folder-plugin.svg +1 -0
- package/public/file-icons/folder-prisma-open.svg +1 -0
- package/public/file-icons/folder-prisma.svg +1 -0
- package/public/file-icons/folder-prompts-open.svg +1 -0
- package/public/file-icons/folder-prompts.svg +1 -0
- package/public/file-icons/folder-proto-open.svg +1 -0
- package/public/file-icons/folder-proto.svg +1 -0
- package/public/file-icons/folder-public-open.svg +1 -0
- package/public/file-icons/folder-public.svg +1 -0
- package/public/file-icons/folder-python-open.svg +1 -0
- package/public/file-icons/folder-python.svg +1 -0
- package/public/file-icons/folder-queue-open.svg +1 -0
- package/public/file-icons/folder-queue.svg +1 -0
- package/public/file-icons/folder-resource-open.svg +1 -0
- package/public/file-icons/folder-resource.svg +1 -0
- package/public/file-icons/folder-review-open.svg +1 -0
- package/public/file-icons/folder-review.svg +1 -0
- package/public/file-icons/folder-robot-open.svg +1 -0
- package/public/file-icons/folder-robot.svg +1 -0
- package/public/file-icons/folder-routes-open.svg +1 -0
- package/public/file-icons/folder-routes.svg +1 -0
- package/public/file-icons/folder-rust-open.svg +1 -0
- package/public/file-icons/folder-rust.svg +1 -0
- package/public/file-icons/folder-sass-open.svg +1 -0
- package/public/file-icons/folder-sass.svg +1 -0
- package/public/file-icons/folder-scripts-open.svg +1 -0
- package/public/file-icons/folder-scripts.svg +1 -0
- package/public/file-icons/folder-secure-open.svg +1 -0
- package/public/file-icons/folder-secure.svg +1 -0
- package/public/file-icons/folder-seeders-open.svg +1 -0
- package/public/file-icons/folder-seeders.svg +1 -0
- package/public/file-icons/folder-server-open.svg +1 -0
- package/public/file-icons/folder-server.svg +1 -0
- package/public/file-icons/folder-shared-open.svg +1 -0
- package/public/file-icons/folder-shared.svg +1 -0
- package/public/file-icons/folder-skills-open.svg +1 -0
- package/public/file-icons/folder-skills.svg +1 -0
- package/public/file-icons/folder-src-open.svg +1 -0
- package/public/file-icons/folder-src.svg +1 -0
- package/public/file-icons/folder-store-open.svg +1 -0
- package/public/file-icons/folder-store.svg +1 -0
- package/public/file-icons/folder-storybook-open.svg +1 -0
- package/public/file-icons/folder-storybook.svg +1 -0
- package/public/file-icons/folder-supabase-open.svg +1 -0
- package/public/file-icons/folder-supabase.svg +1 -0
- package/public/file-icons/folder-svelte-open.svg +1 -0
- package/public/file-icons/folder-svelte.svg +1 -0
- package/public/file-icons/folder-target-open.svg +1 -0
- package/public/file-icons/folder-target.svg +1 -0
- package/public/file-icons/folder-tasks-open.svg +1 -0
- package/public/file-icons/folder-tasks.svg +1 -0
- package/public/file-icons/folder-temp-open.svg +1 -0
- package/public/file-icons/folder-temp.svg +1 -0
- package/public/file-icons/folder-template-open.svg +1 -0
- package/public/file-icons/folder-template.svg +1 -0
- package/public/file-icons/folder-terraform-open.svg +1 -0
- package/public/file-icons/folder-terraform.svg +1 -0
- package/public/file-icons/folder-test-open.svg +1 -0
- package/public/file-icons/folder-test.svg +1 -0
- package/public/file-icons/folder-theme-open.svg +1 -0
- package/public/file-icons/folder-theme.svg +1 -0
- package/public/file-icons/folder-tools-open.svg +1 -0
- package/public/file-icons/folder-tools.svg +1 -0
- package/public/file-icons/folder-turborepo-open.svg +1 -0
- package/public/file-icons/folder-turborepo.svg +1 -0
- package/public/file-icons/folder-typescript-open.svg +1 -0
- package/public/file-icons/folder-typescript.svg +1 -0
- package/public/file-icons/folder-ui-open.svg +1 -0
- package/public/file-icons/folder-ui.svg +1 -0
- package/public/file-icons/folder-utils-open.svg +1 -0
- package/public/file-icons/folder-utils.svg +1 -0
- package/public/file-icons/folder-video-open.svg +1 -0
- package/public/file-icons/folder-video.svg +1 -0
- package/public/file-icons/folder-views-open.svg +1 -0
- package/public/file-icons/folder-views.svg +1 -0
- package/public/file-icons/folder-vscode-open.svg +1 -0
- package/public/file-icons/folder-vscode.svg +1 -0
- package/public/file-icons/folder.svg +1 -0
- package/public/file-icons/font.svg +1 -0
- package/public/file-icons/fsharp.svg +1 -0
- package/public/file-icons/gemfile.svg +1 -0
- package/public/file-icons/git.svg +1 -0
- package/public/file-icons/go-mod.svg +1 -0
- package/public/file-icons/go.svg +1 -0
- package/public/file-icons/gradle.svg +1 -0
- package/public/file-icons/graphql.svg +1 -0
- package/public/file-icons/groovy.svg +1 -0
- package/public/file-icons/h.svg +1 -0
- package/public/file-icons/handlebars.svg +1 -0
- package/public/file-icons/haskell.svg +1 -0
- package/public/file-icons/hcl.svg +1 -0
- package/public/file-icons/heroku.svg +1 -0
- package/public/file-icons/hpp.svg +1 -0
- package/public/file-icons/html.svg +1 -0
- package/public/file-icons/husky.svg +1 -0
- package/public/file-icons/i18n.svg +1 -0
- package/public/file-icons/image.svg +1 -0
- package/public/file-icons/java.svg +1 -0
- package/public/file-icons/javascript.svg +1 -0
- package/public/file-icons/jenkins.svg +1 -0
- package/public/file-icons/jest.svg +1 -0
- package/public/file-icons/jsconfig.svg +1 -0
- package/public/file-icons/json.svg +1 -0
- package/public/file-icons/julia.svg +1 -0
- package/public/file-icons/jupyter.svg +1 -0
- package/public/file-icons/just.svg +1 -0
- package/public/file-icons/key.svg +1 -0
- package/public/file-icons/kotlin.svg +1 -0
- package/public/file-icons/lerna.svg +1 -0
- package/public/file-icons/less.svg +1 -0
- package/public/file-icons/license.svg +1 -0
- package/public/file-icons/lintstaged.svg +1 -0
- package/public/file-icons/liquid.svg +1 -0
- package/public/file-icons/lock.svg +1 -0
- package/public/file-icons/log.svg +1 -0
- package/public/file-icons/lua.svg +1 -0
- package/public/file-icons/makefile.svg +1 -0
- package/public/file-icons/markdown.svg +1 -0
- package/public/file-icons/maven.svg +1 -0
- package/public/file-icons/mdx.svg +1 -0
- package/public/file-icons/netlify.svg +1 -0
- package/public/file-icons/next.svg +1 -0
- package/public/file-icons/nim.svg +1 -0
- package/public/file-icons/nix.svg +1 -0
- package/public/file-icons/nodejs.svg +1 -0
- package/public/file-icons/nodemon.svg +1 -0
- package/public/file-icons/npm.svg +1 -0
- package/public/file-icons/nx.svg +1 -0
- package/public/file-icons/objective-c.svg +1 -0
- package/public/file-icons/objective-cpp.svg +1 -0
- package/public/file-icons/ocaml.svg +1 -0
- package/public/file-icons/pdf.svg +1 -0
- package/public/file-icons/php.svg +1 -0
- package/public/file-icons/pm2-ecosystem.svg +1 -0
- package/public/file-icons/pnpm.svg +1 -0
- package/public/file-icons/poetry.svg +1 -0
- package/public/file-icons/postcss.svg +1 -0
- package/public/file-icons/powerpoint.svg +1 -0
- package/public/file-icons/powershell.svg +1 -0
- package/public/file-icons/prettier.svg +1 -0
- package/public/file-icons/prisma.svg +1 -0
- package/public/file-icons/prolog.svg +1 -0
- package/public/file-icons/proto.svg +1 -0
- package/public/file-icons/pug.svg +1 -0
- package/public/file-icons/python-misc.svg +1 -0
- package/public/file-icons/python.svg +1 -0
- package/public/file-icons/r.svg +1 -0
- package/public/file-icons/razor.svg +1 -0
- package/public/file-icons/react.svg +1 -0
- package/public/file-icons/react_ts.svg +1 -0
- package/public/file-icons/readme.svg +1 -0
- package/public/file-icons/renovate.svg +1 -0
- package/public/file-icons/robots.svg +1 -0
- package/public/file-icons/rollup.svg +1 -0
- package/public/file-icons/ruby.svg +1 -0
- package/public/file-icons/rust.svg +1 -0
- package/public/file-icons/sass.svg +1 -0
- package/public/file-icons/scala.svg +1 -0
- package/public/file-icons/semantic-release.svg +1 -0
- package/public/file-icons/settings.svg +1 -0
- package/public/file-icons/shader.svg +1 -0
- package/public/file-icons/sml.svg +1 -0
- package/public/file-icons/solidity.svg +1 -0
- package/public/file-icons/stylus.svg +1 -0
- package/public/file-icons/svelte.svg +1 -0
- package/public/file-icons/svg.svg +1 -0
- package/public/file-icons/swift.svg +1 -0
- package/public/file-icons/table.svg +1 -0
- package/public/file-icons/tailwindcss.svg +1 -0
- package/public/file-icons/taskfile.svg +1 -0
- package/public/file-icons/terraform.svg +1 -0
- package/public/file-icons/test-js.svg +1 -0
- package/public/file-icons/test-jsx.svg +1 -0
- package/public/file-icons/test-ts.svg +1 -0
- package/public/file-icons/tex.svg +1 -0
- package/public/file-icons/toml.svg +1 -0
- package/public/file-icons/travis.svg +1 -0
- package/public/file-icons/tsconfig.svg +1 -0
- package/public/file-icons/tune.svg +1 -0
- package/public/file-icons/turborepo.svg +1 -0
- package/public/file-icons/typescript-def.svg +1 -0
- package/public/file-icons/typescript.svg +1 -0
- package/public/file-icons/unity.svg +1 -0
- package/public/file-icons/uv.svg +1 -0
- package/public/file-icons/vala.svg +1 -0
- package/public/file-icons/vercel.svg +1 -0
- package/public/file-icons/video.svg +1 -0
- package/public/file-icons/vim.svg +1 -0
- package/public/file-icons/vite.svg +1 -0
- package/public/file-icons/vitest.svg +1 -0
- package/public/file-icons/vlang.svg +1 -0
- package/public/file-icons/vue.svg +1 -0
- package/public/file-icons/webassembly.svg +1 -0
- package/public/file-icons/webpack.svg +1 -0
- package/public/file-icons/word.svg +1 -0
- package/public/file-icons/xml.svg +1 -0
- package/public/file-icons/yaml.svg +1 -0
- package/public/file-icons/yarn.svg +1 -0
- package/public/file-icons/zig.svg +1 -0
- package/public/file-icons/zip.svg +1 -0
- package/public/provider-icons/antgroup-color.svg +1 -0
- package/public/provider-icons/anthropic.svg +1 -0
- package/public/provider-icons/azure-color.svg +1 -0
- package/public/provider-icons/baseten.svg +1 -0
- package/public/provider-icons/bedrock-color.svg +1 -0
- package/public/provider-icons/cerebras-color.svg +1 -0
- package/public/provider-icons/cloudflare-color.svg +1 -0
- package/public/provider-icons/deepseek-color.svg +1 -0
- package/public/provider-icons/fireworks-color.svg +1 -0
- package/public/provider-icons/githubcopilot.svg +1 -0
- package/public/provider-icons/google-color.svg +1 -0
- package/public/provider-icons/googlecloud-color.svg +1 -0
- package/public/provider-icons/groq.svg +1 -0
- package/public/provider-icons/huggingface-color.svg +1 -0
- package/public/provider-icons/kimi-color.svg +1 -0
- package/public/provider-icons/minimax-color.svg +1 -0
- package/public/provider-icons/mistral-color.svg +1 -0
- package/public/provider-icons/moonshot.svg +1 -0
- package/public/provider-icons/nvidia-color.svg +1 -0
- package/public/provider-icons/openai.svg +1 -0
- package/public/provider-icons/opencode.svg +1 -0
- package/public/provider-icons/openrouter-color.svg +1 -0
- package/public/provider-icons/qwen-color.svg +1 -0
- package/public/provider-icons/together-color.svg +1 -0
- package/public/provider-icons/vercel.svg +1 -0
- package/public/provider-icons/xai.svg +1 -0
- package/public/provider-icons/xiaomimimo.svg +1 -0
- package/public/provider-icons/zai.svg +1 -0
- package/scripts/build-output.mjs +131 -0
- package/scripts/dev.mjs +18 -0
- package/scripts/entrypoint.mjs +8 -0
- package/scripts/install-build.mjs +134 -0
- package/scripts/launcher.mjs +249 -0
- package/scripts/pick-folder.ps1 +110 -0
- package/scripts/postinstall.mjs +12 -0
- package/scripts/process-runner.mjs +60 -0
- package/scripts/release.mjs +172 -0
- package/scripts/sync-file-icons.mjs +118 -0
- package/scripts/sync-provider-icons.mjs +41 -0
- package/src/app/api/agent/[id]/events/route.ts +81 -0
- package/src/app/api/agent/[id]/route.ts +24 -0
- package/src/app/api/agent/[id]/tree/route.ts +49 -0
- package/src/app/api/agent/new/route.ts +19 -0
- package/src/app/api/config/route.ts +22 -0
- package/src/app/api/files/route.ts +63 -0
- package/src/app/api/git/route.ts +32 -0
- package/src/app/api/growth/route.ts +50 -0
- package/src/app/api/health/route.ts +7 -0
- package/src/app/api/models/route.ts +129 -0
- package/src/app/api/pi-settings/route.ts +22 -0
- package/src/app/api/plugins/route.ts +79 -0
- package/src/app/api/security/route.ts +41 -0
- package/src/app/api/sessions/[id]/export/route.ts +25 -0
- package/src/app/api/sessions/[id]/route.ts +37 -0
- package/src/app/api/sessions/route.ts +23 -0
- package/src/app/api/skills/route.ts +39 -0
- package/src/app/api/update/route.ts +33 -0
- package/src/app/api/version/route.ts +8 -0
- package/src/app/api/web-auth/route.ts +80 -0
- package/src/app/api/workspaces/route.ts +78 -0
- package/src/app/globals.css +2039 -0
- package/src/app/icon.svg +21 -0
- package/src/app/layout.tsx +29 -0
- package/src/app/login/page.tsx +111 -0
- package/src/app/page.tsx +10 -0
- package/src/components/AppShell.tsx +1171 -0
- package/src/components/ChatInput.tsx +729 -0
- package/src/components/ChatWindow.tsx +1320 -0
- package/src/components/ContextMeter.tsx +131 -0
- package/src/components/DiffView.tsx +139 -0
- package/src/components/ExtensionUI.tsx +181 -0
- package/src/components/FileViewer.tsx +555 -0
- package/src/components/FullDiff.tsx +220 -0
- package/src/components/GitPanel.tsx +357 -0
- package/src/components/GrowthTree.tsx +317 -0
- package/src/components/ModelSelector.tsx +286 -0
- package/src/components/OutlineRail.tsx +166 -0
- package/src/components/PiMark.tsx +79 -0
- package/src/components/ProjectPanel.tsx +309 -0
- package/src/components/ProviderBrand.tsx +28 -0
- package/src/components/ProviderSetupModal.module.css +560 -0
- package/src/components/ProviderSetupModal.tsx +559 -0
- package/src/components/SessionSidebar.tsx +1066 -0
- package/src/components/SettingsPanel.tsx +2216 -0
- package/src/components/TrajectoryAnalyzer.module.css +225 -0
- package/src/components/TrajectoryView.tsx +289 -0
- package/src/components/icons.tsx +443 -0
- package/src/hooks/useFileViewer.ts +58 -0
- package/src/hooks/useGrowth.ts +635 -0
- package/src/hooks/usePiWeb.ts +900 -0
- package/src/i18n.tsx +1043 -0
- package/src/lib/agent-manager.ts +1348 -0
- package/src/lib/app-root.ts +4 -0
- package/src/lib/auth.ts +51 -0
- package/src/lib/command-validation.ts +116 -0
- package/src/lib/enter-behavior.ts +40 -0
- package/src/lib/extension-ui.ts +134 -0
- package/src/lib/file-icons.json +557 -0
- package/src/lib/file-icons.ts +39 -0
- package/src/lib/files-service.ts +280 -0
- package/src/lib/git-service.ts +255 -0
- package/src/lib/growth-rounds.ts +84 -0
- package/src/lib/growth-service.ts +586 -0
- package/src/lib/growth-tracker.ts +328 -0
- package/src/lib/growth-tree.ts +245 -0
- package/src/lib/growth-turns.ts +23 -0
- package/src/lib/highlight.ts +59 -0
- package/src/lib/model-draft.ts +103 -0
- package/src/lib/models-service.ts +852 -0
- package/src/lib/path-security.ts +101 -0
- package/src/lib/pi-settings.ts +115 -0
- package/src/lib/pi.ts +367 -0
- package/src/lib/plugins-service.ts +312 -0
- package/src/lib/process-format.ts +261 -0
- package/src/lib/provider-display.ts +57 -0
- package/src/lib/security-service.ts +52 -0
- package/src/lib/semver.ts +39 -0
- package/src/lib/session-reader.ts +204 -0
- package/src/lib/settings-write-lock.ts +45 -0
- package/src/lib/skills-service.ts +97 -0
- package/src/lib/text-sanitize.ts +20 -0
- package/src/lib/theme.ts +137 -0
- package/src/lib/trajectory.ts +294 -0
- package/src/lib/types.ts +300 -0
- package/src/lib/update-service.ts +129 -0
- package/src/lib/version.ts +6 -0
- package/src/lib/web-auth-shared.ts +35 -0
- package/src/lib/web-auth.ts +53 -0
- package/src/lib/workspace-store.ts +261 -0
- package/src/proxy.ts +53 -0
- package/tsconfig.json +49 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 从 material-icon-theme(MIT)抽一份常用文件/文件夹图标子集到 public/file-icons/,
|
|
3
|
+
* 并生成 src/lib/file-icons.json(扩展名 / 文件名 / 文件夹名 → 图标 id 的精简映射)。
|
|
4
|
+
* 项目树与文件查看器按映射取 /file-icons/<id>.svg,未命中回落到通用 file / folder。
|
|
5
|
+
* 用法:npm run sync:file-icons
|
|
6
|
+
*/
|
|
7
|
+
import { copyFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
|
|
11
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
12
|
+
const pkg = path.join(root, "node_modules", "material-icon-theme");
|
|
13
|
+
const target = path.join(root, "public", "file-icons");
|
|
14
|
+
const manifest = JSON.parse(await readFile(path.join(pkg, "dist", "material-icons.json"), "utf8"));
|
|
15
|
+
|
|
16
|
+
/** 扩展名(不含点,小写);多段扩展如 d.ts / test.ts 也在 fileExtensions 表里 */
|
|
17
|
+
const EXTENSIONS = [
|
|
18
|
+
"ts", "tsx", "d.ts", "test.ts", "spec.ts", "test.tsx", "js", "jsx", "mjs", "cjs", "test.js", "spec.js",
|
|
19
|
+
"json", "jsonc", "json5", "jsonl", "md", "mdx", "markdown", "txt", "rtf", "log",
|
|
20
|
+
"py", "pyi", "pyc", "ipynb", "rb", "go", "rs", "java", "kt", "kts", "swift", "c", "h", "cpp", "cc", "hpp", "cs", "fs",
|
|
21
|
+
"css", "scss", "sass", "less", "styl", "html", "htm", "vue", "svelte", "astro", "php", "ejs", "hbs", "pug", "liquid",
|
|
22
|
+
"sh", "bash", "zsh", "fish", "ps1", "psm1", "bat", "cmd",
|
|
23
|
+
"yml", "yaml", "toml", "ini", "cfg", "conf", "env", "xml", "plist", "properties",
|
|
24
|
+
"svg", "png", "jpg", "jpeg", "gif", "webp", "ico", "bmp", "avif", "psd", "ai",
|
|
25
|
+
"mp3", "wav", "flac", "ogg", "mp4", "mkv", "mov", "webm", "avi",
|
|
26
|
+
"pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "csv", "tsv",
|
|
27
|
+
"zip", "tar", "gz", "tgz", "7z", "rar", "bz2", "xz",
|
|
28
|
+
"sql", "db", "sqlite", "sqlite3", "lock", "wasm", "lua", "r", "dart", "ex", "exs", "erl", "hs", "ml", "clj", "scala", "groovy", "gradle",
|
|
29
|
+
"tf", "tfvars", "hcl", "proto", "graphql", "gql", "prisma", "sol", "vim", "jl", "m", "mm", "pl", "nim", "zig", "v", "elm", "vala",
|
|
30
|
+
"cshtml", "razor", "cmake", "mk", "ninja", "nix", "bicep", "pem", "key", "crt", "cer", "pub", "ttf", "otf", "woff", "woff2", "eot",
|
|
31
|
+
"map", "patch", "diff", "asm", "s", "wat", "glsl", "hlsl", "shader", "unity", "prefab", "blend", "obj", "fbx", "stl", "gltf",
|
|
32
|
+
"ttl", "rdf", "owl", "tex", "bib", "org", "adoc", "rst", "po", "pot", "mo", "ics", "vcf", "gpg", "asc", "sig", "torrent",
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
/** 完整文件名(小写) */
|
|
36
|
+
const FILE_NAMES = [
|
|
37
|
+
"package.json", "package-lock.json", "pnpm-lock.yaml", "yarn.lock", "bun.lockb", "bun.lock", "tsconfig.json", "tsconfig.base.json", "jsconfig.json",
|
|
38
|
+
".gitignore", ".gitattributes", ".gitmodules", ".gitkeep", ".editorconfig", ".npmrc", ".nvmrc", ".prettierrc", ".prettierignore", ".eslintrc", ".eslintrc.js", ".eslintrc.json",
|
|
39
|
+
"eslint.config.js", "eslint.config.mjs", "vitest.config.ts", "vitest.config.mts", "vite.config.ts", "vite.config.js", "next.config.ts", "next.config.js", "next.config.mjs",
|
|
40
|
+
"tailwind.config.js", "tailwind.config.ts", "postcss.config.js", "postcss.config.mjs", "babel.config.js", ".babelrc", "jest.config.js", "jest.config.ts",
|
|
41
|
+
"webpack.config.js", "rollup.config.js", "rollup.config.mjs", "tsup.config.ts", "turbo.json", "nx.json", "lerna.json", "vercel.json", "netlify.toml",
|
|
42
|
+
"dockerfile", "docker-compose.yml", "docker-compose.yaml", "compose.yml", "compose.yaml", ".dockerignore", "makefile", "cmakelists.txt", "justfile", "taskfile.yml",
|
|
43
|
+
"readme.md", "readme", "license", "license.md", "license.txt", "changelog.md", "changelog", "contributing.md", "code_of_conduct.md", "security.md", "authors", "codeowners",
|
|
44
|
+
".env", ".env.local", ".env.example", ".env.development", ".env.production", ".env.test",
|
|
45
|
+
"cargo.toml", "cargo.lock", "go.mod", "go.sum", "pyproject.toml", "requirements.txt", "requirements-dev.txt", "poetry.lock", "uv.lock", "pipfile", "pipfile.lock", "setup.py", "setup.cfg", "tox.ini", "pytest.ini",
|
|
46
|
+
"gemfile", "gemfile.lock", "rakefile", "composer.json", "composer.lock", "build.gradle", "build.gradle.kts", "settings.gradle", "pom.xml", "mix.exs", "deno.json", "deno.jsonc",
|
|
47
|
+
"agents.md", "claude.md", ".cursorrules", "robots.txt", "sitemap.xml", "manifest.json", "favicon.ico", "index.html", "index.js", "index.ts", ".gitlab-ci.yml", "jenkinsfile", ".travis.yml", "procfile", "now.json", "renovate.json", ".releaserc", "commitlint.config.js", ".huskyrc", ".lintstagedrc", "nodemon.json", "pm2.config.js", "ecosystem.config.js",
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
/** 文件夹名(小写),展开态用 <id>-open */
|
|
51
|
+
const FOLDER_NAMES = [
|
|
52
|
+
"src", "source", "lib", "libs", "components", "component", "hooks", "utils", "util", "helpers", "helper", "api", "apis", "app", "apps", "pages", "public", "static", "assets", "images", "image", "img", "icons", "icon",
|
|
53
|
+
"styles", "style", "css", "scss", "sass", "less", "fonts", "font", "test", "tests", "__tests__", "spec", "specs", "e2e", "docs", "doc", "documentation", "scripts", "script", "bin", "build", "dist", "out", "output", "release",
|
|
54
|
+
"node_modules", ".git", ".github", ".gitlab", ".vscode", ".idea", ".husky", "config", "configs", "configuration", "settings", "types", "typings", "@types", "interfaces", "models", "model", "entities", "controllers", "controller",
|
|
55
|
+
"services", "service", "middleware", "middlewares", "routes", "router", "routers", "views", "view", "layouts", "layout", "templates", "template", "data", "database", "db", "migrations", "migration", "seeds", "seed",
|
|
56
|
+
"server", "client", "shared", "common", "core", "plugins", "plugin", "extensions", "extension", "packages", "package", "modules", "module", "tools", "tooling", "examples", "example", "demo", "demos", "samples", "sample",
|
|
57
|
+
"vendor", "vendors", "third_party", "third-party", "temp", "tmp", "cache", ".cache", "logs", "log", "locale", "locales", "i18n", "lang", "langs", "translations", "media", "video", "videos", "audio", "sounds",
|
|
58
|
+
"python", "java", "rust", "android", "ios", "web", "mobile", "desktop", "backend", "frontend", "functions", "lambda", "cloud", "aws", "azure", "gcp", "docker", "k8s", "kubernetes", "terraform", "ci", ".circleci", "workflows",
|
|
59
|
+
"store", "stores", "redux", "context", "contexts", "providers", "provider", "state", "prisma", "supabase", "generated", "gen", "proto", "schemas", "schema", "contracts", "contract", "tasks", "task", "jobs", "job", "queue", "workers", "worker",
|
|
60
|
+
"mock", "mocks", "__mocks__", "fixtures", "fixture", "stories", "benchmark", "benchmarks", "coverage", ".next", ".nuxt", ".svelte-kit", ".turbo", ".venv", "venv", "env", "__pycache__", ".pytest_cache", ".mypy_cache", "target",
|
|
61
|
+
"notebooks", "notebook", "ml", "models", "datasets", "dataset", "features", "feature", "domain", "infra", "infrastructure", "deploy", "deployment", "deployments", "environments", "environment", "secrets", "keys", "certs", "certificates",
|
|
62
|
+
"docs-site", "website", "site", "blog", "content", "posts", "admin", "auth", "user", "users", "account", "accounts", "payment", "payments", "billing", "cart", "checkout", "product", "products", "order", "orders", "search", "chat", "messages",
|
|
63
|
+
"ui", "widgets", "widget", "elements", "element", "primitives", "atoms", "molecules", "organisms", "theme", "themes", "design", "designs", "graphics", "graphql", "gql", "rest", "grpc", "socket", "sockets", "websocket", "events", "event", "listeners",
|
|
64
|
+
"resources", "resource", "res", "raw", "wasm", "native", "cpp", "c", "include", "includes", "headers", "objects", "obj", "debug", "dll", "libraries", "library", "framework", "frameworks", "sdk", "cli", "commands", "command", "console",
|
|
65
|
+
"history", "archive", "archives", "backup", "backups", "old", "legacy", "deprecated", "draft", "drafts", "review", "reviews", "meta", "metadata", "manifest", "manifests", "spec-files", "requirements", "tasks-old", "todo",
|
|
66
|
+
"pi", ".pi", "skills", "skill", "prompts", "prompt", "agents", "agent", "memory", "sessions", "session",
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const defs = manifest.iconDefinitions ?? {};
|
|
70
|
+
const has = (id) => typeof id === "string" && Boolean(defs[id]);
|
|
71
|
+
const used = new Set();
|
|
72
|
+
const ext = {};
|
|
73
|
+
const name = {};
|
|
74
|
+
const folder = {};
|
|
75
|
+
const lower = (s) => s.toLowerCase();
|
|
76
|
+
|
|
77
|
+
for (const e of EXTENSIONS) {
|
|
78
|
+
const id = manifest.fileExtensions?.[lower(e)];
|
|
79
|
+
if (has(id)) {
|
|
80
|
+
ext[lower(e)] = id;
|
|
81
|
+
used.add(id);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
for (const n of FILE_NAMES) {
|
|
85
|
+
const id = manifest.fileNames?.[lower(n)];
|
|
86
|
+
if (has(id)) {
|
|
87
|
+
name[lower(n)] = id;
|
|
88
|
+
used.add(id);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const f of FOLDER_NAMES) {
|
|
92
|
+
const id = manifest.folderNames?.[lower(f)];
|
|
93
|
+
const openId = manifest.folderNamesExpanded?.[lower(f)] ?? (id ? `${id}-open` : undefined);
|
|
94
|
+
if (has(id) && has(openId)) {
|
|
95
|
+
folder[lower(f)] = id;
|
|
96
|
+
used.add(id);
|
|
97
|
+
used.add(openId);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const defaults = { file: manifest.file ?? "file", folder: manifest.folder ?? "folder", folderOpen: manifest.folderExpanded ?? "folder-open" };
|
|
101
|
+
for (const id of Object.values(defaults)) {
|
|
102
|
+
if (!has(id)) throw new Error(`material-icon-theme missing default icon ${id}`);
|
|
103
|
+
used.add(id);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
await mkdir(target, { recursive: true });
|
|
107
|
+
let copied = 0;
|
|
108
|
+
for (const id of used) {
|
|
109
|
+
const rel = String(defs[id].iconPath ?? `./../icons/${id}.svg`).replace(/^\.\/\.\.\//, "");
|
|
110
|
+
await copyFile(path.join(pkg, rel), path.join(target, `${id}.svg`));
|
|
111
|
+
copied += 1;
|
|
112
|
+
}
|
|
113
|
+
await copyFile(path.join(pkg, "LICENSE"), path.join(target, "LICENSE"));
|
|
114
|
+
|
|
115
|
+
const sortKeys = (o) => Object.fromEntries(Object.entries(o).sort(([a], [b]) => a.localeCompare(b)));
|
|
116
|
+
const json = { defaults, ext: sortKeys(ext), name: sortKeys(name), folder: sortKeys(folder) };
|
|
117
|
+
await writeFile(path.join(root, "src", "lib", "file-icons.json"), `${JSON.stringify(json, null, "\t")}\n`, "utf8");
|
|
118
|
+
console.log(`Synced ${copied} file icons (${Object.keys(ext).length} extensions, ${Object.keys(name).length} file names, ${Object.keys(folder).length} folders).`);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { copyFile, mkdir } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
6
|
+
const source = path.join(root, "node_modules", "@lobehub", "icons-static-svg", "icons");
|
|
7
|
+
const target = path.join(root, "public", "provider-icons");
|
|
8
|
+
const slugs = [
|
|
9
|
+
"antgroup-color",
|
|
10
|
+
"anthropic",
|
|
11
|
+
"azure-color",
|
|
12
|
+
"baseten",
|
|
13
|
+
"bedrock-color",
|
|
14
|
+
"cerebras-color",
|
|
15
|
+
"cloudflare-color",
|
|
16
|
+
"deepseek-color",
|
|
17
|
+
"fireworks-color",
|
|
18
|
+
"githubcopilot",
|
|
19
|
+
"google-color",
|
|
20
|
+
"googlecloud-color",
|
|
21
|
+
"groq",
|
|
22
|
+
"huggingface-color",
|
|
23
|
+
"kimi-color",
|
|
24
|
+
"minimax-color",
|
|
25
|
+
"mistral-color",
|
|
26
|
+
"moonshot",
|
|
27
|
+
"nvidia-color",
|
|
28
|
+
"openai",
|
|
29
|
+
"opencode",
|
|
30
|
+
"openrouter-color",
|
|
31
|
+
"qwen-color",
|
|
32
|
+
"together-color",
|
|
33
|
+
"vercel",
|
|
34
|
+
"xai",
|
|
35
|
+
"xiaomimimo",
|
|
36
|
+
"zai",
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
await mkdir(target, { recursive: true });
|
|
40
|
+
await Promise.all(slugs.map((slug) => copyFile(path.join(source, `${slug}.svg`), path.join(target, `${slug}.svg`))));
|
|
41
|
+
console.log(`Synced ${slugs.length} provider icons.`);
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { buildSnapshot, getManaged, subscribe, unsubscribe } from "@/lib/agent-manager";
|
|
2
|
+
import { BoundaryError, resolveSessionPath } from "@/lib/path-security";
|
|
3
|
+
|
|
4
|
+
export const dynamic = "force-dynamic";
|
|
5
|
+
|
|
6
|
+
/** SSE:先推完整快照,再推增量;心跳保活;断线由浏览器 EventSource 自动重连(带 Last-Event-ID) */
|
|
7
|
+
export async function GET(req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
8
|
+
const { id } = await params;
|
|
9
|
+
let sessionPath: string;
|
|
10
|
+
try {
|
|
11
|
+
// allowPending:Hero 发首条消息时订阅先于 JSONL 落盘;此时拒绝会让
|
|
12
|
+
// EventSource 收到 400 并永久放弃重连,实时视图永远拿不到快照。
|
|
13
|
+
sessionPath = await resolveSessionPath(id, { allowPending: true });
|
|
14
|
+
} catch (error) {
|
|
15
|
+
return new Response(error instanceof BoundaryError ? error.message : "invalid session", { status: 400 });
|
|
16
|
+
}
|
|
17
|
+
const m = getManaged(sessionPath);
|
|
18
|
+
const rawLastEventId = req.headers.get("last-event-id");
|
|
19
|
+
const parsedLastEventId = rawLastEventId === null ? undefined : Number.parseInt(rawLastEventId, 10);
|
|
20
|
+
const lastEventId = Number.isSafeInteger(parsedLastEventId) && (parsedLastEventId ?? -1) >= 0 ? parsedLastEventId : undefined;
|
|
21
|
+
|
|
22
|
+
const encoder = new TextEncoder();
|
|
23
|
+
let closed = false;
|
|
24
|
+
let subscriber: ((seq: number, json: string) => void) | null = null;
|
|
25
|
+
let ping: ReturnType<typeof setInterval> | null = null;
|
|
26
|
+
|
|
27
|
+
const stream = new ReadableStream<Uint8Array>({
|
|
28
|
+
async start(controller) {
|
|
29
|
+
const write = (chunk: string) => {
|
|
30
|
+
if (!closed) controller.enqueue(encoder.encode(chunk));
|
|
31
|
+
};
|
|
32
|
+
const close = () => {
|
|
33
|
+
if (closed) return;
|
|
34
|
+
closed = true;
|
|
35
|
+
if (ping) clearInterval(ping);
|
|
36
|
+
if (subscriber) unsubscribe(m, subscriber);
|
|
37
|
+
try {
|
|
38
|
+
controller.close();
|
|
39
|
+
} catch {
|
|
40
|
+
/* already closed */
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
subscriber = (seq: number, json: string) => {
|
|
44
|
+
write(`id: ${seq}\ndata: ${json}\n\n`);
|
|
45
|
+
if (json.includes('"state":"disposed"')) close();
|
|
46
|
+
};
|
|
47
|
+
const send = subscriber;
|
|
48
|
+
|
|
49
|
+
ping = setInterval(() => write(`: ping\n\n`), 15_000);
|
|
50
|
+
write(`retry: 2000\n\n`);
|
|
51
|
+
|
|
52
|
+
req.signal.addEventListener("abort", close, { once: true });
|
|
53
|
+
|
|
54
|
+
// 自动重连优先从环形缓冲续放;缓冲断档时才回退到完整快照。
|
|
55
|
+
if (lastEventId !== undefined && subscribe(m, send, lastEventId)) return;
|
|
56
|
+
const snap = await buildSnapshot(m);
|
|
57
|
+
if (closed) return;
|
|
58
|
+
send(snap.seq, JSON.stringify({ type: "snapshot", snapshot: snap, ts: Date.now() }));
|
|
59
|
+
if (!subscribe(m, send, snap.seq)) {
|
|
60
|
+
const latest = await buildSnapshot(m);
|
|
61
|
+
if (closed) return;
|
|
62
|
+
send(latest.seq, JSON.stringify({ type: "snapshot", snapshot: latest, ts: Date.now() }));
|
|
63
|
+
subscribe(m, send, latest.seq);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
cancel() {
|
|
67
|
+
closed = true;
|
|
68
|
+
if (ping) clearInterval(ping);
|
|
69
|
+
if (subscriber) unsubscribe(m, subscriber);
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return new Response(stream, {
|
|
74
|
+
headers: {
|
|
75
|
+
"Content-Type": "text/event-stream; charset=utf-8",
|
|
76
|
+
"Cache-Control": "no-cache, no-transform",
|
|
77
|
+
Connection: "keep-alive",
|
|
78
|
+
"X-Accel-Buffering": "no",
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { execute, getManaged } from "@/lib/agent-manager";
|
|
3
|
+
import { parseAgentCommand } from "@/lib/command-validation";
|
|
4
|
+
import { BoundaryError, resolveSessionPath } from "@/lib/path-security";
|
|
5
|
+
|
|
6
|
+
export const dynamic = "force-dynamic";
|
|
7
|
+
|
|
8
|
+
export async function POST(req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
9
|
+
const { id } = await params;
|
|
10
|
+
try {
|
|
11
|
+
const sessionPath = await resolveSessionPath(id, { allowPending: true });
|
|
12
|
+
const parsed = parseAgentCommand(await req.json());
|
|
13
|
+
if (!parsed.ok) return NextResponse.json({ success: false, error: parsed.error }, { status: 400 });
|
|
14
|
+
const result = await execute(getManaged(sessionPath), parsed.command);
|
|
15
|
+
if (!result.ok) return NextResponse.json({ success: false, error: result.error }, { status: 400 });
|
|
16
|
+
return NextResponse.json({ success: true, data: result.data ?? {} });
|
|
17
|
+
} catch (error) {
|
|
18
|
+
const message = error instanceof Error ? error.message : "request failed";
|
|
19
|
+
return NextResponse.json(
|
|
20
|
+
{ success: false, error: message },
|
|
21
|
+
{ status: error instanceof BoundaryError || error instanceof SyntaxError ? 400 : 500 },
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { getManaged } from "@/lib/agent-manager";
|
|
3
|
+
import { BoundaryError, resolveSessionPath } from "@/lib/path-security";
|
|
4
|
+
|
|
5
|
+
export const dynamic = "force-dynamic";
|
|
6
|
+
|
|
7
|
+
function messageText(content: unknown): string {
|
|
8
|
+
if (typeof content === "string") return content;
|
|
9
|
+
if (!Array.isArray(content)) return "";
|
|
10
|
+
return content
|
|
11
|
+
.map((item) => (typeof item === "string" ? item : item && typeof item === "object" && "text" in item ? String(item.text ?? "") : ""))
|
|
12
|
+
.join(" ");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** 会话树上的用户消息(分支点):保持 Pi JSONL 树的真实层级与活动分支。 */
|
|
16
|
+
export async function GET(_req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
17
|
+
const { id } = await params;
|
|
18
|
+
try {
|
|
19
|
+
const m = getManaged(await resolveSessionPath(id, { allowPending: true }));
|
|
20
|
+
const activeBranch = m.sm.getBranch() as unknown as any[];
|
|
21
|
+
const activeUserId = [...activeBranch]
|
|
22
|
+
.reverse()
|
|
23
|
+
.find((entry) => entry?.type === "message" && entry?.message?.role === "user")?.id ?? "";
|
|
24
|
+
const userMessages: Array<{ entryId: string; ts: number; text: string; depth: number; label?: string }> = [];
|
|
25
|
+
const walk = (nodes: Array<{ entry: any; children: any[]; label?: string }>, depth: number) => {
|
|
26
|
+
for (const node of nodes) {
|
|
27
|
+
const entry = node.entry;
|
|
28
|
+
if (entry?.type === "message" && entry?.message?.role === "user" && entry.id) {
|
|
29
|
+
const parsedTimestamp = typeof entry.timestamp === "string" ? Date.parse(entry.timestamp) : Number(entry.timestamp);
|
|
30
|
+
userMessages.push({
|
|
31
|
+
entryId: String(entry.id),
|
|
32
|
+
ts: Number.isFinite(parsedTimestamp) ? parsedTimestamp : 0,
|
|
33
|
+
text: messageText(entry.message.content).replace(/\s+/g, " ").slice(0, 160),
|
|
34
|
+
depth,
|
|
35
|
+
label: node.label || undefined,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
walk(node.children ?? [], depth + 1);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
walk(m.sm.getTree() as unknown as Array<{ entry: any; children: any[]; label?: string }>, 0);
|
|
42
|
+
return NextResponse.json({ success: true, data: { userMessages, activeUserId } });
|
|
43
|
+
} catch (error) {
|
|
44
|
+
return NextResponse.json(
|
|
45
|
+
{ success: false, error: error instanceof Error ? error.message : "request failed" },
|
|
46
|
+
{ status: error instanceof BoundaryError ? 400 : 500 },
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { createNewSession } from "@/lib/agent-manager";
|
|
3
|
+
import { BoundaryError, resolveWorkspacePath } from "@/lib/path-security";
|
|
4
|
+
|
|
5
|
+
export const dynamic = "force-dynamic";
|
|
6
|
+
|
|
7
|
+
export async function POST(req: Request) {
|
|
8
|
+
try {
|
|
9
|
+
const body = (await req.json()) as { cwd?: unknown };
|
|
10
|
+
const cwd = await resolveWorkspacePath(body.cwd ?? process.cwd());
|
|
11
|
+
const { sessionPath } = await createNewSession(cwd);
|
|
12
|
+
return NextResponse.json({ success: true, data: { sessionPath } });
|
|
13
|
+
} catch (error) {
|
|
14
|
+
return NextResponse.json(
|
|
15
|
+
{ success: false, error: error instanceof Error ? error.message : "request failed" },
|
|
16
|
+
{ status: error instanceof BoundaryError || error instanceof SyntaxError ? 400 : 500 },
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { NextResponse } from "next/server";
|
|
4
|
+
import { getAgentDir } from "@/lib/pi";
|
|
5
|
+
|
|
6
|
+
export const dynamic = "force-dynamic";
|
|
7
|
+
|
|
8
|
+
/** 下载 ~/.pi/agent/settings.json(对应 dsh 设置里的「打开配置文件」) */
|
|
9
|
+
export async function GET() {
|
|
10
|
+
try {
|
|
11
|
+
const file = path.join(getAgentDir(), "settings.json");
|
|
12
|
+
const content = await fs.readFile(file, "utf8");
|
|
13
|
+
return new Response(content, {
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
16
|
+
"Content-Disposition": 'attachment; filename="settings.json"',
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
} catch (err: any) {
|
|
20
|
+
return NextResponse.json({ success: false, error: String(err?.message ?? err) }, { status: 500 });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { BoundaryError } from "@/lib/path-security";
|
|
3
|
+
import { listWorkspaceDir, openInEditor, parseUploadLength, readWorkspaceFile, saveUploadStream } from "@/lib/files-service";
|
|
4
|
+
|
|
5
|
+
export const dynamic = "force-dynamic";
|
|
6
|
+
|
|
7
|
+
/** 工作区文件浏览:?cwd=&path=(目录列表);?read=1&cwd=&path=(文本预览) */
|
|
8
|
+
export async function GET(req: Request) {
|
|
9
|
+
const url = new URL(req.url);
|
|
10
|
+
try {
|
|
11
|
+
if (url.searchParams.get("read") === "1") {
|
|
12
|
+
return NextResponse.json({ success: true, data: await readWorkspaceFile(url.searchParams.get("cwd"), url.searchParams.get("path")) });
|
|
13
|
+
}
|
|
14
|
+
return NextResponse.json({ success: true, data: await listWorkspaceDir(url.searchParams.get("cwd"), url.searchParams.get("path"), url.searchParams.get("offset")) });
|
|
15
|
+
} catch (err: any) {
|
|
16
|
+
return NextResponse.json(
|
|
17
|
+
{ success: false, error: String(err?.message ?? err) },
|
|
18
|
+
{ status: err instanceof BoundaryError ? 400 : 500 },
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** POST ?action=upload&name= streams bytes; POST { action: "open", cwd, path, line? } opens an editor. */
|
|
24
|
+
export async function POST(req: Request) {
|
|
25
|
+
try {
|
|
26
|
+
const url = new URL(req.url);
|
|
27
|
+
if (url.searchParams.get("action") === "upload") {
|
|
28
|
+
const declared = req.headers.get("x-upload-size");
|
|
29
|
+
const contentLength = req.headers.get("content-length");
|
|
30
|
+
const expectedSize = parseUploadLength(declared ?? contentLength);
|
|
31
|
+
if (declared !== null && contentLength !== null && parseUploadLength(contentLength) !== expectedSize) {
|
|
32
|
+
throw new BoundaryError("conflicting upload sizes");
|
|
33
|
+
}
|
|
34
|
+
return NextResponse.json({ success: true, data: await saveUploadStream(url.searchParams.get("name"), req.body, expectedSize) });
|
|
35
|
+
}
|
|
36
|
+
const reader = req.body?.getReader();
|
|
37
|
+
if (!reader) throw new BoundaryError("missing request body");
|
|
38
|
+
const chunks: Uint8Array[] = [];
|
|
39
|
+
let length = 0;
|
|
40
|
+
try {
|
|
41
|
+
for (;;) {
|
|
42
|
+
const { done, value } = await reader.read();
|
|
43
|
+
if (done) break;
|
|
44
|
+
length += value.byteLength;
|
|
45
|
+
if (length > 64 * 1024) throw new BoundaryError("request body too large");
|
|
46
|
+
chunks.push(value);
|
|
47
|
+
}
|
|
48
|
+
} finally {
|
|
49
|
+
await reader.cancel().catch(() => undefined);
|
|
50
|
+
reader.releaseLock();
|
|
51
|
+
}
|
|
52
|
+
const body = JSON.parse(Buffer.concat(chunks).toString("utf8")) as { action?: string; cwd?: unknown; path?: unknown; line?: unknown; name?: unknown };
|
|
53
|
+
if (body.action === "open") {
|
|
54
|
+
return NextResponse.json({ success: true, data: await openInEditor(body.cwd, body.path, body.line) });
|
|
55
|
+
}
|
|
56
|
+
return NextResponse.json({ success: false, error: "unknown action" }, { status: 400 });
|
|
57
|
+
} catch (err: any) {
|
|
58
|
+
return NextResponse.json(
|
|
59
|
+
{ success: false, error: String(err?.message ?? err) },
|
|
60
|
+
{ status: err instanceof BoundaryError || err instanceof SyntaxError ? 400 : 500 },
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { BoundaryError } from "@/lib/path-security";
|
|
3
|
+
import { gitDiff, gitInfo, gitShow } from "@/lib/git-service";
|
|
4
|
+
|
|
5
|
+
export const dynamic = "force-dynamic";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 工作区 Git 只读接口:
|
|
9
|
+
* ?cwd= 状态(分支、上游、ahead/behind、变更文件、最近提交)
|
|
10
|
+
* ?cwd=&diff=<path>&mode= 单文件差异(mode: staged | worktree | untracked)
|
|
11
|
+
* ?cwd=&show=<hash> 单次提交内容
|
|
12
|
+
*/
|
|
13
|
+
export async function GET(req: Request) {
|
|
14
|
+
const url = new URL(req.url);
|
|
15
|
+
const cwd = url.searchParams.get("cwd");
|
|
16
|
+
try {
|
|
17
|
+
const diff = url.searchParams.get("diff");
|
|
18
|
+
if (diff !== null) {
|
|
19
|
+
return NextResponse.json({ success: true, data: await gitDiff(cwd, diff, url.searchParams.get("mode") ?? "worktree") });
|
|
20
|
+
}
|
|
21
|
+
const show = url.searchParams.get("show");
|
|
22
|
+
if (show !== null) {
|
|
23
|
+
return NextResponse.json({ success: true, data: await gitShow(cwd, show) });
|
|
24
|
+
}
|
|
25
|
+
return NextResponse.json({ success: true, data: await gitInfo(cwd) });
|
|
26
|
+
} catch (err: any) {
|
|
27
|
+
return NextResponse.json(
|
|
28
|
+
{ success: false, error: String(err?.message ?? err) },
|
|
29
|
+
{ status: err instanceof BoundaryError ? 400 : 500 },
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { getManaged, growthSnapshot } from "@/lib/agent-manager";
|
|
3
|
+
import { GrowthError, changesBetween, fileContent, filePatch, isAvailable, listTree, readSteps } from "@/lib/growth-service";
|
|
4
|
+
import { BoundaryError, resolveSessionPath, resolveWorkspacePath } from "@/lib/path-security";
|
|
5
|
+
|
|
6
|
+
export const dynamic = "force-dynamic";
|
|
7
|
+
|
|
8
|
+
function status(err: unknown): number {
|
|
9
|
+
if (err instanceof BoundaryError) return 400;
|
|
10
|
+
if (err instanceof GrowthError) return err.code === "not-found" ? 404 : err.code === "unavailable" ? 503 : err.code === "too-large" ? 413 : 500;
|
|
11
|
+
return 500;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 项目生长(影子仓库快照)只读接口:
|
|
16
|
+
* ?cwd=&session=<jsonl 路径> 本会话的步(省略 session = 工作区全部步)
|
|
17
|
+
* ?cwd=&tree=<hash>&list=1 某一步的文件清单
|
|
18
|
+
* ?cwd=&from=<tree>&to=<tree>&changes=1 两步之间的变更清单
|
|
19
|
+
* ?cwd=&from=&to=&path=[&renamedFrom=] 单文件整文件上下文的 unified diff
|
|
20
|
+
* ?cwd=&tree=&path=&content=1 某一步里单文件全文
|
|
21
|
+
*/
|
|
22
|
+
export async function GET(req: Request) {
|
|
23
|
+
const url = new URL(req.url);
|
|
24
|
+
const q = (k: string) => url.searchParams.get(k);
|
|
25
|
+
try {
|
|
26
|
+
const cwd = await resolveWorkspacePath(q("cwd"));
|
|
27
|
+
if (q("list") === "1") return NextResponse.json({ success: true, data: { files: await listTree(cwd, q("tree")) } });
|
|
28
|
+
if (q("changes") === "1") return NextResponse.json({ success: true, data: { changes: await changesBetween(cwd, q("from"), q("to")) } });
|
|
29
|
+
if (q("content") === "1") return NextResponse.json({ success: true, data: await fileContent(cwd, q("tree"), q("path")) });
|
|
30
|
+
if (q("path") !== null) return NextResponse.json({ success: true, data: await filePatch(cwd, q("from"), q("to"), q("path"), q("renamedFrom") ?? undefined) });
|
|
31
|
+
const available = await isAvailable();
|
|
32
|
+
if (!available) return NextResponse.json({ success: true, data: { available: false, steps: [] } });
|
|
33
|
+
return NextResponse.json({ success: true, data: { available: true, steps: await readSteps(cwd, q("session") ?? undefined) } });
|
|
34
|
+
} catch (err: any) {
|
|
35
|
+
return NextResponse.json({ success: false, error: String(err?.message ?? err) }, { status: status(err) });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** POST { action: "snapshot", session: <会话 id>, label? }:手动拍一张快照(记步并广播给会话订阅者) */
|
|
40
|
+
export async function POST(req: Request) {
|
|
41
|
+
try {
|
|
42
|
+
const body = (await req.json()) as { action?: string; session?: unknown; label?: unknown };
|
|
43
|
+
if (body.action !== "snapshot") return NextResponse.json({ success: false, error: "unknown action" }, { status: 400 });
|
|
44
|
+
const sessionPath = await resolveSessionPath(String(body.session ?? ""), { allowPending: true });
|
|
45
|
+
const step = await growthSnapshot(getManaged(sessionPath), typeof body.label === "string" ? body.label : "");
|
|
46
|
+
return NextResponse.json({ success: true, data: { step } });
|
|
47
|
+
} catch (err: any) {
|
|
48
|
+
return NextResponse.json({ success: false, error: String(err?.message ?? err) }, { status: err instanceof SyntaxError ? 400 : status(err) });
|
|
49
|
+
}
|
|
50
|
+
}
|