vigthoria-cli 1.10.0 → 1.10.36
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/auth.d.ts +1 -0
- package/dist/commands/auth.js +99 -17
- package/dist/commands/chat.d.ts +34 -0
- package/dist/commands/chat.js +1162 -61
- package/dist/commands/config.js +11 -2
- package/dist/commands/legion.js +8 -2
- package/dist/commands/wallet.d.ts +25 -0
- package/dist/commands/wallet.js +191 -0
- package/dist/index.js +158 -2
- package/dist/utils/api.d.ts +90 -2
- package/dist/utils/api.js +1730 -266
- package/dist/utils/config.d.ts +11 -0
- package/dist/utils/config.js +53 -12
- package/dist/utils/persona.d.ts +4 -0
- package/dist/utils/persona.js +34 -0
- package/dist/utils/tools.d.ts +5 -0
- package/dist/utils/tools.js +53 -1
- package/dist/utils/workspace-stream.js +56 -15
- package/install.ps1 +1 -1
- package/install.sh +1 -1
- package/package.json +4 -2
- package/scripts/release/validate-no-go-gates.sh +3 -1
package/dist/utils/api.d.ts
CHANGED
|
@@ -4,15 +4,37 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Config } from './config.js';
|
|
6
6
|
import { Logger } from './logger.js';
|
|
7
|
-
export type CLIErrorCategory = 'auth' | 'repo_session' | 'model_backend' | 'bridge' | 'network' | 'timeout' | 'parsing' | 'tool_execution';
|
|
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
|
+
};
|
|
8
24
|
export declare class CLIError extends Error {
|
|
9
25
|
category: CLIErrorCategory;
|
|
10
26
|
statusCode?: number;
|
|
11
27
|
endpoint?: string;
|
|
28
|
+
walletUrl?: string;
|
|
29
|
+
topupUrl?: string;
|
|
30
|
+
balance?: number;
|
|
12
31
|
constructor(message: string, category: CLIErrorCategory, opts?: {
|
|
13
32
|
statusCode?: number;
|
|
14
33
|
endpoint?: string;
|
|
15
34
|
cause?: Error;
|
|
35
|
+
walletUrl?: string;
|
|
36
|
+
topupUrl?: string;
|
|
37
|
+
balance?: number;
|
|
16
38
|
});
|
|
17
39
|
}
|
|
18
40
|
/** Classify an axios or fetch error into a structured CLIError. */
|
|
@@ -255,6 +277,40 @@ export declare class APIClient {
|
|
|
255
277
|
private getMcpContextUrl;
|
|
256
278
|
private getMcpHeaders;
|
|
257
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;
|
|
258
314
|
private executeV3AgentRunRequest;
|
|
259
315
|
private getVigFlowAccessToken;
|
|
260
316
|
private getVigFlowHeaders;
|
|
@@ -304,7 +360,19 @@ export declare class APIClient {
|
|
|
304
360
|
private resolveServerBindableWorkspacePath;
|
|
305
361
|
private buildPublicWorkspaceDescriptor;
|
|
306
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;
|
|
307
374
|
private buildLocalWorkspaceSummary;
|
|
375
|
+
private buildWorkspaceIndexFile;
|
|
308
376
|
/**
|
|
309
377
|
* Collect text file contents from the workspace for V3 agent hydration.
|
|
310
378
|
* Budget: up to ~2 MB total, per-file cap 200 KB, skip binary extensions.
|
|
@@ -332,6 +400,16 @@ export declare class APIClient {
|
|
|
332
400
|
private buildFallbackFrontendJs;
|
|
333
401
|
private replaceMissingLocalAssetReferences;
|
|
334
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;
|
|
335
413
|
/**
|
|
336
414
|
* Build a human-readable answer from the tool results in a V3 event
|
|
337
415
|
* stream when the server didn't emit a proper complete/message event.
|
|
@@ -339,6 +417,11 @@ export declare class APIClient {
|
|
|
339
417
|
private synthesizeAnswerFromV3Events;
|
|
340
418
|
private sanitizeV3AgentEventForUser;
|
|
341
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>;
|
|
342
425
|
runV3AgentWorkflow(message: string, context?: Record<string, any>): Promise<V3AgentWorkflowResponse>;
|
|
343
426
|
private formatOperatorResponse;
|
|
344
427
|
runOperatorWorkflow(message: string, context?: Record<string, any>): Promise<OperatorWorkflowResponse>;
|
|
@@ -353,12 +436,14 @@ export declare class APIClient {
|
|
|
353
436
|
*
|
|
354
437
|
* NO localhost fallbacks - CLI is for external users, not server-side!
|
|
355
438
|
*/
|
|
356
|
-
chat(messages: ChatMessage[], model: string, useLocal?: boolean): Promise<ChatResponse>;
|
|
439
|
+
chat(messages: ChatMessage[], model: string, useLocal?: boolean, options?: ChatRequestOptions): Promise<ChatResponse>;
|
|
440
|
+
getLastChatTransportErrors(): string[];
|
|
357
441
|
private shouldSkipCloudRoutes;
|
|
358
442
|
private tryChatWithModel;
|
|
359
443
|
private trySelfHostedChatWithModel;
|
|
360
444
|
private getFallbackModelId;
|
|
361
445
|
private isCloudModelId;
|
|
446
|
+
private buildDirectChatHeaders;
|
|
362
447
|
private canUseCloudModel;
|
|
363
448
|
private resolvePermittedModelId;
|
|
364
449
|
private shouldSimulateCloudFailure;
|
|
@@ -463,6 +548,9 @@ export declare class APIClient {
|
|
|
463
548
|
private repairBracketBalance;
|
|
464
549
|
private resolveModelId;
|
|
465
550
|
private getCoderHealth;
|
|
551
|
+
private isHealthyServicePayload;
|
|
552
|
+
private extractModelCount;
|
|
553
|
+
private probeModelList;
|
|
466
554
|
private getModelsHealth;
|
|
467
555
|
private getSelfHostedHealth;
|
|
468
556
|
private getV3AgentHealth;
|