@alint-js/core 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.mts +32 -0
- package/dist/agent.mjs +6 -0
- package/dist/index.d.mts +4 -64
- package/dist/index.mjs +3 -1
- package/dist/types-BPiUTLXT.d.mts +65 -0
- package/package.json +5 -1
package/dist/agent.d.mts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { r as ResolvedModel } from "./types-BPiUTLXT.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/agent/types.d.ts
|
|
4
|
+
type AgentAdapter = (request: AgentRequest) => Promise<AgentResult>;
|
|
5
|
+
interface AgentRequest {
|
|
6
|
+
instructions: string;
|
|
7
|
+
model: ResolvedModel;
|
|
8
|
+
prompt: string;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
tools: AgentTool[];
|
|
11
|
+
}
|
|
12
|
+
interface AgentResult {
|
|
13
|
+
answer: string;
|
|
14
|
+
usage?: AgentUsage;
|
|
15
|
+
}
|
|
16
|
+
/** Agent-agnostic tool definition. Each adapter translates it to its framework's tool format. */
|
|
17
|
+
interface AgentTool {
|
|
18
|
+
description: string;
|
|
19
|
+
execute: (input: unknown) => Promise<unknown> | unknown;
|
|
20
|
+
name: string;
|
|
21
|
+
parameters: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
interface AgentUsage {
|
|
24
|
+
inputTokens?: number;
|
|
25
|
+
outputTokens?: number;
|
|
26
|
+
totalTokens?: number;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/agent/index.d.ts
|
|
30
|
+
declare function defineTool(tool: AgentTool): AgentTool;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { type AgentAdapter, type AgentRequest, type AgentResult, type AgentTool, type AgentUsage, defineTool };
|
package/dist/agent.mjs
ADDED
package/dist/index.d.mts
CHANGED
|
@@ -1,38 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface ProviderDefinition {
|
|
4
|
-
endpoint: string;
|
|
5
|
-
headers?: Record<string, string>;
|
|
6
|
-
id: string;
|
|
7
|
-
models: SetupModelDefinition[];
|
|
8
|
-
type: ProviderType;
|
|
9
|
-
}
|
|
10
|
-
type ProviderType = 'openai-compatible';
|
|
11
|
-
interface RunnerCacheConfig {
|
|
12
|
-
enabled?: boolean;
|
|
13
|
-
location?: string;
|
|
14
|
-
}
|
|
15
|
-
interface RunnerConfig {
|
|
16
|
-
cache?: boolean | RunnerCacheConfig;
|
|
17
|
-
fileConcurrency?: number;
|
|
18
|
-
ruleConcurrency?: number;
|
|
19
|
-
timeoutMs?: number;
|
|
20
|
-
}
|
|
21
|
-
interface SetupConfig {
|
|
22
|
-
providers: ProviderDefinition[];
|
|
23
|
-
runner?: RunnerConfig;
|
|
24
|
-
version: 1;
|
|
25
|
-
}
|
|
26
|
-
interface SetupModelDefinition {
|
|
27
|
-
aliases?: string[];
|
|
28
|
-
capabilities?: string[];
|
|
29
|
-
contextWindow?: number;
|
|
30
|
-
defaultParams?: Record<string, unknown>;
|
|
31
|
-
id: string;
|
|
32
|
-
name?: string;
|
|
33
|
-
size?: ModelSize;
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
1
|
+
import { a as ModelSize, c as RunnerConfig, i as ResolvedProvider, l as SetupConfig, n as ResolveModelOptions, o as ProviderDefinition, r as ResolvedModel, s as ProviderType, t as ModelRequirement, u as SetupModelDefinition } from "./types-BPiUTLXT.mjs";
|
|
2
|
+
|
|
36
3
|
//#region src/core/source/types.d.ts
|
|
37
4
|
interface LanguageContext {
|
|
38
5
|
cwd: string;
|
|
@@ -112,35 +79,6 @@ interface SourceText {
|
|
|
112
79
|
text: string;
|
|
113
80
|
}
|
|
114
81
|
//#endregion
|
|
115
|
-
//#region src/models/types.d.ts
|
|
116
|
-
interface ModelRequirement {
|
|
117
|
-
capabilities?: string[];
|
|
118
|
-
minContextWindow?: number;
|
|
119
|
-
params?: Record<string, unknown>;
|
|
120
|
-
size?: ModelSize;
|
|
121
|
-
}
|
|
122
|
-
interface ResolvedModel {
|
|
123
|
-
aliases: string[];
|
|
124
|
-
capabilities: string[];
|
|
125
|
-
contextWindow?: number;
|
|
126
|
-
id: string;
|
|
127
|
-
name: string;
|
|
128
|
-
params: Record<string, unknown>;
|
|
129
|
-
provider: ResolvedProvider;
|
|
130
|
-
size?: ModelSize;
|
|
131
|
-
}
|
|
132
|
-
interface ResolvedProvider {
|
|
133
|
-
endpoint: string;
|
|
134
|
-
headers: Record<string, string>;
|
|
135
|
-
id: string;
|
|
136
|
-
type: 'openai-compatible';
|
|
137
|
-
}
|
|
138
|
-
interface ResolveModelOptions {
|
|
139
|
-
request?: string;
|
|
140
|
-
requirement?: ModelRequirement;
|
|
141
|
-
ruleId?: string;
|
|
142
|
-
}
|
|
143
|
-
//#endregion
|
|
144
82
|
//#region src/dsl/types.d.ts
|
|
145
83
|
type AlintConfig = readonly AlintConfigInput[];
|
|
146
84
|
type AlintConfigExtends = AlintConfigInput | string;
|
|
@@ -221,6 +159,7 @@ interface RuleContext {
|
|
|
221
159
|
recordUsage: (usage: RuleInferenceUsageRecord) => void;
|
|
222
160
|
};
|
|
223
161
|
model: (selector?: ModelRequirement | string) => Promise<ResolvedModel>;
|
|
162
|
+
outputLanguage?: string;
|
|
224
163
|
report: (diagnostic: DiagnosticDescriptor) => void;
|
|
225
164
|
settings: Record<string, unknown>;
|
|
226
165
|
src: SourceRuntime;
|
|
@@ -386,6 +325,7 @@ interface RunOptions {
|
|
|
386
325
|
cwd?: string;
|
|
387
326
|
files?: string[];
|
|
388
327
|
modelOverride?: string;
|
|
328
|
+
outputLanguage?: string;
|
|
389
329
|
progress?: ProgressReporter;
|
|
390
330
|
runner?: RunnerOptions;
|
|
391
331
|
setupConfig?: SetupConfig;
|
package/dist/index.mjs
CHANGED
|
@@ -647,7 +647,7 @@ function createBuiltInLanguageRegistry() {
|
|
|
647
647
|
}
|
|
648
648
|
//#endregion
|
|
649
649
|
//#region package.json
|
|
650
|
-
var version = "0.0.
|
|
650
|
+
var version = "0.0.8";
|
|
651
651
|
//#endregion
|
|
652
652
|
//#region src/dsl/registry.ts
|
|
653
653
|
function buildRuleRegistry(config) {
|
|
@@ -957,6 +957,7 @@ async function runAlint(options = {}) {
|
|
|
957
957
|
fileEntryKeys: /* @__PURE__ */ new Map(),
|
|
958
958
|
modelHash: stableHash({
|
|
959
959
|
modelOverride: options.modelOverride,
|
|
960
|
+
outputLanguage: options.outputLanguage,
|
|
960
961
|
setupConfig
|
|
961
962
|
}),
|
|
962
963
|
store: cacheStore
|
|
@@ -1204,6 +1205,7 @@ function createRuleRuntimes(options) {
|
|
|
1204
1205
|
if (state) state.currentModel = toDiagnosticModel(resolvedModel, request);
|
|
1205
1206
|
return resolvedModel;
|
|
1206
1207
|
},
|
|
1208
|
+
outputLanguage: options.options.outputLanguage,
|
|
1207
1209
|
report: (descriptor) => {
|
|
1208
1210
|
const state = executionState.getStore();
|
|
1209
1211
|
const filePath = descriptor.filePath ?? state?.activeFilePath;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/config/types.d.ts
|
|
2
|
+
type ModelSize = 'large' | 'medium' | 'small';
|
|
3
|
+
interface ProviderDefinition {
|
|
4
|
+
endpoint: string;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
id: string;
|
|
7
|
+
models: SetupModelDefinition[];
|
|
8
|
+
type: ProviderType;
|
|
9
|
+
}
|
|
10
|
+
type ProviderType = 'openai-compatible';
|
|
11
|
+
interface RunnerCacheConfig {
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
location?: string;
|
|
14
|
+
}
|
|
15
|
+
interface RunnerConfig {
|
|
16
|
+
cache?: boolean | RunnerCacheConfig;
|
|
17
|
+
fileConcurrency?: number;
|
|
18
|
+
ruleConcurrency?: number;
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
}
|
|
21
|
+
interface SetupConfig {
|
|
22
|
+
providers: ProviderDefinition[];
|
|
23
|
+
runner?: RunnerConfig;
|
|
24
|
+
version: 1;
|
|
25
|
+
}
|
|
26
|
+
interface SetupModelDefinition {
|
|
27
|
+
aliases?: string[];
|
|
28
|
+
capabilities?: string[];
|
|
29
|
+
contextWindow?: number;
|
|
30
|
+
defaultParams?: Record<string, unknown>;
|
|
31
|
+
id: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
size?: ModelSize;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/models/types.d.ts
|
|
37
|
+
interface ModelRequirement {
|
|
38
|
+
capabilities?: string[];
|
|
39
|
+
minContextWindow?: number;
|
|
40
|
+
params?: Record<string, unknown>;
|
|
41
|
+
size?: ModelSize;
|
|
42
|
+
}
|
|
43
|
+
interface ResolvedModel {
|
|
44
|
+
aliases: string[];
|
|
45
|
+
capabilities: string[];
|
|
46
|
+
contextWindow?: number;
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
params: Record<string, unknown>;
|
|
50
|
+
provider: ResolvedProvider;
|
|
51
|
+
size?: ModelSize;
|
|
52
|
+
}
|
|
53
|
+
interface ResolvedProvider {
|
|
54
|
+
endpoint: string;
|
|
55
|
+
headers: Record<string, string>;
|
|
56
|
+
id: string;
|
|
57
|
+
type: 'openai-compatible';
|
|
58
|
+
}
|
|
59
|
+
interface ResolveModelOptions {
|
|
60
|
+
request?: string;
|
|
61
|
+
requirement?: ModelRequirement;
|
|
62
|
+
ruleId?: string;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { ModelSize as a, RunnerConfig as c, ResolvedProvider as i, SetupConfig as l, ResolveModelOptions as n, ProviderDefinition as o, ResolvedModel as r, ProviderType as s, ModelRequirement as t, SetupModelDefinition as u };
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alint-js/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.mts",
|
|
8
8
|
"default": "./dist/index.mjs"
|
|
9
9
|
},
|
|
10
|
+
"./agent": {
|
|
11
|
+
"types": "./dist/agent.d.mts",
|
|
12
|
+
"default": "./dist/agent.mjs"
|
|
13
|
+
},
|
|
10
14
|
"./package.json": "./package.json"
|
|
11
15
|
},
|
|
12
16
|
"files": [
|