nova-terminal-assistant 0.1.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.
Potentially problematic release.
This version of nova-terminal-assistant might be problematic. Click here for more details.
- package/README.md +358 -0
- package/bin/nova +38 -0
- package/bin/nova.js +12 -0
- package/package.json +67 -0
- package/src/cli/commands/SmartCompletion.ts +458 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/startup/IFlowRepl.ts +212 -0
- package/src/cli/startup/InkBasedRepl.ts +1056 -0
- package/src/cli/startup/InteractiveRepl.ts +2833 -0
- package/src/cli/startup/NovaApp.ts +1861 -0
- package/src/cli/startup/index.ts +4 -0
- package/src/cli/startup/parseArgs.ts +293 -0
- package/src/cli/test-modules.ts +27 -0
- package/src/cli/ui/IFlowDropdown.ts +425 -0
- package/src/cli/ui/ModernReplUI.ts +276 -0
- package/src/cli/ui/SimpleSelector2.ts +215 -0
- package/src/cli/ui/components/ConfirmDialog.ts +176 -0
- package/src/cli/ui/components/ErrorPanel.ts +364 -0
- package/src/cli/ui/components/InkAppRunner.tsx +67 -0
- package/src/cli/ui/components/InkComponents.tsx +613 -0
- package/src/cli/ui/components/NovaInkApp.tsx +312 -0
- package/src/cli/ui/components/ProgressBar.ts +177 -0
- package/src/cli/ui/components/ProgressIndicator.ts +298 -0
- package/src/cli/ui/components/QuickActions.ts +396 -0
- package/src/cli/ui/components/SimpleErrorPanel.ts +231 -0
- package/src/cli/ui/components/StatusBar.ts +194 -0
- package/src/cli/ui/components/ThinkingBlockRenderer.ts +401 -0
- package/src/cli/ui/components/index.ts +27 -0
- package/src/cli/ui/ink-prototype.tsx +347 -0
- package/src/cli/utils/CliUI.ts +336 -0
- package/src/cli/utils/CompletionHelper.ts +388 -0
- package/src/cli/utils/EnhancedCompleter.test.ts +226 -0
- package/src/cli/utils/EnhancedCompleter.ts +513 -0
- package/src/cli/utils/ErrorEnhancer.ts +429 -0
- package/src/cli/utils/OutputFormatter.ts +193 -0
- package/src/cli/utils/index.ts +9 -0
- package/src/core/agents/AgentOrchestrator.ts +515 -0
- package/src/core/agents/index.ts +17 -0
- package/src/core/audit/AuditLogger.ts +509 -0
- package/src/core/audit/index.ts +11 -0
- package/src/core/auth/AuthManager.d.ts.map +1 -0
- package/src/core/auth/AuthManager.ts +138 -0
- package/src/core/auth/index.d.ts.map +1 -0
- package/src/core/auth/index.ts +2 -0
- package/src/core/config/ConfigManager.d.ts.map +1 -0
- package/src/core/config/ConfigManager.test.ts +183 -0
- package/src/core/config/ConfigManager.ts +1219 -0
- package/src/core/config/index.d.ts.map +1 -0
- package/src/core/config/index.ts +1 -0
- package/src/core/context/ContextBuilder.d.ts.map +1 -0
- package/src/core/context/ContextBuilder.ts +171 -0
- package/src/core/context/ContextCompressor.d.ts.map +1 -0
- package/src/core/context/ContextCompressor.ts +642 -0
- package/src/core/context/LayeredMemoryManager.ts +657 -0
- package/src/core/context/MemoryDiscovery.d.ts.map +1 -0
- package/src/core/context/MemoryDiscovery.ts +175 -0
- package/src/core/context/defaultSystemPrompt.d.ts.map +1 -0
- package/src/core/context/defaultSystemPrompt.ts +35 -0
- package/src/core/context/index.d.ts.map +1 -0
- package/src/core/context/index.ts +22 -0
- package/src/core/extensions/SkillGenerator.ts +421 -0
- package/src/core/extensions/SkillInstaller.d.ts.map +1 -0
- package/src/core/extensions/SkillInstaller.ts +257 -0
- package/src/core/extensions/SkillRegistry.d.ts.map +1 -0
- package/src/core/extensions/SkillRegistry.ts +361 -0
- package/src/core/extensions/SkillValidator.ts +525 -0
- package/src/core/extensions/index.ts +15 -0
- package/src/core/index.d.ts.map +1 -0
- package/src/core/index.ts +42 -0
- package/src/core/mcp/McpManager.d.ts.map +1 -0
- package/src/core/mcp/McpManager.ts +632 -0
- package/src/core/mcp/index.d.ts.map +1 -0
- package/src/core/mcp/index.ts +2 -0
- package/src/core/model/ModelClient.d.ts.map +1 -0
- package/src/core/model/ModelClient.ts +217 -0
- package/src/core/model/ModelConnectionTester.ts +363 -0
- package/src/core/model/ModelValidator.ts +348 -0
- package/src/core/model/index.d.ts.map +1 -0
- package/src/core/model/index.ts +6 -0
- package/src/core/model/providers/AnthropicProvider.d.ts.map +1 -0
- package/src/core/model/providers/AnthropicProvider.ts +279 -0
- package/src/core/model/providers/CodingPlanProvider.d.ts.map +1 -0
- package/src/core/model/providers/CodingPlanProvider.ts +210 -0
- package/src/core/model/providers/OllamaCloudProvider.d.ts.map +1 -0
- package/src/core/model/providers/OllamaCloudProvider.ts +405 -0
- package/src/core/model/providers/OllamaManager.d.ts.map +1 -0
- package/src/core/model/providers/OllamaManager.ts +201 -0
- package/src/core/model/providers/OllamaProvider.d.ts.map +1 -0
- package/src/core/model/providers/OllamaProvider.ts +73 -0
- package/src/core/model/providers/OpenAICompatibleProvider.d.ts.map +1 -0
- package/src/core/model/providers/OpenAICompatibleProvider.ts +327 -0
- package/src/core/model/providers/OpenAIProvider.d.ts.map +1 -0
- package/src/core/model/providers/OpenAIProvider.ts +29 -0
- package/src/core/model/providers/index.d.ts.map +1 -0
- package/src/core/model/providers/index.ts +12 -0
- package/src/core/model/types.d.ts.map +1 -0
- package/src/core/model/types.ts +77 -0
- package/src/core/security/ApprovalManager.d.ts.map +1 -0
- package/src/core/security/ApprovalManager.ts +174 -0
- package/src/core/security/FileFilter.d.ts.map +1 -0
- package/src/core/security/FileFilter.ts +141 -0
- package/src/core/security/HookExecutor.d.ts.map +1 -0
- package/src/core/security/HookExecutor.ts +178 -0
- package/src/core/security/SandboxExecutor.ts +447 -0
- package/src/core/security/index.d.ts.map +1 -0
- package/src/core/security/index.ts +8 -0
- package/src/core/session/AgentLoop.d.ts.map +1 -0
- package/src/core/session/AgentLoop.ts +501 -0
- package/src/core/session/SessionManager.d.ts.map +1 -0
- package/src/core/session/SessionManager.test.ts +183 -0
- package/src/core/session/SessionManager.ts +460 -0
- package/src/core/session/index.d.ts.map +1 -0
- package/src/core/session/index.ts +3 -0
- package/src/core/telemetry/Telemetry.d.ts.map +1 -0
- package/src/core/telemetry/Telemetry.ts +90 -0
- package/src/core/telemetry/TelemetryService.ts +531 -0
- package/src/core/telemetry/index.d.ts.map +1 -0
- package/src/core/telemetry/index.ts +12 -0
- package/src/core/testing/AutoFixer.ts +385 -0
- package/src/core/testing/ErrorAnalyzer.ts +499 -0
- package/src/core/testing/TestRunner.ts +265 -0
- package/src/core/testing/agent-cli-tests.ts +538 -0
- package/src/core/testing/index.ts +11 -0
- package/src/core/tools/ToolRegistry.d.ts.map +1 -0
- package/src/core/tools/ToolRegistry.test.ts +206 -0
- package/src/core/tools/ToolRegistry.ts +260 -0
- package/src/core/tools/impl/EditFileTool.d.ts.map +1 -0
- package/src/core/tools/impl/EditFileTool.ts +97 -0
- package/src/core/tools/impl/ListDirectoryTool.d.ts.map +1 -0
- package/src/core/tools/impl/ListDirectoryTool.ts +142 -0
- package/src/core/tools/impl/MemoryTool.d.ts.map +1 -0
- package/src/core/tools/impl/MemoryTool.ts +102 -0
- package/src/core/tools/impl/ReadFileTool.d.ts.map +1 -0
- package/src/core/tools/impl/ReadFileTool.ts +58 -0
- package/src/core/tools/impl/SearchContentTool.d.ts.map +1 -0
- package/src/core/tools/impl/SearchContentTool.ts +94 -0
- package/src/core/tools/impl/SearchFileTool.d.ts.map +1 -0
- package/src/core/tools/impl/SearchFileTool.ts +61 -0
- package/src/core/tools/impl/ShellTool.d.ts.map +1 -0
- package/src/core/tools/impl/ShellTool.ts +118 -0
- package/src/core/tools/impl/TaskTool.d.ts.map +1 -0
- package/src/core/tools/impl/TaskTool.ts +207 -0
- package/src/core/tools/impl/TodoTool.d.ts.map +1 -0
- package/src/core/tools/impl/TodoTool.ts +122 -0
- package/src/core/tools/impl/WebFetchTool.d.ts.map +1 -0
- package/src/core/tools/impl/WebFetchTool.ts +103 -0
- package/src/core/tools/impl/WebSearchTool.d.ts.map +1 -0
- package/src/core/tools/impl/WebSearchTool.ts +89 -0
- package/src/core/tools/impl/WriteFileTool.d.ts.map +1 -0
- package/src/core/tools/impl/WriteFileTool.ts +49 -0
- package/src/core/tools/impl/index.d.ts.map +1 -0
- package/src/core/tools/impl/index.ts +16 -0
- package/src/core/tools/index.d.ts.map +1 -0
- package/src/core/tools/index.ts +7 -0
- package/src/core/tools/schemas/execution.d.ts.map +1 -0
- package/src/core/tools/schemas/execution.ts +42 -0
- package/src/core/tools/schemas/file.d.ts.map +1 -0
- package/src/core/tools/schemas/file.ts +119 -0
- package/src/core/tools/schemas/index.d.ts.map +1 -0
- package/src/core/tools/schemas/index.ts +11 -0
- package/src/core/tools/schemas/memory.d.ts.map +1 -0
- package/src/core/tools/schemas/memory.ts +52 -0
- package/src/core/tools/schemas/orchestration.d.ts.map +1 -0
- package/src/core/tools/schemas/orchestration.ts +44 -0
- package/src/core/tools/schemas/search.d.ts.map +1 -0
- package/src/core/tools/schemas/search.ts +112 -0
- package/src/core/tools/schemas/todo.d.ts.map +1 -0
- package/src/core/tools/schemas/todo.ts +32 -0
- package/src/core/tools/schemas/web.d.ts.map +1 -0
- package/src/core/tools/schemas/web.ts +86 -0
- package/src/core/types/config.d.ts.map +1 -0
- package/src/core/types/config.ts +200 -0
- package/src/core/types/errors.d.ts.map +1 -0
- package/src/core/types/errors.ts +204 -0
- package/src/core/types/index.d.ts.map +1 -0
- package/src/core/types/index.ts +8 -0
- package/src/core/types/session.d.ts.map +1 -0
- package/src/core/types/session.ts +216 -0
- package/src/core/types/tools.d.ts.map +1 -0
- package/src/core/types/tools.ts +157 -0
- package/src/core/utils/CheckpointManager.d.ts.map +1 -0
- package/src/core/utils/CheckpointManager.ts +327 -0
- package/src/core/utils/Logger.d.ts.map +1 -0
- package/src/core/utils/Logger.ts +98 -0
- package/src/core/utils/RetryManager.ts +471 -0
- package/src/core/utils/TokenCounter.d.ts.map +1 -0
- package/src/core/utils/TokenCounter.ts +414 -0
- package/src/core/utils/VectorMemoryStore.ts +440 -0
- package/src/core/utils/helpers.d.ts.map +1 -0
- package/src/core/utils/helpers.ts +89 -0
- package/src/core/utils/index.d.ts.map +1 -0
- package/src/core/utils/index.ts +19 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// CLI Argument Parser
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
export interface CliArgs {
|
|
6
|
+
command: string;
|
|
7
|
+
subcommand?: string;
|
|
8
|
+
prompt?: string;
|
|
9
|
+
model?: string;
|
|
10
|
+
projectDir?: string;
|
|
11
|
+
approvalMode?: 'yolo' | 'default' | 'accepting_edits' | 'plan' | 'smart';
|
|
12
|
+
maxTurns?: number;
|
|
13
|
+
noStream?: boolean;
|
|
14
|
+
noMcp?: boolean;
|
|
15
|
+
/** --no-input: non-interactive mode, never prompt for input */
|
|
16
|
+
noInput?: boolean;
|
|
17
|
+
/** --json: output in JSON format for machine parsing */
|
|
18
|
+
json?: boolean;
|
|
19
|
+
/** --limit: maximum number of items to display */
|
|
20
|
+
limit?: number;
|
|
21
|
+
/** --minimal: minimal mode - reduced prompt & essential tools only */
|
|
22
|
+
minimal?: boolean;
|
|
23
|
+
/** --thinking: control thinking mode (enabled|disabled|auto) */
|
|
24
|
+
thinking?: string;
|
|
25
|
+
provider?: string;
|
|
26
|
+
apiKey?: string;
|
|
27
|
+
baseUrl?: string;
|
|
28
|
+
providerType?: string;
|
|
29
|
+
defaultModel?: string;
|
|
30
|
+
modelName?: string;
|
|
31
|
+
features?: string;
|
|
32
|
+
costIn?: number;
|
|
33
|
+
costOut?: number;
|
|
34
|
+
maxContext?: number;
|
|
35
|
+
maxOutput?: number;
|
|
36
|
+
ollamaHost?: string;
|
|
37
|
+
ollamaModel?: string;
|
|
38
|
+
/** -c: continue the most recent session */
|
|
39
|
+
continueSession?: boolean;
|
|
40
|
+
/** -r / --resume: interactively pick a session to resume */
|
|
41
|
+
resumeSession?: boolean;
|
|
42
|
+
/** direct session ID to restore */
|
|
43
|
+
sessionId?: string;
|
|
44
|
+
/** --force: force overwrite existing skills */
|
|
45
|
+
force?: boolean;
|
|
46
|
+
/** --source: GitHub repository source for skills install */
|
|
47
|
+
source?: string;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function parseCliArgs(argv: string[]): CliArgs {
|
|
52
|
+
const args: CliArgs = {
|
|
53
|
+
command: 'repl',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
let i = 0;
|
|
57
|
+
while (i < argv.length) {
|
|
58
|
+
const arg = argv[i];
|
|
59
|
+
|
|
60
|
+
switch (arg) {
|
|
61
|
+
case '-p':
|
|
62
|
+
case '--prompt':
|
|
63
|
+
args.prompt = argv[++i];
|
|
64
|
+
break;
|
|
65
|
+
case '-m':
|
|
66
|
+
case '--model':
|
|
67
|
+
args.model = argv[++i];
|
|
68
|
+
break;
|
|
69
|
+
case '-d':
|
|
70
|
+
case '--directory':
|
|
71
|
+
args.projectDir = argv[++i];
|
|
72
|
+
break;
|
|
73
|
+
case '--approval-mode':
|
|
74
|
+
args.approvalMode = argv[++i] as 'yolo' | 'default' | 'accepting_edits' | 'plan' | 'smart';
|
|
75
|
+
break;
|
|
76
|
+
case '--max-turns':
|
|
77
|
+
args.maxTurns = parseInt(argv[++i], 10);
|
|
78
|
+
break;
|
|
79
|
+
case '--no-stream':
|
|
80
|
+
args.noStream = true;
|
|
81
|
+
break;
|
|
82
|
+
case '--no-mcp':
|
|
83
|
+
args.noMcp = true;
|
|
84
|
+
break;
|
|
85
|
+
case '--no-input':
|
|
86
|
+
args.noInput = true;
|
|
87
|
+
break;
|
|
88
|
+
case '--json':
|
|
89
|
+
args.json = true;
|
|
90
|
+
break;
|
|
91
|
+
case '--limit':
|
|
92
|
+
case '-l':
|
|
93
|
+
args.limit = parseInt(argv[++i], 10);
|
|
94
|
+
break;
|
|
95
|
+
case '--minimal':
|
|
96
|
+
case '-M':
|
|
97
|
+
args.minimal = true;
|
|
98
|
+
break;
|
|
99
|
+
case '--thinking':
|
|
100
|
+
case '-t':
|
|
101
|
+
args.thinking = argv[++i];
|
|
102
|
+
break;
|
|
103
|
+
case '-c':
|
|
104
|
+
case '--continue':
|
|
105
|
+
args.continueSession = true;
|
|
106
|
+
break;
|
|
107
|
+
case '-r':
|
|
108
|
+
case '--resume':
|
|
109
|
+
args.resumeSession = true;
|
|
110
|
+
// Optionally a session ID can follow: -r <id>
|
|
111
|
+
if (argv[i + 1] && !argv[i + 1].startsWith('-') && argv[i + 1].length === 36) {
|
|
112
|
+
args.sessionId = argv[++i];
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case '--key':
|
|
116
|
+
args.apiKey = argv[++i];
|
|
117
|
+
break;
|
|
118
|
+
case '--base-url':
|
|
119
|
+
args.baseUrl = argv[++i];
|
|
120
|
+
break;
|
|
121
|
+
// Provider management flags
|
|
122
|
+
case '--type':
|
|
123
|
+
args.providerType = argv[++i];
|
|
124
|
+
break;
|
|
125
|
+
case '--default-model':
|
|
126
|
+
args.defaultModel = argv[++i];
|
|
127
|
+
break;
|
|
128
|
+
case '--model-name':
|
|
129
|
+
args.modelName = argv[++i];
|
|
130
|
+
break;
|
|
131
|
+
case '--model-id':
|
|
132
|
+
args.ollamaModel = argv[++i]; // reused for provider add-model and ollama
|
|
133
|
+
break;
|
|
134
|
+
case '--features':
|
|
135
|
+
args.features = argv[++i];
|
|
136
|
+
break;
|
|
137
|
+
case '--cost-in':
|
|
138
|
+
args.costIn = parseFloat(argv[++i]);
|
|
139
|
+
break;
|
|
140
|
+
case '--cost-out':
|
|
141
|
+
args.costOut = parseFloat(argv[++i]);
|
|
142
|
+
break;
|
|
143
|
+
case '--max-context':
|
|
144
|
+
args.maxContext = parseInt(argv[++i], 10);
|
|
145
|
+
break;
|
|
146
|
+
case '--max-output':
|
|
147
|
+
args.maxOutput = parseInt(argv[++i], 10);
|
|
148
|
+
break;
|
|
149
|
+
case '--host':
|
|
150
|
+
args.ollamaHost = argv[++i];
|
|
151
|
+
break;
|
|
152
|
+
// Command: config
|
|
153
|
+
case 'config':
|
|
154
|
+
args.command = 'config';
|
|
155
|
+
args.subcommand = argv[++i];
|
|
156
|
+
break;
|
|
157
|
+
// Command: model
|
|
158
|
+
case 'model':
|
|
159
|
+
args.command = 'model';
|
|
160
|
+
args.subcommand = argv[++i];
|
|
161
|
+
break;
|
|
162
|
+
// Command: auth
|
|
163
|
+
case 'auth':
|
|
164
|
+
args.command = 'auth';
|
|
165
|
+
args.subcommand = argv[++i];
|
|
166
|
+
if (args.subcommand === 'set' || args.subcommand === 'remove') {
|
|
167
|
+
args.provider = argv[++i];
|
|
168
|
+
}
|
|
169
|
+
// Parse optional --key and --base-url flags
|
|
170
|
+
while (argv[i + 1]?.startsWith('--')) {
|
|
171
|
+
i++;
|
|
172
|
+
if (argv[i] === '--key') args.apiKey = argv[++i];
|
|
173
|
+
else if (argv[i] === '--base-url') args.baseUrl = argv[++i];
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
// Command: provider
|
|
177
|
+
case 'provider':
|
|
178
|
+
args.command = 'provider';
|
|
179
|
+
args.subcommand = argv[++i];
|
|
180
|
+
if (args.subcommand === 'add') {
|
|
181
|
+
// Simplified syntax: nova provider add <base-url> <api-key> [-m <model>] [-n <name>]
|
|
182
|
+
// Or: nova provider add --base-url <url> --key <key> (legacy)
|
|
183
|
+
// Peek ahead to check if next arg is a flag or positional
|
|
184
|
+
while (i + 1 < argv.length && !argv[i + 1].startsWith('-')) {
|
|
185
|
+
const nextArg = argv[i + 1];
|
|
186
|
+
if (!args.baseUrl) {
|
|
187
|
+
args.baseUrl = nextArg;
|
|
188
|
+
} else if (!args.apiKey) {
|
|
189
|
+
args.apiKey = nextArg;
|
|
190
|
+
}
|
|
191
|
+
i++;
|
|
192
|
+
}
|
|
193
|
+
} else if (args.subcommand === 'remove' || args.subcommand === 'add-model') {
|
|
194
|
+
args.provider = argv[++i];
|
|
195
|
+
}
|
|
196
|
+
// Parse optional flags
|
|
197
|
+
while (argv[i + 1]?.startsWith('-')) {
|
|
198
|
+
i++;
|
|
199
|
+
if (argv[i] === '--key' || argv[i] === '-k') args.apiKey = argv[++i];
|
|
200
|
+
else if (argv[i] === '--base-url' || argv[i] === '-u') args.baseUrl = argv[++i];
|
|
201
|
+
else if (argv[i] === '--type' || argv[i] === '-t') args.providerType = argv[++i];
|
|
202
|
+
else if (argv[i] === '--default-model' || argv[i] === '-m' || argv[i] === '--model') args.defaultModel = argv[++i];
|
|
203
|
+
else if (argv[i] === '--name' || argv[i] === '-n') args.provider = argv[++i];
|
|
204
|
+
else if (argv[i] === '--model-id') args.ollamaModel = argv[++i];
|
|
205
|
+
else if (argv[i] === '--model-name') args.modelName = argv[++i];
|
|
206
|
+
else if (argv[i] === '--features') args.features = argv[++i];
|
|
207
|
+
else if (argv[i] === '--cost-in') args.costIn = parseFloat(argv[++i]);
|
|
208
|
+
else if (argv[i] === '--cost-out') args.costOut = parseFloat(argv[++i]);
|
|
209
|
+
else if (argv[i] === '--max-context') args.maxContext = parseInt(argv[++i], 10);
|
|
210
|
+
else if (argv[i] === '--max-output') args.maxOutput = parseInt(argv[++i], 10);
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
// Command: ollama
|
|
214
|
+
case 'ollama':
|
|
215
|
+
args.command = 'ollama';
|
|
216
|
+
args.subcommand = argv[++i];
|
|
217
|
+
if (args.subcommand === 'pull' || args.subcommand === 'rm' || args.subcommand === 'info' || args.subcommand === 'run') {
|
|
218
|
+
args.ollamaModel = argv[++i];
|
|
219
|
+
}
|
|
220
|
+
// Parse optional --host flag
|
|
221
|
+
while (argv[i + 1]?.startsWith('--')) {
|
|
222
|
+
i++;
|
|
223
|
+
if (argv[i] === '--host') args.ollamaHost = argv[++i];
|
|
224
|
+
}
|
|
225
|
+
break;
|
|
226
|
+
// Command: mcp
|
|
227
|
+
case 'mcp':
|
|
228
|
+
args.command = 'mcp';
|
|
229
|
+
if (argv[i + 1] && !argv[i + 1].startsWith('-')) {
|
|
230
|
+
args.subcommand = argv[++i];
|
|
231
|
+
}
|
|
232
|
+
break;
|
|
233
|
+
// Command: skills
|
|
234
|
+
case 'skills':
|
|
235
|
+
args.command = 'skills';
|
|
236
|
+
if (argv[i + 1] && !argv[i + 1].startsWith('-')) {
|
|
237
|
+
args.subcommand = argv[++i];
|
|
238
|
+
}
|
|
239
|
+
// Parse optional flags for install command
|
|
240
|
+
while (argv[i + 1]?.startsWith('--')) {
|
|
241
|
+
i++;
|
|
242
|
+
if (argv[i] === '--force') {
|
|
243
|
+
args.force = true;
|
|
244
|
+
} else if (argv[i] === '--source') {
|
|
245
|
+
args.source = argv[++i];
|
|
246
|
+
} else if (argv[i] === '--provider') {
|
|
247
|
+
// Alias for --source for backward compatibility
|
|
248
|
+
args.source = argv[++i];
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// If install command has a positional argument (source), capture it
|
|
252
|
+
if (args.subcommand === 'install' && argv[i + 1] && !argv[i + 1].startsWith('-')) {
|
|
253
|
+
args.source = argv[++i];
|
|
254
|
+
}
|
|
255
|
+
break;
|
|
256
|
+
// Command: coding-plan
|
|
257
|
+
case 'coding-plan':
|
|
258
|
+
args.command = 'coding-plan';
|
|
259
|
+
args.subcommand = argv[++i];
|
|
260
|
+
if (args.subcommand === 'add') {
|
|
261
|
+
args.provider = argv[++i];
|
|
262
|
+
i++;
|
|
263
|
+
if (argv[i] === '--key' || argv[i] === '-k') args.apiKey = argv[++i];
|
|
264
|
+
}
|
|
265
|
+
break;
|
|
266
|
+
case 'version':
|
|
267
|
+
case '--version':
|
|
268
|
+
case '-v':
|
|
269
|
+
args.command = 'version';
|
|
270
|
+
break;
|
|
271
|
+
case 'help':
|
|
272
|
+
case '--help':
|
|
273
|
+
case '-h':
|
|
274
|
+
args.command = 'help';
|
|
275
|
+
break;
|
|
276
|
+
default:
|
|
277
|
+
if (args.command === 'repl' && !arg.startsWith('-')) {
|
|
278
|
+
args.prompt = arg;
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
i++;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Auto-detect non-interactive mode when stdin is not a TTY
|
|
287
|
+
// This ensures commands never hang waiting for input in automated contexts
|
|
288
|
+
if (!process.stdin.isTTY && args.noInput === undefined) {
|
|
289
|
+
args.noInput = true;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return args;
|
|
293
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ContextCompressor } from '../core/context/ContextCompressor.js';
|
|
2
|
+
import { LayeredMemoryManager } from '../core/context/LayeredMemoryManager.js';
|
|
3
|
+
import { AgentLoop } from '../core/session/AgentLoop.js';
|
|
4
|
+
|
|
5
|
+
console.log('ContextCompressor:', typeof ContextCompressor);
|
|
6
|
+
console.log('LayeredMemoryManager:', typeof LayeredMemoryManager);
|
|
7
|
+
console.log('AgentLoop:', typeof AgentLoop);
|
|
8
|
+
|
|
9
|
+
// Quick functional test of ContextCompressor
|
|
10
|
+
const compressor = new ContextCompressor();
|
|
11
|
+
const result = compressor.shouldCompress({
|
|
12
|
+
tokenUsage: 50000,
|
|
13
|
+
maxTokens: 128000,
|
|
14
|
+
hasPreciseHistory: false,
|
|
15
|
+
messageCount: 20,
|
|
16
|
+
});
|
|
17
|
+
console.log('Compression decision for 50k/128k tokens:', result);
|
|
18
|
+
|
|
19
|
+
const result2 = compressor.shouldCompress({
|
|
20
|
+
tokenUsage: 110000,
|
|
21
|
+
maxTokens: 128000,
|
|
22
|
+
hasPreciseHistory: true,
|
|
23
|
+
messageCount: 50,
|
|
24
|
+
});
|
|
25
|
+
console.log('Compression decision for 110k/128k tokens (precise history):', result2);
|
|
26
|
+
|
|
27
|
+
console.log('\nAll tests passed!');
|