@r_masseater/oxlint-plugin-decision 0.0.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r_masseater/oxlint-plugin-decision",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "description": "Oxlint JS plugin that lints code with plain-English rules answered by decision models on OpenRouter.",
5
5
  "keywords": [
6
6
  "decision-model",
@@ -10,14 +10,14 @@
10
10
  "oxlint-plugin",
11
11
  "tanstack-intent"
12
12
  ],
13
- "homepage": "https://github.com/masseater/oxlint-plugin-decision#readme",
13
+ "homepage": "https://github.com/masseater/lint-kit/tree/main/libs/oxlint-plugin-decision#readme",
14
14
  "bugs": {
15
- "url": "https://github.com/masseater/oxlint-plugin-decision/issues"
15
+ "url": "https://github.com/masseater/lint-kit/issues"
16
16
  },
17
17
  "license": "MIT",
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "git+https://github.com/masseater/oxlint-plugin-decision.git",
20
+ "url": "git+https://github.com/masseater/lint-kit.git",
21
21
  "directory": "libs/oxlint-plugin-decision"
22
22
  },
23
23
  "files": [
@@ -40,26 +40,26 @@
40
40
  "provenance": true
41
41
  },
42
42
  "dependencies": {
43
- "@effect/platform-node": "4.0.0",
44
- "@openrouter/sdk": "1.4.25",
45
- "effect": "4.0.0",
46
- "synckit": "0.12.1"
43
+ "@effect/platform-node": "4.1.1",
44
+ "@openrouter/sdk": "1.5.33",
45
+ "effect": "4.1.1",
46
+ "synckit": "0.12.3"
47
47
  },
48
48
  "devDependencies": {
49
- "@effect/tsgo": "0.50.0",
50
- "@effect/vitest": "4.0.0",
51
- "@oxlint/plugins": "1.87.0",
52
- "@types/node": "26.6.5",
53
- "@vitest/coverage-v8": "5.0.3",
54
- "oxlint": "1.87.0",
49
+ "@effect/tsgo": "0.63.0",
50
+ "@effect/vitest": "4.1.1",
51
+ "@oxlint/plugins": "1.90.0",
52
+ "@types/node": "26.6.6",
53
+ "@vitest/coverage-v8": "5.0.5",
54
+ "oxlint": "1.90.0",
55
55
  "typescript": "7.0.2",
56
- "vite-plus": "1.1.0"
56
+ "vite-plus": "1.4.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "oxlint": ">=1.87.0"
60
60
  },
61
61
  "engines": {
62
- "node": ">=20"
62
+ "node": ">=26"
63
63
  },
