oh-langfuse 0.1.37 → 0.1.39
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
|
@@ -6,7 +6,9 @@ export function shouldSuppressAgentLogLine(line, options = {}) {
|
|
|
6
6
|
const showWarnings = options.showWarnings ?? envShowsWarnings(options.env);
|
|
7
7
|
if (showWarnings) return false;
|
|
8
8
|
const text = String(line || "").trim();
|
|
9
|
-
return /(?:^|\s)(npm\s+warn|warn(?:ing)?\b|\[warn\])/i.test(text)
|
|
9
|
+
return /(?:^|\s)(npm\s+warn|warn(?:ing)?\b|\[warn\])/i.test(text)
|
|
10
|
+
|| /^(?:error\b|\[[^\]]*error[^\]]*\])/i.test(text)
|
|
11
|
+
|| /\[error\]/i.test(text);
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export function filterAgentLogText(text, options = {}) {
|
|
@@ -400,7 +400,6 @@ function getPatchedLangfuseDistIndexJs() {
|
|
|
400
400
|
" const knownSkillNames = await collectKnownSkillNames();",
|
|
401
401
|
" const messageTextById = new Map();",
|
|
402
402
|
" const skillNamesByMessageId = new Map();",
|
|
403
|
-
" const skillNamesBySessionId = new Map();",
|
|
404
403
|
" const toolCallIdsByMessageId = new Map();",
|
|
405
404
|
" const toolCallIdsBySessionId = new Map();",
|
|
406
405
|
" const toolResultIdsByMessageId = new Map();",
|
|
@@ -448,15 +447,6 @@ function getPatchedLangfuseDistIndexJs() {
|
|
|
448
447
|
" }",
|
|
449
448
|
" for (const name of names) set.add(name);",
|
|
450
449
|
" };",
|
|
451
|
-
" const rememberSessionSkillNames = (sessionId, names) => {",
|
|
452
|
-
" if (!sessionId || !names.length) return;",
|
|
453
|
-
" let set = skillNamesBySessionId.get(sessionId);",
|
|
454
|
-
" if (!set) {",
|
|
455
|
-
" set = new Set();",
|
|
456
|
-
" skillNamesBySessionId.set(sessionId, set);",
|
|
457
|
-
" }",
|
|
458
|
-
" for (const name of names) set.add(name);",
|
|
459
|
-
" };",
|
|
460
450
|
" const rememberToolActivity = (map, key, activity, kind) => {",
|
|
461
451
|
" if (!key || !activity?.[kind]) return;",
|
|
462
452
|
" let set = map.get(key);",
|
|
@@ -490,9 +480,9 @@ function getPatchedLangfuseDistIndexJs() {
|
|
|
490
480
|
" const partType = part?.type ?? '';",
|
|
491
481
|
" const sessionId = pickEventString(part?.sessionID, part?.sessionId, payload?.sessionID, payload?.sessionId, payload?.session?.id);",
|
|
492
482
|
" const messageId = pickEventString(part?.messageID, part?.messageId, payload?.messageID, payload?.messageId, payload?.message?.id);",
|
|
493
|
-
" const
|
|
483
|
+
" const skillDetectionSources = [part?.state?.input, part?.input, payload?.input, part?.state?.metadata, payload?.metadata, part?.state?.file, part?.file];",
|
|
484
|
+
" const eventSkillNames = detectOpencodeSkillNames(skillDetectionSources, knownSkillNames);",
|
|
494
485
|
" rememberSkillNames(messageId, eventSkillNames);",
|
|
495
|
-
" rememberSessionSkillNames(sessionId, eventSkillNames);",
|
|
496
486
|
" const toolActivity = countOpencodeToolActivity(event);",
|
|
497
487
|
" rememberToolActivity(toolCallIdsByMessageId, messageId, toolActivity, 'toolCallCount');",
|
|
498
488
|
" rememberToolActivity(toolCallIdsBySessionId, sessionId, toolActivity, 'toolCallCount');",
|
|
@@ -510,7 +500,7 @@ function getPatchedLangfuseDistIndexJs() {
|
|
|
510
500
|
" const tokenAvailable = [tokenMetrics.input, tokenMetrics.output, total, tokenMetrics.cacheRead, tokenMetrics.reasoning].some((value) => value !== undefined);",
|
|
511
501
|
" const span = metricsTracer.startSpan('AI Interaction');",
|
|
512
502
|
" const text = messageTextById.get(messageId) || '';",
|
|
513
|
-
" const skillNames = [...
|
|
503
|
+
" const skillNames = [...(skillNamesByMessageId.get(messageId) ?? [])];",
|
|
514
504
|
" const toolCallCount = Math.max(new Set([...(toolCallIdsByMessageId.get(messageId) ?? []), ...(toolCallIdsBySessionId.get(sessionId) ?? [])]).size, skillNames.length);",
|
|
515
505
|
" const toolResultCount = Math.max(new Set([...(toolResultIdsByMessageId.get(messageId) ?? []), ...(toolResultIdsBySessionId.get(sessionId) ?? [])]).size, skillNames.length);",
|
|
516
506
|
' span.setAttribute("oh.langfuse.source", "opencode");',
|
|
@@ -542,7 +532,6 @@ function getPatchedLangfuseDistIndexJs() {
|
|
|
542
532
|
" emitSkillUseSpans({ skillNames, sessionId, messageId, interactionId });",
|
|
543
533
|
" messageTextById.delete(messageId);",
|
|
544
534
|
" skillNamesByMessageId.delete(messageId);",
|
|
545
|
-
" skillNamesBySessionId.delete(sessionId);",
|
|
546
535
|
" toolCallIdsByMessageId.delete(messageId);",
|
|
547
536
|
" toolCallIdsBySessionId.delete(sessionId);",
|
|
548
537
|
" toolResultIdsByMessageId.delete(messageId);",
|