fix(kimi): скрытый запускатель и запасной путь установки

- Зачем: при повторном запуске через ярлык Kimi цеплялся к консоли pwsh и удерживал окно терминала открытым ради своих логов.
- Что: ярлык переведён на скрытый VBS-запускатель (как у Claude Proxy); добавлен запасной путь %ProgramFiles%\Kimi для установки на всех пользователей.
- Проверка: синтаксис скриптов проверен парсером PowerShell, tests/test_proxy_env_sync.py зелёный.
This commit is contained in:
Dmitriy Dementiev committed 2026-10-23 14:15:46 +03:00
1 parent 5b2eef4881
commit b36ce50e12
4 files changed
+55 -21

No files matched your search

@@ -5,6 +5,7 @@ if (-not ($IsWindows -or $PSVersionTable.PSEdition -eq 'Desktop')) {
}
$LauncherPath = Join-Path $HOME '.local\bin\start-kimi-proxy.ps1'
$LauncherHostPath = Join-Path $HOME '.local\bin\start-kimi-proxy.vbs'
$ProgramsPath = [Environment]::GetFolderPath('Programs')
if ([string]::IsNullOrWhiteSpace($ProgramsPath)) {
Write-Warning 'Start Menu Programs folder was not found.'
@@ -12,23 +13,18 @@ if ([string]::IsNullOrWhiteSpace($ProgramsPath)) {
}
$ShortcutPath = Join-Path $ProgramsPath 'Kimi Proxy.lnk'
$PwshAliasPath = Join-Path $env:LOCALAPPDATA 'Microsoft\WindowsApps\pwsh.exe'
$PwshCommand = Get-Command pwsh -ErrorAction SilentlyContinue
if (Test-Path -LiteralPath $PwshAliasPath) {
$TargetPath = $PwshAliasPath
} elseif ($null -ne $PwshCommand) {
$TargetPath = $PwshCommand.Source
} else {
$TargetPath = 'pwsh.exe'
}
$Arguments = "-NoLogo -NoProfile -ExecutionPolicy Bypass -File `"$LauncherPath`""
$TargetPath = Join-Path $env:WINDIR 'System32\wscript.exe'
$Arguments = "//NoLogo `"$LauncherHostPath`""
$WorkingDirectory = $env:USERPROFILE
$IconLocation = "$TargetPath,0"
$KimiExecutable = Join-Path $env:LOCALAPPDATA 'Programs\Kimi\Kimi.exe'
if (Test-Path -LiteralPath $KimiExecutable) {
$KimiExecutable = @(
(Join-Path $env:LOCALAPPDATA 'Programs\Kimi\Kimi.exe'),
(Join-Path $env:ProgramFiles 'Kimi\Kimi.exe')
) | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1
if ($null -ne $KimiExecutable) {
$IconLocation = "$KimiExecutable,0"
} else {
$IconLocation = "$LauncherPath,0"
}
New-Item -ItemType Directory -Path (Split-Path -Parent $ShortcutPath) -Force | Out-Null
+10 -4
View File
@@ -6,12 +6,18 @@ $HttpProxy = "http://${ProxyHostName}:${ProxyPort}"
$ProxyBypassList = "${ProxyHostName};localhost;127.0.0.1;[::1];*.concept-software.ru;dementev.space;*.dementev.space"
function Get-KimiApplication {
$Executable = Join-Path $env:LOCALAPPDATA 'Programs\Kimi\Kimi.exe'
if (-not (Test-Path -LiteralPath $Executable)) {
throw "Kimi Desktop не найден: ожидался файл '$Executable'."
$Candidates = @(
(Join-Path $env:LOCALAPPDATA 'Programs\Kimi\Kimi.exe'),
(Join-Path $env:ProgramFiles 'Kimi\Kimi.exe')
)
foreach ($Executable in $Candidates) {
if (Test-Path -LiteralPath $Executable) {
return $Executable
}
}
return $Executable
throw "Kimi Desktop не найден: проверены пути '$($Candidates -join "', '")'."
}
function Assert-KimiNotRunning {
@@ -0,0 +1,28 @@
Option Explicit
Dim fileSystem
Dim launcherPath
Dim powerShellPath
Dim command
Dim exitCode
Dim shell
Set fileSystem = CreateObject("Scripting.FileSystemObject")
Set shell = CreateObject("WScript.Shell")
launcherPath = shell.ExpandEnvironmentStrings("%USERPROFILE%\.local\bin\start-kimi-proxy.ps1")
powerShellPath = shell.ExpandEnvironmentStrings("%LOCALAPPDATA%\Microsoft\WindowsApps\pwsh.exe")
If Not fileSystem.FileExists(powerShellPath) Then
powerShellPath = "pwsh.exe"
End If
command = """" & powerShellPath & _
""" -NoLogo -NoProfile -ExecutionPolicy Bypass -File """ & _
launcherPath & """"
exitCode = shell.Run(command, 0, True)
If exitCode <> 0 Then
MsgBox "Не удалось запустить Kimi Proxy. Код ошибки: " & exitCode, _
vbCritical, "Kimi Proxy"
End If