@ouro.bot/cli 0.1.0-alpha.127 → 0.1.0-alpha.128
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/changelog.json +6 -0
- package/dist/heart/provider-ping.js +19 -11
- package/package.json +1 -1
package/changelog.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.0-alpha.128",
|
|
6
|
+
"changes": [
|
|
7
|
+
"Error message sanitizer now strips HTML responses (Cloudflare challenge pages, error pages) in addition to JSON."
|
|
8
|
+
]
|
|
9
|
+
},
|
|
4
10
|
{
|
|
5
11
|
"version": "0.1.0-alpha.127",
|
|
6
12
|
"changes": [
|
|
@@ -12,25 +12,33 @@ const auth_flow_1 = require("./daemon/auth-flow");
|
|
|
12
12
|
const runtime_1 = require("../nerves/runtime");
|
|
13
13
|
const PING_TIMEOUT_MS = 10_000;
|
|
14
14
|
/**
|
|
15
|
-
* Strip raw JSON API response bodies from error messages.
|
|
16
|
-
* SDK errors often include the full response
|
|
17
|
-
* Extract just the HTTP status
|
|
15
|
+
* Strip raw JSON/HTML API response bodies from error messages.
|
|
16
|
+
* SDK errors often include the full response: "400 {"type":"error",...}" or "403 <html>...".
|
|
17
|
+
* Extract just the HTTP status and a short human-readable summary.
|
|
18
18
|
*/
|
|
19
19
|
function sanitizeErrorMessage(message) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const statusMatch = message.match(/^(\d{3})\s/);
|
|
21
|
+
if (!statusMatch)
|
|
22
|
+
return message;
|
|
23
|
+
const status = statusMatch[1];
|
|
24
|
+
const body = message.slice(status.length).trim();
|
|
25
|
+
// HTML response (Cloudflare challenge, error pages, etc.)
|
|
26
|
+
if (body.startsWith("<") || body.includes("<!DOCTYPE") || body.includes("<html")) {
|
|
27
|
+
return `HTTP ${status}`;
|
|
28
|
+
}
|
|
29
|
+
// JSON response
|
|
30
|
+
if (body.startsWith("{")) {
|
|
24
31
|
try {
|
|
25
|
-
const json = JSON.parse(
|
|
32
|
+
const json = JSON.parse(body);
|
|
26
33
|
const inner = json?.error?.message;
|
|
27
34
|
if (typeof inner === "string" && inner && inner !== "Error") {
|
|
28
|
-
return `${
|
|
35
|
+
return `${status} ${inner}`;
|
|
29
36
|
}
|
|
30
37
|
}
|
|
31
|
-
catch { /* not valid JSON
|
|
32
|
-
return `HTTP ${
|
|
38
|
+
catch { /* not valid JSON */ }
|
|
39
|
+
return `HTTP ${status}`;
|
|
33
40
|
}
|
|
41
|
+
// Already clean (e.g., "401 Provided authentication token is expired.")
|
|
34
42
|
return message;
|
|
35
43
|
}
|
|
36
44
|
function hasEmptyCredentials(provider, config) {
|