codelantern-agent-cli 1.0.1 → 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 +283 -163
- package/dist/{chunk-PELESOCI.js → chunk-45FEFNMM.js} +877 -154
- package/dist/chunk-45FEFNMM.js.map +1 -0
- package/dist/cli.js +351 -62
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +91 -5
- package/dist/index.js +19 -1
- package/package.json +2 -1
- package/dist/chunk-PELESOCI.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -273,6 +273,25 @@ declare class ProviderRegistry {
|
|
|
273
273
|
listModels(providerId?: string, refresh?: boolean): Promise<ProviderModelInfo[]>;
|
|
274
274
|
}
|
|
275
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
|
+
|
|
276
295
|
declare class GeminiProvider implements IProviderAdapter {
|
|
277
296
|
id: string;
|
|
278
297
|
name: string;
|
|
@@ -348,6 +367,11 @@ declare function createLinkedAbortController(parentSignal?: AbortSignal, timeout
|
|
|
348
367
|
controller: AbortController;
|
|
349
368
|
cleanup: () => void;
|
|
350
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>;
|
|
351
375
|
declare function wrapStreamWithFirstTokenTimeout<T>(stream: AsyncIterable<T>, firstTokenTimeoutMs: number, provider: string, model: string, signal?: AbortSignal, onFirstToken?: (latencyMs: number) => void): AsyncGenerator<T, void, unknown>;
|
|
352
376
|
|
|
353
377
|
declare class TimeoutError extends Error {
|
|
@@ -404,20 +428,82 @@ interface CommandValidationResult {
|
|
|
404
428
|
}
|
|
405
429
|
declare function validateCommand(command: string): CommandValidationResult;
|
|
406
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;
|
|
407
457
|
declare function encryptSecret(plainText: string): string;
|
|
408
458
|
declare function decryptSecret(encryptedPayload: string): string | null;
|
|
409
459
|
declare function maskApiKey(key: string): string;
|
|
410
|
-
|
|
460
|
+
interface KeyResult {
|
|
411
461
|
key: string | null;
|
|
412
462
|
source?: 'env' | 'store';
|
|
413
|
-
|
|
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
|
+
*/
|
|
414
486
|
declare function setApiKey(provider: string, apiKey: string): void;
|
|
487
|
+
/**
|
|
488
|
+
* Removes an API key from the native OS credential store.
|
|
489
|
+
*/
|
|
415
490
|
declare function removeApiKey(provider: string): boolean;
|
|
416
|
-
|
|
491
|
+
interface ConfiguredKeyInfo {
|
|
417
492
|
configured: boolean;
|
|
418
493
|
source?: 'env' | 'store';
|
|
494
|
+
sourceDescription: string;
|
|
419
495
|
maskedKey: string;
|
|
420
|
-
}
|
|
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>;
|
|
421
507
|
|
|
422
508
|
declare class ApprovalEngine {
|
|
423
509
|
private yolo;
|
|
@@ -543,4 +629,4 @@ declare class LanternAgent {
|
|
|
543
629
|
}>;
|
|
544
630
|
}
|
|
545
631
|
|
|
546
|
-
export { ALLOWED_CONFIG_KEYS, type AgentContext, AnthropicProvider, type ApprovalDecision, ApprovalEngine, type ApprovalRequest, AuthenticationError, CancelledError, type CommandValidationResult, type ConfigKey, type ConversationTurn, DEFAULT_CONFIG, type FileAttachment, FirstTokenTimeoutError, GeminiProvider, type IProviderAdapter, LanternAgent, LanternProviderError, McpManager, type McpServerConfig, MissingApiKeyError, type ModelCapabilities, ModelNotFoundError, type ModelRole, 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, type Skill, SkillManager, type StreamCallbacks, TimeoutError, type TimingDiagnostics, type TokenUsage, type ToolCallItem, type ToolDefinition, type ToolExecutionContext, type ToolExecutionResult, ToolRegistry, type ToolResultItem, addMcpServer, compactTurns, createLinkedAbortController, createNewSession, decryptSecret, deleteSession, encryptSecret, exportSessionMarkdown, formatErrorMessage, formatNewFilePreview, formatTerminalDiff, generateSessionId, getApiKey, getConfigFilePath, getConfigValue, getLanternHomeDir, getMcpConfigPath, getSessionsDir, isSecretFile, listConfiguredKeys, listSessions, loadAttachment, loadAttachments, loadConfig, loadMcpConfig, loadProjectInstructions, loadSession, maskApiKey, removeApiKey, removeMcpServer, sanitizeSecrets, saveConfig, saveMcpConfig, saveSession, setApiKey, setConfigValue, shouldCompact, toggleMcpServer, validateCommand, validateConfigValue, validateWorkspacePath, wrapStreamWithFirstTokenTimeout };
|
|
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
|
@@ -13,14 +13,17 @@ import {
|
|
|
13
13
|
McpManager,
|
|
14
14
|
MissingApiKeyError,
|
|
15
15
|
ModelNotFoundError,
|
|
16
|
+
NativeCredentialStore,
|
|
16
17
|
OpenAIProvider,
|
|
17
18
|
OpenRouterProvider,
|
|
18
19
|
ProviderRegistry,
|
|
19
20
|
RateLimitError,
|
|
21
|
+
SERVICE_NAME,
|
|
20
22
|
SkillManager,
|
|
21
23
|
TimeoutError,
|
|
22
24
|
ToolRegistry,
|
|
23
25
|
addMcpServer,
|
|
26
|
+
classifyModel,
|
|
24
27
|
compactTurns,
|
|
25
28
|
createLinkedAbortController,
|
|
26
29
|
createNewSession,
|
|
@@ -36,8 +39,11 @@ import {
|
|
|
36
39
|
getConfigFilePath,
|
|
37
40
|
getConfigValue,
|
|
38
41
|
getLanternHomeDir,
|
|
42
|
+
getLegacyCredentialsFilePath,
|
|
39
43
|
getMcpConfigPath,
|
|
44
|
+
getRecommendedCodingModels,
|
|
40
45
|
getSessionsDir,
|
|
46
|
+
getStoreName,
|
|
41
47
|
isSecretFile,
|
|
42
48
|
listConfiguredKeys,
|
|
43
49
|
listSessions,
|
|
@@ -48,6 +54,8 @@ import {
|
|
|
48
54
|
loadProjectInstructions,
|
|
49
55
|
loadSession,
|
|
50
56
|
maskApiKey,
|
|
57
|
+
migrateLegacyCredentials,
|
|
58
|
+
promptMaskedApiKey,
|
|
51
59
|
removeApiKey,
|
|
52
60
|
removeMcpServer,
|
|
53
61
|
sanitizeSecrets,
|
|
@@ -61,8 +69,9 @@ import {
|
|
|
61
69
|
validateCommand,
|
|
62
70
|
validateConfigValue,
|
|
63
71
|
validateWorkspacePath,
|
|
72
|
+
withTimeoutRace,
|
|
64
73
|
wrapStreamWithFirstTokenTimeout
|
|
65
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-45FEFNMM.js";
|
|
66
75
|
export {
|
|
67
76
|
ALLOWED_CONFIG_KEYS,
|
|
68
77
|
AnthropicProvider,
|
|
@@ -77,15 +86,18 @@ export {
|
|
|
77
86
|
McpManager,
|
|
78
87
|
MissingApiKeyError,
|
|
79
88
|
ModelNotFoundError,
|
|
89
|
+
NativeCredentialStore,
|
|
80
90
|
OpenAIProvider,
|
|
81
91
|
OpenRouterProvider,
|
|
82
92
|
LanternAgent as OrbitAgent,
|
|
83
93
|
ProviderRegistry,
|
|
84
94
|
RateLimitError,
|
|
95
|
+
SERVICE_NAME,
|
|
85
96
|
SkillManager,
|
|
86
97
|
TimeoutError,
|
|
87
98
|
ToolRegistry,
|
|
88
99
|
addMcpServer,
|
|
100
|
+
classifyModel,
|
|
89
101
|
compactTurns,
|
|
90
102
|
createLinkedAbortController,
|
|
91
103
|
createNewSession,
|
|
@@ -101,8 +113,11 @@ export {
|
|
|
101
113
|
getConfigFilePath,
|
|
102
114
|
getConfigValue,
|
|
103
115
|
getLanternHomeDir,
|
|
116
|
+
getLegacyCredentialsFilePath,
|
|
104
117
|
getMcpConfigPath,
|
|
118
|
+
getRecommendedCodingModels,
|
|
105
119
|
getSessionsDir,
|
|
120
|
+
getStoreName,
|
|
106
121
|
isSecretFile,
|
|
107
122
|
listConfiguredKeys,
|
|
108
123
|
listSessions,
|
|
@@ -113,6 +128,8 @@ export {
|
|
|
113
128
|
loadProjectInstructions,
|
|
114
129
|
loadSession,
|
|
115
130
|
maskApiKey,
|
|
131
|
+
migrateLegacyCredentials,
|
|
132
|
+
promptMaskedApiKey,
|
|
116
133
|
removeApiKey,
|
|
117
134
|
removeMcpServer,
|
|
118
135
|
sanitizeSecrets,
|
|
@@ -126,6 +143,7 @@ export {
|
|
|
126
143
|
validateCommand,
|
|
127
144
|
validateConfigValue,
|
|
128
145
|
validateWorkspacePath,
|
|
146
|
+
withTimeoutRace,
|
|
129
147
|
wrapStreamWithFirstTokenTimeout
|
|
130
148
|
};
|
|
131
149
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codelantern-agent-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
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": {
|
|
@@ -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",
|