wip: 2026-08-11 工作树快照(docs/memory/h5.py/scripts 等 447 项未评审改动,安全提交到 feat 分支)
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 113 KiB |
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"cookies": [],
|
||||
"origins": [
|
||||
{
|
||||
"origin": "https://itsupport.servyou.com.cn",
|
||||
"localStorage": [
|
||||
{
|
||||
"name": "agent_token",
|
||||
"value": "yhxJcy-CUAkjtC8RK-NQkhj785NUHpIVzp_4ecuBrII"
|
||||
},
|
||||
{
|
||||
"name": "it_desk_theme",
|
||||
"value": "light"
|
||||
}
|
||||
],
|
||||
"sessionStorage": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 409 KiB |
|
After Width: | Height: | Size: 722 KiB |
@@ -0,0 +1,138 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
OA Pattern B 端到端 - Windows Terminal 兼容版
|
||||
|
||||
.DESCRIPTION
|
||||
v0.27.0 auth login OA 失败 (form 识别失败) → 走 fallback 路径
|
||||
流程:
|
||||
1. 验证 vault 'oa' 存在
|
||||
2. 重启 daemon (--args --no-sandbox)
|
||||
3. Read-Host 收 username + password (Windows Terminal 调用)
|
||||
4. fill + click submit
|
||||
5. 等待跳转到非 /login 页
|
||||
6. state save
|
||||
7. 清理敏感变量
|
||||
|
||||
.NOTES
|
||||
Author: Duckula
|
||||
Date : 2026-07-29 (v3)
|
||||
Run in: Windows Terminal (NOT in agent-browser PowerShell tool)
|
||||
#>
|
||||
|
||||
$ErrorActionPreference = 'Continue'
|
||||
|
||||
Write-Host "============================================" -ForegroundColor Cyan
|
||||
Write-Host " OA Pattern B 端到端 - fallback manual" -ForegroundColor Cyan
|
||||
Write-Host "============================================" -ForegroundColor Cyan
|
||||
|
||||
# 1. Vault 验证
|
||||
Write-Host ""
|
||||
Write-Host "Step 1: vault list" -ForegroundColor Yellow
|
||||
agent-browser auth list 2>&1 | Out-Null
|
||||
|
||||
# 2. 清理 daemon + 启动
|
||||
Write-Host ""
|
||||
Write-Host "Step 2: restart daemon (--args --no-sandbox)" -ForegroundColor Yellow
|
||||
agent-browser close --all 2>&1 | Out-Null
|
||||
for ($i = 1; $i -le 5; $i++) {
|
||||
$procs = Get-Process | Where-Object { $_.Name -match '^(chrome|agent-browser-win32-x64)$' }
|
||||
if ($procs.Count -eq 0) { break }
|
||||
foreach ($p in $procs) { try { & taskkill /F /PID $p.Id /T 2>&1 | Out-Null } catch {} }
|
||||
Start-Sleep 2
|
||||
}
|
||||
|
||||
$sw = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
agent-browser --args --no-sandbox open "https://oa.servyou-it.com/" 2>&1 | Out-Null
|
||||
$sw.Stop()
|
||||
Write-Host " [open] $($sw.ElapsedMilliseconds) ms" -ForegroundColor Gray
|
||||
Start-Sleep 5
|
||||
|
||||
# 3. Read-Host 收凭据
|
||||
Write-Host ""
|
||||
Write-Host "Step 3: receiver credentials (in your Windows Terminal)" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
$username = Read-Host " OA Username (工号)"
|
||||
Write-Host ""
|
||||
|
||||
$securePwd = Read-Host " OA Password" -AsSecureString
|
||||
if ($null -eq $securePwd) {
|
||||
Write-Host " ❌ Password empty" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($securePwd)
|
||||
$password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
|
||||
[System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR)
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($username) -or [string]::IsNullOrWhiteSpace($password)) {
|
||||
Write-Host " ❌ Empty credentials" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host " ✅ Got credentials" -ForegroundColor Green
|
||||
Write-Host " Username: $username" -ForegroundColor Gray
|
||||
Write-Host " Password: *** (length=$(($password.Length)))" -ForegroundColor Gray
|
||||
|
||||
# 4. Fill + Submit
|
||||
Write-Host ""
|
||||
Write-Host "Step 4: fill + submit" -ForegroundColor Yellow
|
||||
agent-browser --args --no-sandbox fill "input#loginid" $username 2>&1 | Out-Null
|
||||
agent-browser --args --no-sandbox fill "input#userpassword" $password 2>&1 | Out-Null
|
||||
agent-browser --args --no-sandbox click "button#submit" 2>&1 | Out-Null
|
||||
Write-Host " ✅ submitted" -ForegroundColor Green
|
||||
|
||||
# 5. 等待跳转
|
||||
Write-Host ""
|
||||
Write-Host "Step 5: wait 30s (URL not on /login)" -ForegroundColor Yellow
|
||||
$ok = $false
|
||||
for ($i = 1; $i -le 10; $i++) {
|
||||
Start-Sleep 3
|
||||
$url = (agent-browser --args --no-sandbox get url 2>&1 | Out-String).Trim()
|
||||
$iTag = "{0:D2}" -f $i
|
||||
Write-Host " [$iTag] URL: $url" -ForegroundColor Gray
|
||||
if ($url -notlike "*/login*" -and $url -notlike "*logintype=1*" -and $url -notlike "*Loginx.aspx*") {
|
||||
$ok = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $ok) {
|
||||
Write-Host " ⚠️ URL still on login page" -ForegroundColor Yellow
|
||||
Write-Host " (credentials might be wrong, or extra verification needed)" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# 6. state save
|
||||
Write-Host ""
|
||||
Write-Host "Step 6: state save" -ForegroundColor Yellow
|
||||
$stateFile = "D:\资料\03-项目开发\wecom_it_smart_desk\.workbuddy\outputs\oa-auth-state.json"
|
||||
agent-browser --args --no-sandbox state save $stateFile 2>&1 | Out-Null
|
||||
if (Test-Path $stateFile) {
|
||||
$len = (Get-Item $stateFile).Length
|
||||
Write-Host " ✅ saved $stateFile ($len bytes)" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " ⚠️ state save failed" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# 7. Screenshot
|
||||
Write-Host ""
|
||||
Write-Host "Step 7: screenshot" -ForegroundColor Yellow
|
||||
$screenshotPath = "D:\资料\03-项目开发\wecom_it_smart_desk\.workbuddy\outputs\oa-after-login.png"
|
||||
agent-browser --args --no-sandbox screenshot $screenshotPath 2>&1 | Out-Null
|
||||
if (Test-Path $screenshotPath) {
|
||||
Write-Host " ✅ $screenshotPath" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# 8. 清理敏感变量
|
||||
$username = $null
|
||||
$password = $null
|
||||
[System.GC]::Collect()
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "============================================" -ForegroundColor Green
|
||||
Write-Host " ✅ Pattern B fallback 完成" -ForegroundColor Green
|
||||
Write-Host "============================================" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "后续验证:" -ForegroundColor Cyan
|
||||
Write-Host " state file: $stateFile" -ForegroundColor Gray
|
||||
Write-Host " screenshot: $screenshotPath" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
@@ -0,0 +1,107 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
OA vault save - 一次性脚本 (v2: Read-Host 兼容版)
|
||||
|
||||
.DESCRIPTION
|
||||
端到端 Pattern B vault 链路实测脚本 (v2):
|
||||
1. 防御性清理 agent-browser daemon
|
||||
2. 启动 daemon (带 --args --no-sandbox)
|
||||
3. Read-Host 接收 username (明文回显)
|
||||
4. Read-Host -AsSecureString 接收 password (不回显)
|
||||
5. 保存到 vault 名 "oa"
|
||||
6. 验证 vault (auth list)
|
||||
7. 清理敏感变量
|
||||
|
||||
.NOTES
|
||||
Author: Duckula
|
||||
Date : 2026-07-29 (v2)
|
||||
Why : Get-Credential 在 hosted PowerShell 上下文渲染失败
|
||||
改用 Read-Host + AsSecureString 兼容任何交互式 shell
|
||||
- Read-Host 明文 (回显) for username
|
||||
- Read-Host -AsSecureString (SecureString, 不回显) for password
|
||||
#>
|
||||
|
||||
# 1. 清理 daemon
|
||||
Write-Host "============================================" -ForegroundColor Cyan
|
||||
Write-Host " OA vault save - Pattern B 端到端测试" -ForegroundColor Cyan
|
||||
Write-Host "============================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Step 1: 清理 agent-browser daemon (5s)" -ForegroundColor Yellow
|
||||
|
||||
agent-browser close --all 2>&1 | Out-Null
|
||||
for ($i = 1; $i -le 5; $i++) {
|
||||
$procs = Get-Process | Where-Object { $_.Name -match '^(chrome|agent-browser-win32-x64)$' }
|
||||
if ($procs.Count -eq 0) { break }
|
||||
foreach ($p in $procs) {
|
||||
try { & taskkill /F /PID $p.Id /T 2>&1 | Out-Null } catch {}
|
||||
}
|
||||
Start-Sleep 2
|
||||
}
|
||||
|
||||
# 2. 启动 daemon
|
||||
Write-Host ""
|
||||
Write-Host "Step 2: 启动 daemon (--args --no-sandbox)" -ForegroundColor Yellow
|
||||
$sw = [System.Diagnostics.Stopwatch]::StartNew()
|
||||
agent-browser --args --no-sandbox open "https://oa.servyou-it.com/" 2>&1 | Out-Null
|
||||
$sw.Stop()
|
||||
Write-Host " [open] $($sw.ElapsedMilliseconds) ms" -ForegroundColor Gray
|
||||
Start-Sleep 5
|
||||
|
||||
# 3. Read-Host 接收凭据
|
||||
Write-Host ""
|
||||
Write-Host "Step 3: 输入 OA 账号" -ForegroundColor Yellow
|
||||
Write-Host " (Username 回显, Password 不回显)" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
$username = Read-Host " OA Username (工号)"
|
||||
if ([string]::IsNullOrWhiteSpace($username)) {
|
||||
Write-Host " ❌ Username empty" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
$securePwd = Read-Host " OA Password" -AsSecureString
|
||||
if ($null -eq $securePwd) {
|
||||
Write-Host " ❌ Password empty" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($securePwd)
|
||||
$password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
|
||||
[System.Runtime.InteropServices.Marshal]::ZeroFreeBSTR($BSTR)
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($password)) {
|
||||
Write-Host " ❌ Password empty" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host " ✅ Credentials received" -ForegroundColor Green
|
||||
Write-Host " Username: $username" -ForegroundColor Gray
|
||||
Write-Host " Password: *** (length=$(($password.Length)))" -ForegroundColor Gray
|
||||
|
||||
# 4. 保存到 vault
|
||||
Write-Host ""
|
||||
Write-Host "Step 4: auth save oa" -ForegroundColor Yellow
|
||||
$password | agent-browser auth save oa `
|
||||
--url "https://oa.servyou-it.com/" `
|
||||
--username $username `
|
||||
--password-stdin 2>&1 | Out-Null
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host " ❌ auth save failed (exit=$LASTEXITCODE)" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 5. 验证
|
||||
Write-Host ""
|
||||
Write-Host "Step 5: verify vault" -ForegroundColor Yellow
|
||||
agent-browser auth list 2>&1 | Out-Null
|
||||
|
||||
# 6. 清理敏感变量
|
||||
$username = $null
|
||||
$password = $null
|
||||
[System.GC]::Collect()
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "============================================" -ForegroundColor Green
|
||||
Write-Host " ✅ Vault 'oa' saved" -ForegroundColor Green
|
||||
Write-Host "============================================" -ForegroundColor Green
|
||||