vigthoria-cli 1.10.37 → 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.
Files changed (58) hide show
  1. package/dist/commands/agent-session-menu.d.ts +19 -0
  2. package/dist/commands/agent-session-menu.js +155 -0
  3. package/dist/commands/auth.js +68 -51
  4. package/dist/commands/bridge.js +19 -12
  5. package/dist/commands/cancel.js +22 -15
  6. package/dist/commands/chat.d.ts +0 -28
  7. package/dist/commands/chat.js +407 -1254
  8. package/dist/commands/config.js +73 -33
  9. package/dist/commands/deploy.js +123 -83
  10. package/dist/commands/device.js +61 -21
  11. package/dist/commands/edit.js +39 -32
  12. package/dist/commands/explain.js +25 -18
  13. package/dist/commands/generate.js +44 -37
  14. package/dist/commands/hub.js +102 -95
  15. package/dist/commands/index.js +46 -41
  16. package/dist/commands/legion.js +186 -146
  17. package/dist/commands/review.js +36 -29
  18. package/dist/commands/security.js +12 -5
  19. package/dist/commands/wallet.js +35 -28
  20. package/dist/commands/workflow.js +20 -13
  21. package/dist/utils/brain-hub-client.js +5 -1
  22. package/dist/utils/bridge-client.js +52 -11
  23. package/dist/utils/codebase-indexer.js +41 -4
  24. package/dist/utils/context-ranker.js +21 -15
  25. package/dist/utils/files.js +42 -5
  26. package/dist/utils/logger.js +50 -42
  27. package/dist/utils/persona.js +8 -3
  28. package/dist/utils/post-write-validator.js +29 -22
  29. package/dist/utils/project-memory.js +23 -16
  30. package/dist/utils/task-display.js +20 -13
  31. package/dist/utils/workspace-brain-service.js +45 -8
  32. package/dist/utils/workspace-cache.js +26 -18
  33. package/dist/utils/workspace-stream.js +63 -21
  34. package/package.json +3 -6
  35. package/dist/commands/fork.d.ts +0 -17
  36. package/dist/commands/fork.js +0 -164
  37. package/dist/commands/history.d.ts +0 -17
  38. package/dist/commands/history.js +0 -113
  39. package/dist/commands/preview.d.ts +0 -55
  40. package/dist/commands/preview.js +0 -467
  41. package/dist/commands/replay.d.ts +0 -18
  42. package/dist/commands/replay.js +0 -156
  43. package/dist/commands/repo.d.ts +0 -97
  44. package/dist/commands/repo.js +0 -773
  45. package/dist/commands/update.d.ts +0 -9
  46. package/dist/commands/update.js +0 -201
  47. package/dist/index.d.ts +0 -21
  48. package/dist/index.js +0 -1823
  49. package/dist/utils/api.d.ts +0 -572
  50. package/dist/utils/api.js +0 -6548
  51. package/dist/utils/cli-state.d.ts +0 -54
  52. package/dist/utils/cli-state.js +0 -185
  53. package/dist/utils/config.d.ts +0 -85
  54. package/dist/utils/config.js +0 -267
  55. package/dist/utils/session.d.ts +0 -118
  56. package/dist/utils/session.js +0 -423
  57. package/dist/utils/tools.d.ts +0 -276
  58. package/dist/utils/tools.js +0 -3516
