pi-webapp 0.1.7 → 0.1.9
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/README.md +4 -0
- package/README.zh-CN.md +4 -0
- package/bin/npm-command.d.mts +2 -0
- package/bin/npm-command.mjs +36 -0
- package/bin/pi-webapp.mjs +5 -2
- package/dist/extension.js +21 -8
- package/docs/sentry.md +54 -0
- package/package.json +17 -8
- package/web/dist/.vite/manifest.json +859 -0
- package/web/dist/assets/app-B2Ac56ic.js +544 -0
- package/web/dist/assets/app.js +9 -541
- package/web/dist/assets/asciidoc-fDuF7HNn.js +3 -0
- package/web/dist/assets/bat-CIKKTCO7.js +3 -0
- package/web/dist/assets/bibtex-D13O2Wvh.js +3 -0
- package/web/dist/assets/c-BxgHfdNM.js +3 -0
- package/web/dist/assets/clojure-CiHGeAtp.js +3 -0
- package/web/dist/assets/cmake-DmzJtVCe.js +3 -0
- package/web/dist/assets/cpp-WTsyTmWk.js +3 -0
- package/web/dist/assets/csharp-BusYHIEz.js +3 -0
- package/web/dist/assets/css-D-q0lhfR.js +3 -0
- package/web/dist/assets/csv-DFLln536.js +3 -0
- package/web/dist/assets/dart-CafiI-9_.js +3 -0
- package/web/dist/assets/diff-Br1ISN9_.js +3 -0
- package/web/dist/assets/dotenv-CIz2XDph.js +3 -0
- package/web/dist/assets/elixir-DRaGIFOe.js +3 -0
- package/web/dist/assets/erlang-NGps-vi9.js +3 -0
- package/web/dist/assets/fish-ByHW6pZw.js +3 -0
- package/web/dist/assets/fsharp-BOBx9XdV.js +3 -0
- package/web/dist/assets/go-BeHf35-M.js +3 -0
- package/web/dist/assets/graphql-DvPK7yuL.js +3 -0
- package/web/dist/assets/groovy-zjY2ZfG0.js +3 -0
- package/web/dist/assets/haskell-CMvfT32Y.js +3 -0
- package/web/dist/assets/hcl-RKiXyu-a.js +3 -0
- package/web/dist/assets/html-DsaiN7Ee.js +3 -0
- package/web/dist/assets/html-derivative-CADUTaWI.js +3 -0
- package/web/dist/assets/http-B5WHvjtS.js +3 -0
- package/web/dist/assets/ini-DuzuNcum.js +3 -0
- package/web/dist/assets/java-K8yEFi64.js +3 -0
- package/web/dist/assets/javascript-D_ijBMSX.js +3 -0
- package/web/dist/assets/julia-BCSipsbD.js +3 -0
- package/web/dist/assets/kotlin-BSbocnsc.js +3 -0
- package/web/dist/assets/latex-B2rh6wcV.js +3 -0
- package/web/dist/assets/less-DrDudO82.js +3 -0
- package/web/dist/assets/log-ljR8DmTe.js +3 -0
- package/web/dist/assets/lua-DyIUvKwX.js +3 -0
- package/web/dist/assets/make-D75dUjYA.js +3 -0
- package/web/dist/assets/markdown-CW047eNb.js +3 -0
- package/web/dist/assets/mdx-XsqTTZB4.js +3 -0
- package/web/dist/assets/nix-CipIrdNI.js +3 -0
- package/web/dist/assets/perl-D7RI67n_.js +3 -0
- package/web/dist/assets/php-s52DiJil.js +3 -0
- package/web/dist/assets/powershell-jgDnaG9I.js +3 -0
- package/web/dist/assets/proto-BIjSd36w.js +3 -0
- package/web/dist/assets/python-D7_Ztkaq.js +3 -0
- package/web/dist/assets/r-CJzV5ecV.js +3 -0
- package/web/dist/assets/rst-CN3AX0Wt.js +3 -0
- package/web/dist/assets/ruby-TeaxAh4o.js +3 -0
- package/web/dist/assets/rust-DSBpfBj6.js +3 -0
- package/web/dist/assets/scala-C5J7wQ_u.js +3 -0
- package/web/dist/assets/scss-Ce0Xtdy1.js +3 -0
- package/web/dist/assets/sql-B8q9hRYB.js +3 -0
- package/web/dist/assets/svelte-D-qO2kbs.js +3 -0
- package/web/dist/assets/swift-BYyWkiAC.js +3 -0
- package/web/dist/assets/system-verilog-DeQRavVp.js +3 -0
- package/web/dist/assets/telemetry-client-BUyFe34_.js +7 -0
- package/web/dist/assets/toml-D4Tpftfr.js +3 -0
- package/web/dist/assets/vb-CT8kYl35.js +3 -0
- package/web/dist/assets/verilog-CRrcH6Pt.js +3 -0
- package/web/dist/assets/vue-xQhdtb6A.js +3 -0
- package/web/dist/assets/xml-DCBoxqhY.js +3 -0
- package/web/dist/assets/yaml-jmrW97Mk.js +3 -0
- package/web/src/ui/README.md +15 -0
- package/{THIRD_PARTY_LICENSE.txt → web/src/ui/shared/LICENSE.txt} +0 -3
- package/web/src/ui/shared/README.md +25 -0
- package/web/dist/assets/asciidoc.js +0 -1
- package/web/dist/assets/bat.js +0 -1
- package/web/dist/assets/bibtex.js +0 -1
- package/web/dist/assets/c.js +0 -1
- package/web/dist/assets/clojure.js +0 -1
- package/web/dist/assets/cmake.js +0 -1
- package/web/dist/assets/cpp.js +0 -1
- package/web/dist/assets/csharp.js +0 -1
- package/web/dist/assets/css.js +0 -1
- package/web/dist/assets/csv.js +0 -1
- package/web/dist/assets/dart.js +0 -1
- package/web/dist/assets/diff.js +0 -1
- package/web/dist/assets/dotenv.js +0 -1
- package/web/dist/assets/elixir.js +0 -1
- package/web/dist/assets/erlang.js +0 -1
- package/web/dist/assets/fish.js +0 -1
- package/web/dist/assets/fsharp.js +0 -1
- package/web/dist/assets/go.js +0 -1
- package/web/dist/assets/graphql.js +0 -1
- package/web/dist/assets/groovy.js +0 -1
- package/web/dist/assets/haskell.js +0 -1
- package/web/dist/assets/hcl.js +0 -1
- package/web/dist/assets/html-derivative.js +0 -1
- package/web/dist/assets/html.js +0 -1
- package/web/dist/assets/http.js +0 -1
- package/web/dist/assets/ini.js +0 -1
- package/web/dist/assets/java.js +0 -1
- package/web/dist/assets/javascript.js +0 -1
- package/web/dist/assets/julia.js +0 -1
- package/web/dist/assets/kotlin.js +0 -1
- package/web/dist/assets/latex.js +0 -1
- package/web/dist/assets/less.js +0 -1
- package/web/dist/assets/log.js +0 -1
- package/web/dist/assets/lua.js +0 -1
- package/web/dist/assets/make.js +0 -1
- package/web/dist/assets/markdown.js +0 -1
- package/web/dist/assets/mdx.js +0 -1
- package/web/dist/assets/nix.js +0 -1
- package/web/dist/assets/perl.js +0 -1
- package/web/dist/assets/php.js +0 -1
- package/web/dist/assets/powershell.js +0 -1
- package/web/dist/assets/proto.js +0 -1
- package/web/dist/assets/python.js +0 -1
- package/web/dist/assets/r.js +0 -1
- package/web/dist/assets/rst.js +0 -1
- package/web/dist/assets/ruby.js +0 -1
- package/web/dist/assets/rust.js +0 -1
- package/web/dist/assets/scala.js +0 -1
- package/web/dist/assets/scss.js +0 -1
- package/web/dist/assets/sql.js +0 -1
- package/web/dist/assets/svelte.js +0 -1
- package/web/dist/assets/swift.js +0 -1
- package/web/dist/assets/system-verilog.js +0 -1
- package/web/dist/assets/toml.js +0 -1
- package/web/dist/assets/vb.js +0 -1
- package/web/dist/assets/verilog.js +0 -1
- package/web/dist/assets/vue.js +0 -1
- package/web/dist/assets/xml.js +0 -1
- package/web/dist/assets/yaml.js +0 -1
package/README.md
CHANGED
|
@@ -66,6 +66,10 @@ For local Web plugin development with the sibling `pi-extensions` workspace, fol
|
|
|
66
66
|
|
|
67
67
|
The source lives in `extension/`, `shared/`, and `web/src/`. The npm package contains only the bundled, minified JavaScript extension, built web assets, cover image, and the English and Chinese READMEs. No TypeScript source or source maps are published. Minification makes the shipped code harder to read; it does not encrypt JavaScript.
|
|
68
68
|
|
|
69
|
+
## Error collection
|
|
70
|
+
|
|
71
|
+
Frontend and extension Sentry error reporting is enabled by default with the built-in public DSN. Set `PI_WEB_SENTRY_DSN` in the Pi process environment to use another project, or `PI_WEB_SENTRY_ENABLED=false` to disable reporting. Collection is limited to sanitized stacks, semantic breadcrumbs and state summaries; conversations, source contents, attachments, credentials and session recordings are excluded. See [Sentry configuration](docs/sentry.md) for the default destination, separate destinations, limits and private source-map uploads.
|
|
72
|
+
|
|
69
73
|
## Publish
|
|
70
74
|
|
|
71
75
|
CI resolves the published `@chengzhiyi/pi-web-protocol` version before `npm ci`.
|
package/README.zh-CN.md
CHANGED
|
@@ -66,6 +66,10 @@ npm run stop
|
|
|
66
66
|
|
|
67
67
|
源代码位于 `extension/`、`shared/` 和 `web/src/`。npm 软件包仅包含打包并压缩后的 JavaScript 扩展、构建后的 Web 资源、封面图片,以及英文和中文 README;不会发布 TypeScript 源码或 source map。代码压缩会增加阅读发布版本代码的难度,但不会对 JavaScript 加密。
|
|
68
68
|
|
|
69
|
+
## 错误采集
|
|
70
|
+
|
|
71
|
+
前后端 Sentry 错误采集默认开启,使用内置公共 DSN,无需额外配置。在启动 Pi 的环境中设置 `PI_WEB_SENTRY_DSN` 可覆盖默认项目,使用 `PI_WEB_SENTRY_ENABLED=false` 关闭。默认只采集脱敏堆栈、操作轨迹和状态摘要,不采集对话、源码正文、附件内容或凭据,不启用界面录制。默认上报地址、独立前后端 DSN 和私有 sourcemap 上传步骤见 [Sentry 配置说明](docs/sentry.md)。
|
|
72
|
+
|
|
69
73
|
## 发布
|
|
70
74
|
|
|
71
75
|
CI 会先从 npm 解析 `@chengzhiyi/pi-web-protocol` 的已发布版本,再运行 `npm ci`。
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { realpathSync, statSync } from "node:fs";
|
|
2
|
+
import { basename, delimiter, dirname, join, resolve } from "node:path";
|
|
3
|
+
|
|
4
|
+
function npmEntry(path) {
|
|
5
|
+
if (!path) return null;
|
|
6
|
+
try {
|
|
7
|
+
const real = realpathSync(path);
|
|
8
|
+
return basename(real) === "npm-cli.js" && statSync(real).isFile() ? real : null;
|
|
9
|
+
} catch { return null; }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Find npm's JavaScript entry point without relying on executable shell shims. */
|
|
13
|
+
export function resolveNpmCli({ execPath = process.execPath, env = process.env } = {}) {
|
|
14
|
+
const inherited = npmEntry(env.npm_execpath);
|
|
15
|
+
if (inherited) return inherited;
|
|
16
|
+
|
|
17
|
+
const directories = new Set([dirname(execPath)]);
|
|
18
|
+
try { directories.add(dirname(realpathSync(execPath))); } catch { /* Try the original path. */ }
|
|
19
|
+
const searchPath = Object.entries(env).find(([key]) => key.toLowerCase() === "path")?.[1] ?? "";
|
|
20
|
+
for (const directory of searchPath.split(delimiter).filter(Boolean)) directories.add(resolve(directory));
|
|
21
|
+
for (const directory of directories) {
|
|
22
|
+
for (const candidate of [
|
|
23
|
+
join(directory, "node_modules", "npm", "bin", "npm-cli.js"),
|
|
24
|
+
join(directory, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js"),
|
|
25
|
+
join(directory, "npm"),
|
|
26
|
+
]) {
|
|
27
|
+
const cli = npmEntry(candidate);
|
|
28
|
+
if (cli) return cli;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw new Error("找不到 npm 入口 npm-cli.js;请安装包含 npm 的 Node.js,或将 npm 所在目录加入 PATH 后重启服务。");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function npmCommand(args) {
|
|
35
|
+
return { file: process.execPath, args: [resolveNpmCli(), ...args] };
|
|
36
|
+
}
|
package/bin/pi-webapp.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { delimiter, dirname, join, resolve } from "node:path";
|
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import spawn from "cross-spawn";
|
|
10
10
|
import { openWebPage } from "./open-web-page.mjs";
|
|
11
|
+
import { npmCommand } from "./npm-command.mjs";
|
|
11
12
|
|
|
12
13
|
const minimum = [0, 87, 1];
|
|
13
14
|
const launcher = fileURLToPath(import.meta.url);
|
|
@@ -47,13 +48,15 @@ function probe(command) {
|
|
|
47
48
|
|
|
48
49
|
function installPi() {
|
|
49
50
|
console.error("未找到 Pi,正在通过 npm 安装 @earendil-works/pi-coding-agent …");
|
|
50
|
-
const
|
|
51
|
+
const install = npmCommand(["install", "-g", "--ignore-scripts", "@earendil-works/pi-coding-agent"]);
|
|
52
|
+
const result = spawn.sync(install.file, install.args, { stdio: "inherit", windowsHide: true });
|
|
51
53
|
if (result.error || result.status !== 0) {
|
|
52
54
|
throw new Error(`Pi 安装失败。请手动运行 npm install -g --ignore-scripts @earendil-works/pi-coding-agent${result.error ? `(${result.error.message})` : ""}`);
|
|
53
55
|
}
|
|
54
56
|
const inPath = probe("pi");
|
|
55
57
|
if (inPath) return inPath;
|
|
56
|
-
const
|
|
58
|
+
const prefixCommand = npmCommand(["prefix", "-g"]);
|
|
59
|
+
const prefix = spawn.sync(prefixCommand.file, prefixCommand.args, { encoding: "utf8", windowsHide: true });
|
|
57
60
|
if (prefix.status === 0) {
|
|
58
61
|
const installed = process.platform === "win32" ? join(prefix.stdout.trim(), "pi.cmd") : join(prefix.stdout.trim(), "bin", "pi");
|
|
59
62
|
if (existsSync(installed)) return probe(installed);
|