vigthoria-cli 1.10.47 → 1.10.49

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 (60) hide show
  1. package/dist/commands/agent-session-menu.js +2 -8
  2. package/dist/commands/auth.js +51 -68
  3. package/dist/commands/bridge.js +42 -22
  4. package/dist/commands/cancel.js +15 -22
  5. package/dist/commands/chat.d.ts +3 -0
  6. package/dist/commands/chat.js +326 -295
  7. package/dist/commands/config.js +33 -73
  8. package/dist/commands/deploy.js +83 -123
  9. package/dist/commands/device.js +21 -61
  10. package/dist/commands/edit.js +32 -39
  11. package/dist/commands/explain.js +18 -25
  12. package/dist/commands/fork.d.ts +17 -0
  13. package/dist/commands/fork.js +164 -0
  14. package/dist/commands/generate.js +37 -44
  15. package/dist/commands/history.d.ts +17 -0
  16. package/dist/commands/history.js +113 -0
  17. package/dist/commands/hub.js +95 -102
  18. package/dist/commands/index.js +41 -46
  19. package/dist/commands/legion.js +146 -186
  20. package/dist/commands/preview.d.ts +55 -0
  21. package/dist/commands/preview.js +467 -0
  22. package/dist/commands/replay.d.ts +18 -0
  23. package/dist/commands/replay.js +156 -0
  24. package/dist/commands/repo.d.ts +97 -0
  25. package/dist/commands/repo.js +773 -0
  26. package/dist/commands/review.js +29 -36
  27. package/dist/commands/security.js +5 -12
  28. package/dist/commands/update.d.ts +9 -0
  29. package/dist/commands/update.js +201 -0
  30. package/dist/commands/wallet.js +28 -35
  31. package/dist/commands/workflow.js +13 -20
  32. package/dist/index.d.ts +21 -0
  33. package/dist/index.js +1652 -0
  34. package/dist/utils/api.d.ts +544 -0
  35. package/dist/utils/api.js +5486 -0
  36. package/dist/utils/brain-hub-client.js +1 -5
  37. package/dist/utils/bridge-client.js +11 -52
  38. package/dist/utils/cli-state.d.ts +54 -0
  39. package/dist/utils/cli-state.js +185 -0
  40. package/dist/utils/codebase-indexer.js +4 -41
  41. package/dist/utils/config.d.ts +82 -0
  42. package/dist/utils/config.js +269 -0
  43. package/dist/utils/context-ranker.js +15 -21
  44. package/dist/utils/desktop-bridge-client.d.ts +12 -0
  45. package/dist/utils/desktop-bridge-client.js +30 -0
  46. package/dist/utils/files.js +5 -42
  47. package/dist/utils/logger.js +42 -50
  48. package/dist/utils/persona.js +3 -8
  49. package/dist/utils/post-write-validator.js +26 -33
  50. package/dist/utils/project-memory.js +16 -23
  51. package/dist/utils/session.d.ts +118 -0
  52. package/dist/utils/session.js +423 -0
  53. package/dist/utils/task-display.js +13 -20
  54. package/dist/utils/tools.d.ts +269 -0
  55. package/dist/utils/tools.js +3450 -0
  56. package/dist/utils/workspace-brain-service.js +8 -45
  57. package/dist/utils/workspace-cache.js +18 -26
  58. package/dist/utils/workspace-stream.js +21 -63
  59. package/package.json +2 -1
  60. package/scripts/release/validate-no-go-gates.sh +7 -4
