oh-langfuse 0.1.74 → 0.1.76
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/bin/cli.js +11 -9
- package/codex_langfuse_notify.py +30 -2
- package/package.json +1 -1
- package/scripts/opencode-langfuse-setup.mjs +1434 -1434
- package/scripts/real-self-verify.mjs +45 -40
- package/scripts/resolve-opencode-cli.mjs +15 -11
package/bin/cli.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import readline from "readline";
|
|
5
|
-
import { fileURLToPath } from "url";
|
|
6
|
-
import { spawnSync } from "child_process";
|
|
4
|
+
import readline from "readline";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { spawnSync } from "child_process";
|
|
7
|
+
import { resolveOpencodeCli } from "../scripts/resolve-opencode-cli.mjs";
|
|
7
8
|
|
|
8
9
|
const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
9
10
|
const scriptsDir = path.join(rootDir, "scripts");
|
|
@@ -159,12 +160,13 @@ function detectPython() {
|
|
|
159
160
|
return { ok: false, command: null, version: "", pipOk: false, pipVersion: "" };
|
|
160
161
|
}
|
|
161
162
|
|
|
162
|
-
function detectOpencode() {
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
function detectOpencode() {
|
|
164
|
+
const resolved = resolveOpencodeCli();
|
|
165
|
+
const candidates = [resolved, ...(process.platform === "win32" ? ["opencode.cmd", "opencode"] : ["opencode"])].filter(Boolean);
|
|
166
|
+
for (const cmd of candidates) {
|
|
167
|
+
const r = commandExists(cmd, ["--version"]);
|
|
168
|
+
if (r.ok) return { ok: true, command: cmd, version: r.stdout || r.stderr };
|
|
169
|
+
}
|
|
168
170
|
return { ok: false, command: null, version: "" };
|
|
169
171
|
}
|
|
170
172
|
|
package/codex_langfuse_notify.py
CHANGED
|
@@ -748,6 +748,10 @@ def _skill_agent_path(agent: str, detected_by: str) -> str:
|
|
|
748
748
|
return "codex_skill_script_exec"
|
|
749
749
|
if detected_by == "codex_implicit_doc_read":
|
|
750
750
|
return "codex_skill_doc_read"
|
|
751
|
+
if detected_by == "codex_skill_tool":
|
|
752
|
+
return "codex_skill_tool_invoke"
|
|
753
|
+
if detected_by == "codex_skill_doc_read":
|
|
754
|
+
return "codex_skill_doc_read_tool"
|
|
751
755
|
if detected_by == "tool_call":
|
|
752
756
|
return "codex_unsupported_skill_tool"
|
|
753
757
|
if detected_by == "skill_file_path":
|
|
@@ -758,7 +762,7 @@ def _skill_agent_path(agent: str, detected_by: str) -> str:
|
|
|
758
762
|
def _skill_invocation_mode(agent: str, detected_by: str) -> str:
|
|
759
763
|
if agent == "codex" and detected_by == "codex_explicit_injection":
|
|
760
764
|
return "explicit"
|
|
761
|
-
if agent == "codex" and detected_by in ("codex_implicit_script", "codex_implicit_doc_read"):
|
|
765
|
+
if agent == "codex" and detected_by in ("codex_implicit_script", "codex_implicit_doc_read", "codex_skill_tool", "codex_skill_doc_read"):
|
|
762
766
|
return "implicit"
|
|
763
767
|
return "detected"
|
|
764
768
|
|
|
@@ -766,7 +770,7 @@ def _skill_invocation_mode(agent: str, detected_by: str) -> str:
|
|
|
766
770
|
def _skill_event_type(detected_by: str, agent: str = "unknown") -> str:
|
|
767
771
|
if agent == "codex" and detected_by == "tool_call":
|
|
768
772
|
return "detected"
|
|
769
|
-
return "invoked" if detected_by in ("codex_explicit_injection", "codex_implicit_script", "codex_implicit_doc_read") else "detected"
|
|
773
|
+
return "invoked" if detected_by in ("codex_explicit_injection", "codex_implicit_script", "codex_implicit_doc_read", "codex_skill_tool", "codex_skill_doc_read") else "detected"
|
|
770
774
|
|
|
771
775
|
|
|
772
776
|
def _skill_id_segment(name: str) -> str:
|
|
@@ -837,7 +841,31 @@ def _detect_codex_skill_command(command: str, known_skills: set) -> List[Dict[st
|
|
|
837
841
|
def detect_skill_usages(tool_calls: List[Dict[str, Any]], known_skills: set) -> List[Dict[str, str]]:
|
|
838
842
|
found: List[Dict[str, str]] = []
|
|
839
843
|
for call in tool_calls or []:
|
|
844
|
+
call_name = str(call.get("name") or "").strip().lower()
|
|
840
845
|
input_obj = call.get("input") if isinstance(call.get("input"), (dict, list, str)) else {}
|
|
846
|
+
|
|
847
|
+
if call_name == "skill":
|
|
848
|
+
skill_input_name = None
|
|
849
|
+
if isinstance(input_obj, dict):
|
|
850
|
+
skill_input_name = str(input_obj.get("name") or "").strip()
|
|
851
|
+
if skill_input_name:
|
|
852
|
+
name = _accept_known_skill(skill_input_name, known_skills)
|
|
853
|
+
if name:
|
|
854
|
+
found.append(_skill_usage(name, "codex_skill_tool"))
|
|
855
|
+
continue
|
|
856
|
+
|
|
857
|
+
if call_name == "read":
|
|
858
|
+
if isinstance(input_obj, dict):
|
|
859
|
+
file_path = str(input_obj.get("filePath") or "").strip()
|
|
860
|
+
if file_path:
|
|
861
|
+
doc_pattern = r"[\\/](?:skills|skill)[\\/]([^\\/\"'\s]+)[\\/]SKILL\.md$"
|
|
862
|
+
match = re.search(doc_pattern, file_path, re.IGNORECASE)
|
|
863
|
+
if match:
|
|
864
|
+
name = _accept_known_skill(match.group(1), known_skills)
|
|
865
|
+
if name:
|
|
866
|
+
found.append(_skill_usage(name, "codex_skill_doc_read"))
|
|
867
|
+
continue
|
|
868
|
+
|
|
841
869
|
found.extend(_detect_codex_skill_command(_command_from_tool_input(input_obj), known_skills))
|
|
842
870
|
return found
|
|
843
871
|
|