veryfront 0.1.1068 → 0.1.1069
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/esm/cli/shared/config.d.ts.map +1 -1
- package/esm/cli/shared/config.js +3 -10
- package/esm/deno.js +1 -1
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +64 -38
- package/esm/src/proxy/retry.d.ts +1 -0
- package/esm/src/proxy/retry.d.ts.map +1 -1
- package/esm/src/proxy/retry.js +31 -14
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/shared/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,2BAA2B,CAAC;AAuBzF,eAAO,MAAM,wBAAwB;;IAGjC,mDAAmD;;;;GAKtD,CAAC;AACF,eAAO,MAAM,qBAAqB;;IAN9B,mDAAmD;;;;GAMkB,CAAC;AAC1E,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC;AAEvF,eAAO,MAAM,uBAAuB;;;;;GAOnC,CAAC;AACF,eAAO,MAAM,oBAAoB;;;;;GAAsC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,uBAAuB,C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C,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAClD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACjD,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACrC;AAED,eAAO,MAAM,iBAAiB;;;;GAM7B,CAAC;AACF,eAAO,MAAM,cAAc;;;;GAAgC,CAAC;AAC5D,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAEzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAuHjE"}
|
package/esm/cli/shared/config.js
CHANGED
|
@@ -13,7 +13,7 @@ import { cliLogger, VERSION } from "../utils/index.js";
|
|
|
13
13
|
import { readToken } from "../auth/token-store.js";
|
|
14
14
|
import { ensureAuthenticated } from "../auth/login.js";
|
|
15
15
|
import { resolveCliApiUrl } from "./constants.js";
|
|
16
|
-
import { isRetryableConnectionError } from "../../src/proxy/retry.js";
|
|
16
|
+
import { isConnectionRefusedError, isRetryableConnectionError } from "../../src/proxy/retry.js";
|
|
17
17
|
// Delays for exponential backoff with jitter: attempt 1 = ~300ms, 2 = ~1s, 3 = ~3s
|
|
18
18
|
const API_RETRY_DELAYS_MS = [300, 1000, 3000];
|
|
19
19
|
const API_MAX_RETRIES = 3;
|
|
@@ -21,13 +21,6 @@ const API_MAX_RETRIES = 3;
|
|
|
21
21
|
function isTransientStatus(status) {
|
|
22
22
|
return status === 502 || status === 503 || status === 504;
|
|
23
23
|
}
|
|
24
|
-
/** Returns true when the connection error is a refused connection (request never reached server). */
|
|
25
|
-
function isConnectionRefused(error) {
|
|
26
|
-
if (!(error instanceof Error))
|
|
27
|
-
return false;
|
|
28
|
-
const msg = error.message.toLowerCase();
|
|
29
|
-
return msg.includes("connection refused") || msg.includes("os error 111");
|
|
30
|
-
}
|
|
31
24
|
/** Sleep for `ms` milliseconds plus a random jitter up to 20% of `ms`. */
|
|
32
25
|
function sleepWithJitter(ms) {
|
|
33
26
|
const jitter = Math.floor(ms * 0.2 * Math.random());
|
|
@@ -292,7 +285,7 @@ export function createApiClient(config) {
|
|
|
292
285
|
}
|
|
293
286
|
/** Returns true for request methods that are safe to retry on any transient failure. */
|
|
294
287
|
function isIdempotent(method) {
|
|
295
|
-
return method === "GET" || method === "HEAD";
|
|
288
|
+
return method === "GET" || method === "HEAD" || method === "PUT";
|
|
296
289
|
}
|
|
297
290
|
async function request(method, path, body, params) {
|
|
298
291
|
const url = new URL(`${apiUrl}${path}`);
|
|
@@ -311,7 +304,7 @@ export function createApiClient(config) {
|
|
|
311
304
|
const isTransient = status !== undefined
|
|
312
305
|
? isTransientStatus(status)
|
|
313
306
|
: isRetryableConnectionError(error);
|
|
314
|
-
const isRefused =
|
|
307
|
+
const isRefused = isConnectionRefusedError(error);
|
|
315
308
|
// Idempotent: retry on transient HTTP status or any retryable connection error.
|
|
316
309
|
// Non-idempotent: retry only on connection-refused (request never reached server).
|
|
317
310
|
const shouldRetry = isIdempotent(method)
|
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,OAAO,EAIZ,KAAK,QAAQ,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GACxB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IA0JtC;;OAEG;YACW,gBAAgB;IAya9B;;;;OAIG;YACW,yBAAyB;IAqiBvC;;OAEG;YACW,eAAe;IAgC7B;;OAEG;YACW,mBAAmB;IAOjC;;OAEG;IACH,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,sBAAsB;IAoB9B;;OAEG;IACH,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC;IAI5B;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC;QAC9B,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAIF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
|
|
@@ -207,16 +207,19 @@ async function traceConfiguredToolExecution(input) {
|
|
|
207
207
|
}));
|
|
208
208
|
try {
|
|
209
209
|
const result = await executeConfiguredTool(input.toolName, input.args, input.toolsConfig, input.context, input.allowedRemoteToolNames, input.remoteToolSources);
|
|
210
|
+
const resultError = getToolResultError(result);
|
|
210
211
|
setOtelActiveSpanAttributes(buildRuntimeToolTraceAttributes({
|
|
211
212
|
mode: input.mode,
|
|
212
213
|
agentId: input.agentId,
|
|
213
214
|
toolName: input.toolName,
|
|
214
215
|
toolCallId: input.toolCallId,
|
|
215
216
|
context: input.context,
|
|
216
|
-
status: "completed",
|
|
217
|
+
status: resultError === undefined ? "completed" : "failed",
|
|
217
218
|
providerExecuted: false,
|
|
218
219
|
inputSizeBytes,
|
|
219
220
|
outputSizeBytes: estimateSerializedSizeBytes(result),
|
|
221
|
+
errorType: resultError === undefined ? undefined : "ToolResultError",
|
|
222
|
+
errorMessage: resultError,
|
|
220
223
|
}));
|
|
221
224
|
return result;
|
|
222
225
|
}
|
|
@@ -787,27 +790,36 @@ export class AgentRuntime {
|
|
|
787
790
|
result,
|
|
788
791
|
context: executionContext,
|
|
789
792
|
});
|
|
790
|
-
|
|
793
|
+
const resultError = getToolResultError(result);
|
|
794
|
+
toolCall.status = resultError === undefined ? "completed" : "error";
|
|
791
795
|
toolCall.result = result;
|
|
796
|
+
toolCall.error = resultError;
|
|
792
797
|
toolCall.executionTime = Date.now() - startTime;
|
|
793
798
|
setSpanAttributes(toolSpan, compactRuntimeTraceAttributes({
|
|
794
|
-
"tool.status": "completed",
|
|
799
|
+
"tool.status": resultError === undefined ? "completed" : "failed",
|
|
795
800
|
"tool.provider_executed": false,
|
|
796
801
|
"tool.output.size_bytes": estimateSerializedSizeBytes(result),
|
|
802
|
+
...(resultError === undefined ? {} : {
|
|
803
|
+
error: true,
|
|
804
|
+
"error.type": "ToolResultError",
|
|
805
|
+
"error.message": resultError,
|
|
806
|
+
}),
|
|
797
807
|
}));
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
808
|
+
if (resultError === undefined) {
|
|
809
|
+
// Track skill policy from successful load_skill results
|
|
810
|
+
if (tc.toolName === LOAD_SKILL_TOOL_ID) {
|
|
811
|
+
activeSkillId = extractSkillId(result);
|
|
812
|
+
activeSkillPolicy = extractSkillPolicy(result);
|
|
813
|
+
activeSkillToolAvailability = extractSkillToolAvailability(result) ??
|
|
814
|
+
INACTIVE_SKILL_TOOL_AVAILABILITY;
|
|
815
|
+
activeSkillDelegationOverrides = extractSkillDelegationOverrides(result);
|
|
816
|
+
mustLoadSkillFirst = false;
|
|
817
|
+
}
|
|
818
|
+
activeSkillPolicy = removeFormInputAfterSubmission(tc.toolName, result, activeSkillId, activeSkillPolicy);
|
|
819
|
+
if (isSubmittedFormInputExecutionResult(tc.toolName, result)) {
|
|
820
|
+
hasSubmittedFormInputInLoop = true;
|
|
821
|
+
currentRuntimeContext = markSubmittedFormInputRuntimeContext(currentRuntimeContext);
|
|
822
|
+
}
|
|
811
823
|
}
|
|
812
824
|
const toolResultMessage = createToolResultMessage(tc.toolCallId, tc.toolName, result);
|
|
813
825
|
currentMessages.push(toolResultMessage);
|
|
@@ -1199,34 +1211,48 @@ export class AgentRuntime {
|
|
|
1199
1211
|
result,
|
|
1200
1212
|
context: executionContext,
|
|
1201
1213
|
});
|
|
1202
|
-
|
|
1214
|
+
const resultError = getToolResultError(result);
|
|
1215
|
+
toolCall.status = resultError === undefined ? "completed" : "error";
|
|
1203
1216
|
toolCall.result = result;
|
|
1217
|
+
toolCall.error = resultError;
|
|
1204
1218
|
toolCall.executionTime = Date.now() - startTime;
|
|
1205
1219
|
toolCalls.push(toolCall);
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1220
|
+
if (resultError === undefined) {
|
|
1221
|
+
// Track skill policy from successful load_skill results
|
|
1222
|
+
if (tc.name === LOAD_SKILL_TOOL_ID) {
|
|
1223
|
+
activeSkillId = extractSkillId(result);
|
|
1224
|
+
activeSkillPolicy = extractSkillPolicy(result);
|
|
1225
|
+
activeSkillToolAvailability = extractSkillToolAvailability(result) ??
|
|
1226
|
+
INACTIVE_SKILL_TOOL_AVAILABILITY;
|
|
1227
|
+
activeSkillDelegationOverrides = extractSkillDelegationOverrides(result);
|
|
1228
|
+
mustLoadSkillFirst = false;
|
|
1229
|
+
}
|
|
1230
|
+
activeSkillPolicy = removeFormInputAfterSubmission(tc.name, result, activeSkillId, activeSkillPolicy);
|
|
1231
|
+
if (isSubmittedFormInputExecutionResult(tc.name, result)) {
|
|
1232
|
+
hasSubmittedFormInputInLoop = true;
|
|
1233
|
+
currentRuntimeContext = markSubmittedFormInputRuntimeContext(currentRuntimeContext);
|
|
1234
|
+
}
|
|
1235
|
+
if (shouldHideProjectToolAfterAgentWriteSuccess(tc.name)) {
|
|
1236
|
+
agentWriteFinalResponseToolGuardEnabled = true;
|
|
1237
|
+
}
|
|
1214
1238
|
}
|
|
1215
|
-
|
|
1216
|
-
if (
|
|
1217
|
-
|
|
1218
|
-
|
|
1239
|
+
const dynamic = isDynamicTool(tc.name);
|
|
1240
|
+
if (resultError === undefined) {
|
|
1241
|
+
sendSSE(controller, encoder, {
|
|
1242
|
+
type: "tool-output-available",
|
|
1243
|
+
toolCallId: toolCall.id,
|
|
1244
|
+
output: result,
|
|
1245
|
+
...(dynamic ? { dynamic: true } : {}),
|
|
1246
|
+
});
|
|
1219
1247
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1248
|
+
else {
|
|
1249
|
+
sendSSE(controller, encoder, {
|
|
1250
|
+
type: "tool-output-error",
|
|
1251
|
+
toolCallId: toolCall.id,
|
|
1252
|
+
errorText: resultError,
|
|
1253
|
+
...(dynamic ? { dynamic: true } : {}),
|
|
1254
|
+
});
|
|
1222
1255
|
}
|
|
1223
|
-
const dynamic = isDynamicTool(tc.name);
|
|
1224
|
-
sendSSE(controller, encoder, {
|
|
1225
|
-
type: "tool-output-available",
|
|
1226
|
-
toolCallId: toolCall.id,
|
|
1227
|
-
output: result,
|
|
1228
|
-
...(dynamic ? { dynamic: true } : {}),
|
|
1229
|
-
});
|
|
1230
1256
|
const toolResultMessage = createToolResultMessage(tc.id, tc.name, result);
|
|
1231
1257
|
if (!currentStepToolResults.has(tc.id)) {
|
|
1232
1258
|
currentMessages.push(toolResultMessage);
|
package/esm/src/proxy/retry.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* These occur when renderer pods are being recycled or temporarily unavailable.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isRetryableConnectionError(error: unknown): boolean;
|
|
9
|
+
export declare function isConnectionRefusedError(error: unknown): boolean;
|
|
9
10
|
/**
|
|
10
11
|
* Decide how many times the proxy can safely retry an upstream request.
|
|
11
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/src/proxy/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/src/proxy/retry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAyCH;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWlE;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQhE;AAkCD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,oBAAoB,EAAE,MAAM,GAC3B,MAAM,CAUR;AAED,0EAA0E;AAC1E,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,GACb,OAAO,CAQT;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GACjB,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAc1C"}
|
package/esm/src/proxy/retry.js
CHANGED
|
@@ -3,26 +3,43 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { DEFAULT_MAX_BODY_SIZE_BYTES } from "../utils/constants/index.js";
|
|
5
5
|
const CONTROL_PLANE_RUN_STREAM_PATH = /^\/api\/control-plane\/runs\/[^/]+\/stream$/;
|
|
6
|
+
const MAX_ERROR_CAUSE_DEPTH = 8;
|
|
7
|
+
const RETRYABLE_CONNECTION_CODES = new Set(["ECONNRESET", "ECONNREFUSED", "ETIMEDOUT"]);
|
|
8
|
+
const CONNECTION_REFUSED_CODES = new Set(["ECONNREFUSED"]);
|
|
9
|
+
function errorChainMatches(error, predicate) {
|
|
10
|
+
if (!(error instanceof Error))
|
|
11
|
+
return false;
|
|
12
|
+
const seen = new Set();
|
|
13
|
+
let current = error;
|
|
14
|
+
for (let depth = 0; depth < MAX_ERROR_CAUSE_DEPTH; depth++) {
|
|
15
|
+
if (typeof current !== "object" || current === null || seen.has(current))
|
|
16
|
+
return false;
|
|
17
|
+
seen.add(current);
|
|
18
|
+
const details = current;
|
|
19
|
+
const message = typeof details.message === "string" ? details.message.toLowerCase() : "";
|
|
20
|
+
const code = typeof details.code === "string" ? details.code.toUpperCase() : "";
|
|
21
|
+
if (predicate(message, code))
|
|
22
|
+
return true;
|
|
23
|
+
current = details.cause;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
6
27
|
/**
|
|
7
28
|
* Check if a fetch error is a transient connection error worth retrying.
|
|
8
29
|
* These occur when renderer pods are being recycled or temporarily unavailable.
|
|
9
30
|
*/
|
|
10
31
|
export function isRetryableConnectionError(error) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
msg.includes("os error 104") || // ECONNRESET
|
|
18
|
-
msg.includes("os error 111") // ECONNREFUSED
|
|
19
|
-
);
|
|
32
|
+
return errorChainMatches(error, (message, code) => RETRYABLE_CONNECTION_CODES.has(code) ||
|
|
33
|
+
message.includes("connection reset") ||
|
|
34
|
+
message.includes("connection closed") ||
|
|
35
|
+
message.includes("connection refused") ||
|
|
36
|
+
message.includes("os error 104") || // ECONNRESET
|
|
37
|
+
message.includes("os error 111"));
|
|
20
38
|
}
|
|
21
|
-
function isConnectionRefusedError(error) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return message.includes("connection refused") || message.includes("os error 111");
|
|
39
|
+
export function isConnectionRefusedError(error) {
|
|
40
|
+
return errorChainMatches(error, (message, code) => CONNECTION_REFUSED_CODES.has(code) ||
|
|
41
|
+
message.includes("connection refused") ||
|
|
42
|
+
message.includes("os error 111"));
|
|
26
43
|
}
|
|
27
44
|
function isIdempotentMethod(method) {
|
|
28
45
|
return method === "GET" || method === "HEAD" || method === "OPTIONS";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1069",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -328,10 +328,10 @@
|
|
|
328
328
|
"@types/react": "19.2.14",
|
|
329
329
|
"@types/react-dom": "19.2.3",
|
|
330
330
|
"ws": "8.21.0",
|
|
331
|
-
"@veryfront/ext-bundler-esbuild": "0.1.
|
|
332
|
-
"@veryfront/ext-content-mdx": "0.1.
|
|
333
|
-
"@veryfront/ext-css-tailwind": "0.1.
|
|
334
|
-
"@veryfront/ext-parser-babel": "0.1.
|
|
331
|
+
"@veryfront/ext-bundler-esbuild": "0.1.1069",
|
|
332
|
+
"@veryfront/ext-content-mdx": "0.1.1069",
|
|
333
|
+
"@veryfront/ext-css-tailwind": "0.1.1069",
|
|
334
|
+
"@veryfront/ext-parser-babel": "0.1.1069"
|
|
335
335
|
},
|
|
336
336
|
"devDependencies": {
|
|
337
337
|
"@types/node": "20.9.0"
|