@r_masseater/oxlint-plugin-decision 0.0.4 → 0.1.0

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/README.md CHANGED
@@ -47,7 +47,7 @@ export default createDecisionPlugin({
47
47
  target: "function",
48
48
  question:
49
49
  "Does this function's name describe only reading or fetching data (for example get, find, load or fetch), while its body also writes, logs or sends something?",
50
- cutoff: 0.6,
50
+ cutoff: 0.8,
51
51
  context: { scope: "enclosing", kind: "class" },
52
52
  }),
53
53
  ],
@@ -78,13 +78,13 @@ The rules you turn on share one request per file and model, so turning on more r
78
78
  | `id` | The oxlint rule name after `<plugin name>/`. Lowercase words joined by hyphens, unique in the plugin. |
79
79
  | `target` | `"function"`, `"call"`, `"jsx"`, or `"file"`. |
80
80
  | `question` | The question, in English. With the default answer kind, "yes" means "report this". |
81
- | `cutoff` | 0 to 1. The probability the reported answer needs, at or above. |
81
+ | `cutoff` | 0.8 to 1. The probability the reported answer needs, at or above. |
82
82
  | `message` | Optional. A short sentence the error shows instead of the question. |
83
83
  | `select` | Optional. A function of the AST node that says whether to ask about it. See [Selecting matches](#selecting-matches). |
84
84
  | `answer` | Optional. What kind of answer to ask for. See [Answers](#answers). Defaults to `{ kind: "boolean" }`. |
85
85
  | `context` | Optional. Extra source the model reads around the match. See [Context](#context). |
86
86
  | `model` | Optional. Overrides the plugin's `model` for this rule. See [Rule options](#rule-options). |
87
- | `location` | Optional for file rules: a source-location `question` and a `cutoff` greater than 0.5 and at most 1. |
87
+ | `location` | Optional for file rules: a source-location `question` and a `cutoff` from 0.8 to 1. |
88
88
 
89
89
  `target` decides what the model gets to read. There is no selector syntax and no other target; `select` narrows a target down by looking at the AST.
90
90
 
@@ -118,7 +118,7 @@ defineDecisionRule({
118
118
  question:
119
119
  "This function's name presents it as a pure computation, but its body changes state outside itself or performs I/O.",
120
120
  message: "The name promises a pure computation, but the body has side effects.",
121
- cutoff: 0.54,
121
+ cutoff: 0.8,
122
122
  });
123
123
 
124
124
  defineDecisionRule({
@@ -129,7 +129,7 @@ defineDecisionRule({
129
129
  node.callee.type === "Identifier" &&
130
130
  ["it", "test"].includes(node.callee.name),
131
131
  question: "Would this test still pass if the behaviour its name claims were broken?",
132
- cutoff: 0.7,
132
+ cutoff: 0.8,
133
133
  });
134
134
  ```
135
135
 
@@ -148,7 +148,7 @@ defineDecisionRule({
148
148
  id: "stale-comment",
149
149
  target: "function",
150
150
  question: "How does the comment right above this function relate to what the function does?",
151
- cutoff: 0.7,
151
+ cutoff: 0.8,
152
152
  context: { scope: "lines", before: 5, after: 0 },
153
153
  answer: {
154
154
  kind: "classify",
@@ -167,7 +167,7 @@ defineDecisionRule({
167
167
  id: "security-smell",
168
168
  target: "function",
169
169
  question: "Does this function handle untrusted input in a way that could be exploited?",
170
- cutoff: 0.6,
170
+ cutoff: 0.8,
171
171
  answer: { kind: "severity", minimum: "warn" },
172
172
  });
173
173
  ```
@@ -206,7 +206,7 @@ createDecisionPlugin({
206
206
  Respan models, such as `openrouter/respan/span-01-lite`, answer only yes/no questions, so the plugin splits every choice into yes/no questions for them:
207
207
 
208
208
  - `classify` asks whether each label fits and picks the label with the highest yes probability.
209
- - `severity` asks whether the match is at least `info`, at least `warn`, and at least `error`, and picks the most serious level with a yes probability of 0.5 or more. A level's probability is never below that of a more serious level.
209
+ - `severity` asks whether the match is at least `info`, at least `warn`, and at least `error`, and picks the most serious level with a yes probability of 0.8 or more. A level's probability is never below that of a more serious level.
210
210
  - File-rule `location` asks about each candidate line. It finds clear cases, but is less precise than on the default model.
211
211
 
212
212
  The probability in the message is the yes probability of the picked label or level. Respan models are also asked about one match per request, so they send more requests than other models on files with many matches. The default `openrouter/~typesafe/jev-latest` answers every answer kind in one question.
@@ -228,7 +228,7 @@ defineDecisionRule({
228
228
  cutoff: 0.9,
229
229
  location: {
230
230
  question: "Select the declaration of the state used by the offending callback.",
231
- cutoff: 0.75,
231
+ cutoff: 0.8,
232
232
  },
233
233
  });
234
234
  ```
@@ -402,7 +402,7 @@ Types for all of this are exported: `DecisionRule`, `DecisionOptions`, `RuleAnsw
402
402
 
403
403
  Each file gets one request per model, with every match for that model in it. Respan models get one request per match instead, with each choice question split into yes/no questions. A file rule with `location` adds numbered source and a choice question. Above 254 nonblank lines the model selects a range and refines it in follow-up requests with the same context. All requests share the per-file `timeoutMs` budget.
404
404
 
405
- Answers are cached under `node_modules/.cache/oxlint-plugin-decision`, keyed by the endpoint and the request. Changing a snippet, its context, a question or an answer kind re-asks that file. Changing a cutoff or an `id` does not. Malformed answers are never cached, and malformed entries already on disk are asked again. See [Cost and caching](https://github.com/masseater/oxlint-plugin-decision#cost-and-caching) for how to keep the cost down.
405
+ Answers are cached under `node_modules/.cache/oxlint-plugin-decision`, keyed by the endpoint and the request. Changing a snippet, its context, a question or an answer kind re-asks that file. Changing a cutoff or an `id` does not. Malformed answers are never cached, and malformed entries already on disk are asked again. See [Cost and caching](https://github.com/masseater/lint-kit#cost-and-caching) for how to keep the cost down.
406
406
 
407
407
  Requests go through the official [`@openrouter/sdk`](https://www.npmjs.com/package/@openrouter/sdk) client, which retries rate limits and server errors within `timeoutMs`.
408
408
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
+ import { Schema } from "effect";
1
2
  import { DecisionsChoiceQuestion, DecisionsNoulQuestion, DecisionsRequest, DecisionsResponse } from "@openrouter/sdk/models";
2
- //#region ../../node_modules/.pnpm/@oxlint+plugins@1.87.0/node_modules/@oxlint/plugins/index.d.ts
3
3
  //#endregion
4
4
  //#region src-js/plugins/globals.d.ts
5
5
  /**
@@ -3253,48 +3253,49 @@ interface Context extends FileContext {
3253
3253
  */
3254
3254
  report(this: void, diagnostic: Diagnostic): void;
3255
3255
  }
3256
- //#endregion
3257
- //#region src/types.d.ts
3256
+ declare const TargetSchema: Schema.Literals<readonly ["function", "call", "jsx", "file"]>;
3257
+ declare const CiBehaviorSchema: Schema.Literals<readonly ["skip", "fail"]>;
3258
+ declare const ExplainSettingSchema: Schema.Union<readonly [Schema.Boolean, Schema.Literals<readonly ["text", "json"]>]>;
3259
+ declare const EnclosingKindSchema: Schema.Literals<readonly ["function", "class", "block"]>;
3260
+ declare const RuleContextSchema: Schema.Union<readonly [Schema.Struct<{
3261
+ readonly scope: Schema.Literals<readonly ["node", "file", "comment"]>;
3262
+ }>, Schema.Struct<{
3263
+ readonly scope: Schema.Literal<"lines">;
3264
+ readonly before: Schema.optionalKey<Schema.Int>;
3265
+ readonly after: Schema.optionalKey<Schema.Int>;
3266
+ }>, Schema.Struct<{
3267
+ readonly scope: Schema.Literal<"enclosing">;
3268
+ readonly kind: Schema.Literals<readonly ["function", "class", "block"]>;
3269
+ }>]>;
3270
+ declare const SeveritySchema: Schema.Literals<readonly ["info", "warn", "error"]>;
3271
+ declare const RuleAnswerSchema: Schema.Union<readonly [Schema.Struct<{
3272
+ readonly kind: Schema.Literal<"boolean">;
3273
+ }>, Schema.Struct<{
3274
+ readonly kind: Schema.Literal<"classify">;
3275
+ readonly labels: Schema.$Record<Schema.NonEmptyString, Schema.String>;
3276
+ readonly report: Schema.NonEmptyArray<Schema.NonEmptyString>;
3277
+ }>, Schema.Struct<{
3278
+ readonly kind: Schema.Literal<"severity">;
3279
+ readonly minimum: Schema.optionalKey<Schema.Literals<readonly ["info", "warn", "error"]>>;
3280
+ }>]>;
3258
3281
  type Frozen<Value> = Value extends ((...args: never) => unknown) ? Value : Value extends object ? { readonly [Key in keyof Value]: Frozen<Value[Key]>; } : Value;
3259
3282
  type SelectedNode = Frozen<types_d_exports.Node>;
3260
3283
  interface SelectMatch {
3261
3284
  readonly name: string | undefined;
3262
3285
  readonly context: Context;
3263
3286
  }
3264
- type Target = "function" | "call" | "jsx" | "file";
3265
- type CiBehavior = "skip" | "fail";
3287
+ type Target = typeof TargetSchema.Type;
3288
+ type CiBehavior = typeof CiBehaviorSchema.Type;
3266
3289
  type ModelSpec = string | readonly string[];
3267
- type ExplainSetting = boolean | "text" | "json";
3290
+ type ExplainSetting = typeof ExplainSettingSchema.Type;
3268
3291
  interface RuleLocation {
3269
3292
  readonly question: string;
3270
3293
  readonly cutoff: number;
3271
3294
  }
3272
- type EnclosingKind = "function" | "class" | "block";
3273
- type RuleContext = {
3274
- readonly scope: "node";
3275
- } | {
3276
- readonly scope: "lines";
3277
- readonly before?: number;
3278
- readonly after?: number;
3279
- } | {
3280
- readonly scope: "enclosing";
3281
- readonly kind: EnclosingKind;
3282
- } | {
3283
- readonly scope: "file";
3284
- } | {
3285
- readonly scope: "comment";
3286
- };
3287
- type Severity = "info" | "warn" | "error";
3288
- type RuleAnswer = {
3289
- readonly kind: "boolean";
3290
- } | {
3291
- readonly kind: "classify";
3292
- readonly labels: Readonly<Record<string, string>>;
3293
- readonly report: readonly [string, ...string[]];
3294
- } | {
3295
- readonly kind: "severity";
3296
- readonly minimum?: Severity;
3297
- };
3295
+ type EnclosingKind = typeof EnclosingKindSchema.Type;
3296
+ type RuleContext = typeof RuleContextSchema.Type;
3297
+ type Severity = typeof SeveritySchema.Type;
3298
+ type RuleAnswer = typeof RuleAnswerSchema.Type;
3298
3299
  interface DecisionRule {
3299
3300
  readonly id: string;
3300
3301
  readonly target: Target;
@@ -3361,16 +3362,9 @@ interface DecisionPlugin {
3361
3362
  };
3362
3363
  readonly rules: Readonly<Record<string, object>>;
3363
3364
  }
3364
- //#endregion
3365
- //#region src/define.d.ts
3366
3365
  declare const defineDecisionRule: <const Rule extends DecisionRule>(rule: Rule) => Rule;
3367
3366
  declare const defineProvider: <const Provider extends DecisionProvider>(provider: Provider) => Provider;
3368
- //#endregion
3369
- //#region src/openrouter.d.ts
3370
3367
  declare const openRouter: DecisionProvider;
3371
- //#endregion
3372
- //#region src/plugin.d.ts
3373
3368
  declare const createDecisionPlugin: (setup: DecisionPluginSetup) => DecisionPlugin;
3374
- //#endregion
3375
3369
  export { type ChoiceQuestion, type CiBehavior, type DecideInput, type DecideResult, type DecisionOptions, type DecisionPlugin, type DecisionPluginSetup, type DecisionProvider, type DecisionRequest, type DecisionResponse, type DecisionRule, type EnclosingKind, type ExplainSetting, type Frozen, type ModelSpec, type NoulQuestion, type Question, type RuleAnswer, type RuleContext, type RuleLocation, type SelectMatch, type SelectedNode, type Severity, type Target, createDecisionPlugin, defineDecisionRule, defineProvider, openRouter };
3376
3370
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,11 +1,10 @@
1
- import { A as resolveOptions, C as REPORT_LOC, D as checked, E as checkRules, N as isReported, O as modelIdsOf, S as PREFIX, T as TARGET_NODE_TYPES, _ as messageOf, a as locationCandidates, b as ModelSpecSchema, c as locationRefOf, d as selectedLocation, f as sourceLines, g as failsInCi, h as envOf, i as locates, j as snippetNodeFor, k as resolveModel, l as parseVerdicts, m as envNameOf, n as wireRequestsFor, o as locationOfLine, p as truncateSnippet, r as buildRequest, s as locationQuestion, u as refAt, v as runOrElse, w as STRICT, x as OptionsError, y as warnOnce } from "./wire-BGb5iQa9.mjs";
1
+ import { A as resolveOptions, C as REPORT_LOC, D as checked, E as checkRules, N as isReported, O as modelIdsOf, S as PREFIX, T as TARGET_NODE_TYPES, _ as messageOf, a as locationCandidates, b as ModelSpecSchema, c as locationRefOf, d as selectedLocation, f as sourceLines, g as failsInCi, h as envOf, i as locates, j as snippetNodeFor, k as resolveModel, l as parseVerdicts, m as envNameOf, n as wireRequestsFor, o as locationOfLine, p as truncateSnippet, r as buildRequest, s as locationQuestion, u as refAt, v as runOrElse, w as STRICT, x as OptionsError, y as warnOnce } from "./wire-XOgoBBuu.mjs";
2
2
  import { Array, Boolean, Console, Effect, Function, Match, Option, Predicate, Schema, String as String$1, pipe } from "effect";
3
3
  import { createSyncFn } from "synckit";
4
- //#region src/define.ts
4
+ // src/define.ts
5
5
  const defineDecisionRule = (rule) => rule;
6
6
  const defineProvider = (provider) => provider;
7
- //#endregion
8
- //#region src/openrouter.ts
7
+ // src/openrouter.ts
9
8
  const BACKSTOP_MS = 6e4;
10
9
  const SYNCKIT_TIMEOUT = "Internal error: Atomics.wait() failed: timed-out";
11
10
  const workers = /* @__PURE__ */ new Map();
@@ -34,8 +33,7 @@ const openRouter = {
34
33
  onNonEmpty: (some) => ask(some)
35
34
  })
36
35
  };
37
- //#endregion
38
- //#region src/override.ts
36
+ // src/override.ts
39
37
  const RuleOverrideSchema = Schema.Struct({ model: Schema.optionalKey(ModelSpecSchema) });
40
38
  const RULE_OPTIONS_SCHEMA = [{
41
39
  type: "object",
@@ -64,8 +62,7 @@ const overrideRule = (rule, raw, providers) => {
64
62
  })
65
63
  };
66
64
  };
67
- //#endregion
68
- //#region src/context.ts
65
+ // src/context.ts
69
66
  const DEFAULT_LINES = 5;
70
67
  const FIRST_LINE = 1;
71
68
  const LAST = 1;
@@ -128,11 +125,9 @@ const contextOf = (context, node, rule) => {
128
125
  if (rule.scope === "enclosing") return Option.some(enclosingText(context, node, rule.kind));
129
126
  return Option.liftPredicate(context.sourceCode.text, () => rule.scope === "file");
130
127
  };
131
- //#endregion
132
- //#region src/name.ts
133
- const none = () => Option.none();
134
- const heldName = (node) => Option.flatMap(Option.fromNullishOr(node.parent), (parent) => Match.value(parent).pipe(Match.when({ type: "VariableDeclarator" }, (holder) => Option.liftPredicate(holder.id, () => holder.init === node)), Match.when({ type: Match.is("Property", "MethodDefinition", "PropertyDefinition") }, (holder) => Option.liftPredicate(holder.key, () => holder.value === node)), Match.orElse(none)));
135
- const nameNodeOf = (node) => Match.value(node).pipe(Match.when({ type: Match.is("FunctionDeclaration", "FunctionExpression") }, (fn) => Option.orElse(Option.fromNullishOr(fn.id), () => heldName(fn))), Match.when({ type: "ArrowFunctionExpression" }, heldName), Match.when({ type: Match.is("CallExpression", "NewExpression") }, (call) => Option.some(call.callee)), Match.when({ type: "JSXElement" }, (element) => Option.some(element.openingElement.name)), Match.orElse(none));
128
+ // src/name.ts
129
+ const heldName = (node) => Option.flatMap(Option.fromNullishOr(node.parent), (parent) => Match.value(parent).pipe(Match.when({ type: "VariableDeclarator" }, (holder) => Option.liftPredicate(holder.id, () => holder.init === node)), Match.when({ type: Match.is("Property", "MethodDefinition", "PropertyDefinition") }, (holder) => Option.liftPredicate(holder.key, () => holder.value === node)), Match.orElse(() => Option.none())));
130
+ const nameNodeOf = (node) => Match.value(node).pipe(Match.when({ type: Match.is("FunctionDeclaration", "FunctionExpression") }, (fn) => Option.orElse(Option.fromNullishOr(fn.id), () => heldName(fn))), Match.when({ type: "ArrowFunctionExpression" }, heldName), Match.when({ type: Match.is("CallExpression", "NewExpression") }, (call) => Option.some(call.callee)), Match.when({ type: "JSXElement" }, (element) => Option.some(element.openingElement.name)), Match.orElse(() => Option.none()));
136
131
  const nameOf = (node, context) => Option.getOrUndefined(Option.map(nameNodeOf(node), (name) => context.sourceCode.text.slice(name.start, name.end)));
137
132
  const isSelected = (context, node, { select }) => Option.match(Option.fromUndefinedOr(select), {
138
133
  onNone: () => true,
@@ -141,8 +136,7 @@ const isSelected = (context, node, { select }) => Option.match(Option.fromUndefi
141
136
  context
142
137
  })
143
138
  });
144
- //#endregion
145
- //#region src/explain.ts
139
+ // src/explain.ts
146
140
  const EXPLAIN_ENV = "OXLINT_DECISION_EXPLAIN";
147
141
  const OFF_VALUES = /* @__PURE__ */ new Set([
148
142
  "0",
@@ -169,8 +163,8 @@ const explainModeOf = (setting) => Option.match(envOf(EXPLAIN_ENV), {
169
163
  });
170
164
  const probabilitiesIn = (answer) => {
171
165
  if (answer.type === "noul") return Option.some({ yes: answer.noul });
172
- if (answer.type === "UNKNOWN") return Option.none();
173
- return Option.fromUndefinedOr(answer.probabilities);
166
+ if (answer.type === "choice") return Option.fromUndefinedOr(answer.probabilities);
167
+ return Option.none();
174
168
  };
175
169
  const probabilitiesOf = (answer) => Option.fromUndefinedOr(answer).pipe(Option.flatMap(probabilitiesIn), Option.getOrElse(() => ({})));
176
170
  const asksAbout = (ref, id) => id.split(OPTION_SEPARATOR, FIRST).includes(ref);
@@ -287,8 +281,7 @@ const SILENT = {
287
281
  failure: Function.constVoid
288
282
  };
289
283
  const explainerFor = (pass) => Match.value(explainModeOf(pass.setting)).pipe(Match.when("off", () => SILENT), Match.orElse((mode) => explaining(pass, mode)));
290
- //#endregion
291
- //#region src/locate.ts
284
+ // src/locate.ts
292
285
  const MINIMUM_TIMEOUT_MS = 1;
293
286
  const remainingMs = (deadline) => Math.max(MINIMUM_TIMEOUT_MS, deadline - Date.now());
294
287
  const verdictsOf = (result, request) => {
@@ -354,8 +347,7 @@ const locateMatch = (asking, match, { ref, verdicts, request }) => {
354
347
  state: request.state
355
348
  }, first);
356
349
  };
357
- //#endregion
358
- //#region src/report.ts
350
+ // src/report.ts
359
351
  const DECIMALS = 2;
360
352
  const degrade = (pass, reason) => {
361
353
  if (failsInCi(pass.options)) throw new OptionsError(`${reason} (${pass.filename})`);
@@ -513,8 +505,7 @@ const reportModels = (passes) => {
513
505
  const byProvider = Array.groupBy(passes.map((pass) => prepare(pass)), ({ pass }) => pass.model.provider.name);
514
506
  for (const prepared of Object.values(byProvider)) reportProvider(prepared);
515
507
  };
516
- //#endregion
517
- //#region src/visitor.ts
508
+ // src/visitor.ts
518
509
  const raisedMissing = /* @__PURE__ */ new Set();
519
510
  const missingEnvOf = (options, provider) => provider.requiredEnv.map((name) => envNameOf(options.env, name)).filter((name) => Option.isNone(envOf(name)));
520
511
  const isAvailable = (options, { provider }) => {
@@ -632,9 +623,7 @@ const visitorFor = (shared, { id, target }) => (context) => {
632
623
  };
633
624
  const nodeTypes = TARGET_NODE_TYPES[target];
634
625
  return {
635
- ...Object.fromEntries(nodeTypes.map((type) => [type, (node) => {
636
- collect(node);
637
- }])),
626
+ ...Object.fromEntries(nodeTypes.map((type) => [type, collect])),
638
627
  Program: (node) => {
639
628
  file = Option.some(shared.join(context, id));
640
629
  if (target === "file") collect(node);
@@ -645,8 +634,7 @@ const visitorFor = (shared, { id, target }) => (context) => {
645
634
  }
646
635
  };
647
636
  };
648
- //#endregion
649
- //#region src/plugin.ts
637
+ // src/plugin.ts
650
638
  const DEFAULT_NAME = "decision";
651
639
  const metaOf = (rule) => ({
652
640
  type: "problem",
@@ -706,7 +694,6 @@ const createDecisionPlugin = (setup) => {
706
694
  }]))
707
695
  };
708
696
  };
709
- //#endregion
710
697
  export { createDecisionPlugin, defineDecisionRule, defineProvider, openRouter };
711
698
 
712
699
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["Arr","Arr","Str","DECIMALS","Bool","Str","Arr","Fn","Arr","Bool","Arr"],"sources":["../src/define.ts","../src/openrouter.ts","../src/override.ts","../src/context.ts","../src/name.ts","../src/explain.ts","../src/locate.ts","../src/report.ts","../src/visitor.ts","../src/plugin.ts"],"sourcesContent":["import type { DecisionProvider, DecisionRule } from \"./types.ts\";\n\nconst defineDecisionRule = <const Rule extends DecisionRule>(rule: Rule): Rule => rule;\n\nconst defineProvider = <const Provider extends DecisionProvider>(provider: Provider): Provider =>\n provider;\n\nexport { defineDecisionRule, defineProvider };\n","import { Array as Arr, Effect, pipe } from \"effect\";\nimport { createSyncFn } from \"synckit\";\nimport type { Syncify } from \"synckit\";\n\nimport { messageOf, runOrElse } from \"./runtime.ts\";\nimport type { DecideInput, DecideResult, DecisionProvider } from \"./types.ts\";\n\nconst BACKSTOP_MS = 60_000;\nconst SYNCKIT_TIMEOUT = \"Internal error: Atomics.wait() failed: timed-out\";\n\ntype Inputs = Arr.NonEmptyReadonlyArray<DecideInput>;\n\ntype Results = Arr.NonEmptyReadonlyArray<DecideResult>;\n\ntype Worker = (inputs: Inputs) => Promise<Results>;\n\nconst workers = new Map<\"openrouter\", Syncify<Worker>>();\n\nconst workerCall = (): Syncify<Worker> => {\n const existing = workers.get(\"openrouter\");\n if (existing) {\n return existing;\n }\n const created = createSyncFn<Worker>(new URL(\"openrouter-worker.mjs\", import.meta.url), {\n timeout: BACKSTOP_MS,\n });\n workers.set(\"openrouter\", created);\n return created;\n};\n\nconst reasonOf = (error: unknown): string => {\n const message = messageOf(error);\n if (message === SYNCKIT_TIMEOUT) {\n return \"timeout\";\n }\n return `network: ${message}`;\n};\n\nconst ask = (inputs: Inputs): Results =>\n runOrElse(\n Effect.sync(() => workerCall()(inputs)),\n (cause) =>\n pipe(\n inputs,\n Arr.map((): DecideResult => ({ ok: false, reason: reasonOf(cause) })),\n ),\n );\n\nconst openRouter: DecisionProvider = {\n name: \"openrouter\",\n requiredEnv: [\"OPENROUTER_API_KEY\"],\n decide: (input) => Arr.headNonEmpty(ask([input])),\n decideAll: (inputs) => Arr.match(inputs, { onEmpty: () => [], onNonEmpty: (some) => ask(some) }),\n};\n\nexport { openRouter };\n","import type { RuleOptionsSchema } from \"@oxlint/plugins\";\nimport { Option, Predicate, Schema } from \"effect\";\n\nimport { ModelSpecSchema, STRICT, checked, modelIdsOf, resolveModel } from \"./options.ts\";\nimport type { DecisionProvider, ResolvedRule } from \"./types.ts\";\n\nconst RuleOverrideSchema = Schema.Struct({\n model: Schema.optionalKey(ModelSpecSchema),\n});\n\nconst RULE_OPTIONS_SCHEMA = [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n model: {\n oneOf: [\n { type: \"string\", minLength: 1 },\n { type: \"array\", minItems: 1, items: { type: \"string\", minLength: 1 } },\n ],\n },\n },\n },\n] satisfies RuleOptionsSchema;\n\nconst decodeOverride = Schema.decodeUnknownResult(RuleOverrideSchema, STRICT);\n\nconst overrideRule = (\n rule: ResolvedRule,\n raw: unknown,\n providers: Readonly<Record<string, DecisionProvider>>,\n): ResolvedRule => {\n if (Predicate.isUndefined(raw)) {\n return rule;\n }\n const { model } = checked(decodeOverride, raw, `options for rule \"${rule.id}\"`);\n return {\n ...rule,\n models: Option.match(Option.fromUndefinedOr(model), {\n onNone: () => rule.models,\n onSome: (spec) => modelIdsOf(spec).map((id) => resolveModel(id, providers)),\n }),\n };\n};\n\nexport { RULE_OPTIONS_SCHEMA, overrideRule };\n","import type { Context } from \"@oxlint/plugins\";\nimport { Array as Arr, Option, Predicate, String as Str } from \"effect\";\n\nimport { snippetNodeFor } from \"./options.ts\";\nimport { sourceLines } from \"./request.ts\";\nimport type { AstNode, EnclosingKind, ResolvedRule, RuleContext } from \"./types.ts\";\n\nconst DEFAULT_LINES = 5;\nconst FIRST_LINE = 1;\nconst LAST = 1;\nconst END = 1;\n\nconst ENCLOSING_TYPES: Readonly<Record<EnclosingKind, readonly string[]>> = {\n function: [\"FunctionDeclaration\", \"FunctionExpression\", \"ArrowFunctionExpression\"],\n class: [\"ClassDeclaration\", \"ClassExpression\"],\n block: [\"BlockStatement\", \"StaticBlock\", \"Program\"],\n};\n\nconst ancestorsOf = (node: AstNode): readonly AstNode[] =>\n Arr.unfold(Option.fromNullishOr(node.parent), (current) =>\n current.pipe(\n Option.map((ancestor) => [ancestor, Option.fromNullishOr(ancestor.parent)] as const),\n ),\n );\n\nconst enclosingText = (context: Context, node: AstNode, kind: EnclosingKind): string =>\n Arr.findFirst(ancestorsOf(node), (ancestor) =>\n ENCLOSING_TYPES[kind].includes(ancestor.type),\n ).pipe(\n Option.match({\n onNone: () => context.sourceCode.text,\n onSome: (ancestor) => context.sourceCode.getText(ancestor),\n }),\n );\n\nconst linesAround = (\n context: Context,\n node: AstNode,\n {\n before = DEFAULT_LINES,\n after = DEFAULT_LINES,\n }: { readonly before?: number; readonly after?: number },\n): string => {\n const lines = sourceLines(context.sourceCode.text);\n const first = Math.max(FIRST_LINE, node.loc.start.line - before);\n const last = Math.min(lines.length, node.loc.end.line + after);\n return lines\n .slice(first - FIRST_LINE, last)\n .map((text, index) => `L${String(first + index)}| ${text}`)\n .join(\"\\n\");\n};\n\nconst DECLARING_PARENTS: ReadonlySet<string> = new Set([\n \"VariableDeclaration\",\n \"ExportNamedDeclaration\",\n \"ExportDefaultDeclaration\",\n]);\n\nconst declarationOf = (node: AstNode): AstNode =>\n Option.fromNullishOr(node.parent).pipe(\n Option.filter((parent) => DECLARING_PARENTS.has(parent.type)),\n Option.match({ onNone: () => node, onSome: declarationOf }),\n );\n\ninterface Span {\n readonly start: number;\n readonly end: number;\n}\n\nconst leadingOf = (text: string, comments: readonly Span[], until: number): readonly Span[] =>\n Option.match(Arr.last(comments), {\n onNone: () => [],\n onSome: (last) => {\n if (Str.isNonEmpty(text.slice(last.end, until).trim())) {\n return [];\n }\n return [...leadingOf(text, Arr.dropRight(comments, LAST), last.start), last];\n },\n });\n\nconst commentedTextOf = (context: Context, node: AstNode): Option.Option<string> => {\n const { text } = context.sourceCode;\n const named = snippetNodeFor(node);\n const [start] = declarationOf(named).range;\n const before = context.sourceCode\n .getAllComments()\n .filter((comment) => comment.type !== \"Shebang\" && comment.end <= start);\n return Arr.match(leadingOf(text, before, start), {\n onEmpty: () => Option.none(),\n onNonEmpty: ([first]) => Option.some(text.slice(first.start, named.range[END])),\n });\n};\n\nconst isCommented = ({ context: wanted }: ResolvedRule): boolean =>\n Predicate.isNotUndefined(wanted) && wanted.scope === \"comment\";\n\nconst commentedSnippetOf = (\n context: Context,\n node: AstNode,\n rule: ResolvedRule,\n): Option.Option<string> =>\n Option.flatMap(Option.liftPredicate(rule, isCommented), () => commentedTextOf(context, node));\n\nconst lacksComment = (context: Context, node: AstNode, rule: ResolvedRule): boolean =>\n isCommented(rule) && Option.isNone(commentedTextOf(context, node));\n\nconst contextOf = (context: Context, node: AstNode, rule: RuleContext): Option.Option<string> => {\n if (rule.scope === \"lines\") {\n return Option.some(linesAround(context, node, rule));\n }\n if (rule.scope === \"enclosing\") {\n return Option.some(enclosingText(context, node, rule.kind));\n }\n return Option.liftPredicate(context.sourceCode.text, () => rule.scope === \"file\");\n};\n\nexport { commentedSnippetOf, contextOf, lacksComment };\n","import type { Context } from \"@oxlint/plugins\";\nimport { Match, Option } from \"effect\";\n\nimport type { DecisionRule, SelectedNode } from \"./types.ts\";\n\nconst none = (): Option.Option<SelectedNode> => Option.none();\n\nconst heldName = (node: SelectedNode): Option.Option<SelectedNode> =>\n Option.flatMap(Option.fromNullishOr(node.parent), (parent) =>\n Match.value(parent).pipe(\n Match.when({ type: \"VariableDeclarator\" }, (holder) =>\n Option.liftPredicate(holder.id, () => holder.init === node),\n ),\n Match.when(\n { type: Match.is(\"Property\", \"MethodDefinition\", \"PropertyDefinition\") },\n (holder) => Option.liftPredicate(holder.key, () => holder.value === node),\n ),\n Match.orElse(none),\n ),\n );\n\nconst nameNodeOf = (node: SelectedNode): Option.Option<SelectedNode> =>\n Match.value(node).pipe(\n Match.when({ type: Match.is(\"FunctionDeclaration\", \"FunctionExpression\") }, (fn) =>\n Option.orElse(Option.fromNullishOr(fn.id), () => heldName(fn)),\n ),\n Match.when({ type: \"ArrowFunctionExpression\" }, heldName),\n Match.when({ type: Match.is(\"CallExpression\", \"NewExpression\") }, (call) =>\n Option.some(call.callee),\n ),\n Match.when({ type: \"JSXElement\" }, (element) => Option.some(element.openingElement.name)),\n Match.orElse(none),\n );\n\nconst nameOf = (node: SelectedNode, context: Context): string | undefined =>\n Option.getOrUndefined(\n Option.map(nameNodeOf(node), (name) => context.sourceCode.text.slice(name.start, name.end)),\n );\n\nconst isSelected = (context: Context, node: SelectedNode, { select }: DecisionRule): boolean =>\n Option.match(Option.fromUndefinedOr(select), {\n onNone: () => true,\n onSome: (selects) => selects(node, { name: nameOf(node, context), context }),\n });\n\nexport { isSelected };\n","import type { Location } from \"@oxlint/plugins\";\nimport {\n Array as Arr,\n Boolean as Bool,\n Console,\n Effect,\n Function as Fn,\n Match,\n Option,\n Predicate,\n String as Str,\n} from \"effect\";\n\nimport { PREFIX } from \"./options.ts\";\nimport { refAt } from \"./request.ts\";\nimport { envOf } from \"./runtime.ts\";\nimport type {\n Answer,\n Answers,\n DecisionRequest,\n ExplainSetting,\n Match as RuleMatch,\n Question,\n Verdict,\n} from \"./types.ts\";\nimport { wireRequestsFor } from \"./wire.ts\";\nimport type { WireRequest } from \"./wire.ts\";\n\ntype ExplainMode = \"off\" | \"text\" | \"json\";\n\nconst EXPLAIN_ENV = \"OXLINT_DECISION_EXPLAIN\";\nconst OFF_VALUES: ReadonlySet<string> = new Set([\"0\", \"false\", \"off\", \"no\"]);\nconst STATE_HEAD_CHARS = 60;\nconst DECIMALS = 2;\nconst OPTION_SEPARATOR = \"__\";\nconst FIRST = 1;\nconst START = 0;\nconst COLUMN_BASE = 1;\n\ninterface ExplainQuestion {\n readonly id: string;\n readonly question: string;\n readonly probabilities: Readonly<Record<string, number>>;\n}\n\ninterface Explanation {\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly rule: string;\n readonly model: string;\n readonly served?: string;\n readonly cutoff: number;\n readonly cached?: boolean;\n readonly durationMs: number;\n readonly state: { readonly chars: number; readonly head: string };\n readonly questions: readonly ExplainQuestion[];\n readonly verdict?: Verdict;\n readonly reported: boolean;\n readonly error?: string;\n}\n\ninterface Outcome {\n readonly served: string;\n readonly answers: Answers;\n readonly cached: boolean | undefined;\n readonly verdict: Option.Option<Verdict>;\n readonly reported: boolean;\n}\n\ninterface Explainer {\n readonly outcome: (match: RuleMatch, at: Placed, outcome: Outcome) => void;\n readonly failure: (matches: readonly RuleMatch[], reason: string) => void;\n}\n\ninterface Placed {\n readonly ref: string;\n readonly loc: Location;\n}\n\ninterface ExplainPass {\n readonly setting: ExplainSetting;\n readonly cwd: string;\n readonly filename: string;\n readonly model: string;\n readonly request: DecisionRequest;\n readonly durationMs: number;\n}\n\nconst SEPARATOR = /^[/\\\\]/u;\n\nconst relativeTo = (root: string, filename: string): string =>\n Bool.match(\n Str.isNonEmpty(root) &&\n filename.startsWith(root) &&\n SEPARATOR.test(filename.slice(root.length)),\n {\n onTrue: () => filename.slice(root.length + FIRST),\n onFalse: () => filename,\n },\n );\n\nconst fromSetting = (setting: ExplainSetting): ExplainMode =>\n Match.value(setting).pipe(\n Match.when(\"json\", (): ExplainMode => \"json\"),\n Match.when(true, (): ExplainMode => \"text\"),\n Match.when(\"text\", (): ExplainMode => \"text\"),\n Match.orElse((): ExplainMode => \"off\"),\n );\n\nconst fromEnv = (value: string): ExplainMode =>\n Match.value(value.toLowerCase()).pipe(\n Match.when(\"json\", (): ExplainMode => \"json\"),\n Match.when(\n (lower) => OFF_VALUES.has(lower),\n (): ExplainMode => \"off\",\n ),\n Match.orElse((): ExplainMode => \"text\"),\n );\n\nconst explainModeOf = (setting: ExplainSetting): ExplainMode =>\n Option.match(envOf(EXPLAIN_ENV), { onNone: () => fromSetting(setting), onSome: fromEnv });\n\nconst probabilitiesIn = (answer: Answer): Option.Option<Readonly<Record<string, number>>> => {\n if (answer.type === \"noul\") {\n return Option.some({ yes: answer.noul });\n }\n if (answer.type === \"UNKNOWN\") {\n return Option.none();\n }\n return Option.fromUndefinedOr(answer.probabilities);\n};\n\nconst probabilitiesOf = (answer: Answer | undefined): Readonly<Record<string, number>> =>\n Option.fromUndefinedOr(answer).pipe(\n Option.flatMap(probabilitiesIn),\n Option.getOrElse(() => ({})),\n );\n\nconst asksAbout = (ref: string, id: string): boolean =>\n id.split(OPTION_SEPARATOR, FIRST).includes(ref);\n\nconst sentFor = (\n sent: readonly WireRequest[],\n ref: string,\n): readonly (readonly [string, Question])[] =>\n sent.flatMap((wire) => Object.entries(wire.questions).filter(([id]) => asksAbout(ref, id)));\n\nconst stateTextOf = (sent: readonly WireRequest[], ref: string, snippet: string): string =>\n Arr.findFirst(sent, (wire) => Object.keys(wire.questions).some((id) => asksAbout(ref, id))).pipe(\n Option.map(({ state }) => state),\n Option.filter(Predicate.isString),\n Option.getOrElse(() => snippet),\n );\n\nconst summaryOf = (text: string): Explanation[\"state\"] => ({\n chars: text.length,\n head: text.replaceAll(/\\s+/gu, \" \").trim().slice(START, STATE_HEAD_CHARS),\n});\n\ntype Base = Pick<\n Explanation,\n \"file\" | \"line\" | \"column\" | \"rule\" | \"model\" | \"cutoff\" | \"durationMs\" | \"state\" | \"questions\"\n>;\n\ninterface Sent {\n readonly pass: ExplainPass;\n readonly sent: readonly WireRequest[];\n}\n\nconst baseOf = (\n { pass, sent }: Sent,\n match: RuleMatch,\n { ref, loc }: Placed,\n): ((answers: Answers) => Base) => {\n const questions = sentFor(sent, ref);\n return (answers) => ({\n file: relativeTo(pass.cwd, pass.filename),\n line: loc.start.line,\n column: loc.start.column + COLUMN_BASE,\n rule: match.rule.id,\n model: pass.model,\n cutoff: match.rule.cutoff,\n durationMs: pass.durationMs,\n state: summaryOf(stateTextOf(sent, ref, match.snippet)),\n questions: questions.map(([id, question]) => ({\n id,\n question: question.instructions,\n probabilities: probabilitiesOf(answers[id]),\n })),\n });\n};\n\nconst fixed = (value: number): string => value.toFixed(DECIMALS);\n\nconst cachedText = (cached: boolean | undefined): string =>\n Option.match(Option.fromUndefinedOr(cached), {\n onNone: () => \"unknown\",\n onSome: (hit) => Bool.match(hit, { onTrue: () => \"yes\", onFalse: () => \"no\" }),\n });\n\nconst probabilitiesText = (probabilities: Readonly<Record<string, number>>): string =>\n Option.match(\n Arr.match(Object.entries(probabilities), {\n onEmpty: () => Option.none<string>(),\n onNonEmpty: (entries) =>\n Option.some(entries.map(([label, value]) => `${label}=${fixed(value)}`).join(\" \")),\n }),\n { onNone: () => \"(no answer)\", onSome: (text) => text },\n );\n\nconst verdictText = (explanation: Explanation): string => {\n if (Predicate.isNotUndefined(explanation.error)) {\n return `error: ${explanation.error}`;\n }\n const outcome = Bool.match(explanation.reported, {\n onTrue: () => \"reported\",\n onFalse: () => \"not reported\",\n });\n const cutoff = `cutoff ${fixed(explanation.cutoff)}`;\n return Option.match(Option.fromUndefinedOr(explanation.verdict), {\n onNone: () => `no verdict, ${cutoff}, ${outcome}`,\n onSome: ({ answer, probability }) => `${answer} ${fixed(probability)}, ${cutoff}, ${outcome}`,\n });\n};\n\nconst servedText = (served: string | undefined): string =>\n Option.match(Option.fromUndefinedOr(served), {\n onNone: () => \"\",\n onSome: (id) => ` (served ${id})`,\n });\n\nconst asText = (explanation: Explanation): string =>\n [\n `${PREFIX} explain: ${explanation.file}:${String(explanation.line)}:${String(explanation.column)} [${explanation.rule}] ${explanation.model}${servedText(explanation.served)} cached=${cachedText(explanation.cached)} ${String(explanation.durationMs)}ms`,\n ` state: ${String(explanation.state.chars)} chars ${JSON.stringify(explanation.state.head)}`,\n ...explanation.questions.map(\n ({ id, question, probabilities }) =>\n ` ${id}: ${probabilitiesText(probabilities)}\\n ${question}`,\n ),\n ` verdict: ${verdictText(explanation)}`,\n ].join(\"\\n\");\n\nconst printerFor =\n (mode: \"text\" | \"json\") =>\n (explanation: Explanation): void => {\n const line = Bool.match(mode === \"json\", {\n onTrue: () => JSON.stringify(explanation),\n onFalse: () => asText(explanation),\n });\n Effect.runFork(Console.error(line));\n };\n\nconst explaining = (pass: ExplainPass, mode: \"text\" | \"json\"): Explainer => {\n const sent = wireRequestsFor(pass.request);\n const print = printerFor(mode);\n return {\n outcome: (match, at, { served, answers, cached, verdict, reported }) => {\n print({\n ...baseOf({ pass, sent }, match, at)(answers),\n served,\n ...Option.match(Option.fromUndefinedOr(cached), {\n onNone: () => ({}),\n onSome: (hit) => ({ cached: hit }),\n }),\n ...Option.match(verdict, { onNone: () => ({}), onSome: (found) => ({ verdict: found }) }),\n reported,\n });\n },\n failure: (matches, reason) => {\n for (const [index, match] of matches.entries()) {\n const at = { ref: refAt(index), loc: match.loc };\n print({ ...baseOf({ pass, sent }, match, at)({}), reported: false, error: reason });\n }\n },\n };\n};\n\nconst SILENT: Explainer = { outcome: Fn.constVoid, failure: Fn.constVoid };\n\nconst explainerFor = (pass: ExplainPass): Explainer =>\n Match.value(explainModeOf(pass.setting)).pipe(\n Match.when(\"off\", () => SILENT),\n Match.orElse((mode) => explaining(pass, mode)),\n );\n\nexport { explainerFor };\nexport type { Explainer, ExplainPass, Outcome, Placed };\n","import type { Location } from \"@oxlint/plugins\";\nimport { Effect, Option } from \"effect\";\n\nimport {\n locates,\n locationCandidates,\n locationOfLine,\n locationQuestion,\n locationRefOf,\n parseVerdicts,\n selectedLocation,\n} from \"./request.ts\";\nimport type { LocatedMatch } from \"./request.ts\";\nimport { messageOf, runOrElse } from \"./runtime.ts\";\nimport type {\n DecideInput,\n DecideResult,\n DecisionRequest,\n LineRange,\n Match,\n ModelRef,\n Verdicts,\n} from \"./types.ts\";\n\ntype VerdictResult =\n | { readonly ok: true; readonly verdicts: Verdicts; readonly cached: boolean | undefined }\n | { readonly ok: false; readonly reason: string };\n\ninterface Located {\n readonly loc: Location;\n readonly failure: Option.Option<string>;\n}\n\ninterface Asking {\n readonly model: ModelRef;\n readonly deadline: number;\n readonly env: Readonly<Record<string, string>>;\n}\n\ninterface Refinement {\n readonly asking: Asking;\n readonly match: Match & LocatedMatch;\n readonly ref: string;\n readonly state: DecisionRequest[\"state\"];\n}\n\nconst MINIMUM_TIMEOUT_MS = 1;\n\nconst remainingMs = (deadline: number): number =>\n Math.max(MINIMUM_TIMEOUT_MS, deadline - Date.now());\n\nconst verdictsOf = (result: DecideResult, request: DecisionRequest): VerdictResult => {\n if (!result.ok) {\n return result;\n }\n return runOrElse(\n Effect.sync((): VerdictResult => ({\n ok: true,\n verdicts: parseVerdicts(result.response, request),\n cached: result.cached,\n })),\n (cause) => ({ ok: false, reason: messageOf(cause) }),\n );\n};\n\nconst inputOf = (asking: Asking, request: DecisionRequest): DecideInput => ({\n request,\n timeoutMs: remainingMs(asking.deadline),\n env: asking.env,\n});\n\nconst fetchVerdicts = (asking: Asking, request: DecisionRequest): VerdictResult =>\n verdictsOf(asking.model.provider.decide(inputOf(asking, request)), request);\n\nconst isRange = (location: Option.Option<LineRange>): location is Option.Some<LineRange> =>\n Option.exists(location, ({ start, end }) => start !== end);\n\nconst refineOnce = (\n { asking, match, ref, state }: Refinement,\n within: LineRange,\n): VerdictResult & { readonly next?: Option.Option<LineRange> } => {\n const questionId = locationRefOf(ref);\n const candidates = locationCandidates(match.snippet, within);\n const refined = fetchVerdicts(asking, {\n model: asking.model.model,\n state,\n questions: { [questionId]: locationQuestion(match, ref, candidates) },\n });\n if (!refined.ok) {\n return refined;\n }\n return {\n ...refined,\n next: selectedLocation(\n refined.verdicts.answers[questionId],\n candidates,\n match.rule.location.cutoff,\n ),\n };\n};\n\nconst refine = (refinement: Refinement, first: Option.Option<LineRange>): Located => {\n let location = first;\n while (isRange(location)) {\n const step = refineOnce(refinement, location.value);\n if (!step.ok) {\n return { loc: refinement.match.loc, failure: Option.some(step.reason) };\n }\n location = step.next ?? Option.none();\n }\n return {\n loc: Option.match(location, {\n onNone: () => refinement.match.loc,\n onSome: ({ start }) => locationOfLine(refinement.match.snippet, start),\n }),\n failure: Option.none(),\n };\n};\n\nconst locateMatch = (\n asking: Asking,\n match: Match,\n {\n ref,\n verdicts,\n request,\n }: { readonly ref: string; readonly verdicts: Verdicts; readonly request: DecisionRequest },\n): Located => {\n if (!locates(match)) {\n return { loc: match.loc, failure: Option.none() };\n }\n const first = selectedLocation(\n verdicts.answers[locationRefOf(ref)],\n locationCandidates(match.snippet),\n match.rule.location.cutoff,\n );\n return refine({ asking, match, ref, state: request.state }, first);\n};\n\nexport { inputOf, locateMatch, verdictsOf };\nexport type { Asking, Located, VerdictResult };\n","import type { Context, Location } from \"@oxlint/plugins\";\nimport { Array as Arr, Boolean as Bool, Option } from \"effect\";\n\nimport { isReported } from \"./answer.ts\";\nimport { explainerFor } from \"./explain.ts\";\nimport type { ExplainPass, Explainer, Outcome, Placed } from \"./explain.ts\";\nimport { inputOf, locateMatch, verdictsOf } from \"./locate.ts\";\nimport type { Asking, Located } from \"./locate.ts\";\nimport { OptionsError } from \"./options.ts\";\nimport { buildRequest, refAt } from \"./request.ts\";\nimport { failsInCi, warnOnce } from \"./runtime.ts\";\nimport type {\n DecideResult,\n DecisionProvider,\n DecisionRequest,\n Match,\n ModelRef,\n ResolvedOptions,\n Verdicts,\n} from \"./types.ts\";\n\ninterface ModelPass {\n readonly contextOf: (match: Match) => Context;\n readonly filename: string;\n readonly options: ResolvedOptions;\n readonly model: ModelRef;\n readonly matches: readonly Match[];\n readonly deadline: number;\n}\n\ninterface Failure {\n readonly match: Match;\n readonly loc: Location;\n readonly reason: string;\n}\n\ninterface Answered {\n readonly asking: Asking;\n readonly verdicts: Verdicts;\n readonly request: DecisionRequest;\n readonly cached: boolean | undefined;\n readonly explainer: Explainer;\n}\n\nconst DECIMALS = 2;\n\nconst degrade = (pass: ModelPass, reason: string): void => {\n if (failsInCi(pass.options)) {\n throw new OptionsError(`${reason} (${pass.filename})`);\n }\n warnOnce(reason, `${reason} (${pass.filename})`);\n};\n\nconst reportFailure = (pass: ModelPass, failure: Failure): void => {\n if (failsInCi(pass.options)) {\n pass.contextOf(failure.match).report({\n loc: failure.loc,\n messageId: \"unlocated\",\n data: { id: failure.match.rule.id, reason: failure.reason },\n });\n return;\n }\n warnOnce(failure.reason, `${failure.reason} (${pass.filename})`);\n};\n\nconst locate = (\n answered: Answered,\n match: Match,\n { ref, failed }: { readonly ref: string; readonly failed: boolean },\n): Located => {\n if (failed) {\n return { loc: match.loc, failure: Option.none() };\n }\n return locateMatch(answered.asking, match, { ...answered, ref });\n};\n\nconst outcomeOf = (answered: Answered, match: Match, ref: string): Outcome => {\n const verdict = Option.fromUndefinedOr(answered.verdicts.results[ref]);\n return {\n served: `${answered.asking.model.provider.name}/${answered.verdicts.model}`,\n cached: answered.cached,\n answers: answered.verdicts.answers,\n verdict,\n reported: Option.exists(verdict, (found) => isReported(match.rule, found)),\n };\n};\n\nconst reportMatch = (\n pass: ModelPass,\n answered: Answered,\n { match, ref, failed }: { readonly match: Match; readonly ref: string; readonly failed: boolean },\n): Option.Option<string> => {\n const outcome = outcomeOf(answered, match, ref);\n const { verdict } = outcome;\n if (!outcome.reported || Option.isNone(verdict)) {\n answered.explainer.outcome(match, { ref, loc: match.loc }, outcome);\n return Option.none();\n }\n const located = locate(answered, match, { ref, failed });\n const at: Placed = { ref, loc: located.loc };\n answered.explainer.outcome(match, at, outcome);\n pass.contextOf(match).report({\n loc: located.loc,\n messageId: \"yes\",\n data: {\n id: match.rule.id,\n model: `${pass.model.provider.name}/${answered.verdicts.model}`,\n answer: verdict.value.answer,\n score: verdict.value.probability.toFixed(DECIMALS),\n cutoff: match.rule.cutoff.toFixed(DECIMALS),\n question: match.rule.message ?? match.rule.question,\n },\n });\n return located.failure;\n};\n\nconst reportMatches = (pass: ModelPass, answered: Answered): Option.Option<Failure> => {\n let failure: Option.Option<Failure> = Option.none();\n for (const [index, match] of pass.matches.entries()) {\n const located = reportMatch(pass, answered, {\n match,\n ref: refAt(index),\n failed: Option.isSome(failure),\n });\n failure = Option.orElse(failure, () =>\n located.pipe(Option.map((reason) => ({ match, loc: match.loc, reason }))),\n );\n }\n return failure;\n};\n\nconst explainPassOf = (\n pass: ModelPass,\n { request, durationMs }: Pick<ExplainPass, \"request\" | \"durationMs\">,\n): ExplainPass => ({\n setting: pass.options.explain,\n cwd: Option.match(Arr.head(pass.matches), {\n onNone: () => \"\",\n onSome: (match) => pass.contextOf(match).cwd,\n }),\n filename: pass.filename,\n model: pass.model.id,\n request,\n durationMs,\n});\n\nconst explainerOf = (\n pass: ModelPass,\n timed: Pick<ExplainPass, \"request\" | \"durationMs\">,\n): Explainer => explainerFor(explainPassOf(pass, timed));\n\ninterface Prepared {\n readonly pass: ModelPass;\n readonly asking: Asking;\n readonly request: DecisionRequest;\n}\n\nconst prepare = (pass: ModelPass): Prepared => ({\n pass,\n asking: { model: pass.model, deadline: pass.deadline, env: pass.options.env },\n request: buildRequest(pass.model.model, pass.matches),\n});\n\nconst reportAnswer = (\n { pass, asking, request }: Prepared,\n { decided, durationMs }: { readonly decided: DecideResult; readonly durationMs: number },\n): void => {\n const explainer = explainerOf(pass, { request, durationMs });\n const result = verdictsOf(decided, request);\n if (!result.ok) {\n explainer.failure(pass.matches, result.reason);\n degrade(pass, result.reason);\n return;\n }\n Option.map(reportMatches(pass, { ...result, asking, request, explainer }), (failure) => {\n reportFailure(pass, failure);\n });\n};\n\nconst decideWith = (\n provider: DecisionProvider,\n prepared: readonly Prepared[],\n): readonly DecideResult[] => {\n const inputs = prepared.map(({ asking, request }) => inputOf(asking, request));\n return Option.match(Option.fromUndefinedOr(provider.decideAll), {\n onNone: () => inputs.map((input) => provider.decide(input)),\n onSome: (decideAll) => decideAll(inputs),\n });\n};\n\nconst reportProvider = (prepared: Arr.NonEmptyReadonlyArray<Prepared>): void => {\n const { provider } = Arr.headNonEmpty(prepared).pass.model;\n const started = performance.now();\n const results = decideWith(provider, prepared);\n const durationMs = Math.round(performance.now() - started);\n const answers = Bool.match(results.length === prepared.length, {\n onTrue: () => results,\n onFalse: () =>\n prepared.map((): DecideResult => ({\n ok: false,\n reason: `provider ${provider.name} returned ${String(results.length)} results for ${String(prepared.length)} requests`,\n })),\n });\n for (const [one, decided] of Arr.zip(prepared, answers)) {\n reportAnswer(one, { decided, durationMs });\n }\n};\n\nconst reportModels = (passes: readonly ModelPass[]): void => {\n const byProvider = Arr.groupBy(\n passes.map((pass) => prepare(pass)),\n ({ pass }) => pass.model.provider.name,\n );\n for (const prepared of Object.values(byProvider)) {\n reportProvider(prepared);\n }\n};\n\nexport { reportModels };\nexport type { ModelPass };\n","import type { Context, VisitorWithHooks } from \"@oxlint/plugins\";\nimport { Array as Arr, Option, Predicate } from \"effect\";\n\nimport { commentedSnippetOf, contextOf, lacksComment } from \"./context.ts\";\nimport { isSelected } from \"./name.ts\";\nimport { OptionsError, REPORT_LOC, TARGET_NODE_TYPES, snippetNodeFor } from \"./options.ts\";\nimport { reportModels } from \"./report.ts\";\nimport type { ModelPass } from \"./report.ts\";\nimport { truncateSnippet } from \"./request.ts\";\nimport { envNameOf, envOf, failsInCi, warnOnce } from \"./runtime.ts\";\nimport type {\n AstNode,\n DecisionProvider,\n Match,\n ModelRef,\n ResolvedOptions,\n ResolvedRule,\n SelectedNode,\n Target,\n} from \"./types.ts\";\n\ninterface Collected {\n readonly options: ResolvedOptions;\n readonly contexts: Readonly<Record<string, Context>>;\n readonly rules: Readonly<Record<string, ResolvedRule>>;\n readonly matches: readonly Match[];\n}\n\ninterface FileBatch extends Collected {\n readonly contexts: Record<string, Context>;\n readonly rules: Record<string, ResolvedRule>;\n readonly matches: Match[];\n exiting: boolean;\n exits: number;\n}\n\ninterface RuleFile {\n readonly batch: FileBatch;\n readonly rule: ResolvedRule;\n}\n\ninterface SharedFile {\n readonly join: (context: Context, id: string) => RuleFile;\n readonly leave: () => void;\n}\n\ntype OptionsFor = (settings: Readonly<Record<string, unknown>>) => ResolvedOptions;\n\ntype RuleFor = (rule: ResolvedRule, options: unknown) => ResolvedRule;\n\nconst raisedMissing = new Set<string>();\n\nconst missingEnvOf = (options: ResolvedOptions, provider: DecisionProvider): readonly string[] =>\n provider.requiredEnv\n .map((name) => envNameOf(options.env, name))\n .filter((name) => Option.isNone(envOf(name)));\n\nconst isAvailable = (options: ResolvedOptions, { provider }: ModelRef): boolean => {\n const missingNames = missingEnvOf(options, provider);\n if (Arr.isReadonlyArrayEmpty(missingNames)) {\n return true;\n }\n const missing = missingNames.join(\", \");\n if (!failsInCi(options)) {\n warnOnce(`missing:${provider.name}`, `${missing} is not set, skipping ${provider.name} models`);\n } else if (!raisedMissing.has(provider.name)) {\n raisedMissing.add(provider.name);\n throw new OptionsError(`${missing} is not set`);\n }\n return false;\n};\n\nconst availableModels = (batch: Collected): readonly ModelRef[] =>\n [\n ...new Map(\n Object.values(batch.rules)\n .flatMap((rule) => rule.models)\n .map((model) => [model.id, model]),\n ).values(),\n ].filter((model) => isAvailable(batch.options, model));\n\nconst snippetOf = (context: Context, node: AstNode): string => {\n if (node.type === \"Program\") {\n return context.sourceCode.text;\n }\n return context.sourceCode.getText(node);\n};\n\nconst namedSnippetOf = (context: Context, node: AstNode): string => {\n const named = snippetNodeFor(node);\n if (named === node) {\n return snippetOf(context, node);\n }\n return context.sourceCode.getText(named);\n};\n\nconst matchOf = (\n context: Context,\n node: AstNode,\n { rule, options }: { readonly rule: ResolvedRule; readonly options: ResolvedOptions },\n): Match => {\n const text = Option.getOrElse(commentedSnippetOf(context, node, rule), () =>\n namedSnippetOf(context, node),\n );\n const surrounding = contextOf(context, node, rule.context ?? { scope: \"node\" });\n return {\n ...Option.match(surrounding, { onNone: () => ({}), onSome: (value) => ({ context: value }) }),\n rule,\n loc: REPORT_LOC[rule.target](node, snippetOf(context, node)),\n snippet: truncateSnippet(text, options.maxSnippetChars),\n truncated: text.length > options.maxSnippetChars,\n };\n};\n\nconst contextOfRule = (batch: Collected, id: string): Context =>\n Option.getOrThrow(Option.fromUndefinedOr(batch.contexts[id]));\n\nconst finish = (batch: Collected): void => {\n const [first] = Object.values(batch.contexts);\n if (Predicate.isUndefined(first)) {\n return;\n }\n const deadline = Date.now() + batch.options.timeoutMs;\n const passes = availableModels(batch).flatMap((model): readonly ModelPass[] => {\n const matches = batch.matches.filter(({ rule }) =>\n rule.models.some(({ id }) => id === model.id),\n );\n return Arr.match(matches, {\n onEmpty: () => [],\n onNonEmpty: (some) => [\n {\n contextOf: (match) => contextOfRule(batch, match.rule.id),\n filename: first.filename,\n options: batch.options,\n model,\n matches: some,\n deadline,\n },\n ],\n });\n });\n reportModels(passes);\n};\n\nconst ruleIn = (batch: Collected, id: string): ResolvedRule =>\n Option.getOrThrow(Arr.findFirst(batch.options.rules, (rule) => rule.id === id));\n\nconst sharedFile = (optionsFor: OptionsFor, ruleFor: RuleFor): SharedFile => {\n let current: Option.Option<FileBatch> = Option.none();\n const start = (context: Context): FileBatch => {\n const batch: FileBatch = {\n options: optionsFor(context.settings),\n contexts: {},\n rules: {},\n matches: [],\n exiting: false,\n exits: 0,\n };\n current = Option.some(batch);\n return batch;\n };\n return {\n join: (context, id) => {\n const batch = Option.match(current, {\n onNone: () => start(context),\n onSome: (open) => {\n if (open.exiting) {\n return start(context);\n }\n return open;\n },\n });\n const [options] = context.options;\n const rule = ruleFor(ruleIn(batch, id), options);\n batch.contexts[id] = context;\n batch.rules[id] = rule;\n return { batch, rule };\n },\n leave: () => {\n if (Option.isNone(current)) {\n return;\n }\n const batch = current.value;\n batch.exits += 1;\n if (batch.exits >= Object.keys(batch.contexts).length) {\n current = Option.none();\n }\n if (!batch.exiting) {\n batch.exiting = true;\n finish(batch);\n }\n },\n };\n};\n\ntype Visited = SelectedNode & AstNode;\n\nconst isSkipped = (context: Context, node: Visited, rule: ResolvedRule): boolean =>\n !isSelected(context, node, rule) || lacksComment(context, node, rule);\n\nconst visitorFor =\n (shared: SharedFile, { id, target }: { readonly id: string; readonly target: Target }) =>\n (context: Context): VisitorWithHooks => {\n let file: Option.Option<RuleFile> = Option.none();\n\n const collect = (node: Visited): void => {\n if (Option.isNone(file)) {\n return;\n }\n const { batch, rule } = file.value;\n if (isSkipped(context, node, rule)) {\n return;\n }\n batch.matches.push(matchOf(context, node, { rule, options: batch.options }));\n };\n\n const nodeTypes: readonly string[] = TARGET_NODE_TYPES[target];\n\n return {\n ...Object.fromEntries(\n nodeTypes.map((type) => [\n type,\n (node: Visited): void => {\n collect(node);\n },\n ]),\n ),\n Program: (node: Visited): void => {\n file = Option.some(shared.join(context, id));\n if (target === \"file\") {\n collect(node);\n }\n },\n \"Program:exit\": (): void => {\n file = Option.none();\n shared.leave();\n },\n };\n };\n\nexport { sharedFile, visitorFor };\nexport type { Collected, FileBatch, OptionsFor, RuleFile, RuleFor, SharedFile };\n","import type { Plugin, RuleMeta } from \"@oxlint/plugins\";\nimport { Predicate } from \"effect\";\n\nimport { openRouter } from \"./openrouter.ts\";\nimport { PREFIX, checkRules, resolveOptions } from \"./options.ts\";\nimport { RULE_OPTIONS_SCHEMA, overrideRule } from \"./override.ts\";\nimport type {\n DecisionOptions,\n DecisionPlugin,\n DecisionPluginSetup,\n DecisionProvider,\n DecisionRule,\n ResolvedOptions,\n ResolvedRule,\n} from \"./types.ts\";\nimport { sharedFile, visitorFor } from \"./visitor.ts\";\n\nconst DEFAULT_NAME = \"decision\";\n\nconst metaOf = (rule: DecisionRule): RuleMeta => ({\n type: \"problem\",\n docs: { description: rule.question },\n schema: RULE_OPTIONS_SCHEMA,\n messages: {\n yes: \"[{{id}}] {{model}} answered {{answer}} ({{score}} >= {{cutoff}}): {{question}}\",\n unlocated: `${PREFIX}: {{reason}} while refining the location of [{{id}}]; the finding is reported at the file level`,\n },\n});\n\nconst SETUP_ONLY: ReadonlySet<string> = new Set([\"name\", \"rules\", \"providers\"]);\n\nconst optionsOf = (setup: DecisionPluginSetup): DecisionOptions =>\n Object.fromEntries(Object.entries(setup).filter(([key]) => !SETUP_ONLY.has(key)));\n\ntype Resolve = (settings: unknown) => ResolvedOptions;\n\nconst memoized = (resolve: Resolve): Resolve => {\n const resolved = new Map<string, ResolvedOptions>();\n return (settings) => {\n const key = JSON.stringify([settings]);\n const cached = resolved.get(key);\n if (Predicate.isNotUndefined(cached)) {\n return cached;\n }\n const fresh = resolve(settings);\n resolved.set(key, fresh);\n return fresh;\n };\n};\n\nconst memoizedRules = (\n providers: Readonly<Record<string, DecisionProvider>>,\n): ((rule: ResolvedRule, options: unknown) => ResolvedRule) => {\n const resolved = new WeakMap<ResolvedRule, Map<string, ResolvedRule>>();\n return (rule, options) => {\n const known = resolved.get(rule) ?? new Map<string, ResolvedRule>();\n resolved.set(rule, known);\n const key = JSON.stringify([options]);\n const cached = known.get(key);\n if (Predicate.isNotUndefined(cached)) {\n return cached;\n }\n const fresh = overrideRule(rule, options, providers);\n known.set(key, fresh);\n return fresh;\n };\n};\n\nconst createDecisionPlugin = (setup: DecisionPluginSetup): DecisionPlugin => {\n const name = setup.name ?? DEFAULT_NAME;\n const providers: Readonly<Record<string, DecisionProvider>> = Object.fromEntries(\n [openRouter, ...(setup.providers ?? [])].map((provider) => [provider.name, provider]),\n );\n const rules = checkRules(setup.rules);\n const options = optionsOf(setup);\n const resolve = memoized((settings) => resolveOptions({ options, settings }, rules, providers));\n resolve({});\n const shared = sharedFile((settings) => resolve(settings[name]), memoizedRules(providers));\n\n return {\n meta: { name },\n rules: Object.fromEntries(\n rules.map((rule) => [rule.id, { meta: metaOf(rule), createOnce: visitorFor(shared, rule) }]),\n ),\n } satisfies Plugin;\n};\n\nexport { createDecisionPlugin };\n"],"mappings":";;;;AAEA,MAAM,sBAAuD,SAAqB;AAElF,MAAM,kBAA2D,aAC/D;;;ACEF,MAAM,cAAc;AACp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O,CAAC;EACpC,MAAM,SAAS,MAAM,IAAI,GAAG;EAC5B,IAAI,UAAU,eAAe,MAAM,GACjC,OAAO;EAET,MAAM,QAAQ,aAAa,MAAM,SAAS,SAAS;EACnD,MAAM,IAAI,KAAK,KAAK;EACpB,OAAO;CACT;AACF;AAEA,MAAM,wBAAwB,UAA+C;CAC3E,MAAM,OAAO,MAAM,QAAQ;CAC3B,MAAM,YAAwD,OAAO,YACnE,CAAC,YAAY,GAAI,MAAM,aAAa,CAAC,CAAE,CAAC,CAAC,KAAK,aAAa,CAAC,SAAS,MAAM,QAAQ,CAAC,CACtF;CACA,MAAM,QAAQ,WAAW,MAAM,KAAK;CACpC,MAAM,UAAU,UAAU,KAAK;CAC/B,MAAM,UAAU,UAAU,aAAa,eAAe;EAAE;EAAS;CAAS,GAAG,OAAO,SAAS,CAAC;CAC9F,QAAQ,CAAC,CAAC;CACV,MAAM,SAAS,YAAY,aAAa,QAAQ,SAAS,KAAK,GAAG,cAAc,SAAS,CAAC;CAEzF,OAAO;EACL,MAAM,EAAE,KAAK;EACb,OAAO,OAAO,YACZ,MAAM,KAAK,SAAS,CAAC,KAAK,IAAI;GAAE,MAAM,OAAO,IAAI;GAAG,YAAY,WAAW,QAAQ,IAAI;EAAE,CAAC,CAAC,CAC7F;CACF;AACF"}
1
+ {"version":3,"file":"index.mjs","names":["Arr","Arr","Str","DECIMALS","Bool","Str","Arr","Fn","Arr","Bool","Arr"],"sources":["../src/define.ts","../src/openrouter.ts","../src/override.ts","../src/context.ts","../src/name.ts","../src/explain.ts","../src/locate.ts","../src/report.ts","../src/visitor.ts","../src/plugin.ts"],"sourcesContent":["import type { DecisionProvider, DecisionRule } from \"./types.ts\";\n\nconst defineDecisionRule = <const Rule extends DecisionRule>(rule: Rule): Rule => rule;\n\nconst defineProvider = <const Provider extends DecisionProvider>(provider: Provider): Provider =>\n provider;\n\nexport { defineDecisionRule, defineProvider };\n","import { Array as Arr, Effect, pipe } from \"effect\";\nimport { createSyncFn } from \"synckit\";\nimport type { Syncify } from \"synckit\";\n\nimport { messageOf, runOrElse } from \"./runtime.ts\";\nimport type { DecideInput, DecideResult, DecisionProvider } from \"./types.ts\";\n\nconst BACKSTOP_MS = 60_000;\nconst SYNCKIT_TIMEOUT = \"Internal error: Atomics.wait() failed: timed-out\";\n\ntype Inputs = Arr.NonEmptyReadonlyArray<DecideInput>;\n\ntype Results = Arr.NonEmptyReadonlyArray<DecideResult>;\n\ntype Worker = (inputs: Inputs) => Promise<Results>;\n\nconst workers = new Map<\"openrouter\", Syncify<Worker>>();\n\nconst workerCall = (): Syncify<Worker> => {\n const existing = workers.get(\"openrouter\");\n if (existing) {\n return existing;\n }\n const created = createSyncFn<Worker>(new URL(\"openrouter-worker.mjs\", import.meta.url), {\n timeout: BACKSTOP_MS,\n });\n workers.set(\"openrouter\", created);\n return created;\n};\n\nconst reasonOf = (error: unknown): string => {\n const message = messageOf(error);\n if (message === SYNCKIT_TIMEOUT) {\n return \"timeout\";\n }\n return `network: ${message}`;\n};\n\nconst ask = (inputs: Inputs): Results =>\n runOrElse(\n Effect.sync(() => workerCall()(inputs)),\n (cause) =>\n pipe(\n inputs,\n Arr.map((): DecideResult => ({ ok: false, reason: reasonOf(cause) })),\n ),\n );\n\nconst openRouter: DecisionProvider = {\n name: \"openrouter\",\n requiredEnv: [\"OPENROUTER_API_KEY\"],\n decide: (input) => Arr.headNonEmpty(ask([input])),\n decideAll: (inputs) => Arr.match(inputs, { onEmpty: () => [], onNonEmpty: (some) => ask(some) }),\n};\n\nexport { openRouter };\n","import type { RuleOptionsSchema } from \"@oxlint/plugins\";\nimport { Option, Predicate, Schema } from \"effect\";\n\nimport { ModelSpecSchema, STRICT, checked, modelIdsOf, resolveModel } from \"./options.ts\";\nimport type { DecisionProvider, ResolvedRule } from \"./types.ts\";\n\nconst RuleOverrideSchema = Schema.Struct({\n model: Schema.optionalKey(ModelSpecSchema),\n});\n\nconst RULE_OPTIONS_SCHEMA = [\n {\n type: \"object\",\n additionalProperties: false,\n properties: {\n model: {\n oneOf: [\n { type: \"string\", minLength: 1 },\n { type: \"array\", minItems: 1, items: { type: \"string\", minLength: 1 } },\n ],\n },\n },\n },\n] satisfies RuleOptionsSchema;\n\nconst decodeOverride = Schema.decodeUnknownResult(RuleOverrideSchema, STRICT);\n\nconst overrideRule = (\n rule: ResolvedRule,\n raw: unknown,\n providers: Readonly<Record<string, DecisionProvider>>,\n): ResolvedRule => {\n if (Predicate.isUndefined(raw)) {\n return rule;\n }\n const { model } = checked(decodeOverride, raw, `options for rule \"${rule.id}\"`);\n return {\n ...rule,\n models: Option.match(Option.fromUndefinedOr(model), {\n onNone: () => rule.models,\n onSome: (spec) => modelIdsOf(spec).map((id) => resolveModel(id, providers)),\n }),\n };\n};\n\nexport { RULE_OPTIONS_SCHEMA, overrideRule };\n","import type { Context } from \"@oxlint/plugins\";\nimport { Array as Arr, Option, Predicate, String as Str } from \"effect\";\n\nimport { snippetNodeFor } from \"./options.ts\";\nimport { sourceLines } from \"./request.ts\";\nimport type { AstNode, EnclosingKind, ResolvedRule, RuleContext } from \"./types.ts\";\n\nconst DEFAULT_LINES = 5;\nconst FIRST_LINE = 1;\nconst LAST = 1;\nconst END = 1;\n\nconst ENCLOSING_TYPES: Readonly<Record<EnclosingKind, readonly string[]>> = {\n function: [\"FunctionDeclaration\", \"FunctionExpression\", \"ArrowFunctionExpression\"],\n class: [\"ClassDeclaration\", \"ClassExpression\"],\n block: [\"BlockStatement\", \"StaticBlock\", \"Program\"],\n};\n\nconst ancestorsOf = (node: AstNode): readonly AstNode[] =>\n Arr.unfold(Option.fromNullishOr(node.parent), (current) =>\n current.pipe(\n Option.map((ancestor) => [ancestor, Option.fromNullishOr(ancestor.parent)] as const),\n ),\n );\n\nconst enclosingText = (context: Context, node: AstNode, kind: EnclosingKind): string =>\n Arr.findFirst(ancestorsOf(node), (ancestor) =>\n ENCLOSING_TYPES[kind].includes(ancestor.type),\n ).pipe(\n Option.match({\n onNone: () => context.sourceCode.text,\n onSome: (ancestor) => context.sourceCode.getText(ancestor),\n }),\n );\n\nconst linesAround = (\n context: Context,\n node: AstNode,\n {\n before = DEFAULT_LINES,\n after = DEFAULT_LINES,\n }: { readonly before?: number; readonly after?: number },\n): string => {\n const lines = sourceLines(context.sourceCode.text);\n const first = Math.max(FIRST_LINE, node.loc.start.line - before);\n const last = Math.min(lines.length, node.loc.end.line + after);\n return lines\n .slice(first - FIRST_LINE, last)\n .map((text, index) => `L${String(first + index)}| ${text}`)\n .join(\"\\n\");\n};\n\nconst DECLARING_PARENTS: ReadonlySet<string> = new Set([\n \"VariableDeclaration\",\n \"ExportNamedDeclaration\",\n \"ExportDefaultDeclaration\",\n]);\n\nconst declarationOf = (node: AstNode): AstNode =>\n Option.fromNullishOr(node.parent).pipe(\n Option.filter((parent) => DECLARING_PARENTS.has(parent.type)),\n Option.match({ onNone: () => node, onSome: declarationOf }),\n );\n\ninterface Span {\n readonly start: number;\n readonly end: number;\n}\n\nconst leadingOf = (text: string, comments: readonly Span[], until: number): readonly Span[] =>\n Option.match(Arr.last(comments), {\n onNone: () => [],\n onSome: (last) => {\n if (Str.isNonEmpty(text.slice(last.end, until).trim())) {\n return [];\n }\n return [...leadingOf(text, Arr.dropRight(comments, LAST), last.start), last];\n },\n });\n\nconst commentedTextOf = (context: Context, node: AstNode): Option.Option<string> => {\n const { text } = context.sourceCode;\n const named = snippetNodeFor(node);\n const [start] = declarationOf(named).range;\n const before = context.sourceCode\n .getAllComments()\n .filter((comment) => comment.type !== \"Shebang\" && comment.end <= start);\n return Arr.match(leadingOf(text, before, start), {\n onEmpty: () => Option.none(),\n onNonEmpty: ([first]) => Option.some(text.slice(first.start, named.range[END])),\n });\n};\n\nconst isCommented = ({ context: wanted }: ResolvedRule): boolean =>\n Predicate.isNotUndefined(wanted) && wanted.scope === \"comment\";\n\nconst commentedSnippetOf = (\n context: Context,\n node: AstNode,\n rule: ResolvedRule,\n): Option.Option<string> =>\n Option.flatMap(Option.liftPredicate(rule, isCommented), () => commentedTextOf(context, node));\n\nconst lacksComment = (context: Context, node: AstNode, rule: ResolvedRule): boolean =>\n isCommented(rule) && Option.isNone(commentedTextOf(context, node));\n\nconst contextOf = (context: Context, node: AstNode, rule: RuleContext): Option.Option<string> => {\n if (rule.scope === \"lines\") {\n return Option.some(linesAround(context, node, rule));\n }\n if (rule.scope === \"enclosing\") {\n return Option.some(enclosingText(context, node, rule.kind));\n }\n return Option.liftPredicate(context.sourceCode.text, () => rule.scope === \"file\");\n};\n\nexport { commentedSnippetOf, contextOf, lacksComment };\n","import type { Context } from \"@oxlint/plugins\";\nimport { Match, Option } from \"effect\";\n\nimport type { DecisionRule, SelectedNode } from \"./types.ts\";\n\nconst heldName = (node: SelectedNode): Option.Option<SelectedNode> =>\n Option.flatMap(Option.fromNullishOr(node.parent), (parent) =>\n Match.value(parent).pipe(\n Match.when({ type: \"VariableDeclarator\" }, (holder) =>\n Option.liftPredicate(holder.id, () => holder.init === node),\n ),\n Match.when(\n { type: Match.is(\"Property\", \"MethodDefinition\", \"PropertyDefinition\") },\n (holder) => Option.liftPredicate(holder.key, () => holder.value === node),\n ),\n Match.orElse(() => Option.none<SelectedNode>()),\n ),\n );\n\nconst nameNodeOf = (node: SelectedNode): Option.Option<SelectedNode> =>\n Match.value(node).pipe(\n Match.when({ type: Match.is(\"FunctionDeclaration\", \"FunctionExpression\") }, (fn) =>\n Option.orElse(Option.fromNullishOr(fn.id), () => heldName(fn)),\n ),\n Match.when({ type: \"ArrowFunctionExpression\" }, heldName),\n Match.when({ type: Match.is(\"CallExpression\", \"NewExpression\") }, (call) =>\n Option.some(call.callee),\n ),\n Match.when({ type: \"JSXElement\" }, (element) => Option.some(element.openingElement.name)),\n Match.orElse(() => Option.none<SelectedNode>()),\n );\n\nconst nameOf = (node: SelectedNode, context: Context): string | undefined =>\n Option.getOrUndefined(\n Option.map(nameNodeOf(node), (name) => context.sourceCode.text.slice(name.start, name.end)),\n );\n\nconst isSelected = (context: Context, node: SelectedNode, { select }: DecisionRule): boolean =>\n Option.match(Option.fromUndefinedOr(select), {\n onNone: () => true,\n onSome: (selects) => selects(node, { name: nameOf(node, context), context }),\n });\n\nexport { isSelected };\n","import type { Location } from \"@oxlint/plugins\";\nimport {\n Array as Arr,\n Boolean as Bool,\n Console,\n Effect,\n Function as Fn,\n Match,\n Option,\n Predicate,\n String as Str,\n} from \"effect\";\n\nimport { PREFIX } from \"./options.ts\";\nimport { refAt } from \"./request.ts\";\nimport { envOf } from \"./runtime.ts\";\nimport type {\n Answer,\n Answers,\n DecisionRequest,\n ExplainSetting,\n Match as RuleMatch,\n Question,\n Verdict,\n} from \"./types.ts\";\nimport { wireRequestsFor } from \"./wire.ts\";\nimport type { WireRequest } from \"./wire.ts\";\n\ntype ExplainFormat = Extract<ExplainSetting, string>;\n\ntype ExplainMode = \"off\" | ExplainFormat;\n\nconst EXPLAIN_ENV = \"OXLINT_DECISION_EXPLAIN\";\nconst OFF_VALUES: ReadonlySet<string> = new Set([\"0\", \"false\", \"off\", \"no\"]);\nconst STATE_HEAD_CHARS = 60;\nconst DECIMALS = 2;\nconst OPTION_SEPARATOR = \"__\";\nconst FIRST = 1;\nconst START = 0;\nconst COLUMN_BASE = 1;\n\ninterface ExplainQuestion {\n readonly id: string;\n readonly question: string;\n readonly probabilities: Readonly<Record<string, number>>;\n}\n\ninterface Explanation {\n readonly file: string;\n readonly line: number;\n readonly column: number;\n readonly rule: string;\n readonly model: string;\n readonly served?: string;\n readonly cutoff: number;\n readonly cached?: boolean;\n readonly durationMs: number;\n readonly state: { readonly chars: number; readonly head: string };\n readonly questions: readonly ExplainQuestion[];\n readonly verdict?: Verdict;\n readonly reported: boolean;\n readonly error?: string;\n}\n\ninterface Outcome {\n readonly served: string;\n readonly answers: Answers;\n readonly cached: boolean | undefined;\n readonly verdict: Option.Option<Verdict>;\n readonly reported: boolean;\n}\n\ninterface Explainer {\n readonly outcome: (match: RuleMatch, at: Placed, outcome: Outcome) => void;\n readonly failure: (matches: readonly RuleMatch[], reason: string) => void;\n}\n\ninterface Placed {\n readonly ref: string;\n readonly loc: Location;\n}\n\ninterface ExplainPass {\n readonly setting: ExplainSetting;\n readonly cwd: string;\n readonly filename: string;\n readonly model: string;\n readonly request: DecisionRequest;\n readonly durationMs: number;\n}\n\nconst SEPARATOR = /^[/\\\\]/u;\n\nconst relativeTo = (root: string, filename: string): string =>\n Bool.match(\n Str.isNonEmpty(root) &&\n filename.startsWith(root) &&\n SEPARATOR.test(filename.slice(root.length)),\n {\n onTrue: () => filename.slice(root.length + FIRST),\n onFalse: () => filename,\n },\n );\n\nconst fromSetting = (setting: ExplainSetting): ExplainMode =>\n Match.value(setting).pipe(\n Match.when(\"json\", (): ExplainMode => \"json\"),\n Match.when(true, (): ExplainMode => \"text\"),\n Match.when(\"text\", (): ExplainMode => \"text\"),\n Match.orElse((): ExplainMode => \"off\"),\n );\n\nconst fromEnv = (value: string): ExplainMode =>\n Match.value(value.toLowerCase()).pipe(\n Match.when(\"json\", (): ExplainMode => \"json\"),\n Match.when(\n (lower) => OFF_VALUES.has(lower),\n (): ExplainMode => \"off\",\n ),\n Match.orElse((): ExplainMode => \"text\"),\n );\n\nconst explainModeOf = (setting: ExplainSetting): ExplainMode =>\n Option.match(envOf(EXPLAIN_ENV), { onNone: () => fromSetting(setting), onSome: fromEnv });\n\nconst probabilitiesIn = (answer: Answer): Option.Option<Readonly<Record<string, number>>> => {\n if (answer.type === \"noul\") {\n return Option.some({ yes: answer.noul });\n }\n if (answer.type === \"choice\") {\n return Option.fromUndefinedOr(answer.probabilities);\n }\n return Option.none();\n};\n\nconst probabilitiesOf = (answer: Answer | undefined): Readonly<Record<string, number>> =>\n Option.fromUndefinedOr(answer).pipe(\n Option.flatMap(probabilitiesIn),\n Option.getOrElse(() => ({})),\n );\n\nconst asksAbout = (ref: string, id: string): boolean =>\n id.split(OPTION_SEPARATOR, FIRST).includes(ref);\n\nconst sentFor = (\n sent: readonly WireRequest[],\n ref: string,\n): readonly (readonly [string, Question])[] =>\n sent.flatMap((wire) => Object.entries(wire.questions).filter(([id]) => asksAbout(ref, id)));\n\nconst stateTextOf = (sent: readonly WireRequest[], ref: string, snippet: string): string =>\n Arr.findFirst(sent, (wire) => Object.keys(wire.questions).some((id) => asksAbout(ref, id))).pipe(\n Option.map(({ state }) => state),\n Option.filter(Predicate.isString),\n Option.getOrElse(() => snippet),\n );\n\nconst summaryOf = (text: string): Explanation[\"state\"] => ({\n chars: text.length,\n head: text.replaceAll(/\\s+/gu, \" \").trim().slice(START, STATE_HEAD_CHARS),\n});\n\ntype Base = Pick<\n Explanation,\n \"file\" | \"line\" | \"column\" | \"rule\" | \"model\" | \"cutoff\" | \"durationMs\" | \"state\" | \"questions\"\n>;\n\ninterface Sent {\n readonly pass: ExplainPass;\n readonly sent: readonly WireRequest[];\n}\n\nconst baseOf = (\n { pass, sent }: Sent,\n match: RuleMatch,\n { ref, loc }: Placed,\n): ((answers: Answers) => Base) => {\n const questions = sentFor(sent, ref);\n return (answers) => ({\n file: relativeTo(pass.cwd, pass.filename),\n line: loc.start.line,\n column: loc.start.column + COLUMN_BASE,\n rule: match.rule.id,\n model: pass.model,\n cutoff: match.rule.cutoff,\n durationMs: pass.durationMs,\n state: summaryOf(stateTextOf(sent, ref, match.snippet)),\n questions: questions.map(([id, question]) => ({\n id,\n question: question.instructions,\n probabilities: probabilitiesOf(answers[id]),\n })),\n });\n};\n\nconst fixed = (value: number): string => value.toFixed(DECIMALS);\n\nconst cachedText = (cached: boolean | undefined): string =>\n Option.match(Option.fromUndefinedOr(cached), {\n onNone: () => \"unknown\",\n onSome: (hit) => Bool.match(hit, { onTrue: () => \"yes\", onFalse: () => \"no\" }),\n });\n\nconst probabilitiesText = (probabilities: Readonly<Record<string, number>>): string =>\n Option.match(\n Arr.match(Object.entries(probabilities), {\n onEmpty: () => Option.none<string>(),\n onNonEmpty: (entries) =>\n Option.some(entries.map(([label, value]) => `${label}=${fixed(value)}`).join(\" \")),\n }),\n { onNone: () => \"(no answer)\", onSome: (text) => text },\n );\n\nconst verdictText = (explanation: Explanation): string => {\n if (Predicate.isNotUndefined(explanation.error)) {\n return `error: ${explanation.error}`;\n }\n const outcome = Bool.match(explanation.reported, {\n onTrue: () => \"reported\",\n onFalse: () => \"not reported\",\n });\n const cutoff = `cutoff ${fixed(explanation.cutoff)}`;\n return Option.match(Option.fromUndefinedOr(explanation.verdict), {\n onNone: () => `no verdict, ${cutoff}, ${outcome}`,\n onSome: ({ answer, probability }) => `${answer} ${fixed(probability)}, ${cutoff}, ${outcome}`,\n });\n};\n\nconst servedText = (served: string | undefined): string =>\n Option.match(Option.fromUndefinedOr(served), {\n onNone: () => \"\",\n onSome: (id) => ` (served ${id})`,\n });\n\nconst asText = (explanation: Explanation): string =>\n [\n `${PREFIX} explain: ${explanation.file}:${String(explanation.line)}:${String(explanation.column)} [${explanation.rule}] ${explanation.model}${servedText(explanation.served)} cached=${cachedText(explanation.cached)} ${String(explanation.durationMs)}ms`,\n ` state: ${String(explanation.state.chars)} chars ${JSON.stringify(explanation.state.head)}`,\n ...explanation.questions.map(\n ({ id, question, probabilities }) =>\n ` ${id}: ${probabilitiesText(probabilities)}\\n ${question}`,\n ),\n ` verdict: ${verdictText(explanation)}`,\n ].join(\"\\n\");\n\nconst printerFor =\n (mode: ExplainFormat) =>\n (explanation: Explanation): void => {\n const line = Bool.match(mode === \"json\", {\n onTrue: () => JSON.stringify(explanation),\n onFalse: () => asText(explanation),\n });\n Effect.runFork(Console.error(line));\n };\n\nconst explaining = (pass: ExplainPass, mode: ExplainFormat): Explainer => {\n const sent = wireRequestsFor(pass.request);\n const print = printerFor(mode);\n return {\n outcome: (match, at, { served, answers, cached, verdict, reported }) => {\n print({\n ...baseOf({ pass, sent }, match, at)(answers),\n served,\n ...Option.match(Option.fromUndefinedOr(cached), {\n onNone: () => ({}),\n onSome: (hit) => ({ cached: hit }),\n }),\n ...Option.match(verdict, { onNone: () => ({}), onSome: (found) => ({ verdict: found }) }),\n reported,\n });\n },\n failure: (matches, reason) => {\n for (const [index, match] of matches.entries()) {\n const at = { ref: refAt(index), loc: match.loc };\n print({ ...baseOf({ pass, sent }, match, at)({}), reported: false, error: reason });\n }\n },\n };\n};\n\nconst SILENT: Explainer = { outcome: Fn.constVoid, failure: Fn.constVoid };\n\nconst explainerFor = (pass: ExplainPass): Explainer =>\n Match.value(explainModeOf(pass.setting)).pipe(\n Match.when(\"off\", () => SILENT),\n Match.orElse((mode) => explaining(pass, mode)),\n );\n\nexport { explainerFor };\nexport type { Explainer, ExplainPass, Outcome, Placed };\n","import type { Location } from \"@oxlint/plugins\";\nimport { Effect, Option } from \"effect\";\n\nimport {\n locates,\n locationCandidates,\n locationOfLine,\n locationQuestion,\n locationRefOf,\n parseVerdicts,\n selectedLocation,\n} from \"./request.ts\";\nimport type { LocatedMatch } from \"./request.ts\";\nimport { messageOf, runOrElse } from \"./runtime.ts\";\nimport type {\n DecideInput,\n DecideResult,\n DecisionRequest,\n LineRange,\n Match,\n ModelRef,\n Verdicts,\n} from \"./types.ts\";\n\ntype VerdictResult =\n | { readonly ok: true; readonly verdicts: Verdicts; readonly cached: boolean | undefined }\n | { readonly ok: false; readonly reason: string };\n\ninterface Located {\n readonly loc: Location;\n readonly failure: Option.Option<string>;\n}\n\ninterface Asking {\n readonly model: ModelRef;\n readonly deadline: number;\n readonly env: Readonly<Record<string, string>>;\n}\n\ninterface Refinement {\n readonly asking: Asking;\n readonly match: Match & LocatedMatch;\n readonly ref: string;\n readonly state: DecisionRequest[\"state\"];\n}\n\nconst MINIMUM_TIMEOUT_MS = 1;\n\nconst remainingMs = (deadline: number): number =>\n Math.max(MINIMUM_TIMEOUT_MS, deadline - Date.now());\n\nconst verdictsOf = (result: DecideResult, request: DecisionRequest): VerdictResult => {\n if (!result.ok) {\n return result;\n }\n return runOrElse(\n Effect.sync((): VerdictResult => ({\n ok: true,\n verdicts: parseVerdicts(result.response, request),\n cached: result.cached,\n })),\n (cause) => ({ ok: false, reason: messageOf(cause) }),\n );\n};\n\nconst inputOf = (asking: Asking, request: DecisionRequest): DecideInput => ({\n request,\n timeoutMs: remainingMs(asking.deadline),\n env: asking.env,\n});\n\nconst fetchVerdicts = (asking: Asking, request: DecisionRequest): VerdictResult =>\n verdictsOf(asking.model.provider.decide(inputOf(asking, request)), request);\n\nconst isRange = (location: Option.Option<LineRange>): location is Option.Some<LineRange> =>\n Option.exists(location, ({ start, end }) => start !== end);\n\nconst refineOnce = (\n { asking, match, ref, state }: Refinement,\n within: LineRange,\n): VerdictResult & { readonly next?: Option.Option<LineRange> } => {\n const questionId = locationRefOf(ref);\n const candidates = locationCandidates(match.snippet, within);\n const refined = fetchVerdicts(asking, {\n model: asking.model.model,\n state,\n questions: { [questionId]: locationQuestion(match, ref, candidates) },\n });\n if (!refined.ok) {\n return refined;\n }\n return {\n ...refined,\n next: selectedLocation(\n refined.verdicts.answers[questionId],\n candidates,\n match.rule.location.cutoff,\n ),\n };\n};\n\nconst refine = (refinement: Refinement, first: Option.Option<LineRange>): Located => {\n let location = first;\n while (isRange(location)) {\n const step = refineOnce(refinement, location.value);\n if (!step.ok) {\n return { loc: refinement.match.loc, failure: Option.some(step.reason) };\n }\n location = step.next ?? Option.none();\n }\n return {\n loc: Option.match(location, {\n onNone: () => refinement.match.loc,\n onSome: ({ start }) => locationOfLine(refinement.match.snippet, start),\n }),\n failure: Option.none(),\n };\n};\n\nconst locateMatch = (\n asking: Asking,\n match: Match,\n {\n ref,\n verdicts,\n request,\n }: { readonly ref: string; readonly verdicts: Verdicts; readonly request: DecisionRequest },\n): Located => {\n if (!locates(match)) {\n return { loc: match.loc, failure: Option.none() };\n }\n const first = selectedLocation(\n verdicts.answers[locationRefOf(ref)],\n locationCandidates(match.snippet),\n match.rule.location.cutoff,\n );\n return refine({ asking, match, ref, state: request.state }, first);\n};\n\nexport { inputOf, locateMatch, verdictsOf };\nexport type { Asking, Located, VerdictResult };\n","import type { Context, Location } from \"@oxlint/plugins\";\nimport { Array as Arr, Boolean as Bool, Option } from \"effect\";\n\nimport { isReported } from \"./answer.ts\";\nimport { explainerFor } from \"./explain.ts\";\nimport type { ExplainPass, Explainer, Outcome, Placed } from \"./explain.ts\";\nimport { inputOf, locateMatch, verdictsOf } from \"./locate.ts\";\nimport type { Asking, Located } from \"./locate.ts\";\nimport { OptionsError } from \"./options.ts\";\nimport { buildRequest, refAt } from \"./request.ts\";\nimport { failsInCi, warnOnce } from \"./runtime.ts\";\nimport type {\n DecideResult,\n DecisionProvider,\n DecisionRequest,\n Match,\n ModelRef,\n ResolvedOptions,\n Verdicts,\n} from \"./types.ts\";\n\ninterface ModelPass {\n readonly contextOf: (match: Match) => Context;\n readonly filename: string;\n readonly options: ResolvedOptions;\n readonly model: ModelRef;\n readonly matches: readonly Match[];\n readonly deadline: number;\n}\n\ninterface Failure {\n readonly match: Match;\n readonly loc: Location;\n readonly reason: string;\n}\n\ninterface Answered {\n readonly asking: Asking;\n readonly verdicts: Verdicts;\n readonly request: DecisionRequest;\n readonly cached: boolean | undefined;\n readonly explainer: Explainer;\n}\n\nconst DECIMALS = 2;\n\nconst degrade = (pass: ModelPass, reason: string): void => {\n if (failsInCi(pass.options)) {\n throw new OptionsError(`${reason} (${pass.filename})`);\n }\n warnOnce(reason, `${reason} (${pass.filename})`);\n};\n\nconst reportFailure = (pass: ModelPass, failure: Failure): void => {\n if (failsInCi(pass.options)) {\n pass.contextOf(failure.match).report({\n loc: failure.loc,\n messageId: \"unlocated\",\n data: { id: failure.match.rule.id, reason: failure.reason },\n });\n return;\n }\n warnOnce(failure.reason, `${failure.reason} (${pass.filename})`);\n};\n\nconst locate = (\n answered: Answered,\n match: Match,\n { ref, failed }: { readonly ref: string; readonly failed: boolean },\n): Located => {\n if (failed) {\n return { loc: match.loc, failure: Option.none() };\n }\n return locateMatch(answered.asking, match, { ...answered, ref });\n};\n\nconst outcomeOf = (answered: Answered, match: Match, ref: string): Outcome => {\n const verdict = Option.fromUndefinedOr(answered.verdicts.results[ref]);\n return {\n served: `${answered.asking.model.provider.name}/${answered.verdicts.model}`,\n cached: answered.cached,\n answers: answered.verdicts.answers,\n verdict,\n reported: Option.exists(verdict, (found) => isReported(match.rule, found)),\n };\n};\n\nconst reportMatch = (\n pass: ModelPass,\n answered: Answered,\n { match, ref, failed }: { readonly match: Match; readonly ref: string; readonly failed: boolean },\n): Option.Option<string> => {\n const outcome = outcomeOf(answered, match, ref);\n const { verdict } = outcome;\n if (!outcome.reported || Option.isNone(verdict)) {\n answered.explainer.outcome(match, { ref, loc: match.loc }, outcome);\n return Option.none();\n }\n const located = locate(answered, match, { ref, failed });\n const at: Placed = { ref, loc: located.loc };\n answered.explainer.outcome(match, at, outcome);\n pass.contextOf(match).report({\n loc: located.loc,\n messageId: \"yes\",\n data: {\n id: match.rule.id,\n model: `${pass.model.provider.name}/${answered.verdicts.model}`,\n answer: verdict.value.answer,\n score: verdict.value.probability.toFixed(DECIMALS),\n cutoff: match.rule.cutoff.toFixed(DECIMALS),\n question: match.rule.message ?? match.rule.question,\n },\n });\n return located.failure;\n};\n\nconst reportMatches = (pass: ModelPass, answered: Answered): Option.Option<Failure> => {\n let failure: Option.Option<Failure> = Option.none();\n for (const [index, match] of pass.matches.entries()) {\n const located = reportMatch(pass, answered, {\n match,\n ref: refAt(index),\n failed: Option.isSome(failure),\n });\n failure = Option.orElse(failure, () =>\n located.pipe(Option.map((reason) => ({ match, loc: match.loc, reason }))),\n );\n }\n return failure;\n};\n\nconst explainPassOf = (\n pass: ModelPass,\n { request, durationMs }: Pick<ExplainPass, \"request\" | \"durationMs\">,\n): ExplainPass => ({\n setting: pass.options.explain,\n cwd: Option.match(Arr.head(pass.matches), {\n onNone: () => \"\",\n onSome: (match) => pass.contextOf(match).cwd,\n }),\n filename: pass.filename,\n model: pass.model.id,\n request,\n durationMs,\n});\n\nconst explainerOf = (\n pass: ModelPass,\n timed: Pick<ExplainPass, \"request\" | \"durationMs\">,\n): Explainer => explainerFor(explainPassOf(pass, timed));\n\ninterface Prepared {\n readonly pass: ModelPass;\n readonly asking: Asking;\n readonly request: DecisionRequest;\n}\n\nconst prepare = (pass: ModelPass): Prepared => ({\n pass,\n asking: { model: pass.model, deadline: pass.deadline, env: pass.options.env },\n request: buildRequest(pass.model.model, pass.matches),\n});\n\nconst reportAnswer = (\n { pass, asking, request }: Prepared,\n { decided, durationMs }: { readonly decided: DecideResult; readonly durationMs: number },\n): void => {\n const explainer = explainerOf(pass, { request, durationMs });\n const result = verdictsOf(decided, request);\n if (!result.ok) {\n explainer.failure(pass.matches, result.reason);\n degrade(pass, result.reason);\n return;\n }\n Option.map(reportMatches(pass, { ...result, asking, request, explainer }), (failure) => {\n reportFailure(pass, failure);\n });\n};\n\nconst decideWith = (\n provider: DecisionProvider,\n prepared: readonly Prepared[],\n): readonly DecideResult[] => {\n const inputs = prepared.map(({ asking, request }) => inputOf(asking, request));\n return Option.match(Option.fromUndefinedOr(provider.decideAll), {\n onNone: () => inputs.map((input) => provider.decide(input)),\n onSome: (decideAll) => decideAll(inputs),\n });\n};\n\nconst reportProvider = (prepared: Arr.NonEmptyReadonlyArray<Prepared>): void => {\n const { provider } = Arr.headNonEmpty(prepared).pass.model;\n const started = performance.now();\n const results = decideWith(provider, prepared);\n const durationMs = Math.round(performance.now() - started);\n const answers = Bool.match(results.length === prepared.length, {\n onTrue: () => results,\n onFalse: () =>\n prepared.map((): DecideResult => ({\n ok: false,\n reason: `provider ${provider.name} returned ${String(results.length)} results for ${String(prepared.length)} requests`,\n })),\n });\n for (const [one, decided] of Arr.zip(prepared, answers)) {\n reportAnswer(one, { decided, durationMs });\n }\n};\n\nconst reportModels = (passes: readonly ModelPass[]): void => {\n const byProvider = Arr.groupBy(\n passes.map((pass) => prepare(pass)),\n ({ pass }) => pass.model.provider.name,\n );\n for (const prepared of Object.values(byProvider)) {\n reportProvider(prepared);\n }\n};\n\nexport { reportModels };\nexport type { ModelPass };\n","import type { Context, VisitorWithHooks } from \"@oxlint/plugins\";\nimport { Array as Arr, Option, Predicate } from \"effect\";\n\nimport { commentedSnippetOf, contextOf, lacksComment } from \"./context.ts\";\nimport { isSelected } from \"./name.ts\";\nimport { OptionsError, REPORT_LOC, TARGET_NODE_TYPES, snippetNodeFor } from \"./options.ts\";\nimport { reportModels } from \"./report.ts\";\nimport type { ModelPass } from \"./report.ts\";\nimport { truncateSnippet } from \"./request.ts\";\nimport { envNameOf, envOf, failsInCi, warnOnce } from \"./runtime.ts\";\nimport type {\n AstNode,\n DecisionProvider,\n Match,\n ModelRef,\n ResolvedOptions,\n ResolvedRule,\n SelectedNode,\n Target,\n} from \"./types.ts\";\n\ninterface Collected {\n readonly options: ResolvedOptions;\n readonly contexts: Readonly<Record<string, Context>>;\n readonly rules: Readonly<Record<string, ResolvedRule>>;\n readonly matches: readonly Match[];\n}\n\ninterface FileBatch extends Collected {\n readonly contexts: Record<string, Context>;\n readonly rules: Record<string, ResolvedRule>;\n readonly matches: Match[];\n exiting: boolean;\n exits: number;\n}\n\ninterface RuleFile {\n readonly batch: FileBatch;\n readonly rule: ResolvedRule;\n}\n\ninterface SharedFile {\n readonly join: (context: Context, id: string) => RuleFile;\n readonly leave: () => void;\n}\n\ntype OptionsFor = (settings: Readonly<Record<string, unknown>>) => ResolvedOptions;\n\ntype RuleFor = (rule: ResolvedRule, options: unknown) => ResolvedRule;\n\nconst raisedMissing = new Set<string>();\n\nconst missingEnvOf = (options: ResolvedOptions, provider: DecisionProvider): readonly string[] =>\n provider.requiredEnv\n .map((name) => envNameOf(options.env, name))\n .filter((name) => Option.isNone(envOf(name)));\n\nconst isAvailable = (options: ResolvedOptions, { provider }: ModelRef): boolean => {\n const missingNames = missingEnvOf(options, provider);\n if (Arr.isReadonlyArrayEmpty(missingNames)) {\n return true;\n }\n const missing = missingNames.join(\", \");\n if (!failsInCi(options)) {\n warnOnce(`missing:${provider.name}`, `${missing} is not set, skipping ${provider.name} models`);\n } else if (!raisedMissing.has(provider.name)) {\n raisedMissing.add(provider.name);\n throw new OptionsError(`${missing} is not set`);\n }\n return false;\n};\n\nconst availableModels = (batch: Collected): readonly ModelRef[] =>\n [\n ...new Map(\n Object.values(batch.rules)\n .flatMap((rule) => rule.models)\n .map((model) => [model.id, model]),\n ).values(),\n ].filter((model) => isAvailable(batch.options, model));\n\nconst snippetOf = (context: Context, node: AstNode): string => {\n if (node.type === \"Program\") {\n return context.sourceCode.text;\n }\n return context.sourceCode.getText(node);\n};\n\nconst namedSnippetOf = (context: Context, node: AstNode): string => {\n const named = snippetNodeFor(node);\n if (named === node) {\n return snippetOf(context, node);\n }\n return context.sourceCode.getText(named);\n};\n\nconst matchOf = (\n context: Context,\n node: AstNode,\n { rule, options }: { readonly rule: ResolvedRule; readonly options: ResolvedOptions },\n): Match => {\n const text = Option.getOrElse(commentedSnippetOf(context, node, rule), () =>\n namedSnippetOf(context, node),\n );\n const surrounding = contextOf(context, node, rule.context ?? { scope: \"node\" });\n return {\n ...Option.match(surrounding, { onNone: () => ({}), onSome: (value) => ({ context: value }) }),\n rule,\n loc: REPORT_LOC[rule.target](node, snippetOf(context, node)),\n snippet: truncateSnippet(text, options.maxSnippetChars),\n truncated: text.length > options.maxSnippetChars,\n };\n};\n\nconst contextOfRule = (batch: Collected, id: string): Context =>\n Option.getOrThrow(Option.fromUndefinedOr(batch.contexts[id]));\n\nconst finish = (batch: Collected): void => {\n const [first] = Object.values(batch.contexts);\n if (Predicate.isUndefined(first)) {\n return;\n }\n const deadline = Date.now() + batch.options.timeoutMs;\n const passes = availableModels(batch).flatMap((model): readonly ModelPass[] => {\n const matches = batch.matches.filter(({ rule }) =>\n rule.models.some(({ id }) => id === model.id),\n );\n return Arr.match(matches, {\n onEmpty: () => [],\n onNonEmpty: (some) => [\n {\n contextOf: (match) => contextOfRule(batch, match.rule.id),\n filename: first.filename,\n options: batch.options,\n model,\n matches: some,\n deadline,\n },\n ],\n });\n });\n reportModels(passes);\n};\n\nconst ruleIn = (batch: Collected, id: string): ResolvedRule =>\n Option.getOrThrow(Arr.findFirst(batch.options.rules, (rule) => rule.id === id));\n\nconst sharedFile = (optionsFor: OptionsFor, ruleFor: RuleFor): SharedFile => {\n let current: Option.Option<FileBatch> = Option.none();\n const start = (context: Context): FileBatch => {\n const batch: FileBatch = {\n options: optionsFor(context.settings),\n contexts: {},\n rules: {},\n matches: [],\n exiting: false,\n exits: 0,\n };\n current = Option.some(batch);\n return batch;\n };\n return {\n join: (context, id) => {\n const batch = Option.match(current, {\n onNone: () => start(context),\n onSome: (open) => {\n if (open.exiting) {\n return start(context);\n }\n return open;\n },\n });\n const [options] = context.options;\n const rule = ruleFor(ruleIn(batch, id), options);\n batch.contexts[id] = context;\n batch.rules[id] = rule;\n return { batch, rule };\n },\n leave: () => {\n if (Option.isNone(current)) {\n return;\n }\n const batch = current.value;\n batch.exits += 1;\n if (batch.exits >= Object.keys(batch.contexts).length) {\n current = Option.none();\n }\n if (!batch.exiting) {\n batch.exiting = true;\n finish(batch);\n }\n },\n };\n};\n\ntype Visited = SelectedNode & AstNode;\n\nconst isSkipped = (context: Context, node: Visited, rule: ResolvedRule): boolean =>\n !isSelected(context, node, rule) || lacksComment(context, node, rule);\n\nconst visitorFor =\n (shared: SharedFile, { id, target }: { readonly id: string; readonly target: Target }) =>\n (context: Context): VisitorWithHooks => {\n let file: Option.Option<RuleFile> = Option.none();\n\n const collect = (node: Visited): void => {\n if (Option.isNone(file)) {\n return;\n }\n const { batch, rule } = file.value;\n if (isSkipped(context, node, rule)) {\n return;\n }\n batch.matches.push(matchOf(context, node, { rule, options: batch.options }));\n };\n\n const nodeTypes: readonly string[] = TARGET_NODE_TYPES[target];\n\n return {\n ...Object.fromEntries(nodeTypes.map((type) => [type, collect])),\n Program: (node: Visited): void => {\n file = Option.some(shared.join(context, id));\n if (target === \"file\") {\n collect(node);\n }\n },\n \"Program:exit\": (): void => {\n file = Option.none();\n shared.leave();\n },\n };\n };\n\nexport { sharedFile, visitorFor };\nexport type { Collected, FileBatch, OptionsFor, RuleFile, RuleFor, SharedFile };\n","import type { Plugin, RuleMeta } from \"@oxlint/plugins\";\nimport { Predicate } from \"effect\";\n\nimport { openRouter } from \"./openrouter.ts\";\nimport { PREFIX, checkRules, resolveOptions } from \"./options.ts\";\nimport { RULE_OPTIONS_SCHEMA, overrideRule } from \"./override.ts\";\nimport type {\n DecisionOptions,\n DecisionPlugin,\n DecisionPluginSetup,\n DecisionProvider,\n DecisionRule,\n ResolvedOptions,\n ResolvedRule,\n} from \"./types.ts\";\nimport { sharedFile, visitorFor } from \"./visitor.ts\";\n\nconst DEFAULT_NAME = \"decision\";\n\nconst metaOf = (rule: DecisionRule): RuleMeta => ({\n type: \"problem\",\n docs: { description: rule.question },\n schema: RULE_OPTIONS_SCHEMA,\n messages: {\n yes: \"[{{id}}] {{model}} answered {{answer}} ({{score}} >= {{cutoff}}): {{question}}\",\n unlocated: `${PREFIX}: {{reason}} while refining the location of [{{id}}]; the finding is reported at the file level`,\n },\n});\n\nconst SETUP_ONLY: ReadonlySet<string> = new Set([\"name\", \"rules\", \"providers\"]);\n\nconst optionsOf = (setup: DecisionPluginSetup): DecisionOptions =>\n Object.fromEntries(Object.entries(setup).filter(([key]) => !SETUP_ONLY.has(key)));\n\ntype Resolve = (settings: unknown) => ResolvedOptions;\n\nconst memoized = (resolve: Resolve): Resolve => {\n const resolved = new Map<string, ResolvedOptions>();\n return (settings) => {\n const key = JSON.stringify([settings]);\n const cached = resolved.get(key);\n if (Predicate.isNotUndefined(cached)) {\n return cached;\n }\n const fresh = resolve(settings);\n resolved.set(key, fresh);\n return fresh;\n };\n};\n\nconst memoizedRules = (\n providers: Readonly<Record<string, DecisionProvider>>,\n): ((rule: ResolvedRule, options: unknown) => ResolvedRule) => {\n const resolved = new WeakMap<ResolvedRule, Map<string, ResolvedRule>>();\n return (rule, options) => {\n const known = resolved.get(rule) ?? new Map<string, ResolvedRule>();\n resolved.set(rule, known);\n const key = JSON.stringify([options]);\n const cached = known.get(key);\n if (Predicate.isNotUndefined(cached)) {\n return cached;\n }\n const fresh = overrideRule(rule, options, providers);\n known.set(key, fresh);\n return fresh;\n };\n};\n\nconst createDecisionPlugin = (setup: DecisionPluginSetup): DecisionPlugin => {\n const name = setup.name ?? DEFAULT_NAME;\n const providers: Readonly<Record<string, DecisionProvider>> = Object.fromEntries(\n [openRouter, ...(setup.providers ?? [])].map((provider) => [provider.name, provider]),\n );\n const rules = checkRules(setup.rules);\n const options = optionsOf(setup);\n const resolve = memoized((settings) => resolveOptions({ options, settings }, rules, providers));\n resolve({});\n const shared = sharedFile((settings) => resolve(settings[name]), memoizedRules(providers));\n\n return {\n meta: { name },\n rules: Object.fromEntries(\n rules.map((rule) => [rule.id, { meta: metaOf(rule), createOnce: visitorFor(shared, rule) }]),\n ),\n } satisfies Plugin;\n};\n\nexport { createDecisionPlugin };\n"],"mappings":";;;;AAEA,MAAM,sBAAuD,SAAqB;AAElF,MAAM,kBAA2D,aAC/D;;ACEF,MAAM,cAAc;AACpB,MAAM,kBAAkB;AAQxB,MAAM,0BAAU,IAAI,IAAmC;AAEvD,MAAM,mBAAoC;CACxC,MAAM,WAAW,QAAQ,IAAI,YAAY;CACzC,IAAI,UACF,OAAO;CAET,MAAM,UAAU,aAAqB,IAAI,IAAI,yBAAyB,YAAY,GAAG,GAAG,EACtF,SAAS,YACX,CAAC;CACD,QAAQ,IAAI,cAAc,OAAO;CACjC,OAAO;AACT;AAEA,MAAM,YAAY,UAA2B;CAC3C,MAAM,UAAU,UAAU,KAAK;CAC/B,IAAI,YAAY,iBACd,OAAO;CAET,OAAO,YAAY;AACrB;AAEA,MAAM,OAAO,WACX,UACE,OAAO,WAAW,WAAW,CAAC,CAAC,MAAM,CAAC,IACrC,UACC,KACE,QACAA,MAAI,WAAyB;CAAE,IAAI;CAAO,QAAQ,SAAS,KAAK;AAAE,EAAE,CACtE,CACJ;AAEF,MAAM,aAA+B;CACnC,MAAM;CACN,aAAa,CAAC,oBAAoB;CAClC,SAAS,UAAUA,MAAI,aAAa,IAAI,CAAC,KAAK,CAAC,CAAC;CAChD,YAA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