vigthoria-cli 1.9.2 → 1.9.5

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.
@@ -9,30 +9,12 @@ export declare class CLIError extends Error {
9
9
  category: CLIErrorCategory;
10
10
  statusCode?: number;
11
11
  endpoint?: string;
12
- code: string;
13
- details?: any;
14
- isCritical: boolean;
15
12
  constructor(message: string, category: CLIErrorCategory, opts?: {
16
13
  statusCode?: number;
17
14
  endpoint?: string;
18
15
  cause?: Error;
19
16
  });
20
17
  }
21
- export type CliError = {
22
- code: string;
23
- message: string;
24
- details?: any;
25
- isCritical: boolean;
26
- };
27
- export type ApiError = {
28
- code: number;
29
- message: string;
30
- details?: any;
31
- isAuthError: boolean;
32
- };
33
- export declare function handleApiError(error: any): CliError;
34
- export declare function handleAuthError(error: any): CliError;
35
- export declare function propagateError(err: any): never;
36
18
  /** Classify an axios or fetch error into a structured CLIError. */
37
19
  export declare function classifyError(error: unknown, fallbackCategory?: CLIErrorCategory): CLIError;
38
20
  /** Format a CLIError for user-facing display. */
@@ -40,6 +22,7 @@ export declare function formatCLIError(err: CLIError): string;
40
22
  export declare function sanitizeUserFacingErrorText(input: string): string;
41
23
  export declare function isServerRuntime(): boolean;
42
24
  export declare function describeUpstreamStatus(status: number): string;
25
+ export declare function propagateError(err: any): never;
43
26
  export interface ChatMessage {
44
27
  role: 'user' | 'assistant' | 'system';
45
28
  content: string;
@@ -110,6 +93,7 @@ export interface OperatorWorkflowResponse {
110
93
  sourceWorkflowId?: string | null;
111
94
  } | null;
112
95
  metadata?: Record<string, unknown>;
96
+ changedFiles?: Record<string, string>;
113
97
  }
114
98
  export interface StreamChunk {
115
99
  type: 'content' | 'done' | 'error';
@@ -207,43 +191,26 @@ export interface VigthoriUser {
207
191
  adminAccess: boolean;
208
192
  };
209
193
  }
