@termaxjs/web-ai 0.1.1
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/LICENSE +201 -0
- package/dist/config.d.ts +511 -0
- package/dist/config.js +708 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/lib/compact.d.ts +8 -0
- package/dist/lib/compact.js +179 -0
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/index.js +4 -0
- package/dist/lib/miniWindowGeometry.d.ts +17 -0
- package/dist/lib/miniWindowGeometry.js +59 -0
- package/dist/lib/redact.d.ts +1 -0
- package/dist/lib/redact.js +34 -0
- package/dist/lib/security.d.ts +72 -0
- package/dist/lib/security.js +376 -0
- package/dist/tools/agent.d.ts +4 -0
- package/dist/tools/agent.js +22 -0
- package/dist/tools/context.d.ts +30 -0
- package/dist/tools/context.js +8 -0
- package/dist/tools/edit.d.ts +27 -0
- package/dist/tools/edit.js +161 -0
- package/dist/tools/fs.d.ts +93 -0
- package/dist/tools/fs.js +215 -0
- package/dist/tools/search.d.ts +48 -0
- package/dist/tools/search.js +118 -0
- package/dist/tools/shell.d.ts +7 -0
- package/dist/tools/shell.js +37 -0
- package/dist/tools/subagent.d.ts +2 -0
- package/dist/tools/subagent.js +3 -0
- package/dist/tools/terminal.d.ts +44 -0
- package/dist/tools/terminal.js +100 -0
- package/dist/tools/todo.d.ts +2 -0
- package/dist/tools/todo.js +3 -0
- package/dist/tools/tools.d.ts +236 -0
- package/dist/tools/tools.js +42 -0
- package/dist/types.d.ts +10 -0
- package/dist/types.js +1 -0
- package/package.json +51 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
export declare const KEYRING_SERVICE = "termax-ai";
|
|
2
|
+
export type ProviderId = "openai" | "anthropic" | "google" | "xai" | "cerebras" | "groq" | "deepseek" | "mistral" | "openrouter" | "openai-compatible" | "lmstudio" | "mlx" | "ollama";
|
|
3
|
+
export type ProviderInfo = {
|
|
4
|
+
id: ProviderId;
|
|
5
|
+
label: string;
|
|
6
|
+
keyringAccount: string;
|
|
7
|
+
keyPrefix: string | null;
|
|
8
|
+
consoleUrl: string;
|
|
9
|
+
/** Provider accepts (but does not require) an API key. */
|
|
10
|
+
keyOptional?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const PROVIDERS: readonly ProviderInfo[];
|
|
13
|
+
export type CustomEndpoint = {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
baseURL: string;
|
|
17
|
+
modelId: string;
|
|
18
|
+
contextLimit: number;
|
|
19
|
+
};
|
|
20
|
+
export declare function compatModelIdForEndpoint(endpointId: string): string;
|
|
21
|
+
export declare function isCompatModelId(modelId: string): boolean;
|
|
22
|
+
export declare function endpointIdFromCompatModel(modelId: string): string;
|
|
23
|
+
/** One-shot migration of the legacy single OpenAI-compatible config into the
|
|
24
|
+
* named-endpoint list. Returns one endpoint when the old base URL + model id
|
|
25
|
+
* were both set, else empty. `id` is supplied by the caller to stay pure. */
|
|
26
|
+
export declare function migrateLegacyCompatEndpoint(baseURL: string, modelId: string, contextLimit: number, id: string): CustomEndpoint[];
|
|
27
|
+
export declare function getProvider(id: ProviderId): ProviderInfo;
|
|
28
|
+
/** 1 (lowest) – 5 (highest). For `cost`, higher = cheaper. */
|
|
29
|
+
type CapabilityScore = any;
|
|
30
|
+
type ModelTag = any;
|
|
31
|
+
export type ModelCapabilities = {
|
|
32
|
+
intelligence: CapabilityScore;
|
|
33
|
+
speed: CapabilityScore;
|
|
34
|
+
cost: CapabilityScore;
|
|
35
|
+
};
|
|
36
|
+
export type ModelInfo = {
|
|
37
|
+
id: string;
|
|
38
|
+
provider: ProviderId;
|
|
39
|
+
label: string;
|
|
40
|
+
/** One short word for the dropdown trigger. */
|
|
41
|
+
hint: string;
|
|
42
|
+
/** One-line marketing-style description shown under the label. */
|
|
43
|
+
description: string;
|
|
44
|
+
capabilities: ModelCapabilities;
|
|
45
|
+
tags?: readonly ModelTag[];
|
|
46
|
+
};
|
|
47
|
+
export declare const MODELS: readonly [{
|
|
48
|
+
readonly id: "gpt-5.5";
|
|
49
|
+
readonly provider: "openai";
|
|
50
|
+
readonly label: "GPT-5.5";
|
|
51
|
+
readonly hint: "Flagship";
|
|
52
|
+
readonly description: "Frontier reasoning and code.";
|
|
53
|
+
readonly capabilities: {
|
|
54
|
+
readonly intelligence: 5;
|
|
55
|
+
readonly speed: 3;
|
|
56
|
+
readonly cost: 1;
|
|
57
|
+
};
|
|
58
|
+
readonly tags: readonly ["vision", "reasoning", "tools", "coding"];
|
|
59
|
+
}, {
|
|
60
|
+
readonly id: "gpt-5.4-mini";
|
|
61
|
+
readonly provider: "openai";
|
|
62
|
+
readonly label: "GPT-5.4 mini";
|
|
63
|
+
readonly hint: "Fast";
|
|
64
|
+
readonly description: "Snappy default at low cost.";
|
|
65
|
+
readonly capabilities: {
|
|
66
|
+
readonly intelligence: 4;
|
|
67
|
+
readonly speed: 4;
|
|
68
|
+
readonly cost: 4;
|
|
69
|
+
};
|
|
70
|
+
readonly tags: readonly ["vision", "tools"];
|
|
71
|
+
}, {
|
|
72
|
+
readonly id: "gpt-5.4-nano";
|
|
73
|
+
readonly provider: "openai";
|
|
74
|
+
readonly label: "GPT-5.4 nano";
|
|
75
|
+
readonly hint: "Fastest";
|
|
76
|
+
readonly description: "Tiny and instant — great for autocomplete.";
|
|
77
|
+
readonly capabilities: {
|
|
78
|
+
readonly intelligence: 3;
|
|
79
|
+
readonly speed: 5;
|
|
80
|
+
readonly cost: 5;
|
|
81
|
+
};
|
|
82
|
+
readonly tags: readonly ["tools"];
|
|
83
|
+
}, {
|
|
84
|
+
readonly id: "gpt-5.3-codex";
|
|
85
|
+
readonly provider: "openai";
|
|
86
|
+
readonly label: "GPT-5.3 Codex";
|
|
87
|
+
readonly hint: "Coding";
|
|
88
|
+
readonly description: "Tuned for code and tool use.";
|
|
89
|
+
readonly capabilities: {
|
|
90
|
+
readonly intelligence: 4;
|
|
91
|
+
readonly speed: 4;
|
|
92
|
+
readonly cost: 3;
|
|
93
|
+
};
|
|
94
|
+
readonly tags: readonly ["tools", "coding"];
|
|
95
|
+
}, {
|
|
96
|
+
readonly id: "gpt-4.1-mini";
|
|
97
|
+
readonly provider: "openai";
|
|
98
|
+
readonly label: "GPT-4.1 mini";
|
|
99
|
+
readonly hint: "Cheap";
|
|
100
|
+
readonly description: "Ultra-cheap workhorse for bulk tasks.";
|
|
101
|
+
readonly capabilities: {
|
|
102
|
+
readonly intelligence: 3;
|
|
103
|
+
readonly speed: 4;
|
|
104
|
+
readonly cost: 5;
|
|
105
|
+
};
|
|
106
|
+
readonly tags: readonly ["vision", "tools"];
|
|
107
|
+
}, {
|
|
108
|
+
readonly id: "claude-opus-4-7";
|
|
109
|
+
readonly provider: "anthropic";
|
|
110
|
+
readonly label: "Claude Opus 4.7";
|
|
111
|
+
readonly hint: "Best";
|
|
112
|
+
readonly description: "Anthropic's flagship for long reasoning.";
|
|
113
|
+
readonly capabilities: {
|
|
114
|
+
readonly intelligence: 5;
|
|
115
|
+
readonly speed: 2;
|
|
116
|
+
readonly cost: 1;
|
|
117
|
+
};
|
|
118
|
+
readonly tags: readonly ["vision", "reasoning", "tools", "coding"];
|
|
119
|
+
}, {
|
|
120
|
+
readonly id: "claude-sonnet-4-6";
|
|
121
|
+
readonly provider: "anthropic";
|
|
122
|
+
readonly label: "Claude Sonnet 4.6";
|
|
123
|
+
readonly hint: "Balanced";
|
|
124
|
+
readonly description: "Sweet spot of quality and speed.";
|
|
125
|
+
readonly capabilities: {
|
|
126
|
+
readonly intelligence: 4;
|
|
127
|
+
readonly speed: 4;
|
|
128
|
+
readonly cost: 3;
|
|
129
|
+
};
|
|
130
|
+
readonly tags: readonly ["vision", "tools", "coding"];
|
|
131
|
+
}, {
|
|
132
|
+
readonly id: "claude-haiku-4-5";
|
|
133
|
+
readonly provider: "anthropic";
|
|
134
|
+
readonly label: "Claude Haiku 4.5";
|
|
135
|
+
readonly hint: "Fast";
|
|
136
|
+
readonly description: "Quick, cheap, multimodal.";
|
|
137
|
+
readonly capabilities: {
|
|
138
|
+
readonly intelligence: 3;
|
|
139
|
+
readonly speed: 5;
|
|
140
|
+
readonly cost: 4;
|
|
141
|
+
};
|
|
142
|
+
readonly tags: readonly ["vision", "tools"];
|
|
143
|
+
}, {
|
|
144
|
+
readonly id: "claude-opus-4-6";
|
|
145
|
+
readonly provider: "anthropic";
|
|
146
|
+
readonly label: "Claude Opus 4.6";
|
|
147
|
+
readonly hint: "Legacy";
|
|
148
|
+
readonly description: "Previous-gen Opus.";
|
|
149
|
+
readonly capabilities: {
|
|
150
|
+
readonly intelligence: 5;
|
|
151
|
+
readonly speed: 2;
|
|
152
|
+
readonly cost: 1;
|
|
153
|
+
};
|
|
154
|
+
readonly tags: readonly ["vision", "reasoning", "tools", "coding"];
|
|
155
|
+
}, {
|
|
156
|
+
readonly id: "gemini-3.5-flash";
|
|
157
|
+
readonly provider: "google";
|
|
158
|
+
readonly label: "Gemini 3.5 Flash";
|
|
159
|
+
readonly hint: "Fast";
|
|
160
|
+
readonly description: "High-intelligence, extremely fast multimodal model.";
|
|
161
|
+
readonly capabilities: {
|
|
162
|
+
readonly intelligence: 4;
|
|
163
|
+
readonly speed: 5;
|
|
164
|
+
readonly cost: 4;
|
|
165
|
+
};
|
|
166
|
+
readonly tags: readonly ["vision", "tools", "coding"];
|
|
167
|
+
}, {
|
|
168
|
+
readonly id: "gemini-3.1-flash-lite";
|
|
169
|
+
readonly provider: "google";
|
|
170
|
+
readonly label: "Gemini 3.1 Flash-Lite";
|
|
171
|
+
readonly hint: "Lite";
|
|
172
|
+
readonly description: "Extremely fast, cheap, and lightweight multimodal model.";
|
|
173
|
+
readonly capabilities: {
|
|
174
|
+
readonly intelligence: 3;
|
|
175
|
+
readonly speed: 5;
|
|
176
|
+
readonly cost: 5;
|
|
177
|
+
};
|
|
178
|
+
readonly tags: readonly ["vision", "tools"];
|
|
179
|
+
}, {
|
|
180
|
+
readonly id: "gemini-3.1-pro-preview";
|
|
181
|
+
readonly provider: "google";
|
|
182
|
+
readonly label: "Gemini 3.1 Pro";
|
|
183
|
+
readonly hint: "Flagship";
|
|
184
|
+
readonly description: "Strong reasoning, 1M context.";
|
|
185
|
+
readonly capabilities: {
|
|
186
|
+
readonly intelligence: 5;
|
|
187
|
+
readonly speed: 3;
|
|
188
|
+
readonly cost: 2;
|
|
189
|
+
};
|
|
190
|
+
readonly tags: readonly ["vision", "reasoning", "tools", "coding"];
|
|
191
|
+
}, {
|
|
192
|
+
readonly id: "gemini-3-flash-preview";
|
|
193
|
+
readonly provider: "google";
|
|
194
|
+
readonly label: "Gemini 3 Flash";
|
|
195
|
+
readonly hint: "Fast";
|
|
196
|
+
readonly description: "Fast multimodal, 1M context.";
|
|
197
|
+
readonly capabilities: {
|
|
198
|
+
readonly intelligence: 4;
|
|
199
|
+
readonly speed: 5;
|
|
200
|
+
readonly cost: 4;
|
|
201
|
+
};
|
|
202
|
+
readonly tags: readonly ["vision", "tools"];
|
|
203
|
+
}, {
|
|
204
|
+
readonly id: "gemini-2.5-pro";
|
|
205
|
+
readonly provider: "google";
|
|
206
|
+
readonly label: "Gemini 2.5 Pro";
|
|
207
|
+
readonly hint: "Stable";
|
|
208
|
+
readonly description: "Production-stable Gemini.";
|
|
209
|
+
readonly capabilities: {
|
|
210
|
+
readonly intelligence: 4;
|
|
211
|
+
readonly speed: 3;
|
|
212
|
+
readonly cost: 3;
|
|
213
|
+
};
|
|
214
|
+
readonly tags: readonly ["vision", "tools", "coding"];
|
|
215
|
+
}, {
|
|
216
|
+
readonly id: "gemini-2.5-flash";
|
|
217
|
+
readonly provider: "google";
|
|
218
|
+
readonly label: "Gemini 2.5 Flash";
|
|
219
|
+
readonly hint: "Cheap";
|
|
220
|
+
readonly description: "Bulk throughput at low cost.";
|
|
221
|
+
readonly capabilities: {
|
|
222
|
+
readonly intelligence: 3;
|
|
223
|
+
readonly speed: 5;
|
|
224
|
+
readonly cost: 5;
|
|
225
|
+
};
|
|
226
|
+
readonly tags: readonly ["vision", "tools"];
|
|
227
|
+
}, {
|
|
228
|
+
readonly id: "grok-4.20-reasoning";
|
|
229
|
+
readonly provider: "xai";
|
|
230
|
+
readonly label: "Grok 4.20 Reasoning";
|
|
231
|
+
readonly hint: "Reasoning";
|
|
232
|
+
readonly description: "Frontier reasoning with extended thinking.";
|
|
233
|
+
readonly capabilities: {
|
|
234
|
+
readonly intelligence: 5;
|
|
235
|
+
readonly speed: 2;
|
|
236
|
+
readonly cost: 2;
|
|
237
|
+
};
|
|
238
|
+
readonly tags: readonly ["reasoning", "tools", "coding"];
|
|
239
|
+
}, {
|
|
240
|
+
readonly id: "grok-4.20-non-reasoning";
|
|
241
|
+
readonly provider: "xai";
|
|
242
|
+
readonly label: "Grok 4.20";
|
|
243
|
+
readonly hint: "Fast";
|
|
244
|
+
readonly description: "Fast tier for chat and tools.";
|
|
245
|
+
readonly capabilities: {
|
|
246
|
+
readonly intelligence: 4;
|
|
247
|
+
readonly speed: 4;
|
|
248
|
+
readonly cost: 3;
|
|
249
|
+
};
|
|
250
|
+
readonly tags: readonly ["tools"];
|
|
251
|
+
}, {
|
|
252
|
+
readonly id: "grok-4-fast-reasoning";
|
|
253
|
+
readonly provider: "xai";
|
|
254
|
+
readonly label: "Grok 4 Fast";
|
|
255
|
+
readonly hint: "Reasoning";
|
|
256
|
+
readonly description: "Cheaper Grok 4 with vision and reasoning.";
|
|
257
|
+
readonly capabilities: {
|
|
258
|
+
readonly intelligence: 4;
|
|
259
|
+
readonly speed: 4;
|
|
260
|
+
readonly cost: 4;
|
|
261
|
+
};
|
|
262
|
+
readonly tags: readonly ["vision", "reasoning", "tools"];
|
|
263
|
+
}, {
|
|
264
|
+
readonly id: "deepseek-v4-pro";
|
|
265
|
+
readonly provider: "deepseek";
|
|
266
|
+
readonly label: "DeepSeek V4 Pro";
|
|
267
|
+
readonly hint: "Best";
|
|
268
|
+
readonly description: "Strong open-weight code model.";
|
|
269
|
+
readonly capabilities: {
|
|
270
|
+
readonly intelligence: 5;
|
|
271
|
+
readonly speed: 3;
|
|
272
|
+
readonly cost: 4;
|
|
273
|
+
};
|
|
274
|
+
readonly tags: readonly ["reasoning", "tools", "coding"];
|
|
275
|
+
}, {
|
|
276
|
+
readonly id: "deepseek-v4-flash";
|
|
277
|
+
readonly provider: "deepseek";
|
|
278
|
+
readonly label: "DeepSeek V4 Flash";
|
|
279
|
+
readonly hint: "Fast";
|
|
280
|
+
readonly description: "Cheap and fast everyday tier.";
|
|
281
|
+
readonly capabilities: {
|
|
282
|
+
readonly intelligence: 4;
|
|
283
|
+
readonly speed: 5;
|
|
284
|
+
readonly cost: 5;
|
|
285
|
+
};
|
|
286
|
+
readonly tags: readonly ["reasoning", "tools"];
|
|
287
|
+
}, {
|
|
288
|
+
readonly id: "deepseek-reasoner";
|
|
289
|
+
readonly provider: "deepseek";
|
|
290
|
+
readonly label: "DeepSeek Reasoner";
|
|
291
|
+
readonly hint: "Thinking";
|
|
292
|
+
readonly description: "Chain-of-thought at open-weight prices.";
|
|
293
|
+
readonly capabilities: {
|
|
294
|
+
readonly intelligence: 5;
|
|
295
|
+
readonly speed: 2;
|
|
296
|
+
readonly cost: 4;
|
|
297
|
+
};
|
|
298
|
+
readonly tags: readonly ["reasoning", "coding"];
|
|
299
|
+
}, {
|
|
300
|
+
readonly id: "mistral-large-latest";
|
|
301
|
+
readonly provider: "mistral";
|
|
302
|
+
readonly label: "Mistral Large 3";
|
|
303
|
+
readonly hint: "Best";
|
|
304
|
+
readonly description: "Flagship Mistral model with 128K context.";
|
|
305
|
+
readonly capabilities: {
|
|
306
|
+
readonly intelligence: 5;
|
|
307
|
+
readonly speed: 3;
|
|
308
|
+
readonly cost: 3;
|
|
309
|
+
};
|
|
310
|
+
readonly tags: readonly ["vision", "tools", "coding"];
|
|
311
|
+
}, {
|
|
312
|
+
readonly id: "mistral-medium-latest";
|
|
313
|
+
readonly provider: "mistral";
|
|
314
|
+
readonly label: "Mistral Medium 3.5";
|
|
315
|
+
readonly hint: "Balanced";
|
|
316
|
+
readonly description: "Good balance of speed and intelligence.";
|
|
317
|
+
readonly capabilities: {
|
|
318
|
+
readonly intelligence: 4;
|
|
319
|
+
readonly speed: 4;
|
|
320
|
+
readonly cost: 4;
|
|
321
|
+
};
|
|
322
|
+
readonly tags: readonly ["vision", "tools"];
|
|
323
|
+
}, {
|
|
324
|
+
readonly id: "codestral-latest";
|
|
325
|
+
readonly provider: "mistral";
|
|
326
|
+
readonly label: "Codestral";
|
|
327
|
+
readonly hint: "Code";
|
|
328
|
+
readonly description: "Purpose-built coding model from Mistral.";
|
|
329
|
+
readonly capabilities: {
|
|
330
|
+
readonly intelligence: 4;
|
|
331
|
+
readonly speed: 4;
|
|
332
|
+
readonly cost: 4;
|
|
333
|
+
};
|
|
334
|
+
readonly tags: readonly ["coding"];
|
|
335
|
+
}, {
|
|
336
|
+
readonly id: "gpt-oss-120b";
|
|
337
|
+
readonly provider: "cerebras";
|
|
338
|
+
readonly label: "GPT-OSS 120B";
|
|
339
|
+
readonly hint: "Ultra-fast";
|
|
340
|
+
readonly description: "Fastest inference on Cerebras silicon.";
|
|
341
|
+
readonly capabilities: {
|
|
342
|
+
readonly intelligence: 4;
|
|
343
|
+
readonly speed: 5;
|
|
344
|
+
readonly cost: 4;
|
|
345
|
+
};
|
|
346
|
+
readonly tags: readonly ["tools", "coding"];
|
|
347
|
+
}, {
|
|
348
|
+
readonly id: "llama3.3-70b";
|
|
349
|
+
readonly provider: "cerebras";
|
|
350
|
+
readonly label: "Llama 3.3 70B";
|
|
351
|
+
readonly hint: "Fast";
|
|
352
|
+
readonly description: "Meta's open model on wafer-scale silicon.";
|
|
353
|
+
readonly capabilities: {
|
|
354
|
+
readonly intelligence: 3;
|
|
355
|
+
readonly speed: 5;
|
|
356
|
+
readonly cost: 5;
|
|
357
|
+
};
|
|
358
|
+
readonly tags: readonly ["tools"];
|
|
359
|
+
}, {
|
|
360
|
+
readonly id: "qwen-3-32b";
|
|
361
|
+
readonly provider: "cerebras";
|
|
362
|
+
readonly label: "Qwen 3 32B";
|
|
363
|
+
readonly hint: "Fast";
|
|
364
|
+
readonly description: "Multilingual model at extreme speed.";
|
|
365
|
+
readonly capabilities: {
|
|
366
|
+
readonly intelligence: 3;
|
|
367
|
+
readonly speed: 5;
|
|
368
|
+
readonly cost: 5;
|
|
369
|
+
};
|
|
370
|
+
readonly tags: readonly ["tools", "coding"];
|
|
371
|
+
}, {
|
|
372
|
+
readonly id: "openai/gpt-oss-20b";
|
|
373
|
+
readonly provider: "groq";
|
|
374
|
+
readonly label: "GPT-OSS 20B";
|
|
375
|
+
readonly hint: "Ultra-fast";
|
|
376
|
+
readonly description: "Sub-second responses on Groq LPU.";
|
|
377
|
+
readonly capabilities: {
|
|
378
|
+
readonly intelligence: 3;
|
|
379
|
+
readonly speed: 5;
|
|
380
|
+
readonly cost: 5;
|
|
381
|
+
};
|
|
382
|
+
readonly tags: readonly ["tools", "coding"];
|
|
383
|
+
}, {
|
|
384
|
+
readonly id: "llama-3.3-70b-versatile";
|
|
385
|
+
readonly provider: "groq";
|
|
386
|
+
readonly label: "Llama 3.3 70B";
|
|
387
|
+
readonly hint: "Versatile";
|
|
388
|
+
readonly description: "Fast and broadly capable.";
|
|
389
|
+
readonly capabilities: {
|
|
390
|
+
readonly intelligence: 4;
|
|
391
|
+
readonly speed: 5;
|
|
392
|
+
readonly cost: 5;
|
|
393
|
+
};
|
|
394
|
+
readonly tags: readonly ["tools"];
|
|
395
|
+
}, {
|
|
396
|
+
readonly id: "deepseek-r1-distill-llama-70b";
|
|
397
|
+
readonly provider: "groq";
|
|
398
|
+
readonly label: "DeepSeek R1 Distill 70B";
|
|
399
|
+
readonly hint: "Thinking";
|
|
400
|
+
readonly description: "Reasoning-distilled Llama on Groq.";
|
|
401
|
+
readonly capabilities: {
|
|
402
|
+
readonly intelligence: 4;
|
|
403
|
+
readonly speed: 5;
|
|
404
|
+
readonly cost: 5;
|
|
405
|
+
};
|
|
406
|
+
readonly tags: readonly ["reasoning", "tools"];
|
|
407
|
+
}, {
|
|
408
|
+
readonly id: "openrouter-custom";
|
|
409
|
+
readonly provider: "openrouter";
|
|
410
|
+
readonly label: "OpenRouter";
|
|
411
|
+
readonly hint: "Configurable";
|
|
412
|
+
readonly description: "Any model on OpenRouter by id.";
|
|
413
|
+
readonly capabilities: {
|
|
414
|
+
readonly intelligence: 3;
|
|
415
|
+
readonly speed: 3;
|
|
416
|
+
readonly cost: 3;
|
|
417
|
+
};
|
|
418
|
+
}, {
|
|
419
|
+
readonly id: "openai-compatible-custom";
|
|
420
|
+
readonly provider: "openai-compatible";
|
|
421
|
+
readonly label: "Custom endpoint";
|
|
422
|
+
readonly hint: "Configurable";
|
|
423
|
+
readonly description: "Any OpenAI-compatible endpoint.";
|
|
424
|
+
readonly capabilities: {
|
|
425
|
+
readonly intelligence: 3;
|
|
426
|
+
readonly speed: 3;
|
|
427
|
+
readonly cost: 3;
|
|
428
|
+
};
|
|
429
|
+
}, {
|
|
430
|
+
readonly id: "lmstudio-local";
|
|
431
|
+
readonly provider: "lmstudio";
|
|
432
|
+
readonly label: "LM Studio";
|
|
433
|
+
readonly hint: "Local";
|
|
434
|
+
readonly description: "Local GGUF models via LM Studio.";
|
|
435
|
+
readonly capabilities: {
|
|
436
|
+
readonly intelligence: 3;
|
|
437
|
+
readonly speed: 3;
|
|
438
|
+
readonly cost: 5;
|
|
439
|
+
};
|
|
440
|
+
}, {
|
|
441
|
+
readonly id: "mlx-local";
|
|
442
|
+
readonly provider: "mlx";
|
|
443
|
+
readonly label: "MLX";
|
|
444
|
+
readonly hint: "Local";
|
|
445
|
+
readonly description: "Apple-silicon models via mlx_lm.server.";
|
|
446
|
+
readonly capabilities: {
|
|
447
|
+
readonly intelligence: 3;
|
|
448
|
+
readonly speed: 3;
|
|
449
|
+
readonly cost: 5;
|
|
450
|
+
};
|
|
451
|
+
}, {
|
|
452
|
+
readonly id: "ollama-local";
|
|
453
|
+
readonly provider: "ollama";
|
|
454
|
+
readonly label: "Ollama";
|
|
455
|
+
readonly hint: "Local";
|
|
456
|
+
readonly description: "Local models via Ollama.";
|
|
457
|
+
readonly capabilities: {
|
|
458
|
+
readonly intelligence: 3;
|
|
459
|
+
readonly speed: 3;
|
|
460
|
+
readonly cost: 5;
|
|
461
|
+
};
|
|
462
|
+
}];
|
|
463
|
+
export type ModelId = (typeof MODELS)[number]["id"];
|
|
464
|
+
export declare function getCompatModelInfo(modelId: string, endpoints: readonly CustomEndpoint[]): ModelInfo;
|
|
465
|
+
export declare function resolveModel(modelId: string, endpoints?: readonly CustomEndpoint[]): ModelInfo;
|
|
466
|
+
export declare function getModel(id: ModelId): ModelInfo;
|
|
467
|
+
export declare function isKnownModelId(id: string): id is ModelId;
|
|
468
|
+
export declare function modelKeepsReasoning(m: ModelInfo): boolean;
|
|
469
|
+
export declare const DEFAULT_MODEL_ID: ModelId;
|
|
470
|
+
/** Approximate context window (in tokens) per model. Used for the
|
|
471
|
+
* context-usage indicator in the AI mini-window header. Conservative
|
|
472
|
+
* estimates — actual provider limits may shift. */
|
|
473
|
+
export declare const MODEL_CONTEXT_LIMITS: Record<string, number>;
|
|
474
|
+
export declare function getModelContextLimit(modelId: string | undefined, compatOverride?: number): number;
|
|
475
|
+
export type ModelPricing = {
|
|
476
|
+
input: number;
|
|
477
|
+
output: number;
|
|
478
|
+
cacheRead?: number;
|
|
479
|
+
};
|
|
480
|
+
export declare const MODEL_PRICING: Record<string, ModelPricing>;
|
|
481
|
+
export declare function estimateCost(modelId: string | undefined, usage: {
|
|
482
|
+
inputTokens: number;
|
|
483
|
+
outputTokens: number;
|
|
484
|
+
cachedInputTokens: number;
|
|
485
|
+
}): number | null;
|
|
486
|
+
/** Providers that do not require an API key (local servers, key-optional). */
|
|
487
|
+
export declare const KEYLESS_PROVIDERS: readonly ProviderId[];
|
|
488
|
+
export declare function providerNeedsKey(id: ProviderId): boolean;
|
|
489
|
+
/** True for providers that accept an API key — required *or* optional.
|
|
490
|
+
* Used by Settings to decide whether to render a key card at all. */
|
|
491
|
+
export declare function providerSupportsKey(id: ProviderId): boolean;
|
|
492
|
+
/** Any provider can power the editor's inline autocomplete; latency is the
|
|
493
|
+
* user's choice. The picker filters down to fast tiers in the UI. */
|
|
494
|
+
export type AutocompleteProviderId = ProviderId;
|
|
495
|
+
/** Sensible default model id per provider for inline autocomplete. */
|
|
496
|
+
export declare const DEFAULT_AUTOCOMPLETE_MODEL: Partial<Record<ProviderId, string>>;
|
|
497
|
+
/** Curated list of fast models suitable for inline completion (speed ≥ 4). */
|
|
498
|
+
export declare function getAutocompleteEligibleModels(): readonly ModelInfo[];
|
|
499
|
+
export declare const LMSTUDIO_DEFAULT_BASE_URL = "http://localhost:1234/v1";
|
|
500
|
+
export declare const MLX_DEFAULT_BASE_URL = "http://127.0.0.1:8080/v1";
|
|
501
|
+
export declare const OLLAMA_DEFAULT_BASE_URL = "http://localhost:11434/v1";
|
|
502
|
+
export declare const OPENAI_COMPATIBLE_DEFAULT_BASE_URL = "";
|
|
503
|
+
export declare const MAX_AGENT_STEPS = 24;
|
|
504
|
+
export declare const TERMINAL_BUFFER_LINES = 300;
|
|
505
|
+
export declare const SYSTEM_PROMPT = "You are Termax, an AI agent embedded in a developer terminal emulator. You are a hands-on engineer, not a chat bot \u2014 your job is to *do* the work, not narrate it.\n\n# Environment\nEvery turn carries a short <env> block (prepended to the latest user message): workspace_root, active_terminal_cwd, optionally active_file. Treat it as ground truth \u2014 never ask the user where they are. The terminal scrollback is NOT auto-injected; call get_terminal_output only when the user references \"this error\" / \"the last command\" or you genuinely need to interpret recent output.\n\n# Operating principles (CRITICAL \u2014 read these)\n- **Execute, don't echo.** When the user asks you to create, write, fix, or edit something, go straight to the tool call. Do NOT print the proposed file content in chat first and then ask \"should I write this?\" \u2014 the approval card IS the confirmation. Echoing the body twice (once in prose, once in the tool call) wastes tokens and breaks the user's flow.\n- **Chain actions until done.** A real task is usually: read context \u2192 understand \u2192 make the change \u2192 verify. Run the full chain in one turn. Don't stop after a single read to summarize and wait \u2014 keep going.\n- **Ask only when genuinely stuck.** Ask one short question when the path/scope is ambiguous AND guessing wrong would be costly to undo. Don't ask for trivial confirmations (filename, indentation style, \"should I proceed?\"). For low-cost reversible defaults, just pick one and proceed.\n- **Investigate before guessing.** If you don't know where something lives, grep/glob for it \u2014 don't speculate. Verify assumptions with reads instead of asking the user.\n- **Match scope to the request.** A bug fix is a bug fix, not a refactor. Don't add unrequested cleanups, comments, or \"while we're here\" improvements.\n\n# Tools\n- Read: read_file, list_directory, grep, glob, get_terminal_output\n- Mutate (approval required): edit, multi_edit, write_file, create_directory, bash_run, bash_background\n- Background process IO: bash_logs, bash_list, bash_kill\n- Plan / delegation: todo_write, run_subagent\n- Side-channel: suggest_command, open_preview\n\n# Tool budget\n- Don't re-read a file you read earlier this session unless you wrote to it; read_file returns {unchanged: true} and you pay the round-trip for nothing.\n- One focused grep beats three list_directory calls. grep for \"where is X?\", glob for \"what files match path Y?\", list_directory for \"show me this folder\".\n- read_file defaults to the first 25KB / 2000 lines. Use offset/limit to page large files \u2014 don't pull the whole thing if you only need one function.\n- Before five or more tool calls in a row, drop a one-line plan via todo_write so the user can see your trajectory. Skip for single-step asks.\n\n# Editing\n- Prefer edit (single exact-string replace) or multi_edit (atomic batch on one file). Both require a prior read_file on the path in this session.\n- old_string must be unique in the file unless replace_all: true. If it's not, expand context until it is \u2014 don't lower your standard.\n- write_file is for brand-new files or full replacement of tiny ones. Never use it as a proxy for a targeted change.\n- Don't add comments unless the WHY is non-obvious. Don't add file-headers. Don't restate what the code says.\n\n# Path resolution\n- Bare filenames resolve against active_terminal_cwd, not workspace_root. Never write to /notes.md.\n- \"create X\" with no path \u2192 active_terminal_cwd, else workspace_root. Pick and proceed; don't ask.\n- \"edit/fix this file\" with no path \u2192 active_file when present.\n- Before write_file or create_directory in a fresh subtree, list_directory the parent to confirm it exists.\n\n# Shell\n- bash_run for short-lived commands needed for the task (lint, test, search, install). cwd persists across calls in the session shell. Never run interactive tools (vim, less, top) or dev servers/watchers via bash_run \u2014 they hang.\n- bash_background for dev servers, watchers, log tailers. Read output via bash_logs, terminate via bash_kill.\n- BEFORE spawning any dev server (pnpm dev, next dev, vite, cargo watch, ...) call bash_list. If a matching command is running, do NOT respawn \u2014 reuse it: open_preview to surface the page and tell the user it's already running. Only restart on explicit user request (bash_kill the old handle first).\n- After editing files in a project whose dev server is already up, just say \"should hot-reload\" \u2014 don't respawn.\n- suggest_command when the answer IS a single shell command for the user to insert. Don't also paste it in prose.\n\n# Output style\n- Terse. No filler, no apologies, no restating the question, no \"Sure!\" / \"I'll go ahead and...\".\n- State the *why* in one short sentence right before a mutation tool call. Not a paragraph.\n- After the work is done, one or two sentences: what changed, what's next (if anything). Don't recap the diff \u2014 the user can see it.\n- Code blocks always carry a language fence.\n- Refused reads on sensitive files (.env, .ssh, credentials) are final \u2014 don't retry.";
|
|
506
|
+
export declare const SYSTEM_PROMPT_LITE = "You are Termax, an AI agent in a developer terminal. Each turn carries an <env> block (workspace_root, active_terminal_cwd, optional active_file) prepended to the user's message \u2014 treat as ground truth.\n\nTools: read_file, list_directory, grep, glob, get_terminal_output, edit, multi_edit, write_file, create_directory, bash_run, bash_background, bash_logs, bash_list, bash_kill, suggest_command, open_preview.\n\nRules:\n- Execute, don't echo. When asked to create/fix/edit a file, go straight to the tool call. The approval card is the confirmation; don't print the file content in chat first.\n- Chain actions: read \u2192 understand \u2192 change \u2192 verify in one turn. Don't stop mid-task to ask trivial confirmations.\n- Ask only when genuinely ambiguous and a wrong guess is costly. Otherwise pick a reasonable default and proceed.\n- Bare filenames resolve to active_terminal_cwd, not workspace_root.\n- Prefer grep over scanning many files; read_file defaults to 25KB / 2000 lines (use offset/limit for larger).\n- edit/multi_edit need a prior read_file on the path. write_file for new/tiny files only.\n- bash_list before any dev server; reuse if already running.\n- Concise. No filler, no recap of the diff.";
|
|
507
|
+
export declare function selectSystemPrompt(modelId: string | undefined): string;
|
|
508
|
+
import type { AiAdapter } from "./types.js";
|
|
509
|
+
export declare function setAiAdapter(adapter: AiAdapter): void;
|
|
510
|
+
export declare function getAiAdapter(): AiAdapter;
|
|
511
|
+
export {};
|