oh-langfuse 0.1.38 → 0.1.40

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  `oh-langfuse` 是用于给 Claude Code、OpenCode 和 Codex 配置 Langfuse 追踪的命令行工具。它提供交互式安装向导,也支持 `setup` / `check` 直接命令,方便在用户机器上安装、修复和校验配置。
4
4
 
5
- 当前 npm 版本:`0.1.38`
5
+ 当前 npm 版本:`0.1.40`
6
6
 
7
7
  ## 能做什么
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-langfuse",
3
- "version": "0.1.38",
3
+ "version": "0.1.40",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Use npm scripts to configure Claude Code / OpenCode / Codex with Langfuse tracing.",
@@ -1,12 +1,20 @@
1
1
  function envShowsWarnings(env = process.env) {
2
- return /^(1|true|yes|on)$/i.test(String(env.OH_LANGFUSE_SHOW_WARN || env.LANGFUSE_SHOW_WARN || ""));
2
+ return /^(1|true|yes|on)$/i.test(String(
3
+ env.OH_LANGFUSE_SHOW_LOGS ||
4
+ env.LANGFUSE_SHOW_LOGS ||
5
+ env.OH_LANGFUSE_SHOW_WARN ||
6
+ env.LANGFUSE_SHOW_WARN ||
7
+ ""
8
+ ));
3
9
  }
4
10
 
5
11
  export function shouldSuppressAgentLogLine(line, options = {}) {
6
- const showWarnings = options.showWarnings ?? envShowsWarnings(options.env);
12
+ const showWarnings = options.showNoisyLogs ?? options.showWarnings ?? envShowsWarnings(options.env);
7
13
  if (showWarnings) return false;
8
14
  const text = String(line || "").trim();
9
- return /(?:^|\s)(npm\s+warn|warn(?:ing)?\b|\[warn\])/i.test(text);
15
+ return /(?:^|\s)(npm\s+warn|warn(?:ing)?\b|\[warn\])/i.test(text)
16
+ || /^(?:error\b|\[[^\]]*error[^\]]*\])/i.test(text)
17
+ || /\[error\]/i.test(text);
10
18
  }
11
19
 
12
20
  export function filterAgentLogText(text, options = {}) {
@@ -157,10 +157,10 @@ function getPatchedLangfuseDistIndexJs() {
157
157
  " }",
158
158
  "};",
159
159
  "",
160
- "const showWarnings = /^(1|true|yes|on)$/i.test(String(process.env.OH_LANGFUSE_SHOW_WARN || process.env.LANGFUSE_SHOW_WARN || ''));",
161
- "if (!showWarnings) {",
162
- " process.env.LANGFUSE_LOG_LEVEL = 'ERROR';",
163
- " configureGlobalLogger({ level: LogLevel.ERROR });",
160
+ "const showNoisyLogs = /^(1|true|yes|on)$/i.test(String(process.env.OH_LANGFUSE_SHOW_LOGS || process.env.LANGFUSE_SHOW_LOGS || process.env.OH_LANGFUSE_SHOW_WARN || process.env.LANGFUSE_SHOW_WARN || ''));",
161
+ "if (!showNoisyLogs) {",
162
+ " process.env.LANGFUSE_LOG_LEVEL = 'NONE';",
163
+ " configureGlobalLogger({ level: LogLevel.NONE });",
164
164
  "}",
165
165
  "",
166
166
  "const createUserIdSpanProcessor = (userId) => ({",
@@ -381,7 +381,7 @@ function getPatchedLangfuseDistIndexJs() {
381
381
  " const userId = userIdFromConfig || userIdEnv;",
382
382
  "",
383
383
  " const log = (level, message) => {",
384
- " if (level === 'warn' && !showWarnings) return;",
384
+ " if ((level === 'warn' || level === 'error') && !showNoisyLogs) return;",
385
385
  ' client.app.log({ body: { service: "langfuse-otel", level, message } });',
386
386
  " };",
387
387
  "",
@@ -797,7 +797,7 @@ function isOfficialNpmRegistry(registry) {
797
797
  }
798
798
 
799
799
  async function runNpmInstallOrThrow({ opencodeDir, pkgName = "opencode-plugin-langfuse", npmRegistry = "" }) {
800
- const npmArgs = ["install", pkgName, "--prefix", opencodeDir, "--package-lock=false", "--no-save"];
800
+ const npmArgs = ["install", pkgName, "--prefix", opencodeDir, "--package-lock=false", "--no-save", "--audit=false", "--fund=false"];
801
801
  if (npmRegistry) npmArgs.push("--registry", npmRegistry);
802
802
  const cliJs = getNpmCliJsPath();
803
803
  console.log(`使用 npm:${fs.existsSync(cliJs) ? `node ${cliJs}` : getNpmExecutable()}`);
@@ -806,7 +806,7 @@ async function runNpmInstallOrThrow({ opencodeDir, pkgName = "opencode-plugin-la
806
806
  if (!r.error && r.status !== 0 && npmInstallLooksLikeMissingVersion(r) && !isOfficialNpmRegistry(npmRegistry)) {
807
807
  console.error("");
808
808
  console.error("npm registry appears to be missing a package version. Retrying with https://registry.npmjs.org/ ...");
809
- const retryArgs = ["install", pkgName, "--prefix", opencodeDir, "--package-lock=false", "--no-save", "--registry", "https://registry.npmjs.org/"];
809
+ const retryArgs = ["install", pkgName, "--prefix", opencodeDir, "--package-lock=false", "--no-save", "--audit=false", "--fund=false", "--registry", "https://registry.npmjs.org/"];
810
810
  r = await runNpmInstallCapture(retryArgs);
811
811
  if (!r.error && r.status === 0) return;
812
812
  }