vigthoria-cli 1.10.36 → 1.10.47
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/commands/agent-session-menu.d.ts +19 -0
- package/dist/commands/agent-session-menu.js +155 -0
- package/dist/commands/auth.js +68 -51
- package/dist/commands/bridge.js +19 -12
- package/dist/commands/cancel.js +22 -15
- package/dist/commands/chat.d.ts +0 -22
- package/dist/commands/chat.js +402 -1084
- package/dist/commands/config.js +73 -33
- package/dist/commands/deploy.js +123 -83
- package/dist/commands/device.js +61 -21
- package/dist/commands/edit.js +39 -32
- package/dist/commands/explain.js +25 -18
- package/dist/commands/generate.js +44 -37
- package/dist/commands/hub.js +102 -95
- package/dist/commands/index.js +46 -41
- package/dist/commands/legion.js +186 -146
- package/dist/commands/review.js +36 -29
- package/dist/commands/security.js +12 -5
- package/dist/commands/wallet.js +35 -28
- package/dist/commands/workflow.js +20 -13
- package/dist/utils/brain-hub-client.d.ts +32 -0
- package/dist/utils/brain-hub-client.js +52 -0
- package/dist/utils/bridge-client.js +52 -11
- package/dist/utils/codebase-indexer.d.ts +59 -0
- package/dist/utils/codebase-indexer.js +351 -0
- package/dist/utils/context-ranker.js +21 -15
- package/dist/utils/files.js +42 -5
- package/dist/utils/logger.js +50 -42
- package/dist/utils/persona.js +8 -3
- package/dist/utils/post-write-validator.js +29 -22
- package/dist/utils/project-memory.js +23 -16
- package/dist/utils/task-display.js +20 -13
- package/dist/utils/workspace-brain-service.d.ts +43 -0
- package/dist/utils/workspace-brain-service.js +158 -0
- package/dist/utils/workspace-cache.js +26 -18
- package/dist/utils/workspace-stream.js +63 -21
- package/package.json +3 -6
- package/scripts/release/validate-no-go-gates.sh +1 -1
- package/dist/commands/fork.d.ts +0 -17
- package/dist/commands/fork.js +0 -164
- package/dist/commands/history.d.ts +0 -17
- package/dist/commands/history.js +0 -113
- package/dist/commands/preview.d.ts +0 -55
- package/dist/commands/preview.js +0 -467
- package/dist/commands/replay.d.ts +0 -18
- package/dist/commands/replay.js +0 -156
- package/dist/commands/repo.d.ts +0 -97
- package/dist/commands/repo.js +0 -773
- package/dist/commands/update.d.ts +0 -9
- package/dist/commands/update.js +0 -201
- package/dist/index.d.ts +0 -21
- package/dist/index.js +0 -1823
- package/dist/utils/api.d.ts +0 -572
- package/dist/utils/api.js +0 -6548
- package/dist/utils/cli-state.d.ts +0 -54
- package/dist/utils/cli-state.js +0 -185
- package/dist/utils/config.d.ts +0 -85
- package/dist/utils/config.js +0 -267
- package/dist/utils/session.d.ts +0 -118
- package/dist/utils/session.js +0 -423
- package/dist/utils/tools.d.ts +0 -274
- package/dist/utils/tools.js +0 -3502
package/dist/utils/tools.d.ts
DELETED
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vigthoria CLI Tools - Agentic Tool System
|
|
3
|
-
*
|
|
4
|
-
* This module provides Vigthoria Autonomous autonomous tool execution.
|
|
5
|
-
* Tools can be called by the AI to perform actions.
|
|
6
|
-
*
|
|
7
|
-
* Enhanced with:
|
|
8
|
-
* - Risk-based permission system
|
|
9
|
-
* - Automatic retry logic with exponential backoff
|
|
10
|
-
* - Undo functionality for file operations
|
|
11
|
-
* - Detailed error messages with suggestions
|
|
12
|
-
*
|
|
13
|
-
* @version 1.1.0
|
|
14
|
-
* @author Vigthoria Labs
|
|
15
|
-
*/
|
|
16
|
-
import { Logger } from './logger.js';
|
|
17
|
-
export type StreamChunk = {
|
|
18
|
-
type: 'text' | 'delta' | 'error';
|
|
19
|
-
content: string;
|
|
20
|
-
};
|
|
21
|
-
export type UpdateInstallerResult = {
|
|
22
|
-
success: boolean;
|
|
23
|
-
platform: string;
|
|
24
|
-
error?: string;
|
|
25
|
-
};
|
|
26
|
-
export declare function installUpdateWindows(): Promise<UpdateInstallerResult>;
|
|
27
|
-
export declare function robustifyStreamResponse(res: any): AsyncIterable<StreamChunk>;
|
|
28
|
-
export type RiskLevel = 'low' | 'medium' | 'high' | 'critical';
|
|
29
|
-
export type SearchStatus = 'search_matches_found' | 'search_no_matches' | 'search_failed';
|
|
30
|
-
export interface ToolResult {
|
|
31
|
-
success: boolean;
|
|
32
|
-
output?: string;
|
|
33
|
-
error?: string;
|
|
34
|
-
suggestion?: string;
|
|
35
|
-
canRetry?: boolean;
|
|
36
|
-
undoable?: boolean;
|
|
37
|
-
/** True when VIGTHORIA_DRY_RUN / VIGTHORIA_READ_ONLY caused a mutating tool to short-circuit. */
|
|
38
|
-
dryRun?: boolean;
|
|
39
|
-
/** Optional human-readable message attached to a dry-run / informational result. */
|
|
40
|
-
message?: string;
|
|
41
|
-
metadata?: {
|
|
42
|
-
searchStatus?: SearchStatus;
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export interface ToolCall {
|
|
47
|
-
tool: string;
|
|
48
|
-
args: Record<string, string>;
|
|
49
|
-
}
|
|
50
|
-
export interface ToolDefinition {
|
|
51
|
-
name: string;
|
|
52
|
-
description: string;
|
|
53
|
-
parameters: {
|
|
54
|
-
name: string;
|
|
55
|
-
description: string;
|
|
56
|
-
required: boolean;
|
|
57
|
-
}[];
|
|
58
|
-
requiresPermission: boolean;
|
|
59
|
-
dangerous: boolean;
|
|
60
|
-
riskLevel: RiskLevel;
|
|
61
|
-
category: 'read' | 'write' | 'execute' | 'search';
|
|
62
|
-
}
|
|
63
|
-
interface UndoOperation {
|
|
64
|
-
id: string;
|
|
65
|
-
tool: string;
|
|
66
|
-
timestamp: number;
|
|
67
|
-
filePath?: string;
|
|
68
|
-
originalContent?: string | null;
|
|
69
|
-
description: string;
|
|
70
|
-
}
|
|
71
|
-
export declare enum ToolErrorType {
|
|
72
|
-
FILE_NOT_FOUND = "FILE_NOT_FOUND",
|
|
73
|
-
PERMISSION_DENIED = "PERMISSION_DENIED",
|
|
74
|
-
NETWORK_ERROR = "NETWORK_ERROR",
|
|
75
|
-
TIMEOUT = "TIMEOUT",
|
|
76
|
-
INVALID_ARGS = "INVALID_ARGS",
|
|
77
|
-
EXECUTION_FAILED = "EXECUTION_FAILED",
|
|
78
|
-
USER_CANCELLED = "USER_CANCELLED"
|
|
79
|
-
}
|
|
80
|
-
export declare class AgenticTools {
|
|
81
|
-
private logger;
|
|
82
|
-
private cwd;
|
|
83
|
-
private permissionCallback;
|
|
84
|
-
private autoApprove;
|
|
85
|
-
private undoStack;
|
|
86
|
-
private maxUndoStack;
|
|
87
|
-
private retryConfig;
|
|
88
|
-
private formatExternalToolError;
|
|
89
|
-
private externalToolFailure;
|
|
90
|
-
private cleanupAfterToolError;
|
|
91
|
-
private runExternalCommand;
|
|
92
|
-
private isNonEmptyString;
|
|
93
|
-
private describeInvalidValue;
|
|
94
|
-
private assertStringRecord;
|
|
95
|
-
private requireNonEmptyString;
|
|
96
|
-
private requireArgsObject;
|
|
97
|
-
private sessionApprovedTools;
|
|
98
|
-
private static permissionsFile;
|
|
99
|
-
constructor(logger: Logger, cwd: string, permissionCallback: (action: string, options?: {
|
|
100
|
-
batchApproval?: boolean;
|
|
101
|
-
}) => Promise<boolean | 'batch' | 'persist'>, autoApprove?: boolean);
|
|
102
|
-
/** Rebind tool execution to a different local workspace root (e.g. prompt path override). */
|
|
103
|
-
setWorkspaceRoot(cwd: string): void;
|
|
104
|
-
getWorkspaceRoot(): string;
|
|
105
|
-
private getErrorMessage;
|
|
106
|
-
private assertToolCall;
|
|
107
|
-
/**
|
|
108
|
-
* Load persistent permissions for the current project
|
|
109
|
-
*/
|
|
110
|
-
private loadPersistentPermissions;
|
|
111
|
-
/**
|
|
112
|
-
* Save a persistent permission for a tool in the current project
|
|
113
|
-
*/
|
|
114
|
-
private savePersistentPermission;
|
|
115
|
-
/**
|
|
116
|
-
* Check if a tool has persistent permission for the current project
|
|
117
|
-
*/
|
|
118
|
-
private hasPersistentPermission;
|
|
119
|
-
/**
|
|
120
|
-
* Clear session-approved tools (call this at the start of each new AI turn)
|
|
121
|
-
*/
|
|
122
|
-
clearSessionApprovals(): void;
|
|
123
|
-
/**
|
|
124
|
-
* Get currently approved tools for this session
|
|
125
|
-
*/
|
|
126
|
-
getSessionApprovedTools(): string[];
|
|
127
|
-
/**
|
|
128
|
-
* Get the undo stack for inspection
|
|
129
|
-
*/
|
|
130
|
-
getUndoStack(): UndoOperation[];
|
|
131
|
-
/**
|
|
132
|
-
* Undo the last file operation
|
|
133
|
-
*/
|
|
134
|
-
undo(): Promise<ToolResult>;
|
|
135
|
-
/**
|
|
136
|
-
* List of available tools - Vigthoria's advanced
|
|
137
|
-
* Enhanced with risk levels and categories
|
|
138
|
-
*/
|
|
139
|
-
static getToolDefinitions(): ToolDefinition[];
|
|
140
|
-
/**
|
|
141
|
-
* Execute a tool call with enhanced error handling and retry logic
|
|
142
|
-
*/
|
|
143
|
-
execute(call: ToolCall): Promise<ToolResult>;
|
|
144
|
-
private normalizeToolCall;
|
|
145
|
-
/**
|
|
146
|
-
* Execute tool with automatic retry for transient failures
|
|
147
|
-
*/
|
|
148
|
-
private executeWithRetry;
|
|
149
|
-
/**
|
|
150
|
-
* Tool names that mutate the user's filesystem, shell state, or remote
|
|
151
|
-
* services. Used by the dry-run / read-only gate below.
|
|
152
|
-
*/
|
|
153
|
-
private static readonly MUTATING_TOOLS;
|
|
154
|
-
/**
|
|
155
|
-
* `VIGTHORIA_DRY_RUN=1` and `VIGTHORIA_READ_ONLY=1` are end-user safety
|
|
156
|
-
* switches: every mutating tool short-circuits with a clear "would have
|
|
157
|
-
* happened" result instead of touching the filesystem or network.
|
|
158
|
-
*
|
|
159
|
-
* The flags are checked at call-time (not at construction time) so they
|
|
160
|
-
* can be flipped per-prompt by users who want to inspect agent intent
|
|
161
|
-
* before committing.
|
|
162
|
-
*/
|
|
163
|
-
private isDryRunActive;
|
|
164
|
-
/**
|
|
165
|
-
* Execute the actual tool operation
|
|
166
|
-
*/
|
|
167
|
-
private executeTool;
|
|
168
|
-
/**
|
|
169
|
-
* Check if an error is retryable
|
|
170
|
-
*/
|
|
171
|
-
private isRetryableError;
|
|
172
|
-
/**
|
|
173
|
-
* Safely stringify tool arguments without dumping very large payloads into logs.
|
|
174
|
-
*/
|
|
175
|
-
private safeStringifyArgs;
|
|
176
|
-
/**
|
|
177
|
-
* Validate tool parameters
|
|
178
|
-
*/
|
|
179
|
-
private validateParameters;
|
|
180
|
-
/**
|
|
181
|
-
* Create a standardized error result
|
|
182
|
-
*/
|
|
183
|
-
private createErrorResult;
|
|
184
|
-
/**
|
|
185
|
-
* Enhanced permission request with risk visualization
|
|
186
|
-
*/
|
|
187
|
-
private formatPermissionRequest;
|
|
188
|
-
private sleep;
|
|
189
|
-
private bridgeToolsEnabled;
|
|
190
|
-
private tryBridgeReadFile;
|
|
191
|
-
/**
|
|
192
|
-
* Read file with enhanced error handling and suggestions
|
|
193
|
-
*/
|
|
194
|
-
private readFile;
|
|
195
|
-
/**
|
|
196
|
-
* Write file with undo support
|
|
197
|
-
*/
|
|
198
|
-
private writeFile;
|
|
199
|
-
/**
|
|
200
|
-
* Edit file with undo support and helpful error messages
|
|
201
|
-
*/
|
|
202
|
-
private editFile;
|
|
203
|
-
private validateWrittenFile;
|
|
204
|
-
private validateJavaScriptSyntax;
|
|
205
|
-
private validateHtmlContent;
|
|
206
|
-
/**
|
|
207
|
-
* Execute bash command with enhanced error handling
|
|
208
|
-
* SECURITY: Commands are sandboxed to workspace directory
|
|
209
|
-
* WINDOWS: Detects Unix-specific commands and suggests alternatives
|
|
210
|
-
*/
|
|
211
|
-
private bash;
|
|
212
|
-
private grep;
|
|
213
|
-
/**
|
|
214
|
-
* Windows grep: rg > Select-String > Node-native
|
|
215
|
-
*/
|
|
216
|
-
private grepWindows;
|
|
217
|
-
/**
|
|
218
|
-
* Unix grep: rg > system grep (BSD/GNU)
|
|
219
|
-
*/
|
|
220
|
-
private grepUnix;
|
|
221
|
-
/**
|
|
222
|
-
* Search using ripgrep (rg) — works on all platforms
|
|
223
|
-
*/
|
|
224
|
-
private grepWithRg;
|
|
225
|
-
/**
|
|
226
|
-
* Search using PowerShell Select-String (Windows)
|
|
227
|
-
*/
|
|
228
|
-
private grepWithSelectString;
|
|
229
|
-
/**
|
|
230
|
-
* Pure Node.js recursive file search — reliable on all platforms, no external deps
|
|
231
|
-
*/
|
|
232
|
-
private grepNodeNative;
|
|
233
|
-
private listDir;
|
|
234
|
-
private glob;
|
|
235
|
-
private git;
|
|
236
|
-
/**
|
|
237
|
-
* Vigthoria Repository management tool
|
|
238
|
-
* Allows AI to push, pull, list, share, and manage projects in the Vigthoria Repository
|
|
239
|
-
*/
|
|
240
|
-
private repo;
|
|
241
|
-
/**
|
|
242
|
-
* Fetch URL content - Cross-platform web fetching
|
|
243
|
-
* Uses Node.js native fetch (available in Node 18+)
|
|
244
|
-
*/
|
|
245
|
-
private fetchUrl;
|
|
246
|
-
private browserTool;
|
|
247
|
-
/**
|
|
248
|
-
* Execute command via SSH on remote server
|
|
249
|
-
* Useful for running Unix commands from Windows
|
|
250
|
-
*/
|
|
251
|
-
private sshExec;
|
|
252
|
-
/**
|
|
253
|
-
* Resolve and SANITIZE path - prevent path traversal outside workspace
|
|
254
|
-
* SECURITY: All paths MUST stay within the workspace (cwd)
|
|
255
|
-
*/
|
|
256
|
-
private resolvePath;
|
|
257
|
-
/**
|
|
258
|
-
* Check if a path is within the allowed workspace
|
|
259
|
-
*/
|
|
260
|
-
private isPathWithinWorkspace;
|
|
261
|
-
private task;
|
|
262
|
-
private multiEdit;
|
|
263
|
-
private codebaseSearch;
|
|
264
|
-
/**
|
|
265
|
-
* Parse tool calls from AI response (Vigthoria Agent format)
|
|
266
|
-
* Enhanced to handle various AI output formats including malformed JSON
|
|
267
|
-
*/
|
|
268
|
-
static parseToolCalls(text: string): ToolCall[];
|
|
269
|
-
/**
|
|
270
|
-
* Get tools formatted for AI system prompt
|
|
271
|
-
*/
|
|
272
|
-
static getToolsForPrompt(): string;
|
|
273
|
-
}
|
|
274
|
-
export {};
|