@alint-js/core 0.0.29 → 0.0.31
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/dist/{retry-C4sGjSE5.mjs → agent-weXkvGkc.mjs} +20 -1
- package/dist/agent.d.mts +3 -2
- package/dist/agent.mjs +2 -15
- package/dist/index.d.mts +55 -84
- package/dist/index.mjs +433 -530
- package/dist/structured-output.d.mts +1 -1
- package/dist/structured-output.mjs +5 -4
- package/dist/{types-CMLoj9J9.d.mts → types-CR_Grd6q.d.mts} +0 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as ResolvedModel, v as RuleContext } from "./types-
|
|
1
|
+
import { P as ResolvedModel, v as RuleContext } from "./types-CR_Grd6q.mjs";
|
|
2
2
|
import { GenericSchema, InferOutput } from "valibot";
|
|
3
3
|
import { JsonSchema } from "@valibot/to-json-schema";
|
|
4
4
|
import { Message } from "@xsai/shared-chat";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { errorMessageFrom } from "@moeru/std/error";
|
|
2
1
|
import { getDescription, parse } from "valibot";
|
|
3
|
-
import {
|
|
2
|
+
import { errorMessageFrom } from "@moeru/std/error";
|
|
3
|
+
import { sleepWithAbort } from "@moeru/std/sleep";
|
|
4
4
|
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
5
5
|
import { generateText } from "@xsai/generate-text";
|
|
6
6
|
import { rawTool } from "@xsai/tool";
|
|
@@ -44,6 +44,7 @@ async function generateStructured(options) {
|
|
|
44
44
|
options.signal?.throwIfAborted();
|
|
45
45
|
let response;
|
|
46
46
|
try {
|
|
47
|
+
options.signal?.throwIfAborted();
|
|
47
48
|
response = await generateText({
|
|
48
49
|
abortSignal: options.signal,
|
|
49
50
|
baseURL: options.model.provider.endpoint,
|
|
@@ -64,7 +65,7 @@ async function generateStructured(options) {
|
|
|
64
65
|
previousError = isRetriableHttpError(error) ? void 0 : callError;
|
|
65
66
|
options.logger?.debug(`${options.operation} attempt ${attempt} failed while calling the model: ${callError}`);
|
|
66
67
|
if (!isRetriableCallError(error) || attempt === maxAttempts) throw error;
|
|
67
|
-
await
|
|
68
|
+
await sleepWithAbort(retryDelay(attempt), options.signal);
|
|
68
69
|
continue;
|
|
69
70
|
}
|
|
70
71
|
recordAttemptUsage(options, response);
|
|
@@ -73,7 +74,7 @@ async function generateStructured(options) {
|
|
|
73
74
|
previousError = result.error;
|
|
74
75
|
options.logger?.debug(`${options.operation} attempt ${attempt} returned an invalid structured result: ${previousError}`);
|
|
75
76
|
if (!result.retriable || attempt === maxAttempts) throw new InvalidStructuredOutputError(`Invalid structured model response: ${previousError}`);
|
|
76
|
-
await
|
|
77
|
+
await sleepWithAbort(retryDelay(attempt), options.signal);
|
|
77
78
|
}
|
|
78
79
|
throw new InvalidStructuredOutputError("Model did not return a valid structured result");
|
|
79
80
|
}
|
|
@@ -17,7 +17,6 @@ interface RunnerConfig {
|
|
|
17
17
|
/** Retries after the initial attempt for replay-safe agent failures. @default 2 */
|
|
18
18
|
agentRetries?: number;
|
|
19
19
|
cache?: boolean | RunnerCacheConfig;
|
|
20
|
-
fileConcurrency?: number;
|
|
21
20
|
ruleConcurrency?: number;
|
|
22
21
|
stats?: boolean | RunnerStatsConfig;
|
|
23
22
|
timeoutMs?: number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alint-js/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.31",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.mts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@moeru/std": "^0.1.0-beta.
|
|
28
|
+
"@moeru/std": "^0.1.0-beta.20",
|
|
29
29
|
"@valibot/to-json-schema": "^1.7.1",
|
|
30
30
|
"@xsai/generate-text": "^0.5.0-beta.7",
|
|
31
31
|
"@xsai/shared-chat": "^0.5.0-beta.7",
|