oh-langfuse 0.1.39 → 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
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
function envShowsWarnings(env = process.env) {
|
|
2
|
-
return /^(1|true|yes|on)$/i.test(String(
|
|
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
15
|
return /(?:^|\s)(npm\s+warn|warn(?:ing)?\b|\[warn\])/i.test(text)
|
|
@@ -157,10 +157,10 @@ function getPatchedLangfuseDistIndexJs() {
|
|
|
157
157
|
" }",
|
|
158
158
|
"};",
|
|
159
159
|
"",
|
|
160
|
-
"const
|
|
161
|
-
"if (!
|
|
162
|
-
" process.env.LANGFUSE_LOG_LEVEL = '
|
|
163
|
-
" configureGlobalLogger({ level: LogLevel.
|
|
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' && !
|
|
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
|
}
|