@andrueandersoncs/lint-anything 0.3.0 → 0.5.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 +73 -70
- package/dist/cli.js +67 -64
- package/dist/lib.js +228 -146
- package/dist/types/decision-model.d.ts +162 -0
- package/dist/types/item.d.ts +1 -1
- package/dist/types/lib.d.ts +20 -8
- package/dist/types/lint.d.ts +13 -26
- package/dist/types/policy.d.ts +5 -18
- package/dist/types/score.d.ts +2 -2
- package/package.json +2 -2
- package/skills/lint-anything/SKILL.md +24 -41
- package/skills/lint-anything/scripts/score.js +45 -42
- package/dist/types/clef.d.ts +0 -82
package/dist/types/clef.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Cause, Context, Effect, Layer, Result, Runtime, Schema } from "effect";
|
|
2
|
-
/** The Workers AI model lint-anything asks: `@cf/cloudflare/clef`. */
|
|
3
|
-
export declare const model = "clef";
|
|
4
|
-
/**
|
|
5
|
-
* One yes/no question: `instructions` is what Clef judges, and `criteria` say what a yes (`true`) and a no
|
|
6
|
-
* (`false`) mean. Clef answers with the probability of yes.
|
|
7
|
-
*/
|
|
8
|
-
export interface Question {
|
|
9
|
-
readonly instructions: string;
|
|
10
|
-
readonly criteria: {
|
|
11
|
-
readonly true: string;
|
|
12
|
-
readonly false: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
declare const ClefError_base: Schema.Class<ClefError, Schema.TaggedStruct<"ClefError", {
|
|
16
|
-
readonly message: Schema.String;
|
|
17
|
-
}>, Cause.YieldableError>;
|
|
18
|
-
export declare class ClefError extends ClefError_base {
|
|
19
|
-
readonly [Runtime.errorExitCode] = 2;
|
|
20
|
-
}
|
|
21
|
-
declare const RequestTooLarge_base: Schema.Class<RequestTooLarge, Schema.TaggedStruct<"RequestTooLarge", {
|
|
22
|
-
readonly bytes: Schema.Number;
|
|
23
|
-
}>, Cause.YieldableError>;
|
|
24
|
-
/** The request would exceed Clef's context window, which silently truncates state. */
|
|
25
|
-
export declare class RequestTooLarge extends RequestTooLarge_base {
|
|
26
|
-
}
|
|
27
|
-
/** USD per input token. Clef bills no output tokens. */
|
|
28
|
-
export declare const inputTokenPrice = 2.4e-7;
|
|
29
|
-
/**
|
|
30
|
-
* How long a cached answer stands. After it, the question is asked again, so answers follow updates to the
|
|
31
|
-
* model, and the expired answer is deleted, so the cache doesn't grow without bound.
|
|
32
|
-
*/
|
|
33
|
-
export declare const cacheMaxAgeMs: number;
|
|
34
|
-
/** One Clef request: its exact body and what each question id answers. */
|
|
35
|
-
export interface Planned<A> {
|
|
36
|
-
readonly body: string;
|
|
37
|
-
readonly questions: ReadonlyArray<{
|
|
38
|
-
readonly id: string;
|
|
39
|
-
readonly value: A;
|
|
40
|
-
}>;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Plans the requests that ask `questions` under `state`: the state once per request and as many questions
|
|
44
|
-
* as fit. Planned questions answer by index into `questions`.
|
|
45
|
-
*/
|
|
46
|
-
export declare const planRequests: (state: string, questions: ReadonlyArray<Question>) => {
|
|
47
|
-
requests: Planned<number>[];
|
|
48
|
-
oversized: {
|
|
49
|
-
readonly value: number;
|
|
50
|
-
readonly bytes: number;
|
|
51
|
-
}[];
|
|
52
|
-
};
|
|
53
|
-
/** What one source's questions cost in a run. */
|
|
54
|
-
export interface Usage {
|
|
55
|
-
/** Requests sent to Clef (retries of a request not counted again). */
|
|
56
|
-
readonly requests: number;
|
|
57
|
-
/** Answers taken from the cache instead of asked. */
|
|
58
|
-
readonly cached: number;
|
|
59
|
-
/** Input tokens Clef reported for the requests sent; Clef bills no output tokens. */
|
|
60
|
-
readonly inputTokens: number;
|
|
61
|
-
/** Requests whose response reported no token count, so `inputTokens` leaves them out. */
|
|
62
|
-
readonly unmetered: number;
|
|
63
|
-
}
|
|
64
|
-
export declare const noUsage: Usage;
|
|
65
|
-
export declare const sumUsage: (usages: Iterable<Usage>) => Usage;
|
|
66
|
-
declare const Clef_base: Context.ServiceClass<Clef, "lint-anything/Clef", {
|
|
67
|
-
/**
|
|
68
|
-
* Asks each of `questions` under the shared `state`; results follow `questions` order, each the probability
|
|
69
|
-
* of yes, or `RequestTooLarge` for a question too large to send. `source` names who asked, for `stats`.
|
|
70
|
-
*/
|
|
71
|
-
ask(source: string, state: string, questions: ReadonlyArray<Question>): Effect.Effect<ReadonlyArray<Result.Result<number, RequestTooLarge>>, ClefError>;
|
|
72
|
-
/** What each source's questions cost so far, by source; a source that sent and cached nothing is absent. */
|
|
73
|
-
readonly stats: Effect.Effect<ReadonlyMap<string, Usage>>;
|
|
74
|
-
}>;
|
|
75
|
-
export declare class Clef extends Clef_base {
|
|
76
|
-
/**
|
|
77
|
-
* Clef on Workers AI; with `cacheDirectory`, answers are cached in a database there per question across
|
|
78
|
-
* runs, and answers older than `cacheMaxAgeMs` are deleted and asked again.
|
|
79
|
-
*/
|
|
80
|
-
static readonly layer: (cacheDirectory?: string) => Layer.Layer<Clef, ClefError, never>;
|
|
81
|
-
}
|
|
82
|
-
export {};
|