mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-12 05:30:48 +08:00
Harden attachment access controls and stabilize the Weixin bridge.
This persists referenced media safely, adds explicit attachment ACL/backfill flows, and fixes the Weixin sidecar so official login state can bridge reliably into oclaw without duplicate replays or dropped replies. Made-with: Cursor
This commit is contained in:
parent
6cfaff06f6
commit
31e3962c74
22 changed files with 1885 additions and 55 deletions
|
|
@ -6,14 +6,42 @@ $ErrorActionPreference = "Stop"
|
|||
|
||||
function Resolve-RepoRoot {
|
||||
$here = Split-Path -Parent $PSCommandPath
|
||||
return (Resolve-Path (Join-Path $here "..")).Path
|
||||
# runtime/operations/scripts -> repo root
|
||||
return (Resolve-Path (Join-Path $here "..\\..\\..")).Path
|
||||
}
|
||||
|
||||
$oclawRoot = Resolve-RepoRoot
|
||||
$sidecarRoot = Join-Path $oclawRoot "data\\channel_sidecar\\$ChannelId"
|
||||
$pidFile = Join-Path $sidecarRoot "pid.txt"
|
||||
$systemNodeDir = "C:\\Program Files\\nodejs"
|
||||
if (Test-Path (Join-Path $systemNodeDir "node.exe")) {
|
||||
$env:PATH = "$systemNodeDir;$env:PATH"
|
||||
}
|
||||
|
||||
function Get-SidecarProcesses {
|
||||
$escapedSidecarRoot = $sidecarRoot.Replace("\", "\\")
|
||||
$patterns = @(
|
||||
"*$ChannelId*",
|
||||
"*runner.ts*",
|
||||
"*$escapedSidecarRoot*"
|
||||
)
|
||||
Get-CimInstance Win32_Process | Where-Object {
|
||||
$cmd = [string]($_.CommandLine)
|
||||
if (-not $cmd) { return $false }
|
||||
foreach ($pattern in $patterns) {
|
||||
if ($cmd -like $pattern) { return $true }
|
||||
}
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Path $pidFile)) {
|
||||
$sidecarProcs = @(Get-SidecarProcesses)
|
||||
if ($sidecarProcs.Count -gt 0) {
|
||||
$pids = ($sidecarProcs | Select-Object -ExpandProperty ProcessId) -join ","
|
||||
Write-Host "status=orphaned count=$($sidecarProcs.Count) pids=$pids"
|
||||
exit 0
|
||||
}
|
||||
Write-Host "status=stopped"
|
||||
exit 0
|
||||
}
|
||||
|
|
@ -31,8 +59,25 @@ try {
|
|||
} catch {}
|
||||
|
||||
if ($exists) {
|
||||
Write-Host "status=running pid=$procId"
|
||||
$sidecarProcs = @(Get-SidecarProcesses)
|
||||
Write-Host "status=running pid=$procId matches=$($sidecarProcs.Count)"
|
||||
} else {
|
||||
$sidecarProcs = @(Get-SidecarProcesses)
|
||||
if ($sidecarProcs.Count -gt 0) {
|
||||
$pids = ($sidecarProcs | Select-Object -ExpandProperty ProcessId) -join ","
|
||||
Write-Host "status=orphaned stale_pid=$procId count=$($sidecarProcs.Count) pids=$pids"
|
||||
exit 0
|
||||
}
|
||||
$openclawCmd = Get-Command openclaw -ErrorAction SilentlyContinue
|
||||
if ($openclawCmd) {
|
||||
try {
|
||||
$txt = (& openclaw channels status --probe) -join "`n"
|
||||
if ($txt -match "openclaw-weixin .*running") {
|
||||
Write-Host "status=running mode=official"
|
||||
exit 0
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
Write-Host "status=stale_pid pid=$procId"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue