@bpmsoftwaresolutions/ai-engine-client 1.1.17 → 1.1.19
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 +1 -1
- package/src/index.js +32 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const DEFAULT_TIMEOUT_MS = 30000;
|
|
2
|
-
export const AI_ENGINE_CLIENT_VERSION = '1.1.
|
|
2
|
+
export const AI_ENGINE_CLIENT_VERSION = '1.1.19';
|
|
3
3
|
export const GOVERNED_MUTATION_REQUIRED_CAPABILITIES = [
|
|
4
4
|
'executeVerifiedMutation',
|
|
5
5
|
'post_mutation_verification',
|
|
@@ -2100,8 +2100,14 @@ export class AIEngineClient {
|
|
|
2100
2100
|
if (eligibility?.execution_eligible && eligibility?.mutation_allowed) {
|
|
2101
2101
|
return eligibility;
|
|
2102
2102
|
}
|
|
2103
|
+
const remediation = cleanText(eligibility?.remediation_command);
|
|
2104
|
+
const verification = cleanText(eligibility?.verification_command);
|
|
2103
2105
|
throw buildEligibilityError(
|
|
2104
|
-
|
|
2106
|
+
[
|
|
2107
|
+
`Execution eligibility gate blocked mutation${cleanText(body?.requested_mutation_surface) ? ` on ${cleanText(body.requested_mutation_surface)}` : ''}.`,
|
|
2108
|
+
remediation ? `Fix: ${remediation}` : null,
|
|
2109
|
+
verification ? `Then verify: ${verification}` : null,
|
|
2110
|
+
].filter(Boolean).join(' '),
|
|
2105
2111
|
{
|
|
2106
2112
|
required_gate: eligibility?.required_gate || 'execution_eligibility.required_gate',
|
|
2107
2113
|
execution_eligibility: eligibility ?? null,
|
|
@@ -2129,6 +2135,14 @@ export class AIEngineClient {
|
|
|
2129
2135
|
throw error;
|
|
2130
2136
|
}
|
|
2131
2137
|
return payload;
|
|
2138
|
+
} catch (error) {
|
|
2139
|
+
if (error?.name === 'AbortError') {
|
|
2140
|
+
const timeoutError = new Error(`Request to ${url.pathname} timed out after ${this.timeoutMs}ms.`);
|
|
2141
|
+
timeoutError.code = 'REQUEST_TIMEOUT';
|
|
2142
|
+
timeoutError.status = 0;
|
|
2143
|
+
throw timeoutError;
|
|
2144
|
+
}
|
|
2145
|
+
throw error;
|
|
2132
2146
|
} finally {
|
|
2133
2147
|
clearTimeout(timeoutHandle);
|
|
2134
2148
|
}
|
|
@@ -2167,6 +2181,14 @@ export class AIEngineClient {
|
|
|
2167
2181
|
fileName: parseContentDispositionFilename(contentDisposition),
|
|
2168
2182
|
headers: Object.fromEntries(response.headers.entries()),
|
|
2169
2183
|
};
|
|
2184
|
+
} catch (error) {
|
|
2185
|
+
if (error?.name === 'AbortError') {
|
|
2186
|
+
const timeoutError = new Error(`Request to ${url.pathname} timed out after ${this.timeoutMs}ms.`);
|
|
2187
|
+
timeoutError.code = 'REQUEST_TIMEOUT';
|
|
2188
|
+
timeoutError.status = 0;
|
|
2189
|
+
throw timeoutError;
|
|
2190
|
+
}
|
|
2191
|
+
throw error;
|
|
2170
2192
|
} finally {
|
|
2171
2193
|
clearTimeout(timeoutHandle);
|
|
2172
2194
|
}
|
|
@@ -2213,6 +2235,14 @@ export class AIEngineClient {
|
|
|
2213
2235
|
contentType,
|
|
2214
2236
|
fileName: parseContentDispositionFilename(contentDisposition),
|
|
2215
2237
|
};
|
|
2238
|
+
} catch (error) {
|
|
2239
|
+
if (error?.name === 'AbortError') {
|
|
2240
|
+
const timeoutError = new Error(`Request to ${url.pathname} timed out after ${this.timeoutMs}ms.`);
|
|
2241
|
+
timeoutError.code = 'REQUEST_TIMEOUT';
|
|
2242
|
+
timeoutError.status = 0;
|
|
2243
|
+
throw timeoutError;
|
|
2244
|
+
}
|
|
2245
|
+
throw error;
|
|
2216
2246
|
} finally {
|
|
2217
2247
|
clearTimeout(timeoutHandle);
|
|
2218
2248
|
}
|