@@ -0,0 +1,544 @@
1
+ /**
2
+ * API Client for Vigthoria Backend
3
+ * Connects to coder.vigthoria.io API endpoints
4
+ */
5
+ import { Config } from './config.js';
6
+ import { Logger } from './logger.js';
7
+ export type CLIErrorCategory = 'auth' | 'repo_session' | 'model_backend' | 'bridge' | 'network' | 'timeout' | 'parsing' | 'tool_execution' | 'credits';
8
+ export declare const VIGTHORIA_HUB_CREDITS_URL = "https://hub.vigthoria.io/credits";
9
+ export declare const VIGTHORIA_SERVER_TEMPORARILY_UNAVAILABLE_MESSAGE = "Vigthoria Server is temporarily not available. Please try again later. If the issue persists, please contact support.";
10
+ export type ChatRoutePreference = 'coder' | 'models' | 'selfhosted';
11
+ export type ChatRequestOptions = {
12
+ /** @deprecated Use connectTimeoutMs + idleTimeoutMs. Kept for legacy callers. */
13
+ timeoutMs?: number;
14
+ fastFail?: boolean;
15
+ /** When true with fastFail, only try preferredRoute (no fallback hops). */
16
+ singleRoute?: boolean;
17
+ connectTimeoutMs?: number;
18
+ idleTimeoutMs?: number;
19
+ stream?: boolean;
20
+ preferredRoute?: ChatRoutePreference;
21
+ onRouteAttempt?: (routeLabel: string) => void;
22
+ onStreamDelta?: (chunk: string) => void;
23
+ };
24
+ export declare class CLIError extends Error {
25
+ category: CLIErrorCategory;
26
+ statusCode?: number;
27
+ endpoint?: string;
28
+ walletUrl?: string;
29
+ topupUrl?: string;
30
+ balance?: number;
31
+ constructor(message: string, category: CLIErrorCategory, opts?: {
32
+ statusCode?: number;
33
+ endpoint?: string;
34
+ cause?: Error;
35
+ walletUrl?: string;
36
+ topupUrl?: string;
37
+ balance?: number;
38
+ });
39
+ }
40
+ /** Classify an axios or fetch error into a structured CLIError. */
41
+ export declare function classifyError(error: unknown, fallbackCategory?: CLIErrorCategory): CLIError;
42
+ /** Format a CLIError for user-facing display. */
43
+ export declare function formatCLIError(err: CLIError): string;
44
+ export declare function sanitizeUserFacingPathText(input: string): string;
45
+ export declare function sanitizeUserFacingErrorText(input: string): string;
46
+ export declare function isServerRuntime(): boolean;
47
+ export declare function describeUpstreamStatus(status: number): string;
48
+ export declare function propagateError(err: any): never;
49
+ export interface ChatMessage {
50
+ role: 'user' | 'assistant' | 'system';
51
+ content: string;
52
+ }
53
+ export interface ChatResponse {
54
+ id: string;
55
+ message: string;
56
+ model: string;
57
+ usage?: {
58
+ prompt_tokens: number;
59
+ completion_tokens: number;
60
+ total_tokens: number;
61
+ };
62
+ }
63
+ export interface V3AgentWorkflowResponse {
64
+ content: string;
65
+ taskId: string | null;
66
+ contextId?: string | null;
67
+ backendUrl: string;
68
+ partial?: boolean;
69
+ metadata?: Record<string, unknown>;
70
+ changedFiles?: Record<string, string>;
71
+ }
72
+ export interface FrontendPreviewGateResult {
73
+ required: boolean;
74
+ passed: boolean;
75
+ backendUrl?: string;
76
+ entryPath?: string;
77
+ assetPaths?: {
78
+ css: string[];
79
+ js: string[];
80
+ };
81
+ artifacts?: {
82
+ manifestPath?: string;
83
+ screenshotPath?: string;
84
+ previewFileUrl?: string;
85
+ screenshotCaptured?: boolean;
86
+ screenshotError?: string;
87
+ };
88
+ modes?: {
89
+ design?: {
90
+ ready: boolean;
91
+ devices?: string[];
92
+ variantCount?: number;
93
+ };
94
+ live?: {
95
+ ready: boolean;
96
+ entryPoint?: string;
97
+ };
98
+ production?: {
99
+ ready: boolean;
100
+ deploymentTarget?: string;
101
+ recommendedCommand?: string;
102
+ };
103
+ };
104
+ summary?: Record<string, unknown>;
105
+ processingTimeMs?: number;
106
+ error?: string;
107
+ }
108
+ export interface OperatorWorkflowResponse {
109
+ content: string;
110
+ workflowId: string | null;
111
+ contextId?: string | null;
112
+ backendUrl: string;
113
+ savedWorkflow?: {
114
+ id: string;
115
+ name?: string | null;
116
+ sourceWorkflowId?: string | null;
117
+ } | null;
118
+ metadata?: Record<string, unknown>;
119
+ changedFiles?: Record<string, string>;
120
+ }
121
+ export interface StreamChunk {
122
+ type: 'content' | 'done' | 'error';
123
+ content?: string;
124
+ error?: string;
125
+ }
126
+ export interface EndpointHealthStatus {
127
+ name: string;
128
+ endpoint: string;
129
+ ok: boolean;
130
+ error?: string;
131
+ details?: Record<string, unknown>;
132
+ }
133
+ export interface APIHealthStatus {
134
+ overallOk: boolean;
135
+ coder: EndpointHealthStatus;
136
+ models: EndpointHealthStatus;
137
+ selfHosted: EndpointHealthStatus | null;
138
+ }
139
+ export interface CapabilityTruthStatus {
140
+ overallOk: boolean;
141
+ v3Agent: EndpointHealthStatus;
142
+ hyperLoop: EndpointHealthStatus;
143
+ repoMemory: EndpointHealthStatus;
144
+ devtoolsBridge: EndpointHealthStatus;
145
+ }
146
+ export interface VigFlowTemplateSummary {
147
+ id: string;
148
+ name: string;
149
+ description: string;
150
+ category: string;
151
+ icon?: string;
152
+ tags: string[];
153
+ isBuiltin: boolean;
154
+ source: string;
155
+ createdAt?: string;
156
+ }
157
+ export interface VigFlowWorkflowSummary {
158
+ id: string;
159
+ name: string;
160
+ description: string;
161
+ isActive: boolean;
162
+ version: string;
163
+ tags: string[];
164
+ nodeCount: number;
165
+ executionCount: number;
166
+ lastExecutedAt?: string;
167
+ createdAt?: string;
168
+ updatedAt?: string;
169
+ }
170
+ export interface VigFlowWorkflowCreation {
171
+ id: string;
172
+ name: string;
173
+ fromTemplate?: string;
174
+ }
175
+ export interface ResolvedVigFlowWorkflowTarget {
176
+ id: string;
177
+ name: string;
178
+ selector: string;
179
+ matchedBy: 'id' | 'name' | 'search';
180
+ }
181
+ export interface VigFlowExecutionResult {
182
+ executionId: string;
183
+ status: string;
184
+ result?: unknown;
185
+ error?: string;
186
+ nodesExecuted?: number;
187
+ }
188
+ export interface VigFlowExecutionStatus {
189
+ id: string;
190
+ workflowId: string;
191
+ status: string;
192
+ startedAt?: string;
193
+ completedAt?: string;
194
+ nodesExecuted?: number;
195
+ totalNodes?: number;
196
+ result?: unknown;
197
+ error?: string;
198
+ progress?: Record<string, unknown>;
199
+ duration?: number;
200
+ }
201
+ export interface VigthoriUser {
202
+ id: string;
203
+ username: string;
204
+ email: string;
205
+ isAdmin: boolean;
206
+ subscription: {
207
+ plan: string;
208
+ projectLimit: number;
209
+ storageLimit: number;
210
+ viagen6Access: boolean;
211
+ aiModelsLimit: number;
212
+ prioritySupport: boolean;
213
+ teamCollaboration: boolean;
214
+ adminAccess: boolean;
215
+ };
216
+ }
217
+ export declare class APIClient {
218
+ private client;
219
+ private modelRouterClient;
220
+ private selfHostedModelRouterClient;
221
+ private config;
222
+ private logger;
223
+ private ws;
224
+ private vigFlowTokens;
225
+ private _httpsAgent;
226
+ private lastChatTransportErrors;
227
+ constructor(config: Config, logger: Logger);
228
+ /**
229
+ * Destroy keep-alive sockets so the Node.js event loop can drain
230
+ * naturally. Call this before exiting commands that run HTTP probes
231
+ * (e.g. `status`) to avoid the libuv UV_HANDLE_CLOSING assertion
232
+ * on Windows / Node 25+.
233
+ */
234
+ destroy(): void;
235
+ private getSelfHostedModelsApiUrl;
236
+ login(email: string, password: string): Promise<boolean>;
237
+ loginWithToken(token: string): Promise<boolean>;
238
+ private extractUserProfile;
239
+ private refreshToken;
240
+ getSubscriptionStatus(): Promise<void>;
241
+ private getAccessToken;
242
+ /**
243
+ * Validate the current auth token against the Coder API.
244
+ * By default this fails open on network errors to keep offline commands usable.
245
+ */
246
+ validateToken(options?: {
247
+ allowNetworkFailOpen?: boolean;
248
+ enforceTokenShape?: boolean;
249
+ }): Promise<{
250
+ valid: boolean;
251
+ error?: string;
252
+ }>;
253
+ getV3AgentBaseUrls(preferLocal?: boolean): string[];
254
+ getV3AgentRunUrl(baseUrl: string): string;
255
+ getV3AgentContinueUrl(baseUrl: string): string;
256
+ getOperatorBaseUrls(): string[];
257
+ getOperatorStreamUrl(baseUrl: string): string;
258
+ getMcpBaseUrls(): string[];
259
+ getVigFlowBaseUrls(): string[];
260
+ getTemplateServiceBaseUrls(): string[];
261
+ private isFrontendTask;
262
+ /**
263
+ * Returns true when the prompt describes a read-only / analysis task.
264
+ * Used to suppress preview gate and other write-oriented side effects.
265
+ */
266
+ isAnalysisOnlyTask(message?: string, context?: Record<string, any>): boolean;
267
+ private normalizeWorkspaceRelativePath;
268
+ private listFrontendWorkspaceFiles;
269
+ private chooseFrontendPreviewEntry;
270
+ private extractLinkedFrontendAssets;
271
+ private gatherFrontendPreviewArtifacts;
272
+ private captureFrontendPreviewScreenshot;
273
+ private evaluateFrontendVisualProof;
274
+ private persistFrontendPreviewArtifacts;
275
+ runTemplateServicePreviewGate(message?: string, context?: Record<string, any>): Promise<FrontendPreviewGateResult>;
276
+ private getMcpContextCreateUrl;
277
+ private getMcpContextUrl;
278
+ private getMcpHeaders;
279
+ getV3AgentHeaders(): Promise<Record<string, string>>;
280
+ /**
281
+ * Ensure the V3 service key is available in config.
282
+ * If not already set via env or stored config, fetches it from the Coder API
283
+ * using the current user's auth token and caches it for this session and beyond.
284
+ */
285
+ ensureV3ServiceKey(): Promise<void>;
286
+ runV3HealthCheck(): Promise<{
287
+ healthy: boolean;
288
+ endpoint: string;
289
+ error?: string;
290
+ }>;
291
+ private runV3AgentAuthPreflight;
292
+ private executeV3AgentRunRequest;
293
+ private getVigFlowAccessToken;
294
+ private getVigFlowHeaders;
295
+ private withVigFlow;
296
+ /**
297
+ * Build the correct sub-path for VigFlow endpoints.
298
+ * Local servers (e.g. localhost:5060) need `/api/…` prefix.
299
+ * The remote gateway URL already ends with `/api/vigflow`, so appending
300
+ * another `/api/…` would double the prefix and cause 404s.
301
+ */
302
+ private vigFlowEndpoint;
303
+ listVigFlowTemplates(options?: {
304
+ category?: string;
305
+ search?: string;
306
+ }): Promise<VigFlowTemplateSummary[]>;
307
+ listVigFlowWorkflows(): Promise<VigFlowWorkflowSummary[]>;
308
+ resolveVigFlowWorkflow(selector: string): Promise<ResolvedVigFlowWorkflowTarget>;
309
+ useVigFlowTemplate(templateId: string, options?: {
310
+ name?: string;
311
+ variables?: Record<string, unknown>;
312
+ }): Promise<VigFlowWorkflowCreation>;
313
+ runVigFlowWorkflow(workflowId: string, options?: {
314
+ data?: Record<string, unknown>;
315
+ executionOptions?: Record<string, unknown>;
316
+ }): Promise<VigFlowExecutionResult>;
317
+ getVigFlowExecutionStatus(executionId: string): Promise<VigFlowExecutionStatus>;
318
+ /** Maximum serialized context length accepted by the V3 server. */
319
+ private static readonly V3_CONTEXT_CHAR_LIMIT;
320
+ buildV3AgentContext(context?: Record<string, any>): string;
321
+ /**
322
+ * Compact a V3 context payload so the serialized JSON stays under
323
+ * the server's character limit. Progressively sheds bulk:
324
+ * 1. Trim workspaceFiles values to fit budget
325
+ * 2. Drop workspaceFiles entirely
326
+ * 3. Truncate history
327
+ * 4. Truncate file list
328
+ * 5. Drop readmeExcerpt
329
+ */
330
+ private compactV3Context;
331
+ buildMinimalV3AgentContext(context?: Record<string, any>): string;
332
+ private extractEmergencyAppName;
333
+ private materializeEmergencySaaSWorkspace;
334
+ private ensureExecutionContext;
335
+ bindExecutionContext(context?: Record<string, any>): Promise<Record<string, any>>;
336
+ private resolveAgentTargetPath;
337
+ private isLikelyWindowsPath;
338
+ private resolveServerBindableWorkspacePath;
339
+ private getDisplayWorkspaceName;
340
+ private buildPublicWorkspaceDescriptor;
341
+ private buildPublicRuntimeEnvironment;
342
+ private buildLocalWorkspaceSummary;
343
+ /**
344
+ * Collect text file contents from the workspace for V3 agent hydration.
345
+ * Budget: up to ~2 MB total, per-file cap 200 KB, skip binary extensions.
346
+ */
347
+ collectWorkspaceFileContents(rootPath: string, filePaths: string[]): Record<string, string>;
348
+ hasAgentWorkspaceOutput(context?: Record<string, any>): boolean;
349
+ getAgentWorkspaceSnapshot(rootPath: string): {
350
+ fileCount: number;
351
+ paths: string[];
352
+ signature: string;
353
+ };
354
+ waitForAgentWorkspaceSettle(context?: Record<string, any>, options?: Record<string, any>): Promise<void>;
355
+ extractExpectedWorkspaceFiles(message?: string, context?: Record<string, any>): string[];
356
+ captureV3AgentStreamMutation(event: any, streamedFiles: Record<string, string>, serverRoot?: string | null): void;
357
+ private applyV3AgentStreamEventToWorkspace;
358
+ private writeV3AgentWorkspaceFile;
359
+ private deleteV3AgentWorkspaceFile;
360
+ recoverAgentWorkspaceFiles(context?: Record<string, any>, streamedFiles?: Record<string, string>, expectedFiles?: string[]): void;
361
+ normalizeAgentWorkspaceRelativePath(rawPath: string, rootPath?: string): string;
362
+ ensureAgentFrontendPolish(message?: string, context?: Record<string, any>): Promise<void>;
363
+ private injectSectionBeforeFooter;
364
+ private injectNavLink;
365
+ private ensureReferencedFrontendAssets;
366
+ private buildFallbackFrontendCss;
367
+ private buildFallbackFrontendJs;
368
+ private replaceMissingLocalAssetReferences;
369
+ formatV3AgentResponse(data: any): string;
370
+ private sanitizeV3AgentResponseText;
371
+ /**
372
+ * Build a human-readable answer from the tool results in a V3 event
373
+ * stream when the server didn't emit a proper complete/message event.
374
+ */
375
+ private synthesizeAnswerFromV3Events;
376
+ private sanitizeV3AgentEventForUser;
377
+ collectV3AgentStream(response: Response, context?: Record<string, any>): Promise<any>;
378
+ runV3AgentWorkflow(message: string, context?: Record<string, any>): Promise<V3AgentWorkflowResponse>;
379
+ private formatOperatorResponse;
380
+ runOperatorWorkflow(message: string, context?: Record<string, any>): Promise<OperatorWorkflowResponse>;
381
+ /**
382
+ * Chat API - Direct Vigthoria Models API Architecture
383
+ *
384
+ * PRIMARY: api.vigthoria.io - Direct access to Vigthoria Model Router
385
+ * This is the centralized public API for all AI operations.
386
+ * Works for both authenticated and unauthenticated users.
387
+ *
388
+ * FALLBACK: Coder Cloud API - For authenticated users only
389
+ *
390
+ * NO localhost fallbacks - CLI is for external users, not server-side!
391
+ */
392
+ chat(messages: ChatMessage[], model: string, useLocal?: boolean): Promise<ChatResponse>;
393
+ private shouldSkipCloudRoutes;
394
+ private tryChatWithModel;
395
+ private trySelfHostedChatWithModel;
396
+ private getFallbackModelId;
397
+ private isCloudModelId;
398
+ private canUseCloudModel;
399
+ private resolvePermittedModelId;
400
+ private shouldSimulateCloudFailure;
401
+ private shouldTrySelfHostedFallback;
402
+ private isSelfHostedPreferredModel;
403
+ private getSelfHostedFallbackModelId;
404
+ chatStream(messages: ChatMessage[], model: string): AsyncGenerator<StreamChunk>;
405
+ chatWithCallback(messages: ChatMessage[], model: string, onChunk: (chunk: string) => void, onDone: () => void, onError: (error: Error) => void): Promise<void>;
406
+ private chatComplete;
407
+ generateCode(prompt: string, language: string, model: string): Promise<string>;
408
+ /**
409
+ * Ensure code has balanced curly braces by appending missing closing braces.
410
+ */
411
+ private ensureBalancedBraces;
412
+ /**
413
+ * Quick JS/TS syntax validation using Node's built-in parser.
414
+ * Returns true if the code parses without errors.
415
+ */
416
+ private validateJsSyntax;
417
+ /**
418
+ * Extract the first complete function/class from code.
419
+ * Used as last-resort when the model keeps over-producing.
420
+ */
421
+ private extractFirstFunction;
422
+ /**
423
+ * Detect if code is excessively over-engineered for a short prompt.
424
+ * E.g. a "multiply function" request producing 20+ lines.
425
+ */
426
+ private codeIsOverEngineered;
427
+ /**
428
+ * Detect if generated code contains DOM/HTML pollution inappropriate
429
+ * for a pure programming language like JavaScript, Python, etc.
430
+ */
431
+ private codeContainsDomPollution;
432
+ /**
433
+ * Strip DOM pollution from generated code, keeping only the pure logic.
434
+ * Used as last-resort fallback when the model repeatedly ignores constraints.
435
+ */
436
+ private stripDomPollution;
437
+ generateProject(prompt: string, projectType: string, model: string): Promise<{
438
+ code: string;
439
+ plan?: any;
440
+ quality?: {
441
+ lineCount: number;
442
+ score: number;
443
+ checks: {
444
+ hasAnimations: boolean;
445
+ hasNeonEffects: boolean;
446
+ hasResponsive: boolean;
447
+ hasFontAwesome: boolean;
448
+ hasGoogleFonts: boolean;
449
+ };
450
+ };
451
+ }>;
452
+ explainCode(code: string, language: string): Promise<string>;
453
+ reviewCode(code: string, language: string): Promise<{
454
+ score: number;
455
+ issues: {
456
+ type: string;
457
+ line: number;
458
+ message: string;
459
+ severity: string;
460
+ }[];
461
+ suggestions: string[];
462
+ }>;
463
+ /**
464
+ * Lightweight client-side heuristic scan: catches common code smells
465
+ * AND logic/arithmetic bugs so review never returns "score 30, no issues".
466
+ */
467
+ private heuristicCodeIssues;
468
+ fixCode(code: string, language: string, fixType: string): Promise<{
469
+ fixed: string;
470
+ changes: {
471
+ line: number;
472
+ before: string;
473
+ after: string;
474
+ reason: string;
475
+ }[];
476
+ }>;
477
+ /**
478
+ * Compute a semantic diff between original and fixed code using
479
+ * Longest Common Subsequence (LCS) to avoid the line-shift inflation
480
+ * bug where inserting one line flags all subsequent lines as changed.
481
+ */
482
+ private computeSemanticDiff;
483
+ /**
484
+ * Lightweight client-side syntax error detection.
485
+ * Returns a human-readable description of obvious errors, or empty string.
486
+ */
487
+ private detectSyntaxErrors;
488
+ /**
489
+ * Strip comment lines that the model added during a fix but were not
490
+ * present in the original code. Used for syntax-only fixes where the
491
+ * model tends to annotate its changes with "// Fixed ..." comments.
492
+ */
493
+ private stripInjectedComments;
494
+ /**
495
+ * Ensure the fixed code hasn't lost closing delimiters relative to the
496
+ * original. Counts {, }, (, ), [, ] outside strings/comments and if
497
+ * the fix has fewer closers than the original, appends the missing ones.
498
+ */
499
+ private repairBracketBalance;
500
+ private resolveModelId;
501
+ private getCoderHealth;
502
+ /**
503
+ * Fast preflight for local agent loop — probes model backends in parallel
504
+ * so users see a clear pass/fail before "Planning..." hangs on slow routes.
505
+ */
506
+ runChatModelPreflight(requestedModel?: string): Promise<{
507
+ healthy: boolean;
508
+ endpoint: string;
509
+ error?: string;
510
+ routes: Array<{
511
+ name: string;
512
+ ok: boolean;
513
+ error?: string;
514
+ }>;
515
+ }>;
516
+ mapPreflightEndpointToRoute(endpoint: string): ChatRoutePreference | null;
517
+ getLastChatTransportErrors(): string[];
518
+ submitClientToolResult(contextId: string, callId: string, result: {
519
+ success: boolean;
520
+ output: string;
521
+ error?: string;
522
+ }, backendUrl?: string | null): Promise<void>;
523
+ private isHealthyServicePayload;
524
+ private extractModelCount;
525
+ private probeModelList;
526
+ private getModelsHealth;
527
+ private getSelfHostedHealth;
528
+ private getV3AgentHealth;
529
+ private getHyperLoopHealth;
530
+ private getRepoMemoryHealth;
531
+ runSelfHealingCycle(_originalPrompt: string, _workspacePath: string, _context?: Record<string, any>): Promise<{
532
+ healingAttempted: boolean;
533
+ passed: boolean;
534
+ tool: string;
535
+ }>;
536
+ attemptV3ServiceRecovery(reason?: string, _options?: Record<string, any>): Promise<{
537
+ recovered: boolean;
538
+ message: string;
539
+ }>;
540
+ getDevtoolsBridgeStatus(): Promise<EndpointHealthStatus>;
541
+ getCapabilityTruthStatus(context?: Record<string, any>): Promise<CapabilityTruthStatus>;
542
+ getHealthStatus(): Promise<APIHealthStatus>;
543
+ healthCheck(): Promise<boolean>;
544
+ }