vigthoria-cli 1.13.10 → 1.13.12

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/utils/api.js CHANGED
@@ -183,7 +183,12 @@ export function sanitizeUserFacingErrorText(input) {
183
183
  return '';
184
184
  }
185
185
  const withoutTags = raw.replace(/<[^>]+>/g, ' ');
186
- return sanitizeUserFacingPathText(withoutTags).replace(/\s+/g, ' ').trim();
186
+ return sanitizeUserFacingPathText(withoutTags)
187
+ .replace(/\\[nr]/g, ' ')
188
+ .replace(/https?:\/\/(?:localhost|127\.0\.0\.1)(?::\d+)?(?:\/[^\s'")\]]*)?/gi, 'internal AI service')
189
+ .replace(/\b(?:deepseek|openrouter)\/[A-Za-z0-9._/-]+\b/gi, 'cloud model')
190
+ .replace(/\s+/g, ' ')
191
+ .trim();
187
192
  }
188
193
  const TRUSTED_TOKEN_HOST_PATTERN = /(^|\.)vigthoria\.io$/i;
189
194
  function isLoopbackHost(hostname) {
@@ -2658,6 +2663,13 @@ menu {
2658
2663
  const ranked = buildSemanticContext(rootPath, requestFocus, 60).topFiles.map((file) => file.path);
2659
2664
  const changes = getChangedFiles(rootPath, candidatePaths);
2660
2665
  const ordered = new Set();
2666
+ // Resume state must outrank semantic source ranking. The previous
2667
+ // implementation initialized orderedPaths with agentStatePaths, then
2668
+ // replaced it here with candidatePaths only. Since candidatePaths
2669
+ // intentionally excludes .vigthoria, every successful semantic pass
2670
+ // silently dropped progress.json and forced /continue to re-plan.
2671
+ for (const filePath of agentStatePaths)
2672
+ ordered.add(filePath);
2661
2673
  for (const filePath of changes.changed)
2662
2674
  ordered.add(filePath);
2663
2675
  for (const filePath of ranked)
@@ -2673,7 +2685,7 @@ menu {
2673
2685
  };
2674
2686
  }
2675
2687
  catch {
2676
- orderedPaths = candidatePaths;
2688
+ orderedPaths = [...agentStatePaths, ...candidatePaths];
2677
2689
  }
2678
2690
  summary.fileCount = snapshot.fileCount;
2679
2691
  summary.files = orderedPaths.slice(0, 40);
@@ -4070,6 +4082,10 @@ document.addEventListener('DOMContentLoaded', () => {
4070
4082
  events,
4071
4083
  files: streamedFiles,
4072
4084
  partial: true,
4085
+ terminal_error: {
4086
+ message: event.message || 'V3 agent returned an error',
4087
+ code: event.code || event.error_code || null,
4088
+ },
4073
4089
  };
4074
4090
  }
4075
4091
  throw new Error(event.message || 'V3 agent returned an error');
@@ -4228,6 +4244,32 @@ document.addEventListener('DOMContentLoaded', () => {
4228
4244
  const contextId = data.context_id || response.headers.get('x-context-id') || requestExecutionContext.contextId || null;
4229
4245
  const mcpContextId = response.headers.get('x-mcp-context-id') || requestExecutionContext.mcpContextId || null;
4230
4246
  this.recoverAgentWorkspaceFiles(executionContext, data.files || {}, expectedFiles);
4247
+ if (data.terminal_error) {
4248
+ // A pre-existing local project is not proof that this run produced
4249
+ // valid output. Preserve real streamed mutations, but never run or
4250
+ // report a preview gate after a terminal planner/executor error.
4251
+ const failedPreviewGate = {
4252
+ required: false,
4253
+ passed: false,
4254
+ skipped: true,
4255
+ error: 'Agent execution failed before preview validation.',
4256
+ };
4257
+ return this.finalizeV3AgentWorkflowResponse(data, {
4258
+ content: '',
4259
+ taskId: data.task_id || null,
4260
+ contextId,
4261
+ backendUrl: baseUrl,
4262
+ partial: true,
4263
+ metadata: {
4264
+ source: 'v3-agent',
4265
+ mode: 'agent',
4266
+ contextId,
4267
+ mcpContextId,
4268
+ previewGate: failedPreviewGate,
4269
+ workflowError: data.terminal_error,
4270
+ },
4271
+ });
4272
+ }
4231
4273
  await this.waitForAgentWorkspaceSettle(executionContext, { expectedFiles });
4232
4274
  await this.ensureAgentFrontendPolish(message, executionContext);
4233
4275
  const previewGate = await this.runTemplateServicePreviewGate(message, executionContext);
@@ -74,41 +74,93 @@ export function getInferenceRouterBaseUrls(selfHostedUrl) {
74
74
  return [...new Set(urls)];
75
75
  }
76
76
  let inferenceHealthCache = null;
77
- export async function isFastInferenceRouterAvailable(selfHostedUrl, timeoutMs = 400) {
78
- if (process.env.VIGTHORIA_AGENT_LLM_ROUTER === '0') {
79
- return false;
80
- }
81
- const now = Date.now();
82
- if (inferenceHealthCache && now - inferenceHealthCache.checkedAt < 60_000) {
83
- return inferenceHealthCache.ok;
84
- }
85
- for (const base of getInferenceRouterBaseUrls(selfHostedUrl)) {
77
+ function modelIdsFromPayload(payload) {
78
+ if (!payload || typeof payload !== 'object')
79
+ return [];
80
+ const body = payload;
81
+ const values = [
82
+ body.available_models,
83
+ body.loaded_models,
84
+ body.models,
85
+ body.data,
86
+ ].filter(Array.isArray).flat();
87
+ return values.map((entry) => {
88
+ if (typeof entry === 'string')
89
+ return entry;
90
+ if (entry && typeof entry === 'object') {
91
+ const model = entry;
92
+ return String(model.id || model.model || model.name || '');
93
+ }
94
+ return '';
95
+ }).filter(Boolean);
96
+ }
97
+ function includesBalancedRouterModel(modelIds) {
98
+ const allowed = new Set(INFERENCE_MODEL_IDS);
99
+ return modelIds.some((id) => allowed.has(String(id).trim().toLowerCase().replace(/:latest$/, '')));
100
+ }
101
+ async function probeBalancedRouterBase(base, timeoutMs) {
102
+ const fetchJson = async (path) => {
86
103
  const controller = new AbortController();
87
104
  const timer = setTimeout(() => controller.abort(), timeoutMs);
88
105
  try {
89
- const response = await fetch(`${base}/health`, { signal: controller.signal });
90
- clearTimeout(timer);
91
- if (response.ok) {
92
- inferenceHealthCache = { ok: true, checkedAt: now };
93
- return true;
94
- }
106
+ const response = await fetch(`${base}${path}`, { signal: controller.signal });
107
+ const payload = await response.json().catch(() => null);
108
+ return { ok: response.ok, payload };
95
109
  }
96
110
  catch {
111
+ return { ok: false, payload: null };
112
+ }
113
+ finally {
97
114
  clearTimeout(timer);
98
115
  }
116
+ };
117
+ const health = await fetchJson('/health');
118
+ if (!health.ok)
119
+ return false;
120
+ const advertisedByHealth = modelIdsFromPayload(health.payload);
121
+ if (advertisedByHealth.length > 0) {
122
+ return includesBalancedRouterModel(advertisedByHealth);
123
+ }
124
+ // Older inference nodes only expose capabilities on /v1/models.
125
+ const catalog = await fetchJson('/v1/models');
126
+ return catalog.ok && includesBalancedRouterModel(modelIdsFromPayload(catalog.payload));
127
+ }
128
+ async function compatibleInferenceRouterBases(selfHostedUrl, timeoutMs) {
129
+ const bases = getInferenceRouterBaseUrls(selfHostedUrl);
130
+ const key = bases.join('|');
131
+ const now = Date.now();
132
+ if (inferenceHealthCache
133
+ && inferenceHealthCache.key === key
134
+ && now - inferenceHealthCache.checkedAt < 60_000) {
135
+ return inferenceHealthCache.compatibleBases;
136
+ }
137
+ const compatibleBases = [];
138
+ for (const base of bases) {
139
+ if (await probeBalancedRouterBase(base, timeoutMs)) {
140
+ compatibleBases.push(base);
141
+ }
142
+ }
143
+ inferenceHealthCache = { key, compatibleBases, checkedAt: now };
144
+ return compatibleBases;
145
+ }
146
+ export async function isFastInferenceRouterAvailable(selfHostedUrl, timeoutMs = 400) {
147
+ if (process.env.VIGTHORIA_AGENT_LLM_ROUTER === '0') {
148
+ return false;
99
149
  }
100
- inferenceHealthCache = { ok: false, checkedAt: now };
101
- return false;
150
+ return (await compatibleInferenceRouterBases(selfHostedUrl, timeoutMs)).length > 0;
102
151
  }
103
152
  export async function routeWithBalanced4b(prompt, selfHostedUrl, options = {}) {
104
153
  const timeoutMs = options.timeoutMs ?? Number.parseInt(process.env.VIGTHORIA_AGENT_ROUTER_TIMEOUT_MS || '8000', 10);
105
- const bases = getInferenceRouterBaseUrls(selfHostedUrl);
154
+ const bases = await compatibleInferenceRouterBases(selfHostedUrl, Math.min(timeoutMs, 1500));
106
155
  let lastError = 'Inference router unreachable';
156
+ if (bases.length === 0) {
157
+ return { ok: false, error: 'No compatible Balanced 4B inference endpoint is available' };
158
+ }
107
159
  for (const base of bases) {
108
- const controller = new AbortController();
109
- const timer = setTimeout(() => controller.abort(), timeoutMs);
110
160
  const started = Date.now();
111
161
  for (const model of INFERENCE_MODEL_IDS) {
162
+ const controller = new AbortController();
163
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
112
164
  try {
113
165
  const response = await fetch(`${base}/v1/chat/completions`, {
114
166
  method: 'POST',
@@ -125,7 +177,6 @@ export async function routeWithBalanced4b(prompt, selfHostedUrl, options = {}) {
125
177
  }),
126
178
  signal: controller.signal,
127
179
  });
128
- clearTimeout(timer);
129
180
  const payload = await response.json().catch(() => null);
130
181
  if (!response.ok) {
131
182
  lastError = `HTTP ${response.status} from ${base}`;
@@ -149,8 +200,10 @@ export async function routeWithBalanced4b(prompt, selfHostedUrl, options = {}) {
149
200
  catch (err) {
150
201
  lastError = err instanceof Error ? err.message : String(err);
151
202
  }
203
+ finally {
204
+ clearTimeout(timer);
205
+ }
152
206
  }
153
- clearTimeout(timer);
154
207
  }
155
208
  return { ok: false, error: lastError };
156
209
  }
package/install.ps1 CHANGED
@@ -5,7 +5,7 @@
5
5
  $ErrorActionPreference = "Stop"
6
6
 
7
7
  # Configuration
8
- $CLI_VERSION = "1.13.10"
8
+ $CLI_VERSION = "1.13.12"
9
9
  $INSTALL_DIR = "$env:USERPROFILE\.vigthoria"
10
10
  $NPM_PACKAGE = "vigthoria-cli"
11
11
  $GIT_PACKAGE_URL = "git+https://market.vigthoria.io/vigthoria/vigthoria-cli.git"
@@ -35,40 +35,40 @@ Resolve-ReleaseManifest
35
35
 
36
36
  function Write-Banner {
37
37
  Write-Host ""
38
- Write-Host " ╔═══════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
39
- Write-Host " " -ForegroundColor Cyan
40
- Write-Host " VIGTHORIA CLI INSTALLER v$CLI_VERSION " -ForegroundColor Cyan
41
- Write-Host " AI-Powered Terminal Coding Assistant " -ForegroundColor Cyan
42
- Write-Host " " -ForegroundColor Cyan
43
- Write-Host " ╚═══════════════════════════════════════════════════════════╝" -ForegroundColor Cyan
38
+ Write-Host " +-----------------------------------------------------------+" -ForegroundColor Cyan
39
+ Write-Host " | |" -ForegroundColor Cyan
40
+ Write-Host " | VIGTHORIA CLI INSTALLER v$CLI_VERSION |" -ForegroundColor Cyan
41
+ Write-Host " | AI-Powered Terminal Coding Assistant |" -ForegroundColor Cyan
42
+ Write-Host " | |" -ForegroundColor Cyan
43
+ Write-Host " +-----------------------------------------------------------+" -ForegroundColor Cyan
44
44
  Write-Host ""
45
45
  }
46
46
 
47
47
  function Test-NetworkConnectivity {
48
- Write-Host "🔍 Checking network connectivity..." -ForegroundColor Yellow
48
+ Write-Host "[CHECK] Checking network connectivity..." -ForegroundColor Yellow
49
49
 
50
50
  try {
51
51
  $response = Invoke-WebRequest -Uri $HOSTED_TARBALL_URL -Method Head -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop
52
- Write-Host " hosted CLI package is reachable" -ForegroundColor Green
52
+ Write-Host "[OK] Hosted CLI package is reachable" -ForegroundColor Green
53
53
  return $true
54
54
  }
55
55
  catch {
56
- Write-Host " Hosted package unavailable, checking npm registry..." -ForegroundColor Yellow
56
+ Write-Host "[WARN] Hosted package unavailable, checking npm registry..." -ForegroundColor Yellow
57
57
  }
58
58
 
59
59
  try {
60
60
  $response = Invoke-WebRequest -Uri "https://registry.npmjs.org/vigthoria-cli" -UseBasicParsing -TimeoutSec 10 -ErrorAction Stop
61
- Write-Host " npm registry is reachable" -ForegroundColor Green
61
+ Write-Host "[OK] npm registry is reachable" -ForegroundColor Green
62
62
  return $true
63
63
  }
64
64
  catch {
65
- Write-Host " Cannot reach hosted package or npm registry" -ForegroundColor Red
65
+ Write-Host "[ERROR] Cannot reach hosted package or npm registry" -ForegroundColor Red
66
66
  return $false
67
67
  }
68
68
  }
69
69
 
70
70
  function Test-Prerequisites {
71
- Write-Host "🔍 Checking prerequisites..." -ForegroundColor Yellow
71
+ Write-Host "[CHECK] Checking prerequisites..." -ForegroundColor Yellow
72
72
 
73
73
  # Check Node.js
74
74
  try {
@@ -77,16 +77,16 @@ function Test-Prerequisites {
77
77
  $versionText = $nodeVersion.TrimStart('v')
78
78
  $parsedVersion = [version]$versionText
79
79
  if ($parsedVersion -ge [version]"20.19.0") {
80
- Write-Host " Node.js $nodeVersion" -ForegroundColor Green
80
+ Write-Host "[OK] Node.js $nodeVersion" -ForegroundColor Green
81
81
  } else {
82
- Write-Host " Node.js 20.19+ required (found $nodeVersion)" -ForegroundColor Red
82
+ Write-Host "[ERROR] Node.js 20.19+ required (found $nodeVersion)" -ForegroundColor Red
83
83
  Write-Host " Download from: https://nodejs.org/" -ForegroundColor Yellow
84
84
  return $false
85
85
  }
86
86
  }
87
87
  }
88
88
  catch {
89
- Write-Host " Node.js is not installed" -ForegroundColor Red
89
+ Write-Host "[ERROR] Node.js is not installed" -ForegroundColor Red
90
90
  Write-Host ""
91
91
  Write-Host "Please install Node.js first:" -ForegroundColor Yellow
92
92
  Write-Host " Option 1: winget install OpenJS.NodeJS" -ForegroundColor White
@@ -99,11 +99,11 @@ function Test-Prerequisites {
99
99
  try {
100
100
  $npmVersion = npm -v 2>$null
101
101
  if ($npmVersion) {
102
- Write-Host " npm v$npmVersion" -ForegroundColor Green
102
+ Write-Host "[OK] npm v$npmVersion" -ForegroundColor Green
103
103
  }
104
104
  }
105
105
  catch {
106
- Write-Host " npm is not installed" -ForegroundColor Red
106
+ Write-Host "[ERROR] npm is not installed" -ForegroundColor Red
107
107
  return $false
108
108
  }
109
109
 
@@ -112,40 +112,40 @@ function Test-Prerequisites {
112
112
 
113
113
  function Install-VigthoriaCLI-NPM {
114
114
  Write-Host ""
115
- Write-Host "📦 Installing Vigthoria CLI..." -ForegroundColor Cyan
115
+ Write-Host "[INSTALL] Installing Vigthoria CLI..." -ForegroundColor Cyan
116
116
 
117
117
  try {
118
118
  npm install -g $HOSTED_TARBALL_URL
119
- Write-Host " Vigthoria CLI installed successfully!" -ForegroundColor Green
119
+ Write-Host "[OK] Vigthoria CLI installed successfully!" -ForegroundColor Green
120
120
  return $true
121
121
  }
122
122
  catch {
123
- Write-Host " Hosted package install failed, trying npm registry..." -ForegroundColor Yellow
123
+ Write-Host "[WARN] Hosted package install failed, trying npm registry..." -ForegroundColor Yellow
124
124
  }
125
125
 
126
126
  try {
127
127
  npm install -g vigthoria-cli
128
- Write-Host " Vigthoria CLI installed successfully!" -ForegroundColor Green
128
+ Write-Host "[OK] Vigthoria CLI installed successfully!" -ForegroundColor Green
129
129
  return $true
130
130
  }
131
131
  catch {
132
- Write-Host " npm registry install failed, trying git package..." -ForegroundColor Yellow
132
+ Write-Host "[WARN] npm registry install failed, trying git package..." -ForegroundColor Yellow
133
133
  }
134
134
 
135
135
  try {
136
136
  npm install -g $GIT_PACKAGE_URL
137
- Write-Host " Vigthoria CLI installed successfully from git package!" -ForegroundColor Green
137
+ Write-Host "[OK] Vigthoria CLI installed successfully from git package!" -ForegroundColor Green
138
138
  return $true
139
139
  }
140
140
  catch {
141
- Write-Host " install failed (hosted package + npm registry + git package): $_" -ForegroundColor Red
141
+ Write-Host "[ERROR] Install failed (hosted package + npm registry + git package): $_" -ForegroundColor Red
142
142
  return $false
143
143
  }
144
144
  }
145
145
 
146
146
  function Install-VigthoriaCLI-Direct {
147
147
  Write-Host ""
148
- Write-Host "📦 Installing Vigthoria CLI (Direct Download)..." -ForegroundColor Cyan
148
+ Write-Host "[INSTALL] Installing Vigthoria CLI (Direct Download)..." -ForegroundColor Cyan
149
149
 
150
150
  # Create install directory
151
151
  if (-not (Test-Path $INSTALL_DIR)) {
@@ -198,18 +198,18 @@ node "$packagePath\dist\index.js" %*
198
198
  # Cleanup
199
199
  Remove-Item $tarballPath -Force
200
200
 
201
- Write-Host " Vigthoria CLI installed successfully!" -ForegroundColor Green
201
+ Write-Host "[OK] Vigthoria CLI installed successfully!" -ForegroundColor Green
202
202
  return $true
203
203
  }
204
204
  catch {
205
- Write-Host " Direct install failed: $_" -ForegroundColor Red
205
+ Write-Host "[ERROR] Direct install failed: $_" -ForegroundColor Red
206
206
  return $false
207
207
  }
208
208
  }
209
209
 
210
210
  function Install-VigthoriaCLI-GitHub {
211
211
  Write-Host ""
212
- Write-Host "📦 Installing Vigthoria CLI (from Vigthoria Market)..." -ForegroundColor Cyan
212
+ Write-Host "[INSTALL] Installing Vigthoria CLI (from Vigthoria Market)..." -ForegroundColor Cyan
213
213
 
214
214
  # Create install directory
215
215
  if (-not (Test-Path $INSTALL_DIR)) {
@@ -222,7 +222,7 @@ function Install-VigthoriaCLI-GitHub {
222
222
  # Check if git is available
223
223
  $gitVersion = git --version 2>$null
224
224
  if (-not $gitVersion) {
225
- Write-Host " Git is not installed" -ForegroundColor Red
225
+ Write-Host "[ERROR] Git is not installed" -ForegroundColor Red
226
226
  return $false
227
227
  }
228
228
 
@@ -244,20 +244,20 @@ function Install-VigthoriaCLI-GitHub {
244
244
  npm link
245
245
  Pop-Location
246
246
 
247
- Write-Host " Vigthoria CLI installed successfully!" -ForegroundColor Green
247
+ Write-Host "[OK] Vigthoria CLI installed successfully!" -ForegroundColor Green
248
248
  return $true
249
249
  }
250
250
  catch {
251
- Write-Host " GitHub install failed: $_" -ForegroundColor Red
251
+ Write-Host "[ERROR] Git install failed: $_" -ForegroundColor Red
252
252
  return $false
253
253
  }
254
254
  }
255
255
 
256
256
  function Show-NetworkTroubleshooting {
257
257
  Write-Host ""
258
- Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Yellow
258
+ Write-Host "===============================================================" -ForegroundColor Yellow
259
259
  Write-Host " NETWORK TROUBLESHOOTING" -ForegroundColor Yellow
260
- Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Yellow
260
+ Write-Host "===============================================================" -ForegroundColor Yellow
261
261
  Write-Host ""
262
262
  Write-Host "The hosted package and npm registry could not be reached. Try these solutions:" -ForegroundColor White
263
263
  Write-Host ""
@@ -284,9 +284,9 @@ function Show-NetworkTroubleshooting {
284
284
 
285
285
  function Show-Success {
286
286
  Write-Host ""
287
- Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Green
287
+ Write-Host "===============================================================" -ForegroundColor Green
288
288
  Write-Host " INSTALLATION COMPLETE!" -ForegroundColor Green
289
- Write-Host "═══════════════════════════════════════════════════════════════" -ForegroundColor Green
289
+ Write-Host "===============================================================" -ForegroundColor Green
290
290
  Write-Host ""
291
291
  Write-Host " Get started:" -ForegroundColor White
292
292
  Write-Host " 1. Open a new terminal" -ForegroundColor Gray
package/install.sh CHANGED
@@ -26,7 +26,7 @@ else
26
26
  fi
27
27
 
28
28
  # Configuration
29
- CLI_VERSION="1.13.10"
29
+ CLI_VERSION="1.13.12"
30
30
  INSTALL_DIR="$HOME/.vigthoria"
31
31
  REPO_URL="https://market.vigthoria.io/vigthoria/vigthoria-cli"
32
32
  GIT_PACKAGE_URL="git+https://market.vigthoria.io/vigthoria/vigthoria-cli.git"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vigthoria-cli",
3
- "version": "1.13.10",
3
+ "version": "1.13.12",
4
4
  "description": "Vigthoria Coder CLI - AI-powered terminal coding assistant",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",