@trenchwork/erosolar 1.1.62 → 1.2.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.
- package/dist/capabilities/todoCapability.js +2 -2
- package/dist/capabilities/todoCapability.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/contracts/v1/agent.d.ts +12 -2
- package/dist/contracts/v1/agent.d.ts.map +1 -1
- package/dist/core/adversarialCorrection.d.ts +22 -0
- package/dist/core/adversarialCorrection.d.ts.map +1 -0
- package/dist/core/adversarialCorrection.js +25 -0
- package/dist/core/adversarialCorrection.js.map +1 -0
- package/dist/core/agent.d.ts +2 -0
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +11 -45
- package/dist/core/agent.js.map +1 -1
- package/dist/core/contextManager.d.ts.map +1 -1
- package/dist/core/contextManager.js +5 -2
- package/dist/core/contextManager.js.map +1 -1
- package/dist/core/errorClassification.d.ts +44 -0
- package/dist/core/errorClassification.d.ts.map +1 -0
- package/dist/core/errorClassification.js +333 -0
- package/dist/core/errorClassification.js.map +1 -0
- package/dist/core/failureRegistry.d.ts +30 -0
- package/dist/core/failureRegistry.d.ts.map +1 -0
- package/dist/core/failureRegistry.js +74 -0
- package/dist/core/failureRegistry.js.map +1 -0
- package/dist/core/hitl.d.ts.map +1 -1
- package/dist/core/hitl.js +8 -0
- package/dist/core/hitl.js.map +1 -1
- package/dist/core/hostedAuth.d.ts +88 -0
- package/dist/core/hostedAuth.d.ts.map +1 -0
- package/dist/core/hostedAuth.js +219 -0
- package/dist/core/hostedAuth.js.map +1 -0
- package/dist/core/quota.d.ts +61 -0
- package/dist/core/quota.d.ts.map +1 -0
- package/dist/core/quota.js +104 -0
- package/dist/core/quota.js.map +1 -0
- package/dist/core/quotaErrors.d.ts.map +1 -1
- package/dist/core/quotaErrors.js +3 -5
- package/dist/core/quotaErrors.js.map +1 -1
- package/dist/core/resultVerification.d.ts +3 -2
- package/dist/core/resultVerification.d.ts.map +1 -1
- package/dist/core/resultVerification.js +3 -2
- package/dist/core/resultVerification.js.map +1 -1
- package/dist/core/secretStore.d.ts +11 -0
- package/dist/core/secretStore.d.ts.map +1 -1
- package/dist/core/secretStore.js +25 -0
- package/dist/core/secretStore.js.map +1 -1
- package/dist/core/slashCommands.d.ts.map +1 -1
- package/dist/core/slashCommands.js +4 -0
- package/dist/core/slashCommands.js.map +1 -1
- package/dist/core/thinkingVerbs.d.ts +31 -0
- package/dist/core/thinkingVerbs.d.ts.map +1 -0
- package/dist/core/thinkingVerbs.js +58 -0
- package/dist/core/thinkingVerbs.js.map +1 -0
- package/dist/core/turnGovernor.d.ts +63 -0
- package/dist/core/turnGovernor.d.ts.map +1 -0
- package/dist/core/turnGovernor.js +94 -0
- package/dist/core/turnGovernor.js.map +1 -0
- package/dist/core/updateChecker.d.ts.map +1 -1
- package/dist/core/updateChecker.js +5 -1
- package/dist/core/updateChecker.js.map +1 -1
- package/dist/core/usage.d.ts +28 -0
- package/dist/core/usage.d.ts.map +1 -0
- package/dist/core/usage.js +77 -0
- package/dist/core/usage.js.map +1 -0
- package/dist/headless/interactiveShell.d.ts +6 -0
- package/dist/headless/interactiveShell.d.ts.map +1 -1
- package/dist/headless/interactiveShell.js +262 -42
- package/dist/headless/interactiveShell.js.map +1 -1
- package/dist/plugins/providers/deepseek/index.d.ts.map +1 -1
- package/dist/plugins/providers/deepseek/index.js +8 -5
- package/dist/plugins/providers/deepseek/index.js.map +1 -1
- package/dist/providers/baseProvider.d.ts +5 -13
- package/dist/providers/baseProvider.d.ts.map +1 -1
- package/dist/providers/baseProvider.js +12 -66
- package/dist/providers/baseProvider.js.map +1 -1
- package/dist/providers/openaiChatCompletionsProvider.d.ts.map +1 -1
- package/dist/providers/openaiChatCompletionsProvider.js +27 -76
- package/dist/providers/openaiChatCompletionsProvider.js.map +1 -1
- package/dist/providers/resilientProvider.d.ts +2 -9
- package/dist/providers/resilientProvider.d.ts.map +1 -1
- package/dist/providers/resilientProvider.js +13 -199
- package/dist/providers/resilientProvider.js.map +1 -1
- package/dist/runtime/agentController.d.ts.map +1 -1
- package/dist/runtime/agentController.js +7 -0
- package/dist/runtime/agentController.js.map +1 -1
- package/dist/shell/toolPresentation.d.ts +7 -0
- package/dist/shell/toolPresentation.d.ts.map +1 -1
- package/dist/shell/toolPresentation.js +78 -4
- package/dist/shell/toolPresentation.js.map +1 -1
- package/dist/tools/bashTools.d.ts.map +1 -1
- package/dist/tools/bashTools.js +9 -3
- package/dist/tools/bashTools.js.map +1 -1
- package/dist/tools/grepTools.d.ts.map +1 -1
- package/dist/tools/grepTools.js +10 -1
- package/dist/tools/grepTools.js.map +1 -1
- package/dist/tools/memoryTools.d.ts +7 -0
- package/dist/tools/memoryTools.d.ts.map +1 -1
- package/dist/tools/memoryTools.js +17 -0
- package/dist/tools/memoryTools.js.map +1 -1
- package/dist/tools/searchTools.d.ts.map +1 -1
- package/dist/tools/searchTools.js +5 -4
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/tools/todoTools.d.ts +3 -4
- package/dist/tools/todoTools.d.ts.map +1 -1
- package/dist/tools/todoTools.js +23 -4
- package/dist/tools/todoTools.js.map +1 -1
- package/dist/tools/webTools.d.ts.map +1 -1
- package/dist/tools/webTools.js +3 -1
- package/dist/tools/webTools.js.map +1 -1
- package/dist/ui/ink/ChatStatic.d.ts.map +1 -1
- package/dist/ui/ink/ChatStatic.js +21 -5
- package/dist/ui/ink/ChatStatic.js.map +1 -1
- package/dist/ui/ink/InkPromptController.d.ts +5 -0
- package/dist/ui/ink/InkPromptController.d.ts.map +1 -1
- package/dist/ui/ink/InkPromptController.js +16 -6
- package/dist/ui/ink/InkPromptController.js.map +1 -1
- package/dist/ui/ink/Prompt.d.ts +6 -0
- package/dist/ui/ink/Prompt.d.ts.map +1 -1
- package/dist/ui/ink/Prompt.js +69 -10
- package/dist/ui/ink/Prompt.js.map +1 -1
- package/dist/ui/ink/StatusLine.d.ts +6 -0
- package/dist/ui/ink/StatusLine.d.ts.map +1 -1
- package/dist/ui/ink/StatusLine.js +17 -3
- package/dist/ui/ink/StatusLine.js.map +1 -1
- package/dist/ui/ink/pasteBuffer.d.ts +44 -0
- package/dist/ui/ink/pasteBuffer.d.ts.map +1 -0
- package/dist/ui/ink/pasteBuffer.js +73 -0
- package/dist/ui/ink/pasteBuffer.js.map +1 -0
- package/package.json +1 -1
- package/dist/core/index.d.ts +0 -7
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -7
- package/dist/core/index.js.map +0 -1
- package/dist/core/providerKeys.d.ts +0 -20
- package/dist/core/providerKeys.d.ts.map +0 -1
- package/dist/core/providerKeys.js +0 -40
- package/dist/core/providerKeys.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -49
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -104
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts +0 -10
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -110
- package/dist/plugins/tools/agentSpawning/agentSpawningPlugin.js.map +0 -1
- package/dist/plugins/tools/bash/localBashPlugin.d.ts +0 -3
- package/dist/plugins/tools/bash/localBashPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/bash/localBashPlugin.js +0 -14
- package/dist/plugins/tools/bash/localBashPlugin.js.map +0 -1
- package/dist/plugins/tools/edit/editPlugin.d.ts +0 -9
- package/dist/plugins/tools/edit/editPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/edit/editPlugin.js +0 -15
- package/dist/plugins/tools/edit/editPlugin.js.map +0 -1
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts +0 -3
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -9
- package/dist/plugins/tools/enhancedGit/enhancedGitPlugin.js.map +0 -1
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts +0 -3
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.js +0 -14
- package/dist/plugins/tools/filesystem/localFilesystemPlugin.js.map +0 -1
- package/dist/plugins/tools/gitHistory/gitHistoryPlugin.d.ts +0 -3
- package/dist/plugins/tools/gitHistory/gitHistoryPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/gitHistory/gitHistoryPlugin.js +0 -9
- package/dist/plugins/tools/gitHistory/gitHistoryPlugin.js.map +0 -1
- package/dist/plugins/tools/index.d.ts +0 -3
- package/dist/plugins/tools/index.d.ts.map +0 -1
- package/dist/plugins/tools/index.js +0 -3
- package/dist/plugins/tools/index.js.map +0 -1
- package/dist/plugins/tools/integrity/integrityPlugin.d.ts +0 -3
- package/dist/plugins/tools/integrity/integrityPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/integrity/integrityPlugin.js +0 -31
- package/dist/plugins/tools/integrity/integrityPlugin.js.map +0 -1
- package/dist/plugins/tools/mcp/mcpPlugin.d.ts +0 -3
- package/dist/plugins/tools/mcp/mcpPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/mcp/mcpPlugin.js +0 -27
- package/dist/plugins/tools/mcp/mcpPlugin.js.map +0 -1
- package/dist/plugins/tools/nodeDefaults.d.ts +0 -13
- package/dist/plugins/tools/nodeDefaults.d.ts.map +0 -1
- package/dist/plugins/tools/nodeDefaults.js +0 -33
- package/dist/plugins/tools/nodeDefaults.js.map +0 -1
- package/dist/plugins/tools/orchestration/orchestrationPlugin.d.ts +0 -3
- package/dist/plugins/tools/orchestration/orchestrationPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/orchestration/orchestrationPlugin.js +0 -340
- package/dist/plugins/tools/orchestration/orchestrationPlugin.js.map +0 -1
- package/dist/plugins/tools/registry.d.ts +0 -22
- package/dist/plugins/tools/registry.d.ts.map +0 -1
- package/dist/plugins/tools/registry.js +0 -58
- package/dist/plugins/tools/registry.js.map +0 -1
- package/dist/plugins/tools/search/localSearchPlugin.d.ts +0 -3
- package/dist/plugins/tools/search/localSearchPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/search/localSearchPlugin.js +0 -14
- package/dist/plugins/tools/search/localSearchPlugin.js.map +0 -1
- package/dist/plugins/tools/skills/skillPlugin.d.ts +0 -3
- package/dist/plugins/tools/skills/skillPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/skills/skillPlugin.js +0 -27
- package/dist/plugins/tools/skills/skillPlugin.js.map +0 -1
- package/dist/plugins/tools/todo/todoPlugin.d.ts +0 -3
- package/dist/plugins/tools/todo/todoPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/todo/todoPlugin.js +0 -10
- package/dist/plugins/tools/todo/todoPlugin.js.map +0 -1
- package/dist/runtime/agentWorkerPool.d.ts +0 -167
- package/dist/runtime/agentWorkerPool.d.ts.map +0 -1
- package/dist/runtime/agentWorkerPool.js +0 -435
- package/dist/runtime/agentWorkerPool.js.map +0 -1
- package/dist/shell/autoExecutor.d.ts +0 -70
- package/dist/shell/autoExecutor.d.ts.map +0 -1
- package/dist/shell/autoExecutor.js +0 -320
- package/dist/shell/autoExecutor.js.map +0 -1
- package/dist/shell/commandRegistry.d.ts +0 -122
- package/dist/shell/commandRegistry.d.ts.map +0 -1
- package/dist/shell/commandRegistry.js +0 -355
- package/dist/shell/commandRegistry.js.map +0 -1
- package/dist/shell/composableMessage.d.ts +0 -178
- package/dist/shell/composableMessage.d.ts.map +0 -1
- package/dist/shell/composableMessage.js +0 -384
- package/dist/shell/composableMessage.js.map +0 -1
- package/dist/shell/vimMode.d.ts +0 -66
- package/dist/shell/vimMode.d.ts.map +0 -1
- package/dist/shell/vimMode.js +0 -435
- package/dist/shell/vimMode.js.map +0 -1
- package/dist/tools/localExplore.d.ts +0 -38
- package/dist/tools/localExplore.d.ts.map +0 -1
- package/dist/tools/localExplore.js +0 -30
- package/dist/tools/localExplore.js.map +0 -1
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Command Registry - Slash Command Management
|
|
3
|
-
*
|
|
4
|
-
* Provides a registry for slash commands with:
|
|
5
|
-
* - Command registration and discovery
|
|
6
|
-
* - Help text generation
|
|
7
|
-
* - Category organization
|
|
8
|
-
* - Command execution delegation
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const registry = new CommandRegistry();
|
|
13
|
-
*
|
|
14
|
-
* registry.register({
|
|
15
|
-
* name: '/help',
|
|
16
|
-
* aliases: ['/?'],
|
|
17
|
-
* description: 'Show help information',
|
|
18
|
-
* category: 'navigation',
|
|
19
|
-
* handler: async (context) => {
|
|
20
|
-
* context.showHelp();
|
|
21
|
-
* },
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* await registry.execute('/help', '', context);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
import { logDebug } from '../utils/debugLogger.js';
|
|
28
|
-
import { hasChangesToRevert, getRevertSummary, revertAllChanges } from '../tools/fileChangeTracker.js';
|
|
29
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
30
|
-
// Command Registry
|
|
31
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
32
|
-
export class CommandRegistry {
|
|
33
|
-
commands = new Map();
|
|
34
|
-
aliasMap = new Map();
|
|
35
|
-
/**
|
|
36
|
-
* Register a command
|
|
37
|
-
*/
|
|
38
|
-
register(command) {
|
|
39
|
-
// Normalize command name
|
|
40
|
-
const name = this.normalizeName(command.name);
|
|
41
|
-
this.commands.set(name, command);
|
|
42
|
-
// Register aliases
|
|
43
|
-
if (command.aliases) {
|
|
44
|
-
for (const alias of command.aliases) {
|
|
45
|
-
const normalizedAlias = this.normalizeName(alias);
|
|
46
|
-
this.aliasMap.set(normalizedAlias, name);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return this;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Register multiple commands
|
|
53
|
-
*/
|
|
54
|
-
registerAll(commands) {
|
|
55
|
-
for (const command of commands) {
|
|
56
|
-
this.register(command);
|
|
57
|
-
}
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Find a command by name or alias
|
|
62
|
-
*/
|
|
63
|
-
find(commandName) {
|
|
64
|
-
const normalized = this.normalizeName(commandName);
|
|
65
|
-
// Direct match
|
|
66
|
-
const direct = this.commands.get(normalized);
|
|
67
|
-
if (direct) {
|
|
68
|
-
return { command: direct, matchedName: commandName };
|
|
69
|
-
}
|
|
70
|
-
// Alias match
|
|
71
|
-
const aliasTarget = this.aliasMap.get(normalized);
|
|
72
|
-
if (aliasTarget) {
|
|
73
|
-
const command = this.commands.get(aliasTarget);
|
|
74
|
-
if (command) {
|
|
75
|
-
return { command, matchedName: commandName };
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Check if a command exists
|
|
82
|
-
*/
|
|
83
|
-
has(commandName) {
|
|
84
|
-
return this.find(commandName) !== null;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Execute a command
|
|
88
|
-
*/
|
|
89
|
-
async execute(commandName, input, shell) {
|
|
90
|
-
const match = this.find(commandName);
|
|
91
|
-
if (!match) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
const context = {
|
|
95
|
-
shell,
|
|
96
|
-
input,
|
|
97
|
-
rawCommand: commandName,
|
|
98
|
-
};
|
|
99
|
-
try {
|
|
100
|
-
await Promise.resolve(match.command.handler(context));
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
logDebug(`Error executing command ${commandName}:`, error);
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Get all commands in a category
|
|
110
|
-
*/
|
|
111
|
-
getByCategory(category) {
|
|
112
|
-
return Array.from(this.commands.values()).filter((cmd) => cmd.category === category && !cmd.hidden);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Get all categories with their commands
|
|
116
|
-
*/
|
|
117
|
-
getAllCategories() {
|
|
118
|
-
const categories = new Map();
|
|
119
|
-
for (const command of this.commands.values()) {
|
|
120
|
-
if (command.hidden)
|
|
121
|
-
continue;
|
|
122
|
-
const existing = categories.get(command.category) || [];
|
|
123
|
-
existing.push(command);
|
|
124
|
-
categories.set(command.category, existing);
|
|
125
|
-
}
|
|
126
|
-
return categories;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Get all registered commands
|
|
130
|
-
*/
|
|
131
|
-
getAll() {
|
|
132
|
-
return Array.from(this.commands.values());
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Get all visible commands (excluding hidden)
|
|
136
|
-
*/
|
|
137
|
-
getVisible() {
|
|
138
|
-
return Array.from(this.commands.values()).filter((cmd) => !cmd.hidden);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Generate help text for all commands
|
|
142
|
-
*/
|
|
143
|
-
generateHelpText() {
|
|
144
|
-
const lines = ['Available commands:', ''];
|
|
145
|
-
const categories = this.getAllCategories();
|
|
146
|
-
const categoryOrder = [
|
|
147
|
-
'navigation',
|
|
148
|
-
'model',
|
|
149
|
-
'context',
|
|
150
|
-
'session',
|
|
151
|
-
'tools',
|
|
152
|
-
'learning',
|
|
153
|
-
];
|
|
154
|
-
for (const category of categoryOrder) {
|
|
155
|
-
const commands = categories.get(category);
|
|
156
|
-
if (!commands || commands.length === 0)
|
|
157
|
-
continue;
|
|
158
|
-
lines.push(`${this.formatCategoryName(category)}:`);
|
|
159
|
-
for (const cmd of commands.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
160
|
-
const aliases = cmd.aliases?.length ? ` (${cmd.aliases.join(', ')})` : '';
|
|
161
|
-
lines.push(` ${cmd.name}${aliases} - ${cmd.description}`);
|
|
162
|
-
}
|
|
163
|
-
lines.push('');
|
|
164
|
-
}
|
|
165
|
-
return lines.join('\n');
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Generate compact help text (just command names)
|
|
169
|
-
*/
|
|
170
|
-
generateCompactHelp() {
|
|
171
|
-
const commands = this.getVisible()
|
|
172
|
-
.map((cmd) => cmd.name)
|
|
173
|
-
.sort();
|
|
174
|
-
return commands.join(' ');
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Normalize command name
|
|
178
|
-
*/
|
|
179
|
-
normalizeName(name) {
|
|
180
|
-
return name.toLowerCase().trim();
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Format category name for display
|
|
184
|
-
*/
|
|
185
|
-
formatCategoryName(category) {
|
|
186
|
-
const names = {
|
|
187
|
-
navigation: 'Navigation',
|
|
188
|
-
model: 'Model Selection',
|
|
189
|
-
context: 'Context Management',
|
|
190
|
-
session: 'Session Management',
|
|
191
|
-
tools: 'Tools',
|
|
192
|
-
learning: 'Learning',
|
|
193
|
-
};
|
|
194
|
-
return names[category] || category;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
198
|
-
// Built-in Commands Factory
|
|
199
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
200
|
-
/**
|
|
201
|
-
* Create a standard set of commands for the shell
|
|
202
|
-
*
|
|
203
|
-
* This is meant to be extended/customized by the shell implementation
|
|
204
|
-
*/
|
|
205
|
-
export function createBaseCommands() {
|
|
206
|
-
return [
|
|
207
|
-
// Navigation
|
|
208
|
-
{
|
|
209
|
-
name: '/help',
|
|
210
|
-
aliases: ['/?'],
|
|
211
|
-
description: 'Show help information',
|
|
212
|
-
category: 'navigation',
|
|
213
|
-
handler: (ctx) => {
|
|
214
|
-
const shell = ctx.shell;
|
|
215
|
-
shell.showHelp?.();
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
name: '/exit',
|
|
220
|
-
aliases: ['/quit', '/q'],
|
|
221
|
-
description: 'Exit the shell',
|
|
222
|
-
category: 'navigation',
|
|
223
|
-
handler: (ctx) => {
|
|
224
|
-
const shell = ctx.shell;
|
|
225
|
-
shell.shutdown?.();
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
// Model
|
|
229
|
-
{
|
|
230
|
-
name: '/model',
|
|
231
|
-
description: 'Show model selection menu',
|
|
232
|
-
category: 'model',
|
|
233
|
-
handler: (ctx) => {
|
|
234
|
-
const shell = ctx.shell;
|
|
235
|
-
shell.showModelMenu?.();
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
name: '/providers',
|
|
240
|
-
description: 'Show configured providers',
|
|
241
|
-
category: 'model',
|
|
242
|
-
handler: (ctx) => {
|
|
243
|
-
const shell = ctx.shell;
|
|
244
|
-
shell.showConfiguredProviders?.();
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
// Context
|
|
248
|
-
{
|
|
249
|
-
name: '/context',
|
|
250
|
-
description: 'Refresh workspace context',
|
|
251
|
-
category: 'context',
|
|
252
|
-
async: true,
|
|
253
|
-
handler: async (ctx) => {
|
|
254
|
-
const shell = ctx.shell;
|
|
255
|
-
await shell.refreshWorkspaceContextCommand?.(ctx.input);
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
// Session
|
|
259
|
-
{
|
|
260
|
-
name: '/sessions',
|
|
261
|
-
description: 'Session management',
|
|
262
|
-
category: 'session',
|
|
263
|
-
async: true,
|
|
264
|
-
handler: async (ctx) => {
|
|
265
|
-
const shell = ctx.shell;
|
|
266
|
-
await shell.handleSessionCommand?.(ctx.input);
|
|
267
|
-
},
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
name: '/revert',
|
|
271
|
-
description: 'Revert all file changes made this run',
|
|
272
|
-
category: 'session',
|
|
273
|
-
usage: '/revert [confirm]',
|
|
274
|
-
handler: (ctx) => {
|
|
275
|
-
const shell = ctx.shell;
|
|
276
|
-
const workingDir = shell.workingDir ?? process.cwd();
|
|
277
|
-
if (!hasChangesToRevert()) {
|
|
278
|
-
shell.printOutput?.('No changes to revert.');
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
const args = ctx.input.trim().toLowerCase();
|
|
282
|
-
if (args === 'confirm' || args === 'yes' || args === 'y') {
|
|
283
|
-
// Actually revert
|
|
284
|
-
const result = revertAllChanges(workingDir);
|
|
285
|
-
shell.printOutput?.(result);
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
// Show preview
|
|
289
|
-
const summary = getRevertSummary(workingDir);
|
|
290
|
-
shell.printOutput?.(summary);
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
|
-
// Tools
|
|
295
|
-
{
|
|
296
|
-
name: '/tools',
|
|
297
|
-
description: 'Show available tools',
|
|
298
|
-
category: 'tools',
|
|
299
|
-
handler: (ctx) => {
|
|
300
|
-
const shell = ctx.shell;
|
|
301
|
-
shell.showToolsMenu?.();
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
name: '/mcp',
|
|
306
|
-
description: 'Show MCP server status',
|
|
307
|
-
category: 'tools',
|
|
308
|
-
async: true,
|
|
309
|
-
handler: async (ctx) => {
|
|
310
|
-
const shell = ctx.shell;
|
|
311
|
-
await shell.showMcpStatus?.();
|
|
312
|
-
},
|
|
313
|
-
},
|
|
314
|
-
// Learning
|
|
315
|
-
{
|
|
316
|
-
name: '/learn',
|
|
317
|
-
description: 'Show learning system status',
|
|
318
|
-
category: 'learning',
|
|
319
|
-
handler: (ctx) => {
|
|
320
|
-
const shell = ctx.shell;
|
|
321
|
-
shell.showLearningStatus?.(ctx.input);
|
|
322
|
-
},
|
|
323
|
-
},
|
|
324
|
-
// Tools — API keys (replaces /secrets, single source for credential mgmt)
|
|
325
|
-
{
|
|
326
|
-
name: '/key',
|
|
327
|
-
aliases: ['/keys'],
|
|
328
|
-
description: 'Manage API keys',
|
|
329
|
-
category: 'tools',
|
|
330
|
-
handler: (ctx) => {
|
|
331
|
-
const shell = ctx.shell;
|
|
332
|
-
shell.showSecretsMenu?.();
|
|
333
|
-
},
|
|
334
|
-
},
|
|
335
|
-
// /mode slash command removed (2026-05) — it set cowork's
|
|
336
|
-
// permission mode, which moved with the cowork extraction.
|
|
337
|
-
// The HITL capability's autoPause is the equivalent knob for
|
|
338
|
-
// the coding CLI; toggle it via the Option+V shortcut.
|
|
339
|
-
];
|
|
340
|
-
}
|
|
341
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
342
|
-
// Singleton Registry Instance
|
|
343
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
344
|
-
let globalRegistry = null;
|
|
345
|
-
export function getCommandRegistry() {
|
|
346
|
-
if (!globalRegistry) {
|
|
347
|
-
globalRegistry = new CommandRegistry();
|
|
348
|
-
globalRegistry.registerAll(createBaseCommands());
|
|
349
|
-
}
|
|
350
|
-
return globalRegistry;
|
|
351
|
-
}
|
|
352
|
-
export function resetCommandRegistry() {
|
|
353
|
-
globalRegistry = null;
|
|
354
|
-
}
|
|
355
|
-
//# sourceMappingURL=commandRegistry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandRegistry.js","sourceRoot":"","sources":["../../src/shell/commandRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAkDvG,kFAAkF;AAClF,mBAAmB;AACnB,kFAAkF;AAElF,MAAM,OAAO,eAAe;IAClB,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;IAChD,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAA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;QAC7D,uDAAuD;KACxD,CAAC;AACJ,CAAC;AAED,kFAAkF;AAClF,8BAA8B;AAC9B,kFAAkF;AAElF,IAAI,cAAc,GAA2B,IAAI,CAAC;AAElD,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,cAAc,GAAG,IAAI,eAAe,EAAE,CAAC;QACvC,cAAc,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ComposableMessage - Data structure for building messages from multiple parts
|
|
3
|
-
*
|
|
4
|
-
* Handles multi-line pastes by storing them as editable blocks that can be:
|
|
5
|
-
* - Displayed as summaries
|
|
6
|
-
* - Edited individually
|
|
7
|
-
* - Assembled into a final message when sent
|
|
8
|
-
*
|
|
9
|
-
* Architecture:
|
|
10
|
-
* - MessagePart: Union type for text or paste blocks
|
|
11
|
-
* - ComposableMessageBuilder: Manages parts and provides editing/assembly
|
|
12
|
-
* - UI helpers: Format blocks for display with summaries
|
|
13
|
-
*/
|
|
14
|
-
export type MessagePartType = 'text' | 'paste';
|
|
15
|
-
export interface TextPart {
|
|
16
|
-
type: 'text';
|
|
17
|
-
id: string;
|
|
18
|
-
content: string;
|
|
19
|
-
timestamp: number;
|
|
20
|
-
}
|
|
21
|
-
export interface PastePart {
|
|
22
|
-
type: 'paste';
|
|
23
|
-
id: string;
|
|
24
|
-
content: string;
|
|
25
|
-
lineCount: number;
|
|
26
|
-
timestamp: number;
|
|
27
|
-
summary: string;
|
|
28
|
-
edited: boolean;
|
|
29
|
-
}
|
|
30
|
-
export type MessagePart = TextPart | PastePart;
|
|
31
|
-
export interface ComposableMessageState {
|
|
32
|
-
parts: MessagePart[];
|
|
33
|
-
currentDraft: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Paste size warning thresholds
|
|
37
|
-
*/
|
|
38
|
-
export declare const PASTE_LIMITS: {
|
|
39
|
-
readonly WARN_CHARS: 10000;
|
|
40
|
-
readonly WARN_LINES: 100;
|
|
41
|
-
readonly MAX_CHARS: 500000;
|
|
42
|
-
readonly MAX_LINES: 5000;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Paste size check result
|
|
46
|
-
*/
|
|
47
|
-
export interface PasteSizeCheck {
|
|
48
|
-
ok: boolean;
|
|
49
|
-
warning?: string;
|
|
50
|
-
error?: string;
|
|
51
|
-
chars: number;
|
|
52
|
-
lines: number;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Builds messages from composable parts (text + paste blocks)
|
|
56
|
-
* Allows editing blocks before final assembly
|
|
57
|
-
*
|
|
58
|
-
* Features:
|
|
59
|
-
* - Undo/redo support for paste operations
|
|
60
|
-
* - Size warnings for large pastes
|
|
61
|
-
* - Inline editing of paste blocks
|
|
62
|
-
*/
|
|
63
|
-
export declare class ComposableMessageBuilder {
|
|
64
|
-
private parts;
|
|
65
|
-
private currentDraft;
|
|
66
|
-
private idCounter;
|
|
67
|
-
private history;
|
|
68
|
-
private historyIndex;
|
|
69
|
-
private maxHistorySize;
|
|
70
|
-
constructor();
|
|
71
|
-
/**
|
|
72
|
-
* Save current state to history
|
|
73
|
-
*/
|
|
74
|
-
private saveHistory;
|
|
75
|
-
/**
|
|
76
|
-
* Undo last operation
|
|
77
|
-
*/
|
|
78
|
-
undo(): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Redo last undone operation
|
|
81
|
-
*/
|
|
82
|
-
redo(): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Check if undo is available
|
|
85
|
-
*/
|
|
86
|
-
canUndo(): boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Check if redo is available
|
|
89
|
-
*/
|
|
90
|
-
canRedo(): boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Check paste size and return warnings/errors
|
|
93
|
-
*/
|
|
94
|
-
static checkPasteSize(content: string): PasteSizeCheck;
|
|
95
|
-
/**
|
|
96
|
-
* Get current state
|
|
97
|
-
*/
|
|
98
|
-
getState(): ComposableMessageState;
|
|
99
|
-
/**
|
|
100
|
-
* Check if message is empty
|
|
101
|
-
*/
|
|
102
|
-
isEmpty(): boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Check if message has content
|
|
105
|
-
*/
|
|
106
|
-
hasContent(): boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Get number of parts
|
|
109
|
-
*/
|
|
110
|
-
getPartCount(): number;
|
|
111
|
-
/**
|
|
112
|
-
* Set current draft text
|
|
113
|
-
*/
|
|
114
|
-
setDraft(text: string): void;
|
|
115
|
-
/**
|
|
116
|
-
* Get current draft
|
|
117
|
-
*/
|
|
118
|
-
getDraft(): string;
|
|
119
|
-
/**
|
|
120
|
-
* Add a text part from current draft
|
|
121
|
-
*/
|
|
122
|
-
commitDraft(): void;
|
|
123
|
-
/**
|
|
124
|
-
* Add a paste block
|
|
125
|
-
* @returns Paste ID, or null if paste was rejected due to size limits
|
|
126
|
-
*/
|
|
127
|
-
addPaste(content: string): string | null;
|
|
128
|
-
/**
|
|
129
|
-
* Add a paste block without size check (for internal use)
|
|
130
|
-
*/
|
|
131
|
-
addPasteUnchecked(content: string): string;
|
|
132
|
-
/**
|
|
133
|
-
* Edit a paste block by ID
|
|
134
|
-
*/
|
|
135
|
-
editPaste(id: string, newContent: string): boolean;
|
|
136
|
-
/**
|
|
137
|
-
* Remove a part by ID
|
|
138
|
-
*/
|
|
139
|
-
removePart(id: string): boolean;
|
|
140
|
-
/**
|
|
141
|
-
* Get a part by ID
|
|
142
|
-
*/
|
|
143
|
-
getPart(id: string): MessagePart | null;
|
|
144
|
-
/**
|
|
145
|
-
* Assemble final message from all parts
|
|
146
|
-
*/
|
|
147
|
-
assemble(): string;
|
|
148
|
-
/**
|
|
149
|
-
* Clear all parts and draft
|
|
150
|
-
*/
|
|
151
|
-
clear(): void;
|
|
152
|
-
/**
|
|
153
|
-
* Format for display in chat
|
|
154
|
-
*/
|
|
155
|
-
formatForDisplay(): string;
|
|
156
|
-
/**
|
|
157
|
-
* Format summary for status display
|
|
158
|
-
*/
|
|
159
|
-
formatSummary(): string;
|
|
160
|
-
/**
|
|
161
|
-
* Format paste blocks for prompt display.
|
|
162
|
-
* Returns empty string - paste blocks are now displayed as actual content.
|
|
163
|
-
*/
|
|
164
|
-
formatPasteChips(): string;
|
|
165
|
-
/**
|
|
166
|
-
* Get count of paste blocks only
|
|
167
|
-
*/
|
|
168
|
-
getPasteBlockCount(): number;
|
|
169
|
-
/**
|
|
170
|
-
* Generate a summary for a paste block
|
|
171
|
-
*/
|
|
172
|
-
private generateSummary;
|
|
173
|
-
/**
|
|
174
|
-
* Generate unique ID for parts
|
|
175
|
-
*/
|
|
176
|
-
private generateId;
|
|
177
|
-
}
|
|
178
|
-
//# sourceMappingURL=composableMessage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"composableMessage.d.ts","sourceRoot":"","sources":["../../src/shell/composableMessage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,WAAW,G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