@@ -1,276 +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 indexedCodebaseSearch;
99
- private static permissionsFile;
100
- constructor(logger: Logger, cwd: string, permissionCallback: (action: string, options?: {
101
- batchApproval?: boolean;
102
- }) => Promise<boolean | 'batch' | 'persist'>, autoApprove?: boolean);
103
- /** Rebind tool execution to a different local workspace root (e.g. prompt path override). */
104
- setWorkspaceRoot(cwd: string): void;
105
- setIndexedCodebaseSearch(handler: ((query: string, maxResults: number) => string) | null): void;
106
- getWorkspaceRoot(): string;
107
- private getErrorMessage;
108
- private assertToolCall;
109
- /**
110
- * Load persistent permissions for the current project
111
- */
112
- private loadPersistentPermissions;
113
- /**
114
- * Save a persistent permission for a tool in the current project
115
- */
116
- private savePersistentPermission;
117
- /**
118
- * Check if a tool has persistent permission for the current project
119
- */
120
- private hasPersistentPermission;
121
- /**
122
- * Clear session-approved tools (call this at the start of each new AI turn)
123
- */
124
- clearSessionApprovals(): void;
125
- /**
126
- * Get currently approved tools for this session
127
- */
128
- getSessionApprovedTools(): string[];
129
- /**
130
- * Get the undo stack for inspection
131
- */
132
- getUndoStack(): UndoOperation[];
133
- /**
134
- * Undo the last file operation
135
- */
136
- undo(): Promise<ToolResult>;
137
- /**
138
- * List of available tools - Vigthoria's advanced
139
- * Enhanced with risk levels and categories
140
- */
141
- static getToolDefinitions(): ToolDefinition[];
142
- /**
143
- * Execute a tool call with enhanced error handling and retry logic
144
- */
145
- execute(call: ToolCall): Promise<ToolResult>;
146
- private normalizeToolCall;
147
- /**
148
- * Execute tool with automatic retry for transient failures
149
- */
150
- private executeWithRetry;
151
- /**
152
- * Tool names that mutate the user's filesystem, shell state, or remote
153
- * services. Used by the dry-run / read-only gate below.
154
- */
155
- private static readonly MUTATING_TOOLS;
156
- /**
157
- * `VIGTHORIA_DRY_RUN=1` and `VIGTHORIA_READ_ONLY=1` are end-user safety
158
- * switches: every mutating tool short-circuits with a clear "would have
159
- * happened" result instead of touching the filesystem or network.
160
- *
161
- * The flags are checked at call-time (not at construction time) so they
162
- * can be flipped per-prompt by users who want to inspect agent intent
163
- * before committing.
164
- */
165
- private isDryRunActive;
166
- /**
167
- * Execute the actual tool operation
168
- */
169
- private executeTool;
170
- /**
171
- * Check if an error is retryable
172
- */
173
- private isRetryableError;
174
- /**
175
- * Safely stringify tool arguments without dumping very large payloads into logs.
176
- */
177
- private safeStringifyArgs;
178
- /**
179
- * Validate tool parameters
180
- */
181
- private validateParameters;
182
- /**
183
- * Create a standardized error result
184
- */
185
- private createErrorResult;
186
- /**
187
- * Enhanced permission request with risk visualization
188
- */
189
- private formatPermissionRequest;
190
- private sleep;
191
- private bridgeToolsEnabled;
192
- private tryBridgeReadFile;
193
- /**
194
- * Read file with enhanced error handling and suggestions
195
- */
196
- private readFile;
197
- /**
198
- * Write file with undo support
199
- */
200
- private writeFile;
201
- /**
202
- * Edit file with undo support and helpful error messages
203
- */
204
- private editFile;
205
- private validateWrittenFile;
206
- private validateJavaScriptSyntax;
207
- private validateHtmlContent;
208
- /**
209
- * Execute bash command with enhanced error handling
210
- * SECURITY: Commands are sandboxed to workspace directory
211
- * WINDOWS: Detects Unix-specific commands and suggests alternatives
212
- */
213
- private bash;
214
- private grep;
215
- /**
216
- * Windows grep: rg > Select-String > Node-native
217
- */
218
- private grepWindows;
219
- /**
220
- * Unix grep: rg > system grep (BSD/GNU)
221
- */
222
- private grepUnix;
223
- /**
224
- * Search using ripgrep (rg) — works on all platforms
225
- */
226
- private grepWithRg;
227
- /**
228
- * Search using PowerShell Select-String (Windows)
229
- */
230
- private grepWithSelectString;
231
- /**
232
- * Pure Node.js recursive file search — reliable on all platforms, no external deps
233
- */
234
- private grepNodeNative;
235
- private listDir;
236
- private glob;
237
- private git;
238
- /**
239
- * Vigthoria Repository management tool
240
- * Allows AI to push, pull, list, share, and manage projects in the Vigthoria Repository
241
- */
242
- private repo;
243
- /**
244
- * Fetch URL content - Cross-platform web fetching
245
- * Uses Node.js native fetch (available in Node 18+)
246
- */
247
- private fetchUrl;
248
- private browserTool;
249
- /**
250
- * Execute command via SSH on remote server
251
- * Useful for running Unix commands from Windows
252
- */
253
- private sshExec;
254
- /**
255
- * Resolve and SANITIZE path - prevent path traversal outside workspace
256
- * SECURITY: All paths MUST stay within the workspace (cwd)
257
- */
258
- private resolvePath;
259
- /**
260
- * Check if a path is within the allowed workspace
261
- */
262
- private isPathWithinWorkspace;
263
- private task;
264
- private multiEdit;
265
- private codebaseSearch;
266
- /**
267
- * Parse tool calls from AI response (Vigthoria Agent format)
268
- * Enhanced to handle various AI output formats including malformed JSON
269
- */
270
- static parseToolCalls(text: string): ToolCall[];
271
- /**
272
- * Get tools formatted for AI system prompt
273
- */
274
- static getToolsForPrompt(): string;
275
- }
276
- export {};