210
- export interface JwtPayload {
211
- exp?: number;
212
- iat?: number;
213
- sub?: string;
214
- [claim: string]: unknown;
215
- }
216
- export type JwtState = {
217
- token: string | null;
218
- expiresAt: number | null;
219
- isExpired?: () => boolean;
220
- };
221
- export declare function validateJwtExpiry(token: string): boolean;
222
- export declare function validateJwt(token: string): JwtPayload | null;
223
- export type ApiConfig = Config;
224
- export type ApiClient = APIClient;
225
- export declare function refreshJwtIfNeeded(state: JwtState): Promise<string | null>;
226
- export declare function createApiClient(config: any): {
227
- get: (path: string) => Promise<any>;
228
- post: (path: string, body: any) => Promise<any>;
229
- handleAuthError: (err: any) => void;
230
- };
231
194
  export declare class APIClient {
232
195
  private client;
233
196
  private modelRouterClient;
234
197
  private selfHostedModelRouterClient;
235
- config: Config;
236
- token: string | null;
237
- expiresAt: number | null;
198
+ private config;
238
199
  private logger;
239
200
  private ws;
240
201
  private vigFlowTokens;
202
+ private _httpsAgent;
241
203
  constructor(config: Config, logger: Logger);
204
+ /**
205
+ * Destroy keep-alive sockets so the Node.js event loop can drain
206
+ * naturally. Call this before exiting commands that run HTTP probes
207
+ * (e.g. `status`) to avoid the libuv UV_HANDLE_CLOSING assertion
208
+ * on Windows / Node 25+.
209
+ */
242
210
  destroy(): void;
243
211
  private getSelfHostedModelsApiUrl;
244
212
  login(email: string, password: string): Promise<boolean>;
245
213
  loginWithToken(token: string): Promise<boolean>;
246
- private decodeJwtPayload;
247
214
  private extractUserProfile;
248
215
  private refreshToken;
249
216
  getSubscriptionStatus(): Promise<void>;
@@ -267,7 +234,6 @@ export declare class APIClient {
267
234
  getMcpBaseUrls(): string[];
268
235
  getVigFlowBaseUrls(): string[];
269
236
  getTemplateServiceBaseUrls(): string[];
270
- private allowLocalServiceFallbacks;
271
237
  private isFrontendTask;
272
238
  /**
273
239
  * Returns true when the prompt describes a read-only / analysis task.
@@ -328,6 +294,7 @@ export declare class APIClient {
328
294
  private compactV3Context;
329
295
  buildMinimalV3AgentContext(context?: Record<string, any>): string;
330
296
  private extractEmergencyAppName;
297
+ private materializeEmergencySaaSWorkspace;
331
298
  private ensureExecutionContext;
332
299
  bindExecutionContext(context?: Record<string, any>): Promise<Record<string, any>>;
333
300
  private resolveAgentTargetPath;
@@ -398,6 +365,11 @@ export declare class APIClient {
398
365
  * Ensure code has balanced curly braces by appending missing closing braces.
399
366
  */
400
367
  private ensureBalancedBraces;
368
+ /**
369
+ * Quick JS/TS syntax validation using Node's built-in parser.
370
+ * Returns true if the code parses without errors.
371
+ */
372
+ private validateJsSyntax;
401
373
  /**
402
374
  * Extract the first complete function/class from code.
403
375
  * Used as last-resort when the model keeps over-producing.
@@ -481,39 +453,22 @@ export declare class APIClient {
481
453
  * the fix has fewer closers than the original, appends the missing ones.
482
454
  */
483
455
  private repairBracketBalance;
484
- /**
485
- * Build workspace summary re-ordered by semantic relevance to the prompt.
486
- * Changed files are listed first, then keyword-matched files, then the rest.
487
- * Falls back to plain buildLocalWorkspaceSummary when no prompt is provided.
488
- */
489
- private buildSemanticWorkspaceSummary;
490
- /**
491
- * Self-healing cycle: run post-write validators and, if errors are found,
492
- * send a targeted correction prompt to the V3 agent (max one healing round).
493
- *
494
- * This is a best-effort operation — failures never propagate to the user as
495
- * hard errors; they are surfaced as a status line in the terminal output.
496
- */
497
- runSelfHealingCycle(originalPrompt: string, workspacePath: string, context?: Record<string, any>): Promise<{
498
- healingAttempted: boolean;
499
- passed: boolean;
500
- tool: string;
501
- }>;
502
456
  private resolveModelId;
503
457
  private getCoderHealth;
504
458
  private getModelsHealth;
505
459
  private getSelfHostedHealth;
506
- attemptV3ServiceRecovery(reason?: string, options?: {
507
- attempts?: number;
508
- delayMs?: number;
509
- }): Promise<{
510
- recovered: boolean;
511
- message: string;
512
- endpoint?: string;
513
- }>;
514
460
  private getV3AgentHealth;
515
461
  private getHyperLoopHealth;
516
462
  private getRepoMemoryHealth;
463
+ runSelfHealingCycle(_originalPrompt: string, _workspacePath: string, _context?: Record<string, any>): Promise<{
464
+ healingAttempted: boolean;
465
+ passed: boolean;
466
+ tool: string;
467
+ }>;
468
+ attemptV3ServiceRecovery(reason?: string, _options?: Record<string, any>): Promise<{
469
+ recovered: boolean;
470
+ message: string;
471
+ }>;
517
472
  getDevtoolsBridgeStatus(): Promise<EndpointHealthStatus>;
518
473
  getCapabilityTruthStatus(context?: Record<string, any>): Promise<CapabilityTruthStatus>;
519
474
  getHealthStatus(): Promise<APIHealthStatus>;