@nuanu-ai/agentbrowse 0.2.17 → 0.2.18
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/secrets/backend.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/secrets/backend.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AA6DpB,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,kBAAkB,EAAE,oBAAoB,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAAC;CACjE;AAWD,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,OAAO,SAA4D;CAIhF;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC;IAC9B,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9C,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACrE,yBAAyB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC7F,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;CAC3E;AA6KD,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAYhD"}
|
package/dist/secrets/backend.js
CHANGED
|
@@ -3,6 +3,27 @@ import { resolveHostFromInput, resolveMockStoredSecretValues, syncMockSecretCata
|
|
|
3
3
|
import { createOrReuseMockSecretIntent, getMockSecretIntent, markMockSecretIntentCompleted, } from './mock-agentpay-cabinet.js';
|
|
4
4
|
const ENABLE_MOCK_SECRETS_ENV = 'AGENTBROWSE_ENABLE_MOCK_SECRETS';
|
|
5
5
|
const APPROVAL_CHANNEL = 'agentpay-cabinet';
|
|
6
|
+
function tryParseJsonRecord(value) {
|
|
7
|
+
try {
|
|
8
|
+
const parsed = JSON.parse(value);
|
|
9
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed)
|
|
10
|
+
? parsed
|
|
11
|
+
: null;
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function formatAgentpayBackendError(status, text) {
|
|
18
|
+
const parsed = text ? tryParseJsonRecord(text) : null;
|
|
19
|
+
if (!parsed) {
|
|
20
|
+
return `agentpay_secret_backend_http_${status}${text ? `:${text}` : ''}`;
|
|
21
|
+
}
|
|
22
|
+
if (typeof parsed.error === 'string' && parsed.error.length > 0) {
|
|
23
|
+
return `agentpay_secret_backend_http_${status}:${parsed.error}`;
|
|
24
|
+
}
|
|
25
|
+
return `agentpay_secret_backend_http_${status}${text ? `:${text}` : ''}`;
|
|
26
|
+
}
|
|
6
27
|
function envFlagEnabled(value) {
|
|
7
28
|
if (!value) {
|
|
8
29
|
return false;
|
|
@@ -79,7 +100,7 @@ async function requestAgentpay(method, path, body) {
|
|
|
79
100
|
});
|
|
80
101
|
if (!response.ok) {
|
|
81
102
|
const text = await response.text().catch(() => '');
|
|
82
|
-
throw new Error(
|
|
103
|
+
throw new Error(formatAgentpayBackendError(response.status, text));
|
|
83
104
|
}
|
|
84
105
|
return (await response.json());
|
|
85
106
|
}
|
package/package.json
CHANGED