64
64
  "scripts": {
65
65
  "build": "vp pack",
@@ -90,7 +90,7 @@ The package ships no rules. You write each rule as a yes/no (or pick-one) questi
90
90
 
91
91
  There is no other target and no selector syntax. With the default `boolean` answer, "yes" means "report this", so phrase the question so that yes is the violation. The wording is the rule: "Does this send personal data" also fires on a legitimate `mailer.send(user.email, ...)`, while "to a log or console" does not. Questions and messages are English sentences. `message` replaces the question in the diagnostic with a short sentence.
92
92
 
93
- Rule fields: `id` (lowercase words joined by hyphens, unique in the plugin), `target`, `question`, `cutoff` (0 to 1, inclusive), and optional `message`, `select`, `answer`, `context`, `model`, and `location` (file rules only).
93
+ Rule fields: `id` (lowercase words joined by hyphens, unique in the plugin), `target`, `question`, `cutoff` (0.8 to 1, inclusive), and optional `message`, `select`, `answer`, `context`, `model`, and `location` (file rules only).
94
94
 
95
95
  ### Narrow matches with `select` before any request
96
96
 
@@ -105,7 +105,7 @@ defineDecisionRule({
105
105
  node.callee.type === "Identifier" &&
106
106
  ["it", "test"].includes(node.callee.name),
107
107
  question: "Would this test still pass if the behaviour its name claims were broken?",
108
- cutoff: 0.7,
108
+ cutoff: 0.8,
109
109
  });
110
110
  ```
111
111
 
@@ -119,7 +119,7 @@ defineDecisionRule({
119
119
  id: "stale-comment",
120
120
  target: "function",
121
121
  question: "How does the comment right above this function relate to what the function does?",
122
- cutoff: 0.7,
122
+ cutoff: 0.8,
123
123
  context: { scope: "comment" },
124
124
  answer: {
125
125
  kind: "classify",
@@ -137,7 +137,7 @@ defineDecisionRule({
137
137
  id: "security-smell",
138
138
  target: "function",
139
139
  question: "Does this function handle untrusted input in a way that could be exploited?",
140
- cutoff: 0.6,
140
+ cutoff: 0.8,
141
141
  answer: { kind: "severity", minimum: "warn" },
142
142
  });
143
143
  ```
@@ -158,7 +158,7 @@ With `{ scope: "comment" }`, a match without a comment directly above it (or abo
158
158
 
159
159
  ### Point a file rule at a line
160
160
 
161
- A `"file"` rule can add `location: { question, cutoff }` to move the diagnostic from the first line to the suspected violation. The location `cutoff` must be greater than 0.5 and at most 1. An uncertain location, or a file cut by `maxSnippetChars`, keeps the first-line diagnostic.
161
+ A `"file"` rule can add `location: { question, cutoff }` to move the diagnostic from the first line to the suspected violation. The location `cutoff` must be from 0.8 to 1. An uncertain location, or a file cut by `maxSnippetChars`, keeps the first-line diagnostic.
162
162
 
163
163
  ### Set models and plugin settings
164
164
 
@@ -22,7 +22,7 @@ A changed question, snippet, context, or answer kind re-asks that file. A change
22
22
  ## Switching or mixing models
23
23
 
24
24
  - Probabilities are not calibrated the same across models; re-tune cutoffs after switching, and pin a versioned model id once tuned.
25
- - `openrouter/respan/span-01-lite` is free and a cheap way to try rules. Respan models answer yes/no only: the plugin splits `classify` into one yes/no per label (highest yes wins), `severity` into "at least info/warn/error" (the most serious level at 0.5 or above wins), and asks about one match per request.
25
+ - `openrouter/respan/span-01-lite` is free and a cheap way to try rules. Respan models answer yes/no only: the plugin splits `classify` into one yes/no per label (highest yes wins), `severity` into "at least info/warn/error" (the most serious level at 0.8 or above wins), and asks about one match per request.
26
26
  - Override one rule's model in `oxlint.config.ts` without touching the plugin file: `"team/stale-comment": ["warn", { model: "openrouter/~typesafe/jev-latest" }]`. Rules on different models are asked in separate requests and cached separately.
27
27
 
28
28
  ## Cache
@@ -1 +0,0 @@
1
- {"version":3,"file":"wire-BGb5iQa9.mjs","names":["Probability","FIRST_LINE","Arr","Str","Str","Bool","Num","Arr","choiceQuestionsOf","Str","Arr","Num","Bool"],"sources":["../src/answer.ts","../src/options.ts","../src/runtime.ts","../src/request.ts","../src/wire.ts"],"sourcesContent":["import { Option, Result, Schema } from \"effect\";\n\nimport type {\n Answer,\n ChoiceAnswer,\n NoulAnswer,\n Question,\n RuleAnswer,\n Severity,\n Verdict,\n} from \"./types.ts\";\n\nconst YES = \"yes\";\nconst DEFAULT_MINIMUM: Severity = \"warn\";\nconst MINIMUM_LABELS = 2;\n\nconst SEVERITY_CRITERIA = {\n none: \"No problem\",\n info: \"Worth noting, but not a problem\",\n warn: \"Likely a problem\",\n error: \"Clearly a problem\",\n} as const;\n\nconst SEVERITY_ORDER: readonly string[] = Object.keys(SEVERITY_CRITERIA);\n\nconst Probability = Schema.Number.check(Schema.isBetween({ minimum: 0, maximum: 1 }));\n\nconst Label = Schema.NonEmptyString;\n\nconst BooleanAnswer = Schema.Struct({ kind: Schema.Literal(\"boolean\") });\n\nconst ClassifyAnswer = Schema.Struct({\n kind: Schema.Literal(\"classify\"),\n labels: Schema.Record(Label, Schema.String).check(Schema.isMinProperties(MINIMUM_LABELS)),\n report: Schema.NonEmptyArray(Label),\n}).check(\n Schema.makeFilter(({ labels, report }) => report.every((label) => Object.hasOwn(labels, label)), {\n message: \"every label in report must be one of labels\",\n }),\n);\n\nconst SeverityAnswer = Schema.Struct({\n kind: Schema.Literal(\"severity\"),\n minimum: Schema.optionalKey(Schema.Literals([\"info\", \"warn\", \"error\"])),\n});\n\nconst RuleAnswerSchema = Schema.Union([BooleanAnswer, ClassifyAnswer, SeverityAnswer]);\n\nconst BOOLEAN_ANSWER: RuleAnswer = { kind: \"boolean\" };\n\nconst decodeAnswer = Schema.decodeUnknownResult(RuleAnswerSchema);\n\nconst decodeRuleAnswer = (answer: unknown): Result.Result<RuleAnswer, string> => {\n const decoded = decodeAnswer(answer);\n if (Result.isSuccess(decoded)) {\n return Result.succeed(decoded.success);\n }\n return Result.fail(decoded.failure.message);\n};\n\nconst NoulAnswerSchema = Schema.Struct({ type: Schema.Literal(\"noul\"), noul: Probability });\n\nconst ChoiceAnswerSchema = Schema.Struct({\n type: Schema.Literal(\"choice\"),\n choice: Schema.String,\n probabilities: Schema.optional(Schema.Record(Schema.String, Probability)),\n});\n\nconst AnswerSchema = Schema.Union([NoulAnswerSchema, ChoiceAnswerSchema]);\n\nconst decodeNoul = Schema.decodeOption(NoulAnswerSchema);\n\nconst decodeChoice = Schema.decodeOption(ChoiceAnswerSchema);\n\nconst isNoul = (answer: Answer): answer is NoulAnswer => answer.type === \"noul\";\n\nconst isChoice = (answer: Answer): answer is ChoiceAnswer => answer.type === \"choice\";\n\nconst noulOf = (answer: Answer | undefined): Option.Option<NoulAnswer> =>\n Option.fromUndefinedOr(answer).pipe(Option.filter(isNoul), Option.flatMap(decodeNoul));\n\nconst choiceOf = (answer: Answer | undefined): Option.Option<ChoiceAnswer> =>\n Option.fromUndefinedOr(answer).pipe(Option.filter(isChoice), Option.flatMap(decodeChoice));\n\nconst probabilityOfChoice = ({ choice, probabilities }: ChoiceAnswer): Option.Option<number> =>\n Option.fromUndefinedOr(probabilities).pipe(\n Option.flatMap((byLabel) => Option.fromUndefinedOr(byLabel[choice])),\n );\n\nconst questionFor = (answer: RuleAnswer, instructions: string): Question => {\n switch (answer.kind) {\n case \"classify\": {\n return {\n type: \"choice\",\n instructions: `${instructions} Select the label that fits best.`,\n criteria: answer.labels,\n };\n }\n case \"severity\": {\n return {\n type: \"choice\",\n instructions: `${instructions} Rate how serious the problem is, and select none if there is no problem.`,\n criteria: SEVERITY_CRITERIA,\n };\n }\n case \"boolean\": {\n return { type: \"noul\", instructions };\n }\n default: {\n return { type: \"noul\", instructions };\n }\n }\n};\n\nconst choiceVerdictOf = (\n criteria: Readonly<Record<string, unknown>>,\n answer: Answer | undefined,\n): Option.Option<Verdict> =>\n choiceOf(answer).pipe(\n Option.filter(({ choice }) => Object.hasOwn(criteria, choice)),\n Option.flatMap((chosen) =>\n Option.map(probabilityOfChoice(chosen), (probability) => ({\n answer: chosen.choice,\n probability,\n })),\n ),\n );\n\nconst verdictOf = (question: Question, answer: Answer | undefined): Option.Option<Verdict> => {\n if (question.type === \"choice\") {\n return choiceVerdictOf(question.criteria, answer);\n }\n return noulOf(answer).pipe(Option.map(({ noul }) => ({ answer: YES, probability: noul })));\n};\n\nconst rankOf = (label: string): number => SEVERITY_ORDER.indexOf(label);\n\nconst severityMatches = (\n { minimum = DEFAULT_MINIMUM }: { readonly minimum?: Severity },\n label: string,\n): boolean => rankOf(label) >= rankOf(minimum);\n\nconst answerMatches = (answer: RuleAnswer, label: string): boolean => {\n switch (answer.kind) {\n case \"classify\": {\n return answer.report.includes(label);\n }\n case \"severity\": {\n return severityMatches(answer, label);\n }\n case \"boolean\": {\n return label === YES;\n }\n default: {\n return false;\n }\n }\n};\n\nconst isReported = (\n rule: { readonly answer: RuleAnswer; readonly cutoff: number },\n verdict: Verdict,\n): boolean => verdict.probability >= rule.cutoff && answerMatches(rule.answer, verdict.answer);\n\nexport {\n AnswerSchema,\n BOOLEAN_ANSWER,\n SEVERITY_ORDER,\n choiceOf,\n decodeRuleAnswer,\n isReported,\n noulOf,\n probabilityOfChoice,\n questionFor,\n verdictOf,\n};\n","import type { Location } from \"@oxlint/plugins\";\nimport { Array as Arr, Option, Predicate, Result, Schema, String as Str } from \"effect\";\n\nimport { BOOLEAN_ANSWER, decodeRuleAnswer } from \"./answer.ts\";\nimport type {\n AstNode,\n DecisionOptions,\n DecisionProvider,\n DecisionRule,\n ModelRef,\n ModelSpec,\n ResolvedOptions,\n ResolvedRule,\n RuleAnswer,\n Target,\n} from \"./types.ts\";\n\nconst PREFIX = \"oxlint-plugin-decision\";\nconst PROVIDER_SEPARATOR = \"/\";\nconst FIRST_LINE = 1;\nconst ONE_RULE = 1;\nconst FIRST_COLUMN = 0;\n\nconst TARGET_NODE_TYPES = {\n function: [\"FunctionDeclaration\", \"FunctionExpression\", \"ArrowFunctionExpression\"],\n call: [\"CallExpression\"],\n jsx: [\"JSXElement\"],\n file: [\"Program\"],\n} as const satisfies Readonly<Record<Target, readonly string[]>>;\n\nconst NAMED_PARENTS = {\n VariableDeclarator: \"init\",\n Property: \"value\",\n MethodDefinition: \"value\",\n PropertyDefinition: \"value\",\n} as const;\n\ntype NamedField = (typeof NAMED_PARENTS)[keyof typeof NAMED_PARENTS];\n\nconst isNamedParentType = (type: string): type is keyof typeof NAMED_PARENTS =>\n Object.hasOwn(NAMED_PARENTS, type);\n\nconst ANONYMOUS_FUNCTIONS: ReadonlySet<string> = new Set([\n \"FunctionExpression\",\n \"ArrowFunctionExpression\",\n]);\n\nconst holdsAsName = (parent: AstNode, node: AstNode): boolean => {\n if (!isNamedParentType(parent.type)) {\n return false;\n }\n const field: NamedField = NAMED_PARENTS[parent.type];\n return ANONYMOUS_FUNCTIONS.has(node.type) && parent[field] === node;\n};\n\nconst snippetNodeFor = (node: AstNode): AstNode =>\n Option.fromNullishOr(node.parent).pipe(\n Option.filter((parent) => holdsAsName(parent, node)),\n Option.getOrElse((): AstNode => node),\n );\n\nconst DEFAULTS = {\n ci: \"fail\",\n timeoutMs: 10_000,\n maxSnippetChars: 4000,\n model: \"openrouter/~typesafe/jev-latest\",\n env: {},\n explain: false,\n} as const satisfies Required<DecisionOptions>;\n\nconst isSelector = (input: unknown): input is DecisionRule[\"select\"] => Predicate.isFunction(input);\n\nconst RULE_ID = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;\n\nconst ModelSpecSchema = Schema.Union([\n Schema.NonEmptyString,\n Schema.NonEmptyArray(Schema.NonEmptyString),\n]);\n\nconst NONE = 0;\nconst ONE = 1;\nconst EVEN_ODDS = 0.5;\n\nconst NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(NONE));\n\nconst PositiveInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(ONE));\n\nconst RuleId = Schema.NonEmptyString.check(\n Schema.isPattern(RULE_ID, { message: \"id must be lowercase words joined by hyphens\" }),\n);\n\nconst Probability = Schema.Number.check(Schema.isBetween({ minimum: NONE, maximum: ONE }));\n\nconst LocationCutoff = Schema.Number.check(\n Schema.isBetween({ minimum: EVEN_ODDS, maximum: ONE, exclusiveMinimum: true }),\n);\n\nconst RuleContextSchema = Schema.Union([\n Schema.Struct({ scope: Schema.Literals([\"node\", \"file\", \"comment\"]) }),\n Schema.Struct({\n scope: Schema.Literal(\"lines\"),\n before: Schema.optionalKey(NonNegativeInt),\n after: Schema.optionalKey(NonNegativeInt),\n }),\n Schema.Struct({\n scope: Schema.Literal(\"enclosing\"),\n kind: Schema.Literals([\"function\", \"class\", \"block\"]),\n }),\n]);\n\nconst ExplainSetting = Schema.Union([Schema.Boolean, Schema.Literals([\"text\", \"json\"])]);\n\nconst OptionsSchema = Schema.Struct({\n ci: Schema.optionalKey(Schema.Literals([\"skip\", \"fail\"])),\n timeoutMs: Schema.optionalKey(PositiveInt),\n maxSnippetChars: Schema.optionalKey(PositiveInt),\n model: Schema.optionalKey(ModelSpecSchema),\n env: Schema.optionalKey(Schema.Record(Schema.NonEmptyString, Schema.NonEmptyString)),\n explain: Schema.optionalKey(ExplainSetting),\n});\n\nconst RuleSchema = Schema.Struct({\n id: RuleId,\n target: Schema.Literals([\"function\", \"call\", \"jsx\", \"file\"]),\n question: Schema.NonEmptyString,\n cutoff: Probability,\n message: Schema.optionalKey(Schema.NonEmptyString),\n select: Schema.optionalKey(Schema.declare(isSelector)),\n location: Schema.optionalKey(\n Schema.Struct({ question: Schema.NonEmptyString, cutoff: LocationCutoff }),\n ),\n model: Schema.optionalKey(ModelSpecSchema),\n context: Schema.optionalKey(RuleContextSchema),\n answer: Schema.optionalKey(Schema.Unknown),\n});\n\nconst STRICT = { onExcessProperty: \"error\" } as const;\n\nconst decodeOptions = Schema.decodeUnknownResult(OptionsSchema, STRICT);\nconst decodeRule = Schema.decodeUnknownResult(RuleSchema, STRICT);\n\nclass OptionsError extends Error {\n public constructor(message: string) {\n super(`${PREFIX}: ${message}`);\n this.name = \"OptionsError\";\n }\n}\n\nconst modelIdsOf = (spec: ModelSpec): readonly string[] => Arr.dedupe(Arr.ensure(spec));\n\nconst splitModelId = (id: string): Option.Option<readonly [string, string]> => {\n const [provider, ...rest] = Str.split(id, PROVIDER_SEPARATOR);\n const model = rest.join(PROVIDER_SEPARATOR);\n return Option.liftPredicate(\n [provider, model] as const,\n ([left, right]) => Str.isNonEmpty(left) && Str.isNonEmpty(right),\n );\n};\n\nconst resolveModel = (\n id: string,\n providers: Readonly<Record<string, DecisionProvider>>,\n): ModelRef =>\n splitModelId(id).pipe(\n Option.flatMap(([name, model]) =>\n Option.map(Option.fromUndefinedOr(providers[name]), (provider) => ({\n id,\n provider,\n model,\n })),\n ),\n Option.getOrThrowWith(\n () =>\n new OptionsError(\n `model \"${id}\" must be \"<provider>/<model>\" with a provider from: ${Object.keys(providers).join(\", \")}`,\n ),\n ),\n );\n\nconst duplicateIdOf = (rules: readonly DecisionRule[]): Option.Option<string> =>\n Arr.findFirst(\n Object.entries(Arr.groupBy(rules, ({ id }) => id)),\n ([, same]) => same.length > ONE_RULE,\n ).pipe(Option.map(([id]) => id));\n\nconst answerOf = (rule: DecisionRule): RuleAnswer => {\n if (Predicate.isUndefined(rule.answer)) {\n return BOOLEAN_ANSWER;\n }\n return Result.getOrThrowWith(\n decodeRuleAnswer(rule.answer),\n (issue) => new OptionsError(`rule \"${rule.id}\" has an invalid answer: ${issue}`),\n );\n};\n\ntype Decode<Value> = (input: unknown) => Result.Result<Value, Schema.SchemaError>;\n\nconst checked = <Value>(decode: Decode<Value>, input: unknown, what: string): Value =>\n Result.getOrThrowWith(\n decode(input),\n (issue) => new OptionsError(`invalid ${what}: ${issue.message}`),\n );\n\nconst checkRule = (rule: DecisionRule): DecisionRule => {\n checked(decodeRule, rule, `rule \"${rule.id}\"`);\n if (Predicate.isNotUndefined(rule.location) && rule.target !== \"file\") {\n throw new OptionsError(\"location is supported only for file rules\");\n }\n answerOf(rule);\n return rule;\n};\n\nconst checkRules = (rules: readonly DecisionRule[]): readonly DecisionRule[] => {\n if (!Arr.isReadonlyArrayNonEmpty(rules)) {\n throw new OptionsError(\"rules must list at least one rule\");\n }\n Option.map(duplicateIdOf(rules), (duplicate) => {\n throw new OptionsError(`rule id \"${duplicate}\" is used more than once`);\n });\n return rules.map((rule) => checkRule(rule));\n};\n\nconst resolveRule =\n (fallback: ModelSpec, providers: Readonly<Record<string, DecisionProvider>>) =>\n (rule: DecisionRule): ResolvedRule => ({\n ...rule,\n answer: answerOf(rule),\n models: modelIdsOf(rule.model ?? fallback).map((id) => resolveModel(id, providers)),\n });\n\ninterface Sources {\n readonly options: DecisionOptions;\n readonly settings?: unknown;\n}\n\nconst settingsFrom = (settings: unknown): DecisionOptions => {\n if (Predicate.isUndefined(settings)) {\n return {};\n }\n return checked(decodeOptions, settings, \"settings\");\n};\n\nconst resolveOptions = (\n { options, settings }: Sources,\n rules: readonly DecisionRule[],\n providers: Readonly<Record<string, DecisionProvider>>,\n): ResolvedOptions => {\n const fromCode = checked(decodeOptions, options, \"createDecisionPlugin options\");\n const { model, ...merged } = { ...DEFAULTS, ...fromCode, ...settingsFrom(settings) };\n return {\n ci: merged.ci,\n timeoutMs: merged.timeoutMs,\n maxSnippetChars: merged.maxSnippetChars,\n env: merged.env,\n explain: merged.explain,\n rules: checkRules(rules).map((rule) => resolveRule(model, providers)(rule)),\n };\n};\n\nconst headOf = (text: string, line: number, column: number): Location => {\n const [first] = Str.split(text, \"\\n\");\n return { start: { line, column }, end: { line, column: column + first.length } };\n};\n\nconst REPORT_LOC = {\n function: (node: AstNode, text: string): Location =>\n headOf(text, node.loc.start.line, node.loc.start.column),\n call: (node: AstNode): Location => node.loc,\n jsx: (node: AstNode): Location =>\n Option.getOrElse(Option.fromNullishOr(node.openingElement), () => node).loc,\n file: (_node: AstNode, text: string): Location => headOf(text, FIRST_LINE, FIRST_COLUMN),\n} as const satisfies Readonly<Record<Target, (node: AstNode, text: string) => Location>>;\n\nexport type { Decode, Sources };\nexport {\n checkRules,\n NAMED_PARENTS,\n OptionsError,\n PREFIX,\n REPORT_LOC,\n ModelSpecSchema,\n STRICT,\n TARGET_NODE_TYPES,\n checked,\n modelIdsOf,\n resolveModel,\n resolveOptions,\n snippetNodeFor,\n};\n","import { Cause, Config, Console, Effect, Exit, Option, String as Str } from \"effect\";\n\nimport { PREFIX } from \"./options.ts\";\nimport type { ResolvedOptions } from \"./types.ts\";\n\nconst runOrElse = <Value>(\n effect: Effect.Effect<Value, unknown>,\n fallback: (error: unknown) => Value,\n): Value =>\n Exit.match(Effect.runSyncExit(effect), {\n onSuccess: (value) => value,\n onFailure: (cause) => fallback(Cause.squash(cause)),\n });\n\nconst envOf = (name: string): Option.Option<string> =>\n runOrElse(Config.option(Config.NonEmptyString(name)), () => Option.none()).pipe(\n Option.map((value) => value.trim()),\n Option.filter(Str.isNonEmpty),\n );\n\nconst envNameOf = (env: Readonly<Record<string, string>>, name: string): string =>\n env[name] ?? name;\n\nconst failsInCi = (options: ResolvedOptions): boolean =>\n options.ci === \"fail\" && Option.isSome(envOf(\"CI\"));\n\nconst warned = new Set<string>();\n\nconst warnOnce = (reason: string, message: string): void => {\n if (warned.has(reason)) {\n return;\n }\n warned.add(reason);\n Effect.runFork(Console.warn(`${PREFIX}: ${message}`));\n};\n\nconst messageOf = (error: unknown): string => {\n if (error instanceof Error) {\n return error.message;\n }\n return String(error);\n};\n\nexport { envNameOf, envOf, failsInCi, messageOf, runOrElse, warnOnce };\n","import type { Location } from \"@oxlint/plugins\";\nimport {\n Array as Arr,\n Boolean as Bool,\n Number as Num,\n Option,\n Predicate,\n String as Str,\n} from \"effect\";\n\nimport { choiceOf, probabilityOfChoice, questionFor, verdictOf } from \"./answer.ts\";\nimport type {\n Answer,\n Answers,\n ChoiceQuestion,\n DecisionRequest,\n DecisionResponse,\n LineRange,\n Question,\n RequestMatch,\n RuleLocation,\n Verdict,\n Verdicts,\n} from \"./types.ts\";\n\nconst CHOICE_OPTION_LIMIT = 254;\nconst FIRST_LINE = 1;\nconst MINIMUM_WIDTH = 1;\nconst UNKNOWN_CHOICE = \"unknown\";\nconst LOCATION_SUFFIX = \"_location\";\nconst TRUNCATION_MARKER = \"/* ...truncated */\";\n\nconst refAt = (index: number): string => `s${String(index)}`;\n\nconst locationRefOf = (ref: string): string => `${ref}${LOCATION_SUFFIX}`;\n\nconst snippetRefOf = (questionId: string): string =>\n Bool.match(questionId.endsWith(LOCATION_SUFFIX), {\n onTrue: () => questionId.slice(Num.decrement(FIRST_LINE), -LOCATION_SUFFIX.length),\n onFalse: () => questionId,\n });\n\nconst truncateSnippet = (text: string, maxChars: number): string =>\n Bool.match(text.length <= maxChars, {\n onTrue: () => text,\n onFalse: () => `${text.slice(Num.decrement(FIRST_LINE), maxChars)}${TRUNCATION_MARKER}`,\n });\n\nconst sourceLines = (text: string): readonly string[] => text.split(/\\r\\n|[\\n\\r\\u2028\\u2029]/u);\n\ntype LocatedMatch = RequestMatch & {\n readonly rule: { readonly question: string; readonly location: RuleLocation };\n};\n\nconst locates = (match: RequestMatch): match is LocatedMatch =>\n Predicate.isNotUndefined(match.rule.location) && !match.truncated;\n\ninterface NumberedLine {\n readonly text: string;\n readonly line: number;\n}\n\nconst EVERY_LINE: LineRange = { start: FIRST_LINE, end: Number.POSITIVE_INFINITY };\n\nconst isWithin = (line: number, within: LineRange): boolean =>\n Num.between(line, { minimum: within.start, maximum: within.end });\n\nconst rangeKey = ({ start, end }: LineRange): string =>\n Bool.match(start === end, {\n onTrue: () => `L${String(start)}`,\n onFalse: () => `L${String(start)}-L${String(end)}`,\n });\n\nconst rangeLabel = ({ start, end }: LineRange): string =>\n Bool.match(start === end, {\n onTrue: () => `Line ${String(start)}`,\n onFalse: () => `Lines ${String(start)} to ${String(end)}`,\n });\n\nconst rangeOf = (group: Arr.NonEmptyReadonlyArray<NumberedLine>): LineRange => ({\n start: Arr.headNonEmpty(group).line,\n end: Arr.lastNonEmpty(group).line,\n});\n\nconst numberedLines = (snippet: string): readonly NumberedLine[] =>\n sourceLines(snippet).map((text, index) => ({ text, line: Num.sum(index, FIRST_LINE) }));\n\nconst locationCandidates = (\n snippet: string,\n within: LineRange = EVERY_LINE,\n): Readonly<Record<string, LineRange>> => {\n const lines = numberedLines(snippet).filter(\n ({ text, line }) => text.trim().length >= FIRST_LINE && isWithin(line, within),\n );\n const width = Math.max(MINIMUM_WIDTH, Math.ceil(lines.length / CHOICE_OPTION_LIMIT));\n return Object.fromEntries(\n Arr.chunksOf(lines, width).map((group) => {\n const range = rangeOf(group);\n return [rangeKey(range), range];\n }),\n );\n};\n\nconst locationQuestion = (\n match: LocatedMatch,\n ref: string,\n candidates: Readonly<Record<string, LineRange>>,\n): ChoiceQuestion => ({\n type: \"choice\",\n instructions: `Consider only the numbered source in state.snippets.${ref}. If it violates this rule, select the line (or range containing that line) to annotate. Rule: ${match.rule.question} Location: ${match.rule.location.question} If multiple violations exist, select the earliest one. Select ${UNKNOWN_CHOICE} if no violation exists or its location is unclear.`,\n criteria: {\n ...Object.fromEntries(\n Object.entries(candidates).map(([key, range]) => [key, rangeLabel(range)]),\n ),\n [UNKNOWN_CHOICE]: \"No clear source location for this violation\",\n },\n});\n\ntype ChoiceCriteria = ChoiceQuestion[\"criteria\"];\n\nconst validChoice = (answer: Answer | undefined, criteria: ChoiceCriteria): boolean =>\n Option.exists(\n choiceOf(answer),\n (chosen) =>\n Object.hasOwn(criteria, chosen.choice) && Option.isSome(probabilityOfChoice(chosen)),\n );\n\nconst selectedLocation = (\n answer: Answer | undefined,\n candidates: Readonly<Record<string, LineRange>>,\n cutoff: number,\n): Option.Option<LineRange> =>\n choiceOf(answer).pipe(\n Option.filter((chosen) =>\n Option.exists(probabilityOfChoice(chosen), (probability) =>\n Num.isGreaterThanOrEqualTo(probability, cutoff),\n ),\n ),\n Option.flatMap(({ choice }) => Option.fromUndefinedOr(candidates[choice])),\n );\n\nconst locationOfLine = (snippet: string, line: number): Location => {\n const text = Option.getOrElse(Arr.get(sourceLines(snippet), Num.decrement(line)), () => \"\");\n return {\n start: { line, column: Math.max(Num.decrement(FIRST_LINE), text.search(/\\S/u)) },\n end: { line, column: text.trimEnd().length },\n };\n};\n\nconst numbered = (snippet: string): string =>\n numberedLines(snippet)\n .map(({ text, line }) => `L${String(line)}| ${text}`)\n .join(\"\\n\");\n\nconst contextNote = (match: RequestMatch, ref: string): string => {\n if (Predicate.isUndefined(match.context)) {\n return \"\";\n }\n return ` state.contexts.${ref} shows the source around it; use it only to understand the snippet.`;\n};\n\nconst mainQuestionFor = (match: RequestMatch, ref: string): readonly [string, Question] => [\n ref,\n questionFor(\n match.rule.answer,\n `Consider only snippet \"${ref}\" in state.snippets.${contextNote(match, ref)} ${match.rule.question}`,\n ),\n];\n\nconst questionsFor = (\n match: RequestMatch,\n ref: string,\n): readonly (readonly [string, Question])[] => {\n if (!locates(match)) {\n return [mainQuestionFor(match, ref)];\n }\n return [\n mainQuestionFor(match, ref),\n [locationRefOf(ref), locationQuestion(match, ref, locationCandidates(match.snippet))],\n ];\n};\n\nconst snippetFor = (match: RequestMatch): string => {\n if (locates(match)) {\n return numbered(match.snippet);\n }\n return match.snippet;\n};\n\nconst contextsOf = (\n matches: readonly RequestMatch[],\n): Readonly<{ contexts?: Readonly<Record<string, string>> }> => {\n const contexts = matches.flatMap((match, index) =>\n Option.toArray(\n Option.map(Option.fromUndefinedOr(match.context), (text) => [refAt(index), text] as const),\n ),\n );\n if (Arr.isReadonlyArrayEmpty(contexts)) {\n return {};\n }\n return { contexts: Object.fromEntries(contexts) };\n};\n\nconst buildRequest = (model: string, matches: readonly RequestMatch[]): DecisionRequest => ({\n model,\n state: {\n snippets: Object.fromEntries(matches.map((match, index) => [refAt(index), snippetFor(match)])),\n ...contextsOf(matches),\n },\n questions: Object.fromEntries(\n matches.flatMap((match, index) => questionsFor(match, refAt(index))),\n ),\n});\n\nconst choiceQuestionsOf = (\n request: DecisionRequest,\n): readonly (readonly [string, ChoiceCriteria])[] =>\n Object.entries(request.questions).flatMap(([id, question]) => {\n if (question.type === \"choice\") {\n return [[id, question.criteria] as const];\n }\n return [];\n });\n\nconst mainQuestionsOf = (request: DecisionRequest): readonly (readonly [string, Question])[] =>\n Object.entries(request.questions).filter(([id]) => !id.endsWith(LOCATION_SUFFIX));\n\nconst resultOf = (\n answers: Answers,\n [ref, question]: readonly [string, Question],\n): readonly [string, Verdict] => [\n ref,\n Option.getOrThrowWith(\n verdictOf(question, answers[ref]),\n () => new Error(`response has no valid answer for \"${ref}\"`),\n ),\n];\n\nconst parseVerdicts = (response: DecisionResponse, request: DecisionRequest): Verdicts => {\n const { model, answers } = Option.getOrThrowWith(\n Option.liftPredicate(response, ({ model: served }) => Str.isNonEmpty(served)),\n () => new Error(\"response has no model id\"),\n );\n const results = Object.fromEntries(\n mainQuestionsOf(request).map((entry) => resultOf(answers, entry)),\n );\n const complete = choiceQuestionsOf(request).every(([id, criteria]) =>\n validChoice(answers[id], criteria),\n );\n return { model, results, answers, complete };\n};\n\nexport {\n buildRequest,\n locates,\n locationCandidates,\n locationOfLine,\n locationQuestion,\n locationRefOf,\n parseVerdicts,\n refAt,\n selectedLocation,\n snippetRefOf,\n sourceLines,\n truncateSnippet,\n};\nexport type { LocatedMatch };\n","import type { DecisionsRequest } from \"@openrouter/sdk/models\";\nimport {\n Array as Arr,\n Boolean as Bool,\n Number as Num,\n Option,\n Order,\n Predicate,\n pipe,\n} from \"effect\";\n\nimport { SEVERITY_ORDER, noulOf } from \"./answer.ts\";\nimport { snippetRefOf } from \"./request.ts\";\nimport type {\n Answers,\n ChoiceAnswer,\n ChoiceQuestion,\n DecisionRequest,\n DecisionResponse,\n NoulQuestion,\n Question,\n} from \"./types.ts\";\n\ntype State = DecisionRequest[\"state\"];\n\ntype ChoiceCriteria = ChoiceQuestion[\"criteria\"];\n\ninterface WireRequest extends Readonly<Pick<DecisionsRequest, \"model\" | \"state\" | \"questions\">> {\n readonly state: DecisionRequest[\"state\"] | string;\n readonly questions: Readonly<Record<string, Question>>;\n}\n\nconst RESPAN_MODELS = [\"respan/\"] as const;\nconst OPTION_SEPARATOR = \"__\";\nconst CERTAIN = 1;\nconst LIKELY = 0.5;\nconst NO_SEVERITY = \"none\";\n\nconst sectionsOf = (name: string, entries: Readonly<Record<string, string>>): readonly string[] =>\n Object.entries(entries).map(([ref, text]) => `state.${name}.${ref}:\\n${text}`);\n\nconst stateAsText = ({ snippets, contexts = {} }: State): string =>\n [...sectionsOf(\"snippets\", snippets), ...sectionsOf(\"contexts\", contexts)].join(\"\\n\\n\");\n\nconst isRespan = (model: string): boolean =>\n RESPAN_MODELS.some((prefix) => model.startsWith(prefix));\n\nconst only = (\n entries: Readonly<Record<string, string>>,\n ref: string,\n): Readonly<Record<string, string>> =>\n Option.match(Option.fromUndefinedOr(entries[ref]), {\n onNone: () => ({}),\n onSome: (text) => ({ [ref]: text }),\n });\n\nconst stateOf = ({ snippets, contexts }: State, ref: string): State => {\n if (Predicate.isUndefined(contexts)) {\n return { snippets: only(snippets, ref) };\n }\n return { snippets: only(snippets, ref), contexts: only(contexts, ref) };\n};\n\nconst optionIdOf = (id: string, label: string): string => `${id}${OPTION_SEPARATOR}${label}`;\n\nconst isSeverityScale = (criteria: ChoiceCriteria): boolean =>\n Object.keys(criteria).join(\",\") === SEVERITY_ORDER.join(\",\");\n\nconst optionText = (label: string, description: string | null): string =>\n Option.match(Option.fromNullishOr(description), {\n onNone: () => `\"${label}\"`,\n onSome: (text) => `\"${label}\" (${text})`,\n });\n\nconst labelQuestion = (\n instructions: string,\n label: string,\n description: string | null,\n): NoulQuestion => ({\n type: \"noul\",\n instructions: `${instructions} Does the label ${optionText(label, description)} fit?`,\n});\n\nconst levelQuestion = (\n instructions: string,\n label: string,\n description: string | null,\n): NoulQuestion => ({\n type: \"noul\",\n instructions: `${instructions} Is it at least as serious as ${optionText(label, description)}?`,\n});\n\nconst levelsAboveNone = (criteria: ChoiceCriteria): readonly (readonly [string, string | null])[] =>\n Object.entries(criteria).filter(([label]) => label !== NO_SEVERITY);\n\nconst yesNoQuestionsOf = (\n id: string,\n { instructions, criteria }: ChoiceQuestion,\n): readonly (readonly [string, NoulQuestion])[] => {\n if (isSeverityScale(criteria)) {\n return levelsAboveNone(criteria).map(([label, description]) => [\n optionIdOf(id, label),\n levelQuestion(instructions, label, description),\n ]);\n }\n return Object.entries(criteria).map(([label, description]) => [\n optionIdOf(id, label),\n labelQuestion(instructions, label, description),\n ]);\n};\n\nconst asYesNo = ([id, question]: readonly [string, Question]): readonly (readonly [\n string,\n Question,\n])[] => {\n if (question.type === \"choice\") {\n return yesNoQuestionsOf(id, question);\n }\n return [[id, question]];\n};\n\nconst perSnippet = (request: DecisionRequest): Arr.NonEmptyReadonlyArray<WireRequest> => {\n const wires = Object.values(\n Arr.groupBy(Object.entries(request.questions), ([id]) => snippetRefOf(id)),\n ).map((questions): WireRequest => {\n const [[id]] = questions;\n return {\n model: request.model,\n state: stateAsText(stateOf(request.state, snippetRefOf(id))),\n questions: Object.fromEntries(questions.flatMap((entry) => asYesNo(entry))),\n };\n });\n if (Arr.isReadonlyArrayNonEmpty(wires)) {\n return wires;\n }\n return [request];\n};\n\nconst wireRequestsFor = (request: DecisionRequest): Arr.NonEmptyReadonlyArray<WireRequest> => {\n if (isRespan(request.model)) {\n return perSnippet(request);\n }\n return [request];\n};\n\ninterface Score {\n readonly label: string;\n readonly yes: number;\n}\n\nconst byYes = Order.mapInput(Order.Number, ({ yes }: Score) => yes);\n\nconst scoreOf = (answers: Answers, id: string, label: string): Option.Option<Score> =>\n Option.map(noulOf(answers[optionIdOf(id, label)]), ({ noul }) => ({ label, yes: noul }));\n\nconst scoresOf = (\n answers: Answers,\n id: string,\n labels: readonly string[],\n): Option.Option<Arr.NonEmptyReadonlyArray<Score>> =>\n Option.flatMap(Option.all(labels.map((label) => scoreOf(answers, id, label))), (scores) =>\n Option.liftPredicate(scores, Arr.isArrayNonEmpty),\n );\n\nconst probabilitiesOf = (scores: readonly Score[]): Readonly<Record<string, number>> =>\n Object.fromEntries(scores.map(({ label, yes }) => [label, yes]));\n\nconst choiceAnswer = (\n choice: string,\n probabilities: Readonly<Record<string, number>>,\n): ChoiceAnswer => ({\n type: \"choice\",\n choice,\n probabilities,\n});\n\nconst bestLabel = (scores: Arr.NonEmptyReadonlyArray<Score>): ChoiceAnswer =>\n choiceAnswer(Arr.max(scores, byYes).label, probabilitiesOf(scores));\n\nconst atLeast = (scores: Arr.NonEmptyReadonlyArray<Score>): Arr.NonEmptyReadonlyArray<Score> =>\n pipe(\n scores,\n Arr.map(({ label }, index) => ({\n label,\n yes: Math.max(...scores.slice(index).map(({ yes }) => yes)),\n })),\n );\n\nconst severityLevel = (scores: Arr.NonEmptyReadonlyArray<Score>): ChoiceAnswer => {\n const cumulative = atLeast(scores);\n const probabilities = {\n [NO_SEVERITY]: Num.subtract(CERTAIN, Arr.headNonEmpty(cumulative).yes),\n ...probabilitiesOf(cumulative),\n };\n const reached = pipe(\n cumulative,\n Arr.findLast(({ yes }) => yes >= LIKELY),\n );\n return choiceAnswer(\n Option.match(reached, { onNone: () => NO_SEVERITY, onSome: ({ label }) => label }),\n probabilities,\n );\n};\n\nconst labelsAsked = (criteria: ChoiceCriteria): readonly string[] => {\n if (isSeverityScale(criteria)) {\n return levelsAboveNone(criteria).map(([label]) => label);\n }\n return Object.keys(criteria);\n};\n\nconst choiceFromYesNo = (\n answers: Answers,\n [id, { criteria }]: readonly [string, ChoiceQuestion],\n): readonly (readonly [string, ChoiceAnswer])[] => {\n const collapse = Bool.match(isSeverityScale(criteria), {\n onTrue: () => severityLevel,\n onFalse: () => bestLabel,\n });\n return scoresOf(answers, id, labelsAsked(criteria)).pipe(\n Option.map((scores) => [id, collapse(scores)] as const),\n Option.toArray,\n );\n};\n\nconst choiceQuestionsOf = (\n request: DecisionRequest,\n): readonly (readonly [string, ChoiceQuestion])[] =>\n Object.entries(request.questions).flatMap(([id, question]) => {\n if (question.type === \"choice\") {\n return [[id, question] as const];\n }\n return [];\n });\n\nconst withChoices = (request: DecisionRequest, answers: Answers): Answers => {\n if (!isRespan(request.model)) {\n return answers;\n }\n return {\n ...answers,\n ...Object.fromEntries(\n choiceQuestionsOf(request).flatMap((entry) => choiceFromYesNo(answers, entry)),\n ),\n };\n};\n\nconst mergeResponses = (\n request: DecisionRequest,\n responses: Arr.NonEmptyReadonlyArray<DecisionResponse>,\n): DecisionResponse => ({\n ...Arr.headNonEmpty(responses),\n answers: withChoices(\n request,\n Object.fromEntries(responses.flatMap(({ answers }) => Object.entries(answers))),\n ),\n});\n\nexport { mergeResponses, wireRequestsFor };\nexport type { WireRequest };\n"],"mappings":";;AAYA,MAAM,MAAM;AACZ,MAAM,kBAA4B;AAClC,MAAM,iBAAiB;AAEvB,MAAM,oBAAoB;CACxB,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;AACT;AAEA,MAAM,iBAAoC,OAAO,KAAK,iBAAiB;AAEvE,MAAMA,gBAAc,OAAO,OAAO,MAAM,OAAO,UAAU;CAAE,SAAS;CAAG,SAAS;AAAE,CAAC,CAAC;AAEpF,MAAM,QAAQ,OAAO;AAErB,MAAM,gBAAgB,OAAO,OAAO,EAAE,MAAM,OAAO,QAAQ,SAAS,EAAE,CAAC;AAEvE,MAAM,iBAAiB,OAAO,OAAO;CACnC,MAAM,OAAO,QAAQ,UAAU;CAC/B,QAAQ,OAAO,OAAO,OAAO,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,gBAAgB,cAAc,CAAC;CACxF,QAAQ,OAAO,cAAc,KAAK;AACpC,CAAC,CAAC,CAAC,MACD,OAAO,YAAY,EAAE,QAAQ,aAAa,OAAO,OAAO,UAAU,OAAO,OAAO,QAAQ,KAAK,CAAC,GAAG,EAC/F,SAAS,8CACX,CAAC,CACH;AAEA,MAAM,iBAAiB,OAAO,OAAO;CACnC,MAAM,OAAO,QAAQ,UAAU;CAC/B,SAAS,OAAO,YAAY,OAAO,SAAS;EAAC;EAAQ;EAAQ;CAAO,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,mBAAmB,OAAO,MAAM;CAAC;CAAe;CAAgB;AAAc,CAAC;AAErF,MAAM,iBAA6B,EAAE,MAAM,UAAU;AAErD,MAA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