@alint-js/plugin-simplicity 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/index.d.mts CHANGED
@@ -85,7 +85,7 @@ interface SourceText {
85
85
  text: string;
86
86
  }
87
87
  //#endregion
88
- //#region ../core/dist/types-CMLoj9J9.d.mts
88
+ //#region ../core/dist/types-CR_Grd6q.d.mts
89
89
  //#region src/config/types.d.ts
90
90
  type ModelSize = 'large' | 'medium' | 'small';
91
91
  interface RunnerCacheConfig {
@@ -96,7 +96,6 @@ interface RunnerConfig {
96
96
  /** Retries after the initial attempt for replay-safe agent failures. @default 2 */
97
97
  agentRetries?: number;
98
98
  cache?: boolean | RunnerCacheConfig;
99
- fileConcurrency?: number;
100
99
  ruleConcurrency?: number;
101
100
  stats?: boolean | RunnerStatsConfig;
102
101
  timeoutMs?: number;
@@ -345,7 +344,7 @@ declare function tokenize(text: string, commentRanges: readonly SourceRange[], i
345
344
  /** Shared token fraction of the larger bag. Ranks candidates, decides nothing. */
346
345
  declare function tokenOverlap(left: readonly string[], right: readonly string[]): number;
347
346
  //#endregion
348
- //#region ../core/dist/types-CMLoj9J9.d.mts
347
+ //#region ../core/dist/types-CR_Grd6q.d.mts
349
348
  /** Agent-agnostic tool definition. Each adapter translates it to its framework's tool format. */
350
349
  interface AgentTool {
351
350
  description: string;
package/dist/index.mjs CHANGED
@@ -9,7 +9,6 @@ import { dirname as dirname$1, extname, join, relative as relative$1 } from "nod
9
9
  import { mkdir, readFile, rename, writeFile } from "node:fs/promises";
10
10
  import { fileURLToPath } from "url";
11
11
  import { createRequire as createRequire$1 } from "module";
12
- import { setTimeout as setTimeout$1 } from "node:timers/promises";
13
12
  //#region ../plugin/dist/index.mjs
14
13
  function definePlugin(plugin) {
15
14
  return plugin;
@@ -104,7 +103,29 @@ function buildDuplicatedHelperPrompt(options) {
104
103
  ].join("\n");
105
104
  }
106
105
  //#endregion
107
- //#region ../core/dist/agent.mjs
106
+ //#region ../../node_modules/.pnpm/@moeru+std@0.1.0-beta.20/node_modules/@moeru/std/dist/sleep/index.js
107
+ const sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms));
108
+ const sleepWithAbort = async (ms, signal) => {
109
+ if (!signal) return sleep(ms);
110
+ return new Promise((resolve, reject) => {
111
+ if (signal.aborted) {
112
+ reject(signal.reason ?? new DOMException("Aborted", "AbortError"));
113
+ return;
114
+ }
115
+ const timer = setTimeout(() => {
116
+ signal.removeEventListener("abort", onAbort);
117
+ resolve();
118
+ }, ms);
119
+ signal.addEventListener("abort", onAbort, { once: true });
120
+ function onAbort() {
121
+ clearTimeout(timer);
122
+ signal?.removeEventListener("abort", onAbort);
123
+ reject(signal?.reason ?? new DOMException("Aborted", "AbortError"));
124
+ }
125
+ });
126
+ };
127
+ //#endregion
128
+ //#region ../core/dist/agent-weXkvGkc.mjs
108
129
  function defineTool(tool) {
109
130
  return tool;
110
131
  }
@@ -9561,6 +9582,7 @@ async function generateStructured(options) {
9561
9582
  options.signal?.throwIfAborted();
9562
9583
  let response;
9563
9584
  try {
9585
+ options.signal?.throwIfAborted();
9564
9586
  response = await generateText({
9565
9587
  abortSignal: options.signal,
9566
9588
  baseURL: options.model.provider.endpoint,
@@ -9581,7 +9603,7 @@ async function generateStructured(options) {
9581
9603
  previousError = isRetriableHttpError(error) ? void 0 : callError;
9582
9604
  options.logger?.debug(`${options.operation} attempt ${attempt} failed while calling the model: ${callError}`);
9583
9605
  if (!isRetriableCallError(error) || attempt === maxAttempts) throw error;
9584
- await setTimeout$1(retryDelay(attempt), void 0, { signal: options.signal });
9606
+ await sleepWithAbort(retryDelay(attempt), options.signal);
9585
9607
  continue;
9586
9608
  }
9587
9609
  recordAttemptUsage(options, response);
@@ -9590,7 +9612,7 @@ async function generateStructured(options) {
9590
9612
  previousError = result.error;
9591
9613
  options.logger?.debug(`${options.operation} attempt ${attempt} returned an invalid structured result: ${previousError}`);
9592
9614
  if (!result.retriable || attempt === maxAttempts) throw new InvalidStructuredOutputError(`Invalid structured model response: ${previousError}`);
9593
- await setTimeout$1(retryDelay(attempt), void 0, { signal: options.signal });
9615
+ await sleepWithAbort(retryDelay(attempt), options.signal);
9594
9616
  }
9595
9617
  throw new InvalidStructuredOutputError("Model did not return a valid structured result");
9596
9618
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alint-js/plugin-simplicity",
3
3
  "type": "module",
4
- "version": "0.0.29",
4
+ "version": "0.0.31",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.mts",
@@ -13,7 +13,7 @@
13
13
  "dist"
14
14
  ],
15
15
  "devDependencies": {
16
- "@moeru/std": "^0.1.0-beta.18",
16
+ "@moeru/std": "^0.1.0-beta.20",
17
17
  "minimatch": "^10.2.5",
18
18
  "pathe": "^2.0.3",
19
19
  "tree-sitter-wasms": "^0.1.13",
@@ -21,10 +21,10 @@
21
21
  "typescript": "^6.0.3",
22
22
  "valibot": "^1.4.2",
23
23
  "web-tree-sitter": "^0.24.7",
24
- "@alint-js/core": "0.0.29",
25
- "@alint-js/plugin": "0.0.29",
26
- "@alint-js/tools-fs": "0.0.29",
27
- "@alint-js/agent-apeira": "0.0.29"
24
+ "@alint-js/core": "0.0.31",
25
+ "@alint-js/plugin": "0.0.31",
26
+ "@alint-js/agent-apeira": "0.0.31",
27
+ "@alint-js/tools-fs": "0.0.31"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "tsdown",