oh-langfuse 0.1.68 → 0.1.70
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/package.json
CHANGED
|
@@ -977,6 +977,26 @@ function writeOpencodeCommandShim(opencodeDir, { publicKey, secretKey, baseUrl,
|
|
|
977
977
|
cmd.push(' call "%APPDATA%\\npm\\opencode.cmd" %*');
|
|
978
978
|
cmd.push(" exit /b %ERRORLEVEL%");
|
|
979
979
|
cmd.push(")");
|
|
980
|
+
cmd.push('if exist "%APPDATA%\\npm\\node_modules\\opencode-ai\\bin\\opencode.exe" (');
|
|
981
|
+
cmd.push(' call "%APPDATA%\\npm\\node_modules\\opencode-ai\\bin\\opencode.exe" %*');
|
|
982
|
+
cmd.push(" exit /b %ERRORLEVEL%");
|
|
983
|
+
cmd.push(")");
|
|
984
|
+
cmd.push('if exist "%APPDATA%\\npm\\node_modules\\opencode-ai\\node_modules\\opencode-windows-x64\\bin\\opencode.exe" (');
|
|
985
|
+
cmd.push(' call "%APPDATA%\\npm\\node_modules\\opencode-ai\\node_modules\\opencode-windows-x64\\bin\\opencode.exe" %*');
|
|
986
|
+
cmd.push(" exit /b %ERRORLEVEL%");
|
|
987
|
+
cmd.push(")");
|
|
988
|
+
cmd.push('if exist "%APPDATA%\\npm\\node_modules\\opencode-ai\\node_modules\\opencode-windows-x64-baseline\\bin\\opencode.exe" (');
|
|
989
|
+
cmd.push(' call "%APPDATA%\\npm\\node_modules\\opencode-ai\\node_modules\\opencode-windows-x64-baseline\\bin\\opencode.exe" %*');
|
|
990
|
+
cmd.push(" exit /b %ERRORLEVEL%");
|
|
991
|
+
cmd.push(")");
|
|
992
|
+
cmd.push('if exist "%APPDATA%\\npm\\node_modules\\opencode-windows-x64\\bin\\opencode.exe" (');
|
|
993
|
+
cmd.push(' call "%APPDATA%\\npm\\node_modules\\opencode-windows-x64\\bin\\opencode.exe" %*');
|
|
994
|
+
cmd.push(" exit /b %ERRORLEVEL%");
|
|
995
|
+
cmd.push(")");
|
|
996
|
+
cmd.push('if exist "%APPDATA%\\npm\\node_modules\\opencode-windows-x64-baseline\\bin\\opencode.exe" (');
|
|
997
|
+
cmd.push(' call "%APPDATA%\\npm\\node_modules\\opencode-windows-x64-baseline\\bin\\opencode.exe" %*');
|
|
998
|
+
cmd.push(" exit /b %ERRORLEVEL%");
|
|
999
|
+
cmd.push(")");
|
|
980
1000
|
cmd.push('for /f "delims=" %%O in (\'where.exe opencode 2^>nul\') do (');
|
|
981
1001
|
cmd.push(' if /I not "%%~fO"=="%~f0" (');
|
|
982
1002
|
cmd.push(' call "%%O" %*');
|
|
@@ -984,7 +1004,7 @@ function writeOpencodeCommandShim(opencodeDir, { publicKey, secretKey, baseUrl,
|
|
|
984
1004
|
cmd.push(" )");
|
|
985
1005
|
cmd.push(")");
|
|
986
1006
|
cmd.push("echo [ERROR] OpenCode CLI not found. Install OpenCode CLI first. 1>&2");
|
|
987
|
-
cmd.push("echo Try: npm install -g opencode-
|
|
1007
|
+
cmd.push("echo Try: npm install -g opencode-ai@latest 1>&2");
|
|
988
1008
|
cmd.push("echo Then run: npx oh-langfuse@latest update opencode 1>&2");
|
|
989
1009
|
cmd.push("exit /b 127");
|
|
990
1010
|
fs.writeFileSync(shim, cmd.join("\r\n") + "\r\n", "utf8");
|
|
@@ -1004,15 +1024,29 @@ function writeOpencodeCommandShim(opencodeDir, { publicKey, secretKey, baseUrl,
|
|
|
1004
1024
|
userId ? `export LANGFUSE_USER_ID=${shQuote(userId)}` : null,
|
|
1005
1025
|
unixAutoUpdateCommand("opencode"),
|
|
1006
1026
|
`OH_LANGFUSE_REAL_OPENCODE=${quotedRealOpencodeCli}`,
|
|
1007
|
-
|
|
1008
|
-
|
|
1027
|
+
"OH_LANGFUSE_BROKEN_OPENCODE=",
|
|
1028
|
+
"try_opencode_candidate() {",
|
|
1029
|
+
' candidate="$1"',
|
|
1030
|
+
" shift",
|
|
1031
|
+
' if [ -x "$candidate" ]; then',
|
|
1032
|
+
' if "$candidate" --version >/dev/null 2>&1; then exec "$candidate" "$@"; fi',
|
|
1033
|
+
' OH_LANGFUSE_BROKEN_OPENCODE="$candidate"',
|
|
1034
|
+
" fi",
|
|
1035
|
+
"}",
|
|
1036
|
+
'try_opencode_candidate "$HOME/.opencode/bin/opencode" "$@"',
|
|
1037
|
+
'try_opencode_candidate "$OH_LANGFUSE_REAL_OPENCODE" "$@"',
|
|
1009
1038
|
'if command -v opencode >/dev/null 2>&1; then',
|
|
1010
1039
|
' resolved="$(command -v opencode)"',
|
|
1011
|
-
' if [ "$resolved" != "$0" ]; then
|
|
1040
|
+
' if [ "$resolved" != "$0" ]; then try_opencode_candidate "$resolved" "$@"; fi',
|
|
1041
|
+
"fi",
|
|
1042
|
+
'if [ -n "$OH_LANGFUSE_BROKEN_OPENCODE" ]; then',
|
|
1043
|
+
' echo "[ERROR] OpenCode CLI was found but failed to start: $OH_LANGFUSE_BROKEN_OPENCODE" >&2',
|
|
1044
|
+
' echo "Try: npm install -g opencode-ai@latest --registry=https://registry.npmjs.org/" >&2',
|
|
1045
|
+
' echo "Then run: npx --registry=https://registry.npmjs.org/ -y oh-langfuse@latest update opencode --npmRegistry=https://registry.npmjs.org/" >&2',
|
|
1046
|
+
" exit 127",
|
|
1012
1047
|
"fi",
|
|
1013
1048
|
'echo "[ERROR] OpenCode CLI not found. Install OpenCode CLI first." >&2',
|
|
1014
|
-
'echo "Try: npm install -g opencode-
|
|
1015
|
-
'echo "If that package fails on your host, try opencode-linux-x64-baseline or opencode-linux-x64-musl." >&2',
|
|
1049
|
+
'echo "Try: npm install -g opencode-ai@latest" >&2',
|
|
1016
1050
|
'echo "Then run: npx oh-langfuse@latest update opencode" >&2',
|
|
1017
1051
|
"exit 127",
|
|
1018
1052
|
""
|
|
@@ -26,10 +26,15 @@ export function resolveOpencodeCli(preferred) {
|
|
|
26
26
|
if (process.env.LOCALAPPDATA) {
|
|
27
27
|
candidates.push(path.join(process.env.LOCALAPPDATA, "Programs", "opencode", "opencode.exe"));
|
|
28
28
|
}
|
|
29
|
-
if (process.env.APPDATA) {
|
|
30
|
-
candidates.push(path.join(process.env.APPDATA, "npm", "opencode.cmd"));
|
|
31
|
-
candidates.push(path.join(process.env.APPDATA, "npm", "opencode"));
|
|
32
|
-
|
|
29
|
+
if (process.env.APPDATA) {
|
|
30
|
+
candidates.push(path.join(process.env.APPDATA, "npm", "opencode.cmd"));
|
|
31
|
+
candidates.push(path.join(process.env.APPDATA, "npm", "opencode"));
|
|
32
|
+
candidates.push(path.join(process.env.APPDATA, "npm", "node_modules", "opencode-ai", "bin", "opencode.exe"));
|
|
33
|
+
candidates.push(path.join(process.env.APPDATA, "npm", "node_modules", "opencode-ai", "node_modules", "opencode-windows-x64", "bin", "opencode.exe"));
|
|
34
|
+
candidates.push(path.join(process.env.APPDATA, "npm", "node_modules", "opencode-ai", "node_modules", "opencode-windows-x64-baseline", "bin", "opencode.exe"));
|
|
35
|
+
candidates.push(path.join(process.env.APPDATA, "npm", "node_modules", "opencode-windows-x64", "bin", "opencode.exe"));
|
|
36
|
+
candidates.push(path.join(process.env.APPDATA, "npm", "node_modules", "opencode-windows-x64-baseline", "bin", "opencode.exe"));
|
|
37
|
+
}
|
|
33
38
|
candidates.push(path.join(home, "scoop", "shims", "opencode.exe"));
|
|
34
39
|
} else {
|
|
35
40
|
candidates.push(path.join(home, ".opencode", "bin", "opencode"));
|