codelantern-agent-cli 1.0.0 → 1.0.2
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 +294 -223
- package/dist/chunk-45FEFNMM.js +5030 -0
- package/dist/chunk-45FEFNMM.js.map +1 -0
- package/dist/cli.js +974 -89
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +371 -23
- package/dist/index.js +64 -7
- package/package.json +3 -2
- package/dist/chunk-Y3PEOLTZ.js +0 -2513
- package/dist/chunk-Y3PEOLTZ.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Core type definitions for
|
|
2
|
+
* Core type definitions for Code Lantern CLI
|
|
3
3
|
*/
|
|
4
4
|
type ModelRole = 'user' | 'model' | 'tool' | 'system';
|
|
5
5
|
interface FileAttachment {
|
|
@@ -40,9 +40,11 @@ interface OrbitSession {
|
|
|
40
40
|
createdAt: string;
|
|
41
41
|
updatedAt: string;
|
|
42
42
|
workspace: string;
|
|
43
|
+
provider?: string;
|
|
43
44
|
model: string;
|
|
44
45
|
turns: ConversationTurn[];
|
|
45
46
|
totalUsage: TokenUsage;
|
|
47
|
+
activeSkills?: string[];
|
|
46
48
|
}
|
|
47
49
|
interface McpServerConfig {
|
|
48
50
|
command: string;
|
|
@@ -50,7 +52,56 @@ interface McpServerConfig {
|
|
|
50
52
|
env?: Record<string, string>;
|
|
51
53
|
disabled?: boolean;
|
|
52
54
|
}
|
|
55
|
+
type ProviderType = 'gemini' | 'openai' | 'anthropic' | 'openrouter' | 'custom';
|
|
56
|
+
interface ProviderConfig {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
type: ProviderType;
|
|
60
|
+
baseUrl?: string;
|
|
61
|
+
apiKey?: string;
|
|
62
|
+
defaultModel?: string;
|
|
63
|
+
headers?: Record<string, string>;
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
}
|
|
66
|
+
interface ModelCapabilities {
|
|
67
|
+
streaming: boolean;
|
|
68
|
+
tools: boolean;
|
|
69
|
+
images: boolean;
|
|
70
|
+
reasoning: boolean;
|
|
71
|
+
contextWindow?: number;
|
|
72
|
+
}
|
|
73
|
+
interface ProviderModelInfo {
|
|
74
|
+
id: string;
|
|
75
|
+
name: string;
|
|
76
|
+
provider: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
contextWindow?: number;
|
|
79
|
+
capabilities: ModelCapabilities;
|
|
80
|
+
pricing?: {
|
|
81
|
+
promptPer1k?: number;
|
|
82
|
+
completionPer1k?: number;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
interface TimingDiagnostics {
|
|
86
|
+
providerInitMs?: number;
|
|
87
|
+
connectMs?: number;
|
|
88
|
+
ttftMs?: number;
|
|
89
|
+
streamMs?: number;
|
|
90
|
+
totalMs: number;
|
|
91
|
+
toolExecutionMs: Record<string, number>;
|
|
92
|
+
}
|
|
93
|
+
interface Skill {
|
|
94
|
+
name: string;
|
|
95
|
+
description: string;
|
|
96
|
+
path: string;
|
|
97
|
+
source: 'project' | 'user';
|
|
98
|
+
enabled: boolean;
|
|
99
|
+
content: string;
|
|
100
|
+
references?: string[];
|
|
101
|
+
tags?: string[];
|
|
102
|
+
}
|
|
53
103
|
interface OrbitConfig {
|
|
104
|
+
activeProvider: string;
|
|
54
105
|
defaultModel: string;
|
|
55
106
|
maxSteps: number;
|
|
56
107
|
temperature: number;
|
|
@@ -60,6 +111,11 @@ interface OrbitConfig {
|
|
|
60
111
|
autoCompactThreshold: number;
|
|
61
112
|
mcpServers?: Record<string, McpServerConfig>;
|
|
62
113
|
timeoutMs: number;
|
|
114
|
+
firstTokenTimeoutMs: number;
|
|
115
|
+
showTiming: boolean;
|
|
116
|
+
lowLatency: boolean;
|
|
117
|
+
activeSkills: string[];
|
|
118
|
+
providers?: Record<string, ProviderConfig>;
|
|
63
119
|
}
|
|
64
120
|
interface ApprovalRequest {
|
|
65
121
|
type: 'file_edit' | 'file_write' | 'command';
|
|
@@ -75,12 +131,20 @@ interface ApprovalRequest {
|
|
|
75
131
|
type ApprovalDecision = 'allow' | 'deny' | 'yolo_all';
|
|
76
132
|
interface AgentContext {
|
|
77
133
|
workspace: string;
|
|
134
|
+
provider: string;
|
|
78
135
|
model: string;
|
|
79
136
|
yolo: boolean;
|
|
80
137
|
planMode: boolean;
|
|
81
138
|
jsonOutput: boolean;
|
|
82
139
|
maxSteps: number;
|
|
140
|
+
timeoutMs: number;
|
|
141
|
+
firstTokenTimeoutMs: number;
|
|
142
|
+
showTiming: boolean;
|
|
143
|
+
lowLatency: boolean;
|
|
144
|
+
activeSkills?: string[];
|
|
83
145
|
attachments?: FileAttachment[];
|
|
146
|
+
signal?: AbortSignal;
|
|
147
|
+
onStateChange?: (state: string) => void;
|
|
84
148
|
}
|
|
85
149
|
interface ToolDefinition {
|
|
86
150
|
name: string;
|
|
@@ -104,6 +168,7 @@ interface ToolExecutionContext {
|
|
|
104
168
|
yolo: boolean;
|
|
105
169
|
planMode: boolean;
|
|
106
170
|
requestApproval: (request: ApprovalRequest) => Promise<boolean>;
|
|
171
|
+
signal?: AbortSignal;
|
|
107
172
|
}
|
|
108
173
|
interface ToolExecutionResult {
|
|
109
174
|
success: boolean;
|
|
@@ -124,7 +189,7 @@ declare function setConfigValue(key: string, value: unknown): {
|
|
|
124
189
|
declare function getConfigValue<K extends keyof OrbitConfig>(key: K): OrbitConfig[K];
|
|
125
190
|
|
|
126
191
|
declare const DEFAULT_CONFIG: OrbitConfig;
|
|
127
|
-
declare const ALLOWED_CONFIG_KEYS: readonly ["defaultModel", "maxSteps", "temperature", "maxOutputTokens", "yolo", "theme", "autoCompactThreshold", "timeoutMs"];
|
|
192
|
+
declare const ALLOWED_CONFIG_KEYS: readonly ["activeProvider", "defaultModel", "maxSteps", "temperature", "maxOutputTokens", "yolo", "theme", "autoCompactThreshold", "timeoutMs", "firstTokenTimeoutMs", "showTiming", "lowLatency", "activeSkills"];
|
|
128
193
|
type ConfigKey = (typeof ALLOWED_CONFIG_KEYS)[number];
|
|
129
194
|
declare function validateConfigValue(key: string, value: unknown): {
|
|
130
195
|
valid: boolean;
|
|
@@ -143,36 +208,202 @@ interface StreamCallbacks {
|
|
|
143
208
|
onChunk?: (text: string) => void;
|
|
144
209
|
onToolCalls?: (toolCalls: ToolCallItem[]) => void;
|
|
145
210
|
onUsage?: (usage: TokenUsage) => void;
|
|
211
|
+
onStateChange?: (state: string) => void;
|
|
212
|
+
}
|
|
213
|
+
interface ProviderStreamParams {
|
|
214
|
+
model: string;
|
|
215
|
+
systemInstruction: string;
|
|
216
|
+
history: ConversationTurn[];
|
|
217
|
+
tools: ToolDefinition[];
|
|
218
|
+
callbacks: StreamCallbacks;
|
|
219
|
+
signal?: AbortSignal;
|
|
220
|
+
temperature?: number;
|
|
221
|
+
maxOutputTokens?: number;
|
|
222
|
+
timeoutMs?: number;
|
|
223
|
+
firstTokenTimeoutMs?: number;
|
|
224
|
+
lowLatency?: boolean;
|
|
225
|
+
enableSearchGrounding?: boolean;
|
|
146
226
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
227
|
+
interface ProviderStreamResult {
|
|
228
|
+
text: string;
|
|
229
|
+
toolCalls: ToolCallItem[];
|
|
230
|
+
usage: TokenUsage;
|
|
231
|
+
timing: TimingDiagnostics;
|
|
232
|
+
}
|
|
233
|
+
interface ProviderTestResult {
|
|
234
|
+
success: boolean;
|
|
235
|
+
latencyMs: number;
|
|
236
|
+
error?: string;
|
|
237
|
+
modelsCount?: number;
|
|
238
|
+
resolvedModel?: string;
|
|
239
|
+
}
|
|
240
|
+
interface IProviderAdapter {
|
|
241
|
+
id: string;
|
|
242
|
+
name: string;
|
|
243
|
+
displayName: string;
|
|
244
|
+
defaultModel: string;
|
|
151
245
|
isConfigured(): boolean;
|
|
246
|
+
getApiKey(): string | null;
|
|
152
247
|
getMaskedKey(): string;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
248
|
+
streamGenerate(params: ProviderStreamParams): Promise<ProviderStreamResult>;
|
|
249
|
+
listModels(refresh?: boolean): Promise<ProviderModelInfo[]>;
|
|
250
|
+
testConnection(): Promise<ProviderTestResult>;
|
|
251
|
+
getCapabilities(modelId: string): ModelCapabilities;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
declare class ProviderRegistry {
|
|
255
|
+
private providers;
|
|
256
|
+
constructor();
|
|
257
|
+
private registerBuiltins;
|
|
258
|
+
private loadCustomProviders;
|
|
259
|
+
getProvider(id?: string): IProviderAdapter;
|
|
260
|
+
hasProvider(id: string): boolean;
|
|
261
|
+
listProviders(): Array<{
|
|
262
|
+
id: string;
|
|
263
|
+
name: string;
|
|
264
|
+
displayName: string;
|
|
265
|
+
isConfigured: boolean;
|
|
266
|
+
maskedKey: string;
|
|
267
|
+
defaultModel: string;
|
|
268
|
+
isActive: boolean;
|
|
162
269
|
}>;
|
|
270
|
+
registerCustomProvider(cfg: ProviderConfig): void;
|
|
271
|
+
removeCustomProvider(id: string): boolean;
|
|
272
|
+
testProvider(id?: string): Promise<ProviderTestResult>;
|
|
273
|
+
listModels(providerId?: string, refresh?: boolean): Promise<ProviderModelInfo[]>;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
type ModelCategory = 'coding' | 'chat' | 'specialized';
|
|
277
|
+
interface ModelClassification {
|
|
278
|
+
id: string;
|
|
279
|
+
category: ModelCategory;
|
|
280
|
+
specializedType?: string;
|
|
281
|
+
isRecommendedForCoding: boolean;
|
|
282
|
+
capabilities: ModelCapabilities;
|
|
283
|
+
warning?: string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Inspects a model ID and optional capability hints to classify whether it is
|
|
287
|
+
* suitable for interactive autonomous coding (tools + chat), chat-only, or specialized.
|
|
288
|
+
*/
|
|
289
|
+
declare function classifyModel(modelId: string, capabilities?: Partial<ModelCapabilities>, description?: string): ModelClassification;
|
|
290
|
+
/**
|
|
291
|
+
* Returns a list of known compatible coding models for the given provider.
|
|
292
|
+
*/
|
|
293
|
+
declare function getRecommendedCodingModels(providerId: string, availableModels?: ProviderModelInfo[]): string[];
|
|
294
|
+
|
|
295
|
+
declare class GeminiProvider implements IProviderAdapter {
|
|
296
|
+
id: string;
|
|
297
|
+
name: string;
|
|
298
|
+
displayName: string;
|
|
299
|
+
defaultModel: string;
|
|
300
|
+
private cachedModels;
|
|
301
|
+
isConfigured(): boolean;
|
|
302
|
+
getApiKey(): string | null;
|
|
303
|
+
getMaskedKey(): string;
|
|
304
|
+
private getClient;
|
|
305
|
+
getCapabilities(modelId: string): ModelCapabilities;
|
|
306
|
+
testConnection(): Promise<ProviderTestResult>;
|
|
307
|
+
listModels(refresh?: boolean): Promise<ProviderModelInfo[]>;
|
|
308
|
+
streamGenerate(params: ProviderStreamParams): Promise<ProviderStreamResult>;
|
|
163
309
|
private convertHistoryToContents;
|
|
164
310
|
private convertToolsToDeclarations;
|
|
165
311
|
}
|
|
166
312
|
|
|
167
|
-
declare class
|
|
313
|
+
declare class OpenAIProvider implements IProviderAdapter {
|
|
314
|
+
id: string;
|
|
315
|
+
name: string;
|
|
316
|
+
displayName: string;
|
|
317
|
+
defaultModel: string;
|
|
318
|
+
baseUrl: string;
|
|
319
|
+
customHeaders: Record<string, string>;
|
|
320
|
+
private cachedModels;
|
|
321
|
+
constructor(options?: {
|
|
322
|
+
id?: string;
|
|
323
|
+
name?: string;
|
|
324
|
+
displayName?: string;
|
|
325
|
+
baseUrl?: string;
|
|
326
|
+
defaultModel?: string;
|
|
327
|
+
headers?: Record<string, string>;
|
|
328
|
+
});
|
|
329
|
+
isConfigured(): boolean;
|
|
330
|
+
getApiKey(): string | null;
|
|
331
|
+
getMaskedKey(): string;
|
|
332
|
+
getCapabilities(modelId: string): ModelCapabilities;
|
|
333
|
+
testConnection(): Promise<ProviderTestResult>;
|
|
334
|
+
listModels(refresh?: boolean): Promise<ProviderModelInfo[]>;
|
|
335
|
+
streamGenerate(params: ProviderStreamParams): Promise<ProviderStreamResult>;
|
|
336
|
+
private convertHistoryToMessages;
|
|
337
|
+
private convertTools;
|
|
338
|
+
private readSSEStream;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
declare class AnthropicProvider implements IProviderAdapter {
|
|
342
|
+
id: string;
|
|
343
|
+
name: string;
|
|
344
|
+
displayName: string;
|
|
345
|
+
defaultModel: string;
|
|
346
|
+
baseUrl: string;
|
|
347
|
+
private cachedModels;
|
|
348
|
+
isConfigured(): boolean;
|
|
349
|
+
getApiKey(): string | null;
|
|
350
|
+
getMaskedKey(): string;
|
|
351
|
+
getCapabilities(modelId: string): ModelCapabilities;
|
|
352
|
+
testConnection(): Promise<ProviderTestResult>;
|
|
353
|
+
listModels(refresh?: boolean): Promise<ProviderModelInfo[]>;
|
|
354
|
+
streamGenerate(params: ProviderStreamParams): Promise<ProviderStreamResult>;
|
|
355
|
+
private convertHistoryToMessages;
|
|
356
|
+
private convertTools;
|
|
357
|
+
private readSSEStream;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
declare class OpenRouterProvider extends OpenAIProvider {
|
|
168
361
|
constructor();
|
|
362
|
+
getCapabilities(modelId: string): ModelCapabilities;
|
|
363
|
+
listModels(refresh?: boolean): Promise<ProviderModelInfo[]>;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
declare function createLinkedAbortController(parentSignal?: AbortSignal, timeoutMs?: number): {
|
|
367
|
+
controller: AbortController;
|
|
368
|
+
cleanup: () => void;
|
|
369
|
+
};
|
|
370
|
+
/**
|
|
371
|
+
* Race a promise against a timeout duration and optional AbortSignal.
|
|
372
|
+
* Cleans up timer and listeners unconditionally in finally.
|
|
373
|
+
*/
|
|
374
|
+
declare function withTimeoutRace<T>(promise: Promise<T>, timeoutMs: number, operationName: string, signal?: AbortSignal, onTimeout?: () => void): Promise<T>;
|
|
375
|
+
declare function wrapStreamWithFirstTokenTimeout<T>(stream: AsyncIterable<T>, firstTokenTimeoutMs: number, provider: string, model: string, signal?: AbortSignal, onFirstToken?: (latencyMs: number) => void): AsyncGenerator<T, void, unknown>;
|
|
376
|
+
|
|
377
|
+
declare class TimeoutError extends Error {
|
|
378
|
+
timeoutMs: number;
|
|
379
|
+
constructor(timeoutMs: number, operation?: string);
|
|
380
|
+
}
|
|
381
|
+
declare class FirstTokenTimeoutError extends Error {
|
|
382
|
+
timeoutMs: number;
|
|
383
|
+
provider: string;
|
|
384
|
+
model: string;
|
|
385
|
+
constructor(timeoutMs: number, provider: string, model: string);
|
|
386
|
+
}
|
|
387
|
+
declare class CancelledError extends Error {
|
|
388
|
+
constructor(message?: string);
|
|
389
|
+
}
|
|
390
|
+
declare class MissingApiKeyError extends Error {
|
|
391
|
+
provider: string;
|
|
392
|
+
constructor(provider?: string, envVar?: string);
|
|
169
393
|
}
|
|
170
394
|
declare class RateLimitError extends Error {
|
|
171
395
|
constructor(message?: string);
|
|
172
396
|
}
|
|
173
|
-
declare class
|
|
397
|
+
declare class AuthenticationError extends Error {
|
|
398
|
+
constructor(message?: string);
|
|
399
|
+
}
|
|
400
|
+
declare class ModelNotFoundError extends Error {
|
|
401
|
+
constructor(model: string, provider: string);
|
|
402
|
+
}
|
|
403
|
+
declare class LanternProviderError extends Error {
|
|
174
404
|
statusCode?: number;
|
|
175
|
-
|
|
405
|
+
provider?: string;
|
|
406
|
+
constructor(message: string, statusCode?: number, provider?: string);
|
|
176
407
|
}
|
|
177
408
|
declare function formatErrorMessage(err: unknown): string;
|
|
178
409
|
|
|
@@ -197,6 +428,83 @@ interface CommandValidationResult {
|
|
|
197
428
|
}
|
|
198
429
|
declare function validateCommand(command: string): CommandValidationResult;
|
|
199
430
|
|
|
431
|
+
interface INativeCredentialStore {
|
|
432
|
+
name: string;
|
|
433
|
+
isAvailable(): boolean;
|
|
434
|
+
get(service: string, account: string): string | null;
|
|
435
|
+
set(service: string, account: string, secret: string): boolean;
|
|
436
|
+
delete(service: string, account: string): boolean;
|
|
437
|
+
}
|
|
438
|
+
declare class NativeCredentialStore {
|
|
439
|
+
private static instance;
|
|
440
|
+
private primaryStore;
|
|
441
|
+
private fallbackStore;
|
|
442
|
+
private constructor();
|
|
443
|
+
static getInstance(): NativeCredentialStore;
|
|
444
|
+
getStoreName(): string;
|
|
445
|
+
isAvailable(): boolean;
|
|
446
|
+
get(service: string, account: string): string | null;
|
|
447
|
+
set(service: string, account: string, secret: string): boolean;
|
|
448
|
+
delete(service: string, account: string): boolean;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
declare const SERVICE_NAME = "codelantern";
|
|
452
|
+
declare function getLegacyCredentialsFilePath(): string;
|
|
453
|
+
/**
|
|
454
|
+
* Returns user-friendly name of the active OS credential store
|
|
455
|
+
*/
|
|
456
|
+
declare function getStoreName(): string;
|
|
457
|
+
declare function encryptSecret(plainText: string): string;
|
|
458
|
+
declare function decryptSecret(encryptedPayload: string): string | null;
|
|
459
|
+
declare function maskApiKey(key: string): string;
|
|
460
|
+
interface KeyResult {
|
|
461
|
+
key: string | null;
|
|
462
|
+
source?: 'env' | 'store';
|
|
463
|
+
sourceDescription?: string;
|
|
464
|
+
}
|
|
465
|
+
interface MigrationReport {
|
|
466
|
+
attempted: boolean;
|
|
467
|
+
migratedProviders: string[];
|
|
468
|
+
failedProviders: string[];
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Automatically migrates existing credentials from legacy ~/.codelantern/credentials.json
|
|
472
|
+
* into the native OS credential store (Keychain on macOS, Windows Credential Manager on Windows).
|
|
473
|
+
* Verifies each key's retrieval before removing from the legacy vault to ensure crash safety.
|
|
474
|
+
*/
|
|
475
|
+
declare function migrateLegacyCredentials(force?: boolean): MigrationReport;
|
|
476
|
+
/**
|
|
477
|
+
* Retrieves the API key for a given provider with explicit precedence:
|
|
478
|
+
* 1. Environment variables (GEMINI_API_KEY, etc.)
|
|
479
|
+
* 2. Native OS credential store (macOS Keychain, Windows Credential Manager)
|
|
480
|
+
*/
|
|
481
|
+
declare function getApiKey(provider: string): KeyResult;
|
|
482
|
+
/**
|
|
483
|
+
* Securely saves an API key to the native OS credential store.
|
|
484
|
+
* Verifies that the saved key can be retrieved before returning.
|
|
485
|
+
*/
|
|
486
|
+
declare function setApiKey(provider: string, apiKey: string): void;
|
|
487
|
+
/**
|
|
488
|
+
* Removes an API key from the native OS credential store.
|
|
489
|
+
*/
|
|
490
|
+
declare function removeApiKey(provider: string): boolean;
|
|
491
|
+
interface ConfiguredKeyInfo {
|
|
492
|
+
configured: boolean;
|
|
493
|
+
source?: 'env' | 'store';
|
|
494
|
+
sourceDescription: string;
|
|
495
|
+
maskedKey: string;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Lists all configured provider keys, indicating source and masked representation.
|
|
499
|
+
* Never exposes plaintext keys.
|
|
500
|
+
*/
|
|
501
|
+
declare function listConfiguredKeys(): Record<string, ConfiguredKeyInfo>;
|
|
502
|
+
/**
|
|
503
|
+
* Prompts the user interactively with a masked prompt ('*').
|
|
504
|
+
* Keystrokes are not echoed in plaintext to the terminal.
|
|
505
|
+
*/
|
|
506
|
+
declare function promptMaskedApiKey(query: string): Promise<string>;
|
|
507
|
+
|
|
200
508
|
declare class ApprovalEngine {
|
|
201
509
|
private yolo;
|
|
202
510
|
private planMode;
|
|
@@ -233,6 +541,42 @@ declare function exportSessionMarkdown(session: OrbitSession): string;
|
|
|
233
541
|
declare function shouldCompact(turns: ConversationTurn[], threshold?: number): boolean;
|
|
234
542
|
declare function compactTurns(turns: ConversationTurn[], retainRecentCount?: number): ConversationTurn[];
|
|
235
543
|
|
|
544
|
+
declare class SkillManager {
|
|
545
|
+
private userSkillsDir;
|
|
546
|
+
constructor();
|
|
547
|
+
getUserSkillsDir(): string;
|
|
548
|
+
getProjectSkillsDirs(workspace: string): string[];
|
|
549
|
+
/**
|
|
550
|
+
* Discovers all available skills from user-level and project-level directories
|
|
551
|
+
*/
|
|
552
|
+
listSkills(workspace?: string): Skill[];
|
|
553
|
+
private scanDirectoryForSkills;
|
|
554
|
+
parseSkillMd(rawContent: string, defaultName: string): {
|
|
555
|
+
name: string;
|
|
556
|
+
description: string;
|
|
557
|
+
content: string;
|
|
558
|
+
};
|
|
559
|
+
getSkill(name: string, workspace?: string): Skill | null;
|
|
560
|
+
enableSkill(name: string): boolean;
|
|
561
|
+
disableSkill(name: string): boolean;
|
|
562
|
+
addSkillFromPath(sourcePath: string): {
|
|
563
|
+
success: boolean;
|
|
564
|
+
skillName?: string;
|
|
565
|
+
error?: string;
|
|
566
|
+
};
|
|
567
|
+
addSkillFromGit(repoUrl: string): {
|
|
568
|
+
success: boolean;
|
|
569
|
+
skillName?: string;
|
|
570
|
+
error?: string;
|
|
571
|
+
};
|
|
572
|
+
removeSkill(name: string): boolean;
|
|
573
|
+
/**
|
|
574
|
+
* Matches prompt against available skills by keyword and intent.
|
|
575
|
+
* Transparent and non-intrusive.
|
|
576
|
+
*/
|
|
577
|
+
matchSkillsForPrompt(userPrompt: string, workspace?: string): Skill[];
|
|
578
|
+
}
|
|
579
|
+
|
|
236
580
|
interface OrbitTool {
|
|
237
581
|
definition: ToolDefinition;
|
|
238
582
|
execute: (args: Record<string, any>, context: ToolExecutionContext) => Promise<ToolExecutionResult>;
|
|
@@ -264,21 +608,25 @@ declare function addMcpServer(name: string, config: McpServerConfig): void;
|
|
|
264
608
|
declare function removeMcpServer(name: string): boolean;
|
|
265
609
|
declare function toggleMcpServer(name: string, disabled: boolean): boolean;
|
|
266
610
|
|
|
267
|
-
declare class
|
|
268
|
-
private
|
|
611
|
+
declare class LanternAgent {
|
|
612
|
+
private providerRegistry;
|
|
269
613
|
private tools;
|
|
270
614
|
private mcpManager;
|
|
615
|
+
private skillManager;
|
|
271
616
|
private approvalEngine;
|
|
272
617
|
private spinner;
|
|
273
|
-
constructor(
|
|
618
|
+
constructor();
|
|
619
|
+
getProviderRegistry(): ProviderRegistry;
|
|
620
|
+
getSkillManager(): SkillManager;
|
|
274
621
|
initMcp(): Promise<void>;
|
|
275
622
|
shutdown(): Promise<void>;
|
|
276
|
-
buildSystemPrompt(workspace: string, planMode?: boolean): string;
|
|
623
|
+
buildSystemPrompt(workspace: string, planMode?: boolean, activeSkills?: Skill[]): string;
|
|
277
624
|
runTurn(session: OrbitSession, userPrompt: string, context: AgentContext, attachments?: FileAttachment[]): Promise<{
|
|
278
625
|
reply: string;
|
|
279
626
|
toolCount: number;
|
|
280
627
|
usage: TokenUsage;
|
|
628
|
+
timing: TimingDiagnostics;
|
|
281
629
|
}>;
|
|
282
630
|
}
|
|
283
631
|
|
|
284
|
-
export { ALLOWED_CONFIG_KEYS, type AgentContext, type ApprovalDecision, ApprovalEngine, type ApprovalRequest, type CommandValidationResult, type ConfigKey, type ConversationTurn, DEFAULT_CONFIG, type FileAttachment, GeminiProvider,
|
|
632
|
+
export { ALLOWED_CONFIG_KEYS, type AgentContext, AnthropicProvider, type ApprovalDecision, ApprovalEngine, type ApprovalRequest, AuthenticationError, CancelledError, type CommandValidationResult, type ConfigKey, type ConfiguredKeyInfo, type ConversationTurn, DEFAULT_CONFIG, type FileAttachment, FirstTokenTimeoutError, GeminiProvider, type INativeCredentialStore, type IProviderAdapter, type KeyResult, LanternAgent, LanternProviderError, McpManager, type McpServerConfig, type MigrationReport, MissingApiKeyError, type ModelCapabilities, type ModelCategory, type ModelClassification, ModelNotFoundError, type ModelRole, NativeCredentialStore, OpenAIProvider, OpenRouterProvider, LanternAgent as OrbitAgent, type OrbitConfig, type OrbitSession, type OrbitTool, type PathValidationResult, type ProjectInstructions, type ProviderConfig, type ProviderModelInfo, ProviderRegistry, type ProviderStreamParams, type ProviderStreamResult, type ProviderTestResult, type ProviderType, RateLimitError, SERVICE_NAME, type Skill, SkillManager, type StreamCallbacks, TimeoutError, type TimingDiagnostics, type TokenUsage, type ToolCallItem, type ToolDefinition, type ToolExecutionContext, type ToolExecutionResult, ToolRegistry, type ToolResultItem, addMcpServer, classifyModel, compactTurns, createLinkedAbortController, createNewSession, decryptSecret, deleteSession, encryptSecret, exportSessionMarkdown, formatErrorMessage, formatNewFilePreview, formatTerminalDiff, generateSessionId, getApiKey, getConfigFilePath, getConfigValue, getLanternHomeDir, getLegacyCredentialsFilePath, getMcpConfigPath, getRecommendedCodingModels, getSessionsDir, getStoreName, isSecretFile, listConfiguredKeys, listSessions, loadAttachment, loadAttachments, loadConfig, loadMcpConfig, loadProjectInstructions, loadSession, maskApiKey, migrateLegacyCredentials, promptMaskedApiKey, removeApiKey, removeMcpServer, sanitizeSecrets, saveConfig, saveMcpConfig, saveSession, setApiKey, setConfigValue, shouldCompact, toggleMcpServer, validateCommand, validateConfigValue, validateWorkspacePath, withTimeoutRace, wrapStreamWithFirstTokenTimeout };
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ALLOWED_CONFIG_KEYS,
|
|
4
|
+
AnthropicProvider,
|
|
4
5
|
ApprovalEngine,
|
|
6
|
+
AuthenticationError,
|
|
7
|
+
CancelledError,
|
|
5
8
|
DEFAULT_CONFIG,
|
|
9
|
+
FirstTokenTimeoutError,
|
|
6
10
|
GeminiProvider,
|
|
7
|
-
|
|
11
|
+
LanternAgent,
|
|
12
|
+
LanternProviderError,
|
|
8
13
|
McpManager,
|
|
9
14
|
MissingApiKeyError,
|
|
10
|
-
|
|
15
|
+
ModelNotFoundError,
|
|
16
|
+
NativeCredentialStore,
|
|
17
|
+
OpenAIProvider,
|
|
18
|
+
OpenRouterProvider,
|
|
19
|
+
ProviderRegistry,
|
|
11
20
|
RateLimitError,
|
|
21
|
+
SERVICE_NAME,
|
|
22
|
+
SkillManager,
|
|
23
|
+
TimeoutError,
|
|
12
24
|
ToolRegistry,
|
|
13
25
|
addMcpServer,
|
|
26
|
+
classifyModel,
|
|
14
27
|
compactTurns,
|
|
28
|
+
createLinkedAbortController,
|
|
15
29
|
createNewSession,
|
|
30
|
+
decryptSecret,
|
|
16
31
|
deleteSession,
|
|
32
|
+
encryptSecret,
|
|
17
33
|
exportSessionMarkdown,
|
|
18
34
|
formatErrorMessage,
|
|
19
35
|
formatNewFilePreview,
|
|
20
36
|
formatTerminalDiff,
|
|
21
37
|
generateSessionId,
|
|
38
|
+
getApiKey,
|
|
22
39
|
getConfigFilePath,
|
|
23
40
|
getConfigValue,
|
|
24
41
|
getLanternHomeDir,
|
|
42
|
+
getLegacyCredentialsFilePath,
|
|
25
43
|
getMcpConfigPath,
|
|
44
|
+
getRecommendedCodingModels,
|
|
26
45
|
getSessionsDir,
|
|
46
|
+
getStoreName,
|
|
27
47
|
isSecretFile,
|
|
48
|
+
listConfiguredKeys,
|
|
28
49
|
listSessions,
|
|
29
50
|
loadAttachment,
|
|
30
51
|
loadAttachments,
|
|
@@ -32,44 +53,73 @@ import {
|
|
|
32
53
|
loadMcpConfig,
|
|
33
54
|
loadProjectInstructions,
|
|
34
55
|
loadSession,
|
|
56
|
+
maskApiKey,
|
|
57
|
+
migrateLegacyCredentials,
|
|
58
|
+
promptMaskedApiKey,
|
|
59
|
+
removeApiKey,
|
|
35
60
|
removeMcpServer,
|
|
36
61
|
sanitizeSecrets,
|
|
37
62
|
saveConfig,
|
|
38
63
|
saveMcpConfig,
|
|
39
64
|
saveSession,
|
|
65
|
+
setApiKey,
|
|
40
66
|
setConfigValue,
|
|
41
67
|
shouldCompact,
|
|
42
68
|
toggleMcpServer,
|
|
43
69
|
validateCommand,
|
|
44
70
|
validateConfigValue,
|
|
45
|
-
validateWorkspacePath
|
|
46
|
-
|
|
71
|
+
validateWorkspacePath,
|
|
72
|
+
withTimeoutRace,
|
|
73
|
+
wrapStreamWithFirstTokenTimeout
|
|
74
|
+
} from "./chunk-45FEFNMM.js";
|
|
47
75
|
export {
|
|
48
76
|
ALLOWED_CONFIG_KEYS,
|
|
77
|
+
AnthropicProvider,
|
|
49
78
|
ApprovalEngine,
|
|
79
|
+
AuthenticationError,
|
|
80
|
+
CancelledError,
|
|
50
81
|
DEFAULT_CONFIG,
|
|
82
|
+
FirstTokenTimeoutError,
|
|
51
83
|
GeminiProvider,
|
|
52
|
-
|
|
84
|
+
LanternAgent,
|
|
85
|
+
LanternProviderError,
|
|
53
86
|
McpManager,
|
|
54
87
|
MissingApiKeyError,
|
|
55
|
-
|
|
88
|
+
ModelNotFoundError,
|
|
89
|
+
NativeCredentialStore,
|
|
90
|
+
OpenAIProvider,
|
|
91
|
+
OpenRouterProvider,
|
|
92
|
+
LanternAgent as OrbitAgent,
|
|
93
|
+
ProviderRegistry,
|
|
56
94
|
RateLimitError,
|
|
95
|
+
SERVICE_NAME,
|
|
96
|
+
SkillManager,
|
|
97
|
+
TimeoutError,
|
|
57
98
|
ToolRegistry,
|
|
58
99
|
addMcpServer,
|
|
100
|
+
classifyModel,
|
|
59
101
|
compactTurns,
|
|
102
|
+
createLinkedAbortController,
|
|
60
103
|
createNewSession,
|
|
104
|
+
decryptSecret,
|
|
61
105
|
deleteSession,
|
|
106
|
+
encryptSecret,
|
|
62
107
|
exportSessionMarkdown,
|
|
63
108
|
formatErrorMessage,
|
|
64
109
|
formatNewFilePreview,
|
|
65
110
|
formatTerminalDiff,
|
|
66
111
|
generateSessionId,
|
|
112
|
+
getApiKey,
|
|
67
113
|
getConfigFilePath,
|
|
68
114
|
getConfigValue,
|
|
69
115
|
getLanternHomeDir,
|
|
116
|
+
getLegacyCredentialsFilePath,
|
|
70
117
|
getMcpConfigPath,
|
|
118
|
+
getRecommendedCodingModels,
|
|
71
119
|
getSessionsDir,
|
|
120
|
+
getStoreName,
|
|
72
121
|
isSecretFile,
|
|
122
|
+
listConfiguredKeys,
|
|
73
123
|
listSessions,
|
|
74
124
|
loadAttachment,
|
|
75
125
|
loadAttachments,
|
|
@@ -77,16 +127,23 @@ export {
|
|
|
77
127
|
loadMcpConfig,
|
|
78
128
|
loadProjectInstructions,
|
|
79
129
|
loadSession,
|
|
130
|
+
maskApiKey,
|
|
131
|
+
migrateLegacyCredentials,
|
|
132
|
+
promptMaskedApiKey,
|
|
133
|
+
removeApiKey,
|
|
80
134
|
removeMcpServer,
|
|
81
135
|
sanitizeSecrets,
|
|
82
136
|
saveConfig,
|
|
83
137
|
saveMcpConfig,
|
|
84
138
|
saveSession,
|
|
139
|
+
setApiKey,
|
|
85
140
|
setConfigValue,
|
|
86
141
|
shouldCompact,
|
|
87
142
|
toggleMcpServer,
|
|
88
143
|
validateCommand,
|
|
89
144
|
validateConfigValue,
|
|
90
|
-
validateWorkspacePath
|
|
145
|
+
validateWorkspacePath,
|
|
146
|
+
withTimeoutRace,
|
|
147
|
+
wrapStreamWithFirstTokenTimeout
|
|
91
148
|
};
|
|
92
149
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codelantern-agent-cli",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Code Lantern CLI - Personal AI coding assistant for the terminal
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Code Lantern CLI - Personal AI coding assistant for the terminal with multi-provider and skills support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"lantern": "./dist/cli.js"
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@google/genai": "^2.32.0",
|
|
43
43
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
44
|
+
"@napi-rs/keyring": "^2.1.2",
|
|
44
45
|
"commander": "^14.0.3",
|
|
45
46
|
"diff": "^8.0.4",
|
|
46
47
|
"fast-glob": "^3.3.3",
|