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.
- 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 -28
- package/dist/commands/chat.js +407 -1254
- 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.js +5 -1
- package/dist/utils/bridge-client.js +52 -11
- package/dist/utils/codebase-indexer.js +41 -4
- 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.js +45 -8
- package/dist/utils/workspace-cache.js +26 -18
- package/dist/utils/workspace-stream.js +63 -21
- package/package.json +3 -6
- 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 -276
- package/dist/utils/tools.js +0 -3516
package/dist/utils/api.d.ts
DELETED
|
@@ -1,572 +0,0 @@
|
|
|
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
|
-
/**
|
|
287
|
-
* Fast preflight for local agent loop — probes model backends in parallel
|
|
288
|
-
* so users see a clear pass/fail before "Planning..." hangs on slow routes.
|
|
289
|
-
*/
|
|
290
|
-
runChatModelPreflight(requestedModel?: string): Promise<{
|
|
291
|
-
healthy: boolean;
|
|
292
|
-
endpoint: string;
|
|
293
|
-
error?: string;
|
|
294
|
-
routes: Array<{
|
|
295
|
-
name: string;
|
|
296
|
-
ok: boolean;
|
|
297
|
-
error?: string;
|
|
298
|
-
}>;
|
|
299
|
-
}>;
|
|
300
|
-
runV3HealthCheck(options?: {
|
|
301
|
-
soft?: boolean;
|
|
302
|
-
}): Promise<{
|
|
303
|
-
healthy: boolean;
|
|
304
|
-
endpoint: string;
|
|
305
|
-
error?: string;
|
|
306
|
-
}>;
|
|
307
|
-
private resolveChatConnectTimeoutMs;
|
|
308
|
-
private resolveChatIdleTimeoutMs;
|
|
309
|
-
mapPreflightEndpointToRoute(endpoint: string): ChatRoutePreference | null;
|
|
310
|
-
private isCanonicalCoderDuplicate;
|
|
311
|
-
private consumeOpenAIStreamResponse;
|
|
312
|
-
private tryStreamingModelRouterChat;
|
|
313
|
-
private runV3AgentAuthPreflight;
|
|
314
|
-
private executeV3AgentRunRequest;
|
|
315
|
-
private getVigFlowAccessToken;
|
|
316
|
-
private getVigFlowHeaders;
|
|
317
|
-
private withVigFlow;
|
|
318
|
-
/**
|
|
319
|
-
* Build the correct sub-path for VigFlow endpoints.
|
|
320
|
-
* Local servers (e.g. localhost:5060) need `/api/…` prefix.
|
|
321
|
-
* The remote gateway URL already ends with `/api/vigflow`, so appending
|
|
322
|
-
* another `/api/…` would double the prefix and cause 404s.
|
|
323
|
-
*/
|
|
324
|
-
private vigFlowEndpoint;
|
|
325
|
-
listVigFlowTemplates(options?: {
|
|
326
|
-
category?: string;
|
|
327
|
-
search?: string;
|
|
328
|
-
}): Promise<VigFlowTemplateSummary[]>;
|
|
329
|
-
listVigFlowWorkflows(): Promise<VigFlowWorkflowSummary[]>;
|
|
330
|
-
resolveVigFlowWorkflow(selector: string): Promise<ResolvedVigFlowWorkflowTarget>;
|
|
331
|
-
useVigFlowTemplate(templateId: string, options?: {
|
|
332
|
-
name?: string;
|
|
333
|
-
variables?: Record<string, unknown>;
|
|
334
|
-
}): Promise<VigFlowWorkflowCreation>;
|
|
335
|
-
runVigFlowWorkflow(workflowId: string, options?: {
|
|
336
|
-
data?: Record<string, unknown>;
|
|
337
|
-
executionOptions?: Record<string, unknown>;
|
|
338
|
-
}): Promise<VigFlowExecutionResult>;
|
|
339
|
-
getVigFlowExecutionStatus(executionId: string): Promise<VigFlowExecutionStatus>;
|
|
340
|
-
/** Maximum serialized context length accepted by the V3 server. */
|
|
341
|
-
private static readonly V3_CONTEXT_CHAR_LIMIT;
|
|
342
|
-
buildV3AgentContext(context?: Record<string, any>): string;
|
|
343
|
-
/**
|
|
344
|
-
* Compact a V3 context payload so the serialized JSON stays under
|
|
345
|
-
* the server's character limit. Progressively sheds bulk:
|
|
346
|
-
* 1. Trim workspaceFiles values to fit budget
|
|
347
|
-
* 2. Drop workspaceFiles entirely
|
|
348
|
-
* 3. Truncate history
|
|
349
|
-
* 4. Truncate file list
|
|
350
|
-
* 5. Drop readmeExcerpt
|
|
351
|
-
*/
|
|
352
|
-
private compactV3Context;
|
|
353
|
-
buildMinimalV3AgentContext(context?: Record<string, any>): string;
|
|
354
|
-
private extractEmergencyAppName;
|
|
355
|
-
private materializeEmergencySaaSWorkspace;
|
|
356
|
-
private ensureExecutionContext;
|
|
357
|
-
bindExecutionContext(context?: Record<string, any>): Promise<Record<string, any>>;
|
|
358
|
-
private resolveAgentTargetPath;
|
|
359
|
-
private isLikelyWindowsPath;
|
|
360
|
-
private resolveServerBindableWorkspacePath;
|
|
361
|
-
private buildPublicWorkspaceDescriptor;
|
|
362
|
-
private buildPublicRuntimeEnvironment;
|
|
363
|
-
private extractPromptFocusTerms;
|
|
364
|
-
private buildTopLevelWorkspaceLayout;
|
|
365
|
-
private normalizeFocusPathKey;
|
|
366
|
-
private resolvePromptFocusDirectories;
|
|
367
|
-
private buildMandatoryFocusReadPaths;
|
|
368
|
-
private buildAnalysisGuidance;
|
|
369
|
-
private collectFocusDirectoryFilePaths;
|
|
370
|
-
private mergeWorkspacePathCandidates;
|
|
371
|
-
private scoreWorkspacePathForHydration;
|
|
372
|
-
private sortWorkspacePathsForHydration;
|
|
373
|
-
private trimVigthoriaBrainForTransport;
|
|
374
|
-
private buildLocalWorkspaceSummary;
|
|
375
|
-
private buildWorkspaceIndexFile;
|
|
376
|
-
/**
|
|
377
|
-
* Collect text file contents from the workspace for V3 agent hydration.
|
|
378
|
-
* Budget: up to ~2 MB total, per-file cap 200 KB, skip binary extensions.
|
|
379
|
-
*/
|
|
380
|
-
collectWorkspaceFileContents(rootPath: string, filePaths: string[]): Record<string, string>;
|
|
381
|
-
hasAgentWorkspaceOutput(context?: Record<string, any>): boolean;
|
|
382
|
-
getAgentWorkspaceSnapshot(rootPath: string): {
|
|
383
|
-
fileCount: number;
|
|
384
|
-
paths: string[];
|
|
385
|
-
signature: string;
|
|
386
|
-
};
|
|
387
|
-
waitForAgentWorkspaceSettle(context?: Record<string, any>, options?: Record<string, any>): Promise<void>;
|
|
388
|
-
extractExpectedWorkspaceFiles(message?: string, context?: Record<string, any>): string[];
|
|
389
|
-
captureV3AgentStreamMutation(event: any, streamedFiles: Record<string, string>, serverRoot?: string | null): void;
|
|
390
|
-
private applyV3AgentStreamEventToWorkspace;
|
|
391
|
-
private writeV3AgentWorkspaceFile;
|
|
392
|
-
private deleteV3AgentWorkspaceFile;
|
|
393
|
-
recoverAgentWorkspaceFiles(context?: Record<string, any>, streamedFiles?: Record<string, string>, expectedFiles?: string[]): void;
|
|
394
|
-
normalizeAgentWorkspaceRelativePath(rawPath: string, rootPath?: string): string;
|
|
395
|
-
ensureAgentFrontendPolish(message?: string, context?: Record<string, any>): Promise<void>;
|
|
396
|
-
private injectSectionBeforeFooter;
|
|
397
|
-
private injectNavLink;
|
|
398
|
-
private ensureReferencedFrontendAssets;
|
|
399
|
-
private buildFallbackFrontendCss;
|
|
400
|
-
private buildFallbackFrontendJs;
|
|
401
|
-
private replaceMissingLocalAssetReferences;
|
|
402
|
-
formatV3AgentResponse(data: any): string;
|
|
403
|
-
private isGenericV3AgentSummary;
|
|
404
|
-
private isV3StreamStatusMessage;
|
|
405
|
-
private scoreEvidenceFilePath;
|
|
406
|
-
private isLowTrustDocPath;
|
|
407
|
-
private extractCodeSignalsFromEvidence;
|
|
408
|
-
private classifyGameGenreFromText;
|
|
409
|
-
private extractReadmeGenreClaims;
|
|
410
|
-
private extractCodeGenreClaims;
|
|
411
|
-
private buildReadmeCodeConsistencySection;
|
|
412
|
-
private detectDocReliabilityWarnings;
|
|
413
|
-
/**
|
|
414
|
-
* Build a human-readable answer from the tool results in a V3 event
|
|
415
|
-
* stream when the server didn't emit a proper complete/message event.
|
|
416
|
-
*/
|
|
417
|
-
private synthesizeAnswerFromV3Events;
|
|
418
|
-
private sanitizeV3AgentEventForUser;
|
|
419
|
-
collectV3AgentStream(response: Response, context?: Record<string, any>): Promise<any>;
|
|
420
|
-
submitClientToolResult(contextId: string, callId: string, result: {
|
|
421
|
-
success: boolean;
|
|
422
|
-
output: string;
|
|
423
|
-
error?: string;
|
|
424
|
-
}, backendUrl?: string | null): Promise<void>;
|
|
425
|
-
runV3AgentWorkflow(message: string, context?: Record<string, any>): Promise<V3AgentWorkflowResponse>;
|
|
426
|
-
private formatOperatorResponse;
|
|
427
|
-
runOperatorWorkflow(message: string, context?: Record<string, any>): Promise<OperatorWorkflowResponse>;
|
|
428
|
-
/**
|
|
429
|
-
* Chat API - Direct Vigthoria Models API Architecture
|
|
430
|
-
*
|
|
431
|
-
* PRIMARY: api.vigthoria.io - Direct access to Vigthoria Model Router
|
|
432
|
-
* This is the centralized public API for all AI operations.
|
|
433
|
-
* Works for both authenticated and unauthenticated users.
|
|
434
|
-
*
|
|
435
|
-
* FALLBACK: Coder Cloud API - For authenticated users only
|
|
436
|
-
*
|
|
437
|
-
* NO localhost fallbacks - CLI is for external users, not server-side!
|
|
438
|
-
*/
|
|
439
|
-
chat(messages: ChatMessage[], model: string, useLocal?: boolean, options?: ChatRequestOptions): Promise<ChatResponse>;
|
|
440
|
-
getLastChatTransportErrors(): string[];
|
|
441
|
-
private shouldSkipCloudRoutes;
|
|
442
|
-
private tryChatWithModel;
|
|
443
|
-
private trySelfHostedChatWithModel;
|
|
444
|
-
private getFallbackModelId;
|
|
445
|
-
private isCloudModelId;
|
|
446
|
-
private buildDirectChatHeaders;
|
|
447
|
-
private canUseCloudModel;
|
|
448
|
-
private resolvePermittedModelId;
|
|
449
|
-
private shouldSimulateCloudFailure;
|
|
450
|
-
private shouldTrySelfHostedFallback;
|
|
451
|
-
private isSelfHostedPreferredModel;
|
|
452
|
-
private getSelfHostedFallbackModelId;
|
|
453
|
-
chatStream(messages: ChatMessage[], model: string): AsyncGenerator<StreamChunk>;
|
|
454
|
-
chatWithCallback(messages: ChatMessage[], model: string, onChunk: (chunk: string) => void, onDone: () => void, onError: (error: Error) => void): Promise<void>;
|
|
455
|
-
private chatComplete;
|
|
456
|
-
generateCode(prompt: string, language: string, model: string): Promise<string>;
|
|
457
|
-
/**
|
|
458
|
-
* Ensure code has balanced curly braces by appending missing closing braces.
|
|
459
|
-
*/
|
|
460
|
-
private ensureBalancedBraces;
|
|
461
|
-
/**
|
|
462
|
-
* Quick JS/TS syntax validation using Node's built-in parser.
|
|
463
|
-
* Returns true if the code parses without errors.
|
|
464
|
-
*/
|
|
465
|
-
private validateJsSyntax;
|
|
466
|
-
/**
|
|
467
|
-
* Extract the first complete function/class from code.
|
|
468
|
-
* Used as last-resort when the model keeps over-producing.
|
|
469
|
-
*/
|
|
470
|
-
private extractFirstFunction;
|
|
471
|
-
/**
|
|
472
|
-
* Detect if code is excessively over-engineered for a short prompt.
|
|
473
|
-
* E.g. a "multiply function" request producing 20+ lines.
|
|
474
|
-
*/
|
|
475
|
-
private codeIsOverEngineered;
|
|
476
|
-
/**
|
|
477
|
-
* Detect if generated code contains DOM/HTML pollution inappropriate
|
|
478
|
-
* for a pure programming language like JavaScript, Python, etc.
|
|
479
|
-
*/
|
|
480
|
-
private codeContainsDomPollution;
|
|
481
|
-
/**
|
|
482
|
-
* Strip DOM pollution from generated code, keeping only the pure logic.
|
|
483
|
-
* Used as last-resort fallback when the model repeatedly ignores constraints.
|
|
484
|
-
*/
|
|
485
|
-
private stripDomPollution;
|
|
486
|
-
generateProject(prompt: string, projectType: string, model: string): Promise<{
|
|
487
|
-
code: string;
|
|
488
|
-
plan?: any;
|
|
489
|
-
quality?: {
|
|
490
|
-
lineCount: number;
|
|
491
|
-
score: number;
|
|
492
|
-
checks: {
|
|
493
|
-
hasAnimations: boolean;
|
|
494
|
-
hasNeonEffects: boolean;
|
|
495
|
-
hasResponsive: boolean;
|
|
496
|
-
hasFontAwesome: boolean;
|
|
497
|
-
hasGoogleFonts: boolean;
|
|
498
|
-
};
|
|
499
|
-
};
|
|
500
|
-
}>;
|
|
501
|
-
explainCode(code: string, language: string): Promise<string>;
|
|
502
|
-
reviewCode(code: string, language: string): Promise<{
|
|
503
|
-
score: number;
|
|
504
|
-
issues: {
|
|
505
|
-
type: string;
|
|
506
|
-
line: number;
|
|
507
|
-
message: string;
|
|
508
|
-
severity: string;
|
|
509
|
-
}[];
|
|
510
|
-
suggestions: string[];
|
|
511
|
-
}>;
|
|
512
|
-
/**
|
|
513
|
-
* Lightweight client-side heuristic scan: catches common code smells
|
|
514
|
-
* AND logic/arithmetic bugs so review never returns "score 30, no issues".
|
|
515
|
-
*/
|
|
516
|
-
private heuristicCodeIssues;
|
|
517
|
-
fixCode(code: string, language: string, fixType: string): Promise<{
|
|
518
|
-
fixed: string;
|
|
519
|
-
changes: {
|
|
520
|
-
line: number;
|
|
521
|
-
before: string;
|
|
522
|
-
after: string;
|
|
523
|
-
reason: string;
|
|
524
|
-
}[];
|
|
525
|
-
}>;
|
|
526
|
-
/**
|
|
527
|
-
* Compute a semantic diff between original and fixed code using
|
|
528
|
-
* Longest Common Subsequence (LCS) to avoid the line-shift inflation
|
|
529
|
-
* bug where inserting one line flags all subsequent lines as changed.
|
|
530
|
-
*/
|
|
531
|
-
private computeSemanticDiff;
|
|
532
|
-
/**
|
|
533
|
-
* Lightweight client-side syntax error detection.
|
|
534
|
-
* Returns a human-readable description of obvious errors, or empty string.
|
|
535
|
-
*/
|
|
536
|
-
private detectSyntaxErrors;
|
|
537
|
-
/**
|
|
538
|
-
* Strip comment lines that the model added during a fix but were not
|
|
539
|
-
* present in the original code. Used for syntax-only fixes where the
|
|
540
|
-
* model tends to annotate its changes with "// Fixed ..." comments.
|
|
541
|
-
*/
|
|
542
|
-
private stripInjectedComments;
|
|
543
|
-
/**
|
|
544
|
-
* Ensure the fixed code hasn't lost closing delimiters relative to the
|
|
545
|
-
* original. Counts {, }, (, ), [, ] outside strings/comments and if
|
|
546
|
-
* the fix has fewer closers than the original, appends the missing ones.
|
|
547
|
-
*/
|
|
548
|
-
private repairBracketBalance;
|
|
549
|
-
private resolveModelId;
|
|
550
|
-
private getCoderHealth;
|
|
551
|
-
private isHealthyServicePayload;
|
|
552
|
-
private extractModelCount;
|
|
553
|
-
private probeModelList;
|
|
554
|
-
private getModelsHealth;
|
|
555
|
-
private getSelfHostedHealth;
|
|
556
|
-
private getV3AgentHealth;
|
|
557
|
-
private getHyperLoopHealth;
|
|
558
|
-
private getRepoMemoryHealth;
|
|
559
|
-
runSelfHealingCycle(_originalPrompt: string, _workspacePath: string, _context?: Record<string, any>): Promise<{
|
|
560
|
-
healingAttempted: boolean;
|
|
561
|
-
passed: boolean;
|
|
562
|
-
tool: string;
|
|
563
|
-
}>;
|
|
564
|
-
attemptV3ServiceRecovery(reason?: string, _options?: Record<string, any>): Promise<{
|
|
565
|
-
recovered: boolean;
|
|
566
|
-
message: string;
|
|
567
|
-
}>;
|
|
568
|
-
getDevtoolsBridgeStatus(): Promise<EndpointHealthStatus>;
|
|
569
|
-
getCapabilityTruthStatus(context?: Record<string, any>): Promise<CapabilityTruthStatus>;
|
|
570
|
-
getHealthStatus(): Promise<APIHealthStatus>;
|
|
571
|
-
healthCheck(): Promise<boolean>;
|
|
572
|
-
}
|