@mobius-os/mobius 0.3.27 → 0.3.31
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/install.ps1 +265 -0
- package/package.json +23 -7
- package/scripts/build-python-bundles.sh +129 -0
- package/src/App.tsx +2 -2
- package/src/components/Chat.tsx +93 -183
- package/src/components/ConfigFlow.tsx +2 -0
- package/src/components/primitives.tsx +113 -6
- package/src/lib/screen-text.ts +73 -27
- package/src/lib/windows-input.ts +186 -0
- package/src/main.tsx +5 -1
- package/tests/aimux.test.tsx +210 -0
- package/tests/flow.test.tsx +211 -0
- package/tests/integration.test.ts +114 -0
- package/tests/preview.tsx +104 -0
- package/tests/reconnect.test.tsx +170 -0
- package/tests/resume.test.tsx +73 -0
- package/tests/screen.test.tsx +117 -0
- package/tests/scroll.test.tsx +252 -0
- package/tests/selection.test.tsx +219 -0
- package/tests/ui.test.tsx +889 -0
- package/tsconfig.json +19 -0
- package/uninstall.ps1 +144 -0
package/tsconfig.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"lib": ["ES2022"],
|
|
14
|
+
"types": ["node"],
|
|
15
|
+
"baseUrl": ".",
|
|
16
|
+
"paths": {}
|
|
17
|
+
},
|
|
18
|
+
"include": ["src", "tests"]
|
|
19
|
+
}
|
package/uninstall.ps1
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#requires -Version 5.1
|
|
2
|
+
<#
|
|
3
|
+
.SYNOPSIS
|
|
4
|
+
Completely uninstall the current-user Mobius TUI installation on Windows.
|
|
5
|
+
.DESCRIPTION
|
|
6
|
+
Removes the portable Node runtime, npm package, launchers, AIMUX/Python bundle,
|
|
7
|
+
saved login and preferences under ~/.mobius, user PATH entries, and both
|
|
8
|
+
Explorer "Open in Mobius" context-menu registrations. No administrator rights
|
|
9
|
+
are required. Unrelated system Node.js/Python/AIMUX installations are untouched.
|
|
10
|
+
.EXAMPLE
|
|
11
|
+
irm https://serve.nutshellai.cn/publish/auto/mobiustui/uninstall-v11.ps1 | iex
|
|
12
|
+
#>
|
|
13
|
+
$ErrorActionPreference = 'Stop'
|
|
14
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
15
|
+
|
|
16
|
+
function Step($m) { Write-Host "[*] $m" -ForegroundColor Cyan }
|
|
17
|
+
function Ok($m) { Write-Host "[OK] $m" -ForegroundColor Green }
|
|
18
|
+
function Warn($m) { Write-Host "[!] $m" -ForegroundColor Yellow }
|
|
19
|
+
function Err($m) { Write-Host "[X] $m" -ForegroundColor Red }
|
|
20
|
+
|
|
21
|
+
function Normalize-PathEntry($value) {
|
|
22
|
+
if ([string]::IsNullOrWhiteSpace($value)) { return '' }
|
|
23
|
+
return $value.Trim().Trim('"').TrimEnd('\')
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function Invoke-MobiusUninstall {
|
|
27
|
+
$mobiusHome = Join-Path $env:USERPROFILE '.mobius'
|
|
28
|
+
$mobiusBin = Join-Path $mobiusHome 'bin'
|
|
29
|
+
$npmGlobal = Join-Path $mobiusHome 'npm-global'
|
|
30
|
+
$npmGlobalBin = Join-Path $npmGlobal 'bin'
|
|
31
|
+
|
|
32
|
+
Write-Host '=== Mobius TUI Windows 全面卸载(当前用户)===' -ForegroundColor White
|
|
33
|
+
Write-Host ''
|
|
34
|
+
Warn "将永久删除: $mobiusHome"
|
|
35
|
+
Warn '包括登录信息、项目缓存、目录绑定、Issue 偏好、便携 Node、TUI 和 AIMUX/Python bundle。'
|
|
36
|
+
Warn '还会删除用户 PATH 中的 Mobius 项和两个“在 Mobius 中打开”右键菜单。'
|
|
37
|
+
Write-Host ''
|
|
38
|
+
|
|
39
|
+
if ($env:MOBIUS_UNINSTALL_FORCE -ne '1') {
|
|
40
|
+
$confirmation = Read-Host '确认全面卸载请输入 UNINSTALL'
|
|
41
|
+
if ($confirmation -cne 'UNINSTALL') {
|
|
42
|
+
Warn '已取消,没有删除任何内容。'
|
|
43
|
+
return
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Step '停止正在使用便携 Node 的 Mobius 进程...'
|
|
48
|
+
$portableProcesses = @(Get-Process node -ErrorAction SilentlyContinue | Where-Object {
|
|
49
|
+
try {
|
|
50
|
+
$_.Path -and $_.Path.StartsWith($mobiusHome, [System.StringComparison]::OrdinalIgnoreCase)
|
|
51
|
+
} catch {
|
|
52
|
+
$false
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
foreach ($process in $portableProcesses) {
|
|
56
|
+
try {
|
|
57
|
+
Stop-Process -Id $process.Id -Force -ErrorAction Stop
|
|
58
|
+
Ok "已停止进程: node.exe (PID $($process.Id))"
|
|
59
|
+
} catch {
|
|
60
|
+
Warn "无法停止 PID $($process.Id): $($_.Exception.Message)"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if ($portableProcesses.Count -eq 0) { Ok '没有正在运行的 Mobius Node 进程。' }
|
|
64
|
+
Start-Sleep -Milliseconds 500
|
|
65
|
+
|
|
66
|
+
Step '删除 Explorer 右键菜单...'
|
|
67
|
+
$contextMenuKeys = @(
|
|
68
|
+
'HKCU:\Software\Classes\Directory\shell\Mobius',
|
|
69
|
+
'HKCU:\Software\Classes\Directory\Background\shell\Mobius'
|
|
70
|
+
)
|
|
71
|
+
foreach ($key in $contextMenuKeys) {
|
|
72
|
+
if (Test-Path $key) { Remove-Item $key -Recurse -Force }
|
|
73
|
+
}
|
|
74
|
+
Ok '文件夹本身和文件夹空白处的右键菜单已删除。'
|
|
75
|
+
|
|
76
|
+
Step '从当前用户 PATH 删除 Mobius 目录...'
|
|
77
|
+
$removeEntries = @($mobiusBin, $npmGlobal, $npmGlobalBin) |
|
|
78
|
+
ForEach-Object { Normalize-PathEntry $_ }
|
|
79
|
+
$userPath = (Get-ItemProperty -Path 'HKCU:\Environment' -Name Path -ErrorAction SilentlyContinue).Path
|
|
80
|
+
if ($null -ne $userPath) {
|
|
81
|
+
$filteredUserPath = @($userPath -split ';' | Where-Object {
|
|
82
|
+
$normalized = Normalize-PathEntry $_
|
|
83
|
+
$normalized -and -not ($removeEntries -contains $normalized)
|
|
84
|
+
})
|
|
85
|
+
Set-ItemProperty -Path 'HKCU:\Environment' -Name Path -Value ($filteredUserPath -join ';')
|
|
86
|
+
}
|
|
87
|
+
$filteredCurrentPath = @($env:Path -split ';' | Where-Object {
|
|
88
|
+
$normalized = Normalize-PathEntry $_
|
|
89
|
+
$normalized -and -not ($removeEntries -contains $normalized)
|
|
90
|
+
})
|
|
91
|
+
$env:Path = $filteredCurrentPath -join ';'
|
|
92
|
+
Ok '用户 PATH 已清理。'
|
|
93
|
+
|
|
94
|
+
Step '清除 Mobius TUI 用户级环境变量...'
|
|
95
|
+
foreach ($name in @('MOBIUS_TUI_HOME', 'MOBIUS_TUI_PYTHON', 'MOBIUS_TUI_PYTHON_BUNDLE_URL')) {
|
|
96
|
+
Remove-ItemProperty -Path 'HKCU:\Environment' -Name $name -ErrorAction SilentlyContinue
|
|
97
|
+
Remove-Item "Env:$name" -ErrorAction SilentlyContinue
|
|
98
|
+
}
|
|
99
|
+
Ok 'Mobius TUI 用户级环境变量已清理。'
|
|
100
|
+
|
|
101
|
+
Step '删除 Mobius TUI 的全部用户数据和运行时...'
|
|
102
|
+
if (Test-Path $mobiusHome) {
|
|
103
|
+
$removed = $false
|
|
104
|
+
for ($attempt = 1; $attempt -le 4 -and -not $removed; $attempt++) {
|
|
105
|
+
Remove-Item $mobiusHome -Recurse -Force -ErrorAction SilentlyContinue
|
|
106
|
+
$removed = -not (Test-Path $mobiusHome)
|
|
107
|
+
if (-not $removed) { Start-Sleep -Milliseconds (500 * $attempt) }
|
|
108
|
+
}
|
|
109
|
+
if (-not $removed) {
|
|
110
|
+
throw "无法完全删除 $mobiusHome;仍有进程或安全软件占用其中的文件。"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
Ok "已删除: $mobiusHome"
|
|
114
|
+
|
|
115
|
+
Step '删除临时安装器和旧错误日志...'
|
|
116
|
+
Get-ChildItem $env:TEMP -Filter 'mobius-install-v*.ps1' -ErrorAction SilentlyContinue |
|
|
117
|
+
Remove-Item -Force -ErrorAction SilentlyContinue
|
|
118
|
+
Remove-Item (Join-Path $env:TEMP 'mobius-install-v10-error.log') -Force -ErrorAction SilentlyContinue
|
|
119
|
+
Remove-Item (Join-Path $env:TEMP 'mobius-install-v11-error.log') -Force -ErrorAction SilentlyContinue
|
|
120
|
+
Remove-Item (Join-Path $env:TEMP 'mobius-install-v12-error.log') -Force -ErrorAction SilentlyContinue
|
|
121
|
+
Remove-Item (Join-Path $env:TEMP 'mobius-install-v13-error.log') -Force -ErrorAction SilentlyContinue
|
|
122
|
+
Remove-Item (Join-Path $env:TEMP 'mobius-install-v14-error.log') -Force -ErrorAction SilentlyContinue
|
|
123
|
+
Remove-Item (Join-Path $env:TEMP 'mobius-install-v15-error.log') -Force -ErrorAction SilentlyContinue
|
|
124
|
+
Remove-Item (Join-Path $env:TEMP 'mobius-uninstall-v11-error.log') -Force -ErrorAction SilentlyContinue
|
|
125
|
+
Ok '临时安装文件已清理。'
|
|
126
|
+
|
|
127
|
+
Write-Host ''
|
|
128
|
+
Write-Host '=== Mobius TUI 已全面卸载 ===' -ForegroundColor Green
|
|
129
|
+
Write-Host '请关闭并重新打开 PowerShell/Explorer,使 PATH 和右键菜单刷新。' -ForegroundColor Gray
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
Invoke-MobiusUninstall
|
|
134
|
+
} catch {
|
|
135
|
+
$errorLog = Join-Path $env:TEMP 'mobius-uninstall-v11-error.log'
|
|
136
|
+
$errorText = $_ | Format-List * -Force | Out-String
|
|
137
|
+
$errorText | Set-Content -Path $errorLog -Encoding UTF8
|
|
138
|
+
Write-Host ''
|
|
139
|
+
Err "Mobius 卸载失败: $($_.Exception.Message)"
|
|
140
|
+
Write-Host "完整错误日志: $errorLog" -ForegroundColor Yellow
|
|
141
|
+
Write-Host $errorText -ForegroundColor DarkYellow
|
|
142
|
+
try { Read-Host '按 Enter 返回 PowerShell(窗口不会自动关闭)' | Out-Null } catch { }
|
|
143
|
+
return
|
|
144
|
+
}
|