@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,635 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* useGrowth:项目生长视图的状态。
|
|
5
|
+
* 账本(拉取 + 实时步按 seq 合并)、轮次导航 / 默认跟随、范围(本步 / 本会话)、
|
|
6
|
+
* 所选快照的文件与变更、当前磁盘全量目录懒加载、展开状态与新变更动画。
|
|
7
|
+
*/
|
|
8
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
9
|
+
import { allDirPaths, buildTree, dirsToReveal, graftLazy, type TreeNode } from "@/lib/growth-tree";
|
|
10
|
+
import { buildGrowthRounds, type GrowthRound } from "@/lib/growth-rounds";
|
|
11
|
+
import type { GrowthChange, GrowthStep } from "@/lib/types";
|
|
12
|
+
|
|
13
|
+
export type GrowthScope = "step" | "session";
|
|
14
|
+
|
|
15
|
+
export interface TreeFile {
|
|
16
|
+
path: string;
|
|
17
|
+
size: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface GrowthApi {
|
|
21
|
+
available: boolean;
|
|
22
|
+
loading: boolean;
|
|
23
|
+
error: string | null;
|
|
24
|
+
steps: GrowthStep[];
|
|
25
|
+
rounds: GrowthRound[];
|
|
26
|
+
/** 本会话第一步(基线) */
|
|
27
|
+
baseline: GrowthStep | null;
|
|
28
|
+
latest: GrowthStep | null;
|
|
29
|
+
selected: GrowthStep | null;
|
|
30
|
+
selectedRound: GrowthRound | null;
|
|
31
|
+
following: boolean;
|
|
32
|
+
scope: GrowthScope;
|
|
33
|
+
/** 所选范围的 from/to tree(查看器取 diff 用) */
|
|
34
|
+
range: { from: string; to: string } | null;
|
|
35
|
+
changes: GrowthChange[];
|
|
36
|
+
/** 相对会话基线的全部变更(头部总计) */
|
|
37
|
+
sessionChanges: GrowthChange[];
|
|
38
|
+
tree: TreeNode;
|
|
39
|
+
/** 所选步的全部文件路径(快速打开用) */
|
|
40
|
+
filePaths: string[];
|
|
41
|
+
expanded: Set<string>;
|
|
42
|
+
/** 最新一步刚改动的路径(入场动画) */
|
|
43
|
+
fresh: Set<string>;
|
|
44
|
+
pending: string[];
|
|
45
|
+
follow(): void;
|
|
46
|
+
/** 选中某一轮(时间轴柱);选到最后一轮等于回到跟随 */
|
|
47
|
+
selectRound(id: number): void;
|
|
48
|
+
prev(): void;
|
|
49
|
+
next(): void;
|
|
50
|
+
setScope(scope: GrowthScope): void;
|
|
51
|
+
toggleDir(path: string): void;
|
|
52
|
+
revealPath(path: string): void;
|
|
53
|
+
expandAll(): void;
|
|
54
|
+
collapseAll(): void;
|
|
55
|
+
expandLazy(path: string): Promise<void>;
|
|
56
|
+
refresh(): Promise<void>;
|
|
57
|
+
snapshotNow(): Promise<GrowthStep | null>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function sessionIdOf(sessionPath: string): string {
|
|
61
|
+
const bytes = new TextEncoder().encode(sessionPath);
|
|
62
|
+
let bin = "";
|
|
63
|
+
for (const b of bytes) bin += String.fromCharCode(b);
|
|
64
|
+
return encodeURIComponent(btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function cwdKey(cwd: string): string {
|
|
68
|
+
const norm = cwd.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
69
|
+
return /^[A-Za-z]:\//.test(norm) || norm.startsWith("//") ? norm.toLowerCase() : norm;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function mergeSteps(fetched: GrowthStep[], live: GrowthStep[]): GrowthStep[] {
|
|
73
|
+
if (!live.length) return fetched;
|
|
74
|
+
const bySeq = new Map<number, GrowthStep>();
|
|
75
|
+
for (const s of fetched) bySeq.set(s.seq, s);
|
|
76
|
+
for (const s of live) bySeq.set(s.seq, s);
|
|
77
|
+
return [...bySeq.values()].sort((a, b) => a.seq - b.seq);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const REVEAL_LIMIT = 200;
|
|
81
|
+
const FRESH_MS = 2500;
|
|
82
|
+
/** 非跟随态给出的稳定空数组:每次渲染都 new 一个会让下游 effect(查看器取数)反复重跑 */
|
|
83
|
+
const NO_PENDING: string[] = [];
|
|
84
|
+
/** 清单 / 变更缓存条数上限(按 tree 哈希键;长会话几百步也就几 MB,超过就淘汰最早的) */
|
|
85
|
+
const CACHE_LIMIT = 300;
|
|
86
|
+
function remember<K, V>(map: Map<K, V>, key: K, value: V): void {
|
|
87
|
+
if (map.size >= CACHE_LIMIT) map.delete(map.keys().next().value as K);
|
|
88
|
+
map.set(key, value);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface DiskEntry {
|
|
92
|
+
name: string;
|
|
93
|
+
kind: "dir" | "file";
|
|
94
|
+
size?: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** 磁盘列表里永远不画的目录:版本库内部(快照本来就排除它,节点也没有可看的东西) */
|
|
98
|
+
const HIDDEN_DISK_DIRS = new Set([".git"]);
|
|
99
|
+
|
|
100
|
+
function diskNodes(parent: string, entries: DiskEntry[]): TreeNode[] {
|
|
101
|
+
return entries.filter((entry) => !(entry.kind === "dir" && !parent && HIDDEN_DISK_DIRS.has(entry.name))).map((entry) => ({
|
|
102
|
+
path: parent ? `${parent}/${entry.name}` : entry.name,
|
|
103
|
+
name: entry.name,
|
|
104
|
+
kind: entry.kind,
|
|
105
|
+
size: entry.size,
|
|
106
|
+
lazy: true,
|
|
107
|
+
...(entry.kind === "dir" ? { children: [] } : {}),
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function getJson<T>(url: string, signal?: AbortSignal): Promise<T> {
|
|
112
|
+
signal?.throwIfAborted();
|
|
113
|
+
const r = await fetch(url, { signal, cache: "no-store" });
|
|
114
|
+
const j = await r.json();
|
|
115
|
+
signal?.throwIfAborted();
|
|
116
|
+
if (!r.ok || !j.success) throw new Error(j.error || `request failed (${r.status})`);
|
|
117
|
+
return j.data as T;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async function listDiskEntries(cwd: string, dir: string, signal: AbortSignal): Promise<DiskEntry[]> {
|
|
121
|
+
const entries: DiskEntry[] = [];
|
|
122
|
+
let offset = 0;
|
|
123
|
+
for (;;) {
|
|
124
|
+
const query = new URLSearchParams({ cwd, path: dir, offset: String(offset) });
|
|
125
|
+
const page = await getJson<{ entries: DiskEntry[]; nextOffset: number | null }>(`/api/files?${query}`, signal);
|
|
126
|
+
entries.push(...page.entries);
|
|
127
|
+
if (page.nextOffset === null) return entries;
|
|
128
|
+
if (page.nextOffset <= offset) throw new Error("directory pagination did not advance");
|
|
129
|
+
offset = page.nextOffset;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function useGrowth({
|
|
134
|
+
cwd,
|
|
135
|
+
sessionPath,
|
|
136
|
+
liveSteps,
|
|
137
|
+
pending,
|
|
138
|
+
runtimeError,
|
|
139
|
+
active,
|
|
140
|
+
connected,
|
|
141
|
+
turnStarts = [],
|
|
142
|
+
}: {
|
|
143
|
+
cwd: string;
|
|
144
|
+
sessionPath: string | null;
|
|
145
|
+
/** usePiWeb 在本次连接期间收到的实时步 */
|
|
146
|
+
liveSteps: GrowthStep[];
|
|
147
|
+
/** 改盘类工具运行期间目录监听看到的路径 */
|
|
148
|
+
pending: string[];
|
|
149
|
+
/** 实时快照失败;成功记录后由事件清除。 */
|
|
150
|
+
runtimeError?: string | null;
|
|
151
|
+
/** 项目栏或查看器打开时才拉数据 */
|
|
152
|
+
active: boolean;
|
|
153
|
+
/** SSE 重连后补拉断线期间可能漏掉的生长步。 */
|
|
154
|
+
connected: boolean;
|
|
155
|
+
/** 用户消息的时间戳;用于在旧快照缺少回合标记时恢复轮次边界。 */
|
|
156
|
+
turnStarts?: number[];
|
|
157
|
+
}): GrowthApi {
|
|
158
|
+
const key = JSON.stringify([cwdKey(cwd), sessionPath ?? ""]);
|
|
159
|
+
const requestScope = useMemo(() => ({
|
|
160
|
+
key,
|
|
161
|
+
active: true,
|
|
162
|
+
controllers: new Set<AbortController>(),
|
|
163
|
+
loadingDirs: new Map<string, AbortController>(),
|
|
164
|
+
refresh: null as AbortController | null,
|
|
165
|
+
}), [key]);
|
|
166
|
+
const currentScope = useRef(requestScope);
|
|
167
|
+
currentScope.current = requestScope;
|
|
168
|
+
const beginRequest = useCallback(() => {
|
|
169
|
+
const controller = new AbortController();
|
|
170
|
+
if (currentScope.current !== requestScope || !requestScope.active) controller.abort();
|
|
171
|
+
else requestScope.controllers.add(controller);
|
|
172
|
+
return controller;
|
|
173
|
+
}, [requestScope]);
|
|
174
|
+
const isCurrent = useCallback((controller: AbortController) => currentScope.current === requestScope && requestScope.active && !controller.signal.aborted, [requestScope]);
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
requestScope.active = true;
|
|
177
|
+
return () => {
|
|
178
|
+
requestScope.active = false;
|
|
179
|
+
for (const controller of requestScope.controllers) controller.abort();
|
|
180
|
+
requestScope.controllers.clear();
|
|
181
|
+
requestScope.loadingDirs.clear();
|
|
182
|
+
};
|
|
183
|
+
}, [requestScope]);
|
|
184
|
+
const [fetched, setFetched] = useState<{ key: string; steps: GrowthStep[]; available: boolean; error: string | null }>({ key: "", steps: [], available: true, error: null });
|
|
185
|
+
const [loading, setLoading] = useState(false);
|
|
186
|
+
const [selectedRoundId, setSelectedRoundId] = useState<number | null>(null);
|
|
187
|
+
const [scope, setScopeState] = useState<GrowthScope>("step");
|
|
188
|
+
const [files, setFiles] = useState<{ key: string; tree: string; files: TreeFile[] } | null>(null);
|
|
189
|
+
const [rangeChanges, setRangeChanges] = useState<{ key: string; changes: GrowthChange[]; error?: string } | null>(null);
|
|
190
|
+
const [sessionRange, setSessionRange] = useState<{ key: string; changes: GrowthChange[]; error?: string } | null>(null);
|
|
191
|
+
const [expanded, setExpanded] = useState<Set<string>>(() => new Set());
|
|
192
|
+
const [fresh, setFresh] = useState<Set<string>>(() => new Set());
|
|
193
|
+
const [lazyState, setLazyState] = useState(() => ({ scope: requestScope, children: new Map<string, TreeNode[]>() }));
|
|
194
|
+
const lazyChildren = useMemo(() => lazyState.scope === requestScope ? lazyState.children : new Map<string, TreeNode[]>(), [lazyState, requestScope]);
|
|
195
|
+
const lazyChildrenRef = useRef(lazyChildren);
|
|
196
|
+
lazyChildrenRef.current = lazyChildren;
|
|
197
|
+
const updateLazy = useCallback((controller: AbortController, update: (previous: Map<string, TreeNode[]>) => Map<string, TreeNode[]>) => {
|
|
198
|
+
if (!isCurrent(controller)) return;
|
|
199
|
+
setLazyState((previous) => isCurrent(controller)
|
|
200
|
+
? { scope: requestScope, children: update(previous.scope === requestScope ? previous.children : new Map()) }
|
|
201
|
+
: previous);
|
|
202
|
+
}, [isCurrent, requestScope]);
|
|
203
|
+
const listingCache = useRef(new Map<string, TreeFile[]>());
|
|
204
|
+
const changesCache = useRef(new Map<string, GrowthChange[]>());
|
|
205
|
+
const collapsedByUser = useRef(new Set<string>());
|
|
206
|
+
const freshTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
|
|
207
|
+
const lastRevealedSeq = useRef<number>(0);
|
|
208
|
+
const previousConnected = useRef(connected);
|
|
209
|
+
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
const saved = localStorage.getItem("piweb.growth.scope");
|
|
212
|
+
if (saved === "step" || saved === "session") setScopeState(saved);
|
|
213
|
+
}, []);
|
|
214
|
+
const setScope = useCallback((s: GrowthScope) => {
|
|
215
|
+
setScopeState(s);
|
|
216
|
+
localStorage.setItem("piweb.growth.scope", s);
|
|
217
|
+
}, []);
|
|
218
|
+
|
|
219
|
+
// 展开集合按工作区持久化
|
|
220
|
+
useEffect(() => {
|
|
221
|
+
if (!cwd) return;
|
|
222
|
+
try {
|
|
223
|
+
const raw = localStorage.getItem(`piweb.growth.expanded:${cwdKey(cwd)}`);
|
|
224
|
+
setExpanded(new Set(raw ? (JSON.parse(raw) as string[]) : []));
|
|
225
|
+
} catch {
|
|
226
|
+
setExpanded(new Set());
|
|
227
|
+
}
|
|
228
|
+
collapsedByUser.current = new Set();
|
|
229
|
+
}, [cwd]);
|
|
230
|
+
const persistExpanded = useCallback(
|
|
231
|
+
(next: Set<string>) => {
|
|
232
|
+
if (!cwd) return;
|
|
233
|
+
try {
|
|
234
|
+
localStorage.setItem(`piweb.growth.expanded:${cwdKey(cwd)}`, JSON.stringify([...next].slice(0, 2000)));
|
|
235
|
+
} catch {
|
|
236
|
+
/* ignore */
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
[cwd],
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
// 切会话:回到跟随、清实时相关状态
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
setSelectedRoundId(null);
|
|
245
|
+
setFresh(new Set());
|
|
246
|
+
setLoading(false);
|
|
247
|
+
setLazyState({ scope: requestScope, children: new Map() });
|
|
248
|
+
if (freshTimer.current) clearTimeout(freshTimer.current);
|
|
249
|
+
lastRevealedSeq.current = 0;
|
|
250
|
+
}, [requestScope]);
|
|
251
|
+
|
|
252
|
+
const refresh = useCallback(async () => {
|
|
253
|
+
const controller = beginRequest();
|
|
254
|
+
if (!isCurrent(controller)) return;
|
|
255
|
+
requestScope.refresh?.abort();
|
|
256
|
+
requestScope.refresh = controller;
|
|
257
|
+
if (!cwd) {
|
|
258
|
+
setFetched({ key, steps: [], available: true, error: null });
|
|
259
|
+
updateLazy(controller, () => new Map());
|
|
260
|
+
setLoading(false);
|
|
261
|
+
requestScope.controllers.delete(controller);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
setLoading(true);
|
|
265
|
+
try {
|
|
266
|
+
const params = new URLSearchParams({ cwd });
|
|
267
|
+
if (sessionPath) params.set("session", sessionPath);
|
|
268
|
+
const [growthResult, diskResult] = await Promise.allSettled([
|
|
269
|
+
sessionPath ? getJson<{ available: boolean; steps: GrowthStep[] }>(`/api/growth?${params}`, controller.signal) : Promise.resolve({ available: true, steps: [] }),
|
|
270
|
+
listDiskEntries(cwd, "", controller.signal),
|
|
271
|
+
]);
|
|
272
|
+
if (!isCurrent(controller)) return;
|
|
273
|
+
if (growthResult.status === "fulfilled") {
|
|
274
|
+
setFetched({ key, steps: growthResult.value.steps ?? [], available: growthResult.value.available !== false, error: null });
|
|
275
|
+
} else {
|
|
276
|
+
setFetched({ key, steps: [], available: true, error: growthResult.reason instanceof Error ? growthResult.reason.message : "failed to load" });
|
|
277
|
+
}
|
|
278
|
+
if (diskResult.status === "fulfilled") {
|
|
279
|
+
updateLazy(controller, (previous) => new Map(previous).set("", diskNodes("", diskResult.value)));
|
|
280
|
+
} else if (growthResult.status === "fulfilled") {
|
|
281
|
+
setFetched((previous) => ({ ...previous, error: diskResult.reason instanceof Error ? diskResult.reason.message : "failed to list workspace" }));
|
|
282
|
+
}
|
|
283
|
+
} finally {
|
|
284
|
+
if (isCurrent(controller)) setLoading(false);
|
|
285
|
+
requestScope.controllers.delete(controller);
|
|
286
|
+
}
|
|
287
|
+
}, [cwd, sessionPath, key, beginRequest, isCurrent, requestScope, updateLazy]);
|
|
288
|
+
|
|
289
|
+
useEffect(() => {
|
|
290
|
+
if (active) void refresh();
|
|
291
|
+
return () => requestScope.refresh?.abort();
|
|
292
|
+
}, [active, refresh, requestScope]);
|
|
293
|
+
useEffect(() => {
|
|
294
|
+
if (active && connected && !previousConnected.current) void refresh();
|
|
295
|
+
previousConnected.current = connected;
|
|
296
|
+
}, [active, connected, refresh]);
|
|
297
|
+
|
|
298
|
+
const steps = useMemo(() => mergeSteps(fetched.key === key ? fetched.steps : [], liveSteps), [fetched, key, liveSteps]);
|
|
299
|
+
const baseline = steps[0] ?? null;
|
|
300
|
+
const latest = steps[steps.length - 1] ?? null;
|
|
301
|
+
// 磁盘目录只在记下新步时重拉:工具运行中的新路径由目录监听直接画成「生成中」节点,不用每 300ms 重拉一遍全部目录
|
|
302
|
+
const diskPulse = latest?.seq ?? 0;
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
if (!active || !cwd || !latest) return;
|
|
305
|
+
const controller = beginRequest();
|
|
306
|
+
const timer = setTimeout(() => {
|
|
307
|
+
if (!isCurrent(controller)) return;
|
|
308
|
+
const dirs = [...new Set(["", ...lazyChildrenRef.current.keys()])];
|
|
309
|
+
void Promise.allSettled(dirs.map((dir) => listDiskEntries(cwd, dir, controller.signal)))
|
|
310
|
+
.then((results) => {
|
|
311
|
+
updateLazy(controller, (previous) => {
|
|
312
|
+
const next = new Map(previous);
|
|
313
|
+
for (const [index, result] of results.entries()) {
|
|
314
|
+
if (result.status === "fulfilled") next.set(dirs[index], diskNodes(dirs[index], result.value));
|
|
315
|
+
else if (dirs[index]) next.delete(dirs[index]);
|
|
316
|
+
}
|
|
317
|
+
return next;
|
|
318
|
+
});
|
|
319
|
+
}).finally(() => requestScope.controllers.delete(controller));
|
|
320
|
+
}, 100);
|
|
321
|
+
return () => {
|
|
322
|
+
controller.abort();
|
|
323
|
+
requestScope.controllers.delete(controller);
|
|
324
|
+
clearTimeout(timer);
|
|
325
|
+
};
|
|
326
|
+
}, [active, cwd, diskPulse, beginRequest, isCurrent, requestScope, updateLazy]);
|
|
327
|
+
const rounds = useMemo(() => buildGrowthRounds(steps, turnStarts), [steps, turnStarts]);
|
|
328
|
+
const following = selectedRoundId === null;
|
|
329
|
+
const selectedRound = useMemo(
|
|
330
|
+
() => (following ? rounds[rounds.length - 1] : rounds.find((round) => round.id === selectedRoundId) ?? rounds[rounds.length - 1]) ?? null,
|
|
331
|
+
[following, rounds, selectedRoundId],
|
|
332
|
+
);
|
|
333
|
+
const selected = selectedRound ? selectedRound.last : baseline;
|
|
334
|
+
|
|
335
|
+
// 所选步的文件清单;缓存身份包含工作区与会话,迟到结果不写缓存。
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
if (!selected || !cwd) {
|
|
338
|
+
setFiles(null);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
const tree = selected.tree;
|
|
342
|
+
const cacheKey = `${key}|${tree}`;
|
|
343
|
+
const cached = listingCache.current.get(cacheKey);
|
|
344
|
+
if (cached) {
|
|
345
|
+
setFiles({ key, tree, files: cached });
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const controller = beginRequest();
|
|
349
|
+
void getJson<{ files: TreeFile[] }>(`/api/growth?cwd=${encodeURIComponent(cwd)}&tree=${tree}&list=1`, controller.signal)
|
|
350
|
+
.then((data) => {
|
|
351
|
+
if (!isCurrent(controller)) return;
|
|
352
|
+
remember(listingCache.current, cacheKey, data.files);
|
|
353
|
+
setFiles({ key, tree, files: data.files });
|
|
354
|
+
})
|
|
355
|
+
.catch(() => {
|
|
356
|
+
if (isCurrent(controller)) setFiles({ key, tree, files: [] });
|
|
357
|
+
})
|
|
358
|
+
.finally(() => requestScope.controllers.delete(controller));
|
|
359
|
+
return () => {
|
|
360
|
+
controller.abort();
|
|
361
|
+
requestScope.controllers.delete(controller);
|
|
362
|
+
};
|
|
363
|
+
}, [selected, cwd, key, beginRequest, isCurrent, requestScope]);
|
|
364
|
+
|
|
365
|
+
// 所选范围的变更:本步优先用账本内嵌清单;本会话 / 截断时按 tree 对取
|
|
366
|
+
const range = useMemo(() => {
|
|
367
|
+
if (!selected || (selectedRound && !selectedRound.recorded)) return null;
|
|
368
|
+
if (scope === "step") return selectedRound?.fromTree && selectedRound.toTree ? { from: selectedRound.fromTree, to: selectedRound.toTree } : null;
|
|
369
|
+
return { from: (baseline ?? selected).tree, to: selected.tree };
|
|
370
|
+
}, [selected, selectedRound, scope, baseline]);
|
|
371
|
+
const inlineChanges = useMemo<GrowthChange[] | null>(() => {
|
|
372
|
+
if (!selected || !selectedRound || !selectedRound.recorded) return [];
|
|
373
|
+
if (scope === "step") return selectedRound.steps.length === 1 && selectedRound.fromTree === selected.parent && !selected.truncated ? selected.changes : null;
|
|
374
|
+
if (baseline && baseline.seq === selected.seq) return [];
|
|
375
|
+
return null;
|
|
376
|
+
}, [selected, selectedRound, scope, baseline]);
|
|
377
|
+
|
|
378
|
+
const loadRange = useCallback(
|
|
379
|
+
async (from: string, to: string, controller: AbortController): Promise<GrowthChange[]> => {
|
|
380
|
+
const k = `${key}|${from}..${to}`;
|
|
381
|
+
const cached = changesCache.current.get(k);
|
|
382
|
+
if (cached) return cached;
|
|
383
|
+
if (from === to) return [];
|
|
384
|
+
const data = await getJson<{ changes: GrowthChange[] }>(`/api/growth?cwd=${encodeURIComponent(cwd)}&from=${from}&to=${to}&changes=1`, controller.signal);
|
|
385
|
+
if (isCurrent(controller)) remember(changesCache.current, k, data.changes);
|
|
386
|
+
return data.changes;
|
|
387
|
+
},
|
|
388
|
+
[cwd, key, isCurrent],
|
|
389
|
+
);
|
|
390
|
+
|
|
391
|
+
useEffect(() => {
|
|
392
|
+
if (!range || inlineChanges !== null || !cwd) return;
|
|
393
|
+
const k = `${key}|${range.from}..${range.to}`;
|
|
394
|
+
const controller = beginRequest();
|
|
395
|
+
void loadRange(range.from, range.to, controller)
|
|
396
|
+
.then((changes) => {
|
|
397
|
+
if (isCurrent(controller)) setRangeChanges({ key: k, changes });
|
|
398
|
+
})
|
|
399
|
+
.catch((error) => {
|
|
400
|
+
if (isCurrent(controller)) setRangeChanges({ key: k, changes: [], error: error instanceof Error ? error.message : "failed to load round changes" });
|
|
401
|
+
})
|
|
402
|
+
.finally(() => requestScope.controllers.delete(controller));
|
|
403
|
+
return () => {
|
|
404
|
+
controller.abort();
|
|
405
|
+
requestScope.controllers.delete(controller);
|
|
406
|
+
};
|
|
407
|
+
}, [range, inlineChanges, cwd, key, loadRange, beginRequest, isCurrent, requestScope]);
|
|
408
|
+
|
|
409
|
+
const changes = useMemo<GrowthChange[]>(() => {
|
|
410
|
+
if (inlineChanges !== null) return inlineChanges;
|
|
411
|
+
if (!range) return [];
|
|
412
|
+
return rangeChanges?.key === `${key}|${range.from}..${range.to}` ? rangeChanges.changes : [];
|
|
413
|
+
}, [inlineChanges, range, rangeChanges, key]);
|
|
414
|
+
|
|
415
|
+
// 本会话总计(基线 → 所选步)
|
|
416
|
+
useEffect(() => {
|
|
417
|
+
if (!baseline || !selected || !cwd) return;
|
|
418
|
+
const k = `${key}|${baseline.tree}..${selected.tree}`;
|
|
419
|
+
const controller = beginRequest();
|
|
420
|
+
void loadRange(baseline.tree, selected.tree, controller)
|
|
421
|
+
.then((list) => {
|
|
422
|
+
if (isCurrent(controller)) setSessionRange({ key: k, changes: list });
|
|
423
|
+
})
|
|
424
|
+
.catch((error) => {
|
|
425
|
+
if (isCurrent(controller)) setSessionRange({ key: k, changes: [], error: error instanceof Error ? error.message : "failed to load session changes" });
|
|
426
|
+
})
|
|
427
|
+
.finally(() => requestScope.controllers.delete(controller));
|
|
428
|
+
return () => {
|
|
429
|
+
controller.abort();
|
|
430
|
+
requestScope.controllers.delete(controller);
|
|
431
|
+
};
|
|
432
|
+
}, [baseline, selected, cwd, key, loadRange, beginRequest, isCurrent, requestScope]);
|
|
433
|
+
const sessionChanges = useMemo(() => (baseline && selected && sessionRange?.key === `${key}|${baseline.tree}..${selected.tree}` ? sessionRange.changes : []), [baseline, selected, sessionRange, key]);
|
|
434
|
+
|
|
435
|
+
const shownPending = following ? pending : NO_PENDING;
|
|
436
|
+
const tree = useMemo(() => {
|
|
437
|
+
const base = buildTree(files?.key === key && selected && files.tree === selected.tree ? files.files : [], changes, shownPending);
|
|
438
|
+
return graftLazy(base, lazyChildren);
|
|
439
|
+
}, [files, selected, changes, shownPending, lazyChildren, key]);
|
|
440
|
+
const filePaths = useMemo(() => {
|
|
441
|
+
const paths = new Set(files?.key === key && selected && files.tree === selected.tree ? files.files.map((file) => file.path) : []);
|
|
442
|
+
for (const children of lazyChildren.values()) for (const child of children) if (child.kind === "file") paths.add(child.path);
|
|
443
|
+
return [...paths];
|
|
444
|
+
}, [files, selected, lazyChildren, key]);
|
|
445
|
+
|
|
446
|
+
// 新步到来(跟随中):自动展开改动路径上的目录(用户手动收起过的除外)+ 入场动画
|
|
447
|
+
useEffect(() => {
|
|
448
|
+
if (!latest || !following || latest.seq === lastRevealedSeq.current) return;
|
|
449
|
+
lastRevealedSeq.current = latest.seq;
|
|
450
|
+
const list = latest.initial ? [] : latest.changes;
|
|
451
|
+
if (!list.length) return;
|
|
452
|
+
const dirs = dirsToReveal(list.slice(0, REVEAL_LIMIT)).filter((d) => !collapsedByUser.current.has(d));
|
|
453
|
+
if (dirs.length) {
|
|
454
|
+
setExpanded((prev) => {
|
|
455
|
+
const next = new Set(prev);
|
|
456
|
+
for (const d of dirs) next.add(d);
|
|
457
|
+
persistExpanded(next);
|
|
458
|
+
return next;
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
setFresh(new Set(list.map((c) => c.path)));
|
|
462
|
+
if (freshTimer.current) clearTimeout(freshTimer.current);
|
|
463
|
+
freshTimer.current = setTimeout(() => setFresh(new Set()), FRESH_MS);
|
|
464
|
+
}, [latest, following, persistExpanded]);
|
|
465
|
+
useEffect(() => () => {
|
|
466
|
+
if (freshTimer.current) clearTimeout(freshTimer.current);
|
|
467
|
+
}, []);
|
|
468
|
+
|
|
469
|
+
// 生成中的路径也把目录撑开
|
|
470
|
+
useEffect(() => {
|
|
471
|
+
if (!shownPending.length) return;
|
|
472
|
+
const dirs = dirsToReveal([], shownPending.slice(0, REVEAL_LIMIT)).filter((d) => !collapsedByUser.current.has(d));
|
|
473
|
+
if (!dirs.length) return;
|
|
474
|
+
setExpanded((prev) => {
|
|
475
|
+
if (dirs.every((d) => prev.has(d))) return prev;
|
|
476
|
+
const next = new Set(prev);
|
|
477
|
+
for (const d of dirs) next.add(d);
|
|
478
|
+
return next;
|
|
479
|
+
});
|
|
480
|
+
}, [shownPending]);
|
|
481
|
+
|
|
482
|
+
// 手动选步:展开这一步改动的目录
|
|
483
|
+
useEffect(() => {
|
|
484
|
+
if (following || !selected) return;
|
|
485
|
+
const list = changes.slice(0, REVEAL_LIMIT);
|
|
486
|
+
if (!list.length) return;
|
|
487
|
+
const dirs = dirsToReveal(list);
|
|
488
|
+
setExpanded((prev) => {
|
|
489
|
+
if (dirs.every((d) => prev.has(d))) return prev;
|
|
490
|
+
const next = new Set(prev);
|
|
491
|
+
for (const d of dirs) next.add(d);
|
|
492
|
+
return next;
|
|
493
|
+
});
|
|
494
|
+
}, [following, selected, changes]);
|
|
495
|
+
|
|
496
|
+
const follow = useCallback(() => {
|
|
497
|
+
setSelectedRoundId(null);
|
|
498
|
+
}, []);
|
|
499
|
+
const selectRound = useCallback(
|
|
500
|
+
(id: number) => setSelectedRoundId(rounds.length && rounds[rounds.length - 1].id === id ? null : id),
|
|
501
|
+
[rounds],
|
|
502
|
+
);
|
|
503
|
+
const prev = useCallback(() => {
|
|
504
|
+
if (!selectedRound) return;
|
|
505
|
+
const idx = rounds.findIndex((round) => round.id === selectedRound.id);
|
|
506
|
+
if (idx > 0) setSelectedRoundId(rounds[idx - 1].id);
|
|
507
|
+
}, [selectedRound, rounds]);
|
|
508
|
+
const next = useCallback(() => {
|
|
509
|
+
if (!selectedRound) return;
|
|
510
|
+
const idx = rounds.findIndex((round) => round.id === selectedRound.id);
|
|
511
|
+
if (idx < 0 || idx >= rounds.length - 1) return;
|
|
512
|
+
setSelectedRoundId(idx + 1 === rounds.length - 1 ? null : rounds[idx + 1].id);
|
|
513
|
+
}, [selectedRound, rounds]);
|
|
514
|
+
|
|
515
|
+
const toggleDir = useCallback(
|
|
516
|
+
(path: string) => {
|
|
517
|
+
setExpanded((prevSet) => {
|
|
518
|
+
const nextSet = new Set(prevSet);
|
|
519
|
+
if (nextSet.has(path)) {
|
|
520
|
+
nextSet.delete(path);
|
|
521
|
+
collapsedByUser.current.add(path);
|
|
522
|
+
} else {
|
|
523
|
+
nextSet.add(path);
|
|
524
|
+
collapsedByUser.current.delete(path);
|
|
525
|
+
}
|
|
526
|
+
persistExpanded(nextSet);
|
|
527
|
+
return nextSet;
|
|
528
|
+
});
|
|
529
|
+
},
|
|
530
|
+
[persistExpanded],
|
|
531
|
+
);
|
|
532
|
+
const revealPath = useCallback(
|
|
533
|
+
(path: string) => {
|
|
534
|
+
const parts = path.split("/");
|
|
535
|
+
const dirs: string[] = [];
|
|
536
|
+
for (let i = 1; i < parts.length; i += 1) dirs.push(parts.slice(0, i).join("/"));
|
|
537
|
+
setExpanded((prevSet) => {
|
|
538
|
+
const nextSet = new Set(prevSet);
|
|
539
|
+
for (const d of dirs) {
|
|
540
|
+
nextSet.add(d);
|
|
541
|
+
collapsedByUser.current.delete(d);
|
|
542
|
+
}
|
|
543
|
+
persistExpanded(nextSet);
|
|
544
|
+
return nextSet;
|
|
545
|
+
});
|
|
546
|
+
},
|
|
547
|
+
[persistExpanded],
|
|
548
|
+
);
|
|
549
|
+
const expandAll = useCallback(() => {
|
|
550
|
+
const all = new Set(allDirPaths(tree));
|
|
551
|
+
collapsedByUser.current = new Set();
|
|
552
|
+
setExpanded(all);
|
|
553
|
+
persistExpanded(all);
|
|
554
|
+
}, [tree, persistExpanded]);
|
|
555
|
+
const collapseAll = useCallback(() => {
|
|
556
|
+
const empty = new Set<string>();
|
|
557
|
+
setExpanded(empty);
|
|
558
|
+
persistExpanded(empty);
|
|
559
|
+
}, [persistExpanded]);
|
|
560
|
+
|
|
561
|
+
const expandLazy = useCallback(
|
|
562
|
+
async (path: string) => {
|
|
563
|
+
if (!cwd || currentScope.current !== requestScope || lazyChildrenRef.current.has(path) || requestScope.loadingDirs.has(path)) return;
|
|
564
|
+
const controller = beginRequest();
|
|
565
|
+
if (!isCurrent(controller)) return;
|
|
566
|
+
requestScope.loadingDirs.set(path, controller);
|
|
567
|
+
try {
|
|
568
|
+
const entries = await listDiskEntries(cwd, path, controller.signal);
|
|
569
|
+
updateLazy(controller, (previous) => new Map(previous).set(path, diskNodes(path, entries)));
|
|
570
|
+
} catch {
|
|
571
|
+
// 不把失败缓存为空目录:重试或另一个工作区必须能发出真正的请求。
|
|
572
|
+
} finally {
|
|
573
|
+
if (requestScope.loadingDirs.get(path) === controller) requestScope.loadingDirs.delete(path);
|
|
574
|
+
requestScope.controllers.delete(controller);
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
[cwd, requestScope, beginRequest, isCurrent, updateLazy],
|
|
578
|
+
);
|
|
579
|
+
|
|
580
|
+
const snapshotNow = useCallback(async (): Promise<GrowthStep | null> => {
|
|
581
|
+
if (!sessionPath) return null;
|
|
582
|
+
const controller = beginRequest();
|
|
583
|
+
if (!isCurrent(controller)) return null;
|
|
584
|
+
try {
|
|
585
|
+
const r = await fetch("/api/growth", {
|
|
586
|
+
method: "POST",
|
|
587
|
+
headers: { "Content-Type": "application/json" },
|
|
588
|
+
body: JSON.stringify({ action: "snapshot", session: sessionIdOf(sessionPath) }),
|
|
589
|
+
signal: controller.signal,
|
|
590
|
+
});
|
|
591
|
+
const j = await r.json();
|
|
592
|
+
if (!isCurrent(controller)) return null;
|
|
593
|
+
if (!r.ok || !j.success) throw new Error(j.error || `request failed (${r.status})`);
|
|
594
|
+
const step = (j.data?.step ?? null) as GrowthStep | null;
|
|
595
|
+
if (step) setFetched((previous) => isCurrent(controller) && previous.key === key ? { ...previous, steps: mergeSteps(previous.steps, [step]) } : previous);
|
|
596
|
+
return step;
|
|
597
|
+
} finally {
|
|
598
|
+
requestScope.controllers.delete(controller);
|
|
599
|
+
}
|
|
600
|
+
}, [sessionPath, key, requestScope, beginRequest, isCurrent]);
|
|
601
|
+
|
|
602
|
+
return {
|
|
603
|
+
available: fetched.key === key ? fetched.available : true,
|
|
604
|
+
loading,
|
|
605
|
+
error: runtimeError ?? (fetched.key === key ? fetched.error : null) ?? (range && rangeChanges?.key === `${key}|${range.from}..${range.to}` ? rangeChanges.error : null) ?? (baseline && selected && sessionRange?.key === `${key}|${baseline.tree}..${selected.tree}` ? sessionRange.error : null) ?? null,
|
|
606
|
+
steps,
|
|
607
|
+
rounds,
|
|
608
|
+
baseline,
|
|
609
|
+
latest,
|
|
610
|
+
selected,
|
|
611
|
+
selectedRound,
|
|
612
|
+
following,
|
|
613
|
+
scope,
|
|
614
|
+
range,
|
|
615
|
+
changes,
|
|
616
|
+
sessionChanges,
|
|
617
|
+
tree,
|
|
618
|
+
filePaths,
|
|
619
|
+
expanded,
|
|
620
|
+
fresh,
|
|
621
|
+
pending: shownPending,
|
|
622
|
+
follow,
|
|
623
|
+
selectRound,
|
|
624
|
+
prev,
|
|
625
|
+
next,
|
|
626
|
+
setScope,
|
|
627
|
+
toggleDir,
|
|
628
|
+
revealPath,
|
|
629
|
+
expandAll,
|
|
630
|
+
collapseAll,
|
|
631
|
+
expandLazy,
|
|
632
|
+
refresh,
|
|
633
|
+
snapshotNow,
|
|
634
|
+
};
|
|
635
|
+
}
|