mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 01:50:44 +08:00
feat(runtime): enforce native tool calls and web-only stack scripts
Apply a global native tool_calls-only prompt rule to prevent DSML/textual protocol outputs, and expand start_web/stop_web to manage gateway, sidecars, and wiki worker without launching desktop. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
4335040a27
commit
2c7b318561
4 changed files with 100 additions and 7 deletions
|
|
@ -2,9 +2,55 @@ param(
|
|||
[string]$BindHost = "127.0.0.1",
|
||||
[int]$Port = 8787,
|
||||
[switch]$SkipInstall = $false,
|
||||
[switch]$Background = $false
|
||||
[bool]$Background = $true,
|
||||
[switch]$WithoutWeixin = $false,
|
||||
[switch]$WithoutWhatsApp = $false,
|
||||
[bool]$WithWikiWorker = $true,
|
||||
[string]$WeixinChannelId = "oclaw-weixin",
|
||||
[string]$WeixinGatewayBaseUrl = "",
|
||||
[string]$WhatsAppChannelId = "whatsapp"
|
||||
)
|
||||
|
||||
# 网页端(/admin、/chat)由网关进程提供,这里只是一个语义化别名。
|
||||
& "$PSScriptRoot/start_gateway.ps1" -BindHost $BindHost -Port $Port -SkipInstall:$SkipInstall -Background:$Background
|
||||
function Write-Step([string]$msg) {
|
||||
Write-Host "==> $msg" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
function Warn([string]$msg) {
|
||||
Write-Host "[WARN] $msg" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Step "Starting web stack (gateway + sidecars; desktop excluded)"
|
||||
& "$PSScriptRoot/start_gateway.ps1" -BindHost $BindHost -Port $Port -SkipInstall:$SkipInstall -Background:$Background -WithWikiWorker:$WithWikiWorker
|
||||
|
||||
if (-not $Background) {
|
||||
Write-Host ""
|
||||
Write-Host "[INFO] Gateway is running in foreground; sidecars were not started in this mode." -ForegroundColor Yellow
|
||||
Write-Host " Run start_web.ps1 with -Background:`$true for one-command full web startup." -ForegroundColor Yellow
|
||||
exit 0
|
||||
}
|
||||
|
||||
if (-not $WithoutWeixin) {
|
||||
$gwBase = ($WeixinGatewayBaseUrl | ForEach-Object { "$_".Trim() })
|
||||
if (-not $gwBase) {
|
||||
$gwBase = "http://$BindHost`:$Port"
|
||||
}
|
||||
Write-Step "Starting weixin sidecar"
|
||||
try {
|
||||
& "$PSScriptRoot/weixin_start.ps1" -ChannelId $WeixinChannelId -GatewayBaseUrl $gwBase
|
||||
} catch {
|
||||
Warn "weixin sidecar skipped: $($_.Exception.Message)"
|
||||
}
|
||||
}
|
||||
if (-not $WithoutWhatsApp) {
|
||||
$waBase = "http://$BindHost`:$Port"
|
||||
Write-Step "Starting whatsapp sidecar"
|
||||
try {
|
||||
& "$PSScriptRoot/whatsapp_start.ps1" -ChannelId $WhatsAppChannelId -GatewayBaseUrl $waBase
|
||||
} catch {
|
||||
Warn "whatsapp sidecar skipped: $($_.Exception.Message)"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Web stack started." -ForegroundColor Green
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,52 @@
|
|||
param(
|
||||
[int]$Port = 8787,
|
||||
[switch]$Force = $false
|
||||
[switch]$Force = $false,
|
||||
[switch]$WithoutWeixin = $false,
|
||||
[switch]$WithoutWhatsApp = $false,
|
||||
[bool]$WithWikiWorker = $true,
|
||||
[string]$WeixinChannelId = "oclaw-weixin",
|
||||
[string]$WhatsAppChannelId = "whatsapp"
|
||||
)
|
||||
|
||||
# 网页端(/admin、/chat)由网关进程提供,这里只是一个语义化别名。
|
||||
& "$PSScriptRoot/stop_gateway.ps1" -Port $Port -Force:$Force
|
||||
function Write-Step([string]$msg) {
|
||||
Write-Host "==> $msg" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
Write-Step "Stopping web stack (gateway + sidecars; desktop excluded)"
|
||||
|
||||
if (-not $WithoutWeixin) {
|
||||
Write-Step "Stopping weixin sidecar"
|
||||
try {
|
||||
& "$PSScriptRoot/weixin_stop.ps1" -ChannelId $WeixinChannelId -Force:$Force
|
||||
} catch {
|
||||
if (-not $Force) { throw }
|
||||
}
|
||||
}
|
||||
if (-not $WithoutWhatsApp) {
|
||||
Write-Step "Stopping whatsapp sidecar"
|
||||
try {
|
||||
& "$PSScriptRoot/whatsapp_stop.ps1" -ChannelId $WhatsAppChannelId -Force:$Force
|
||||
} catch {
|
||||
if (-not $Force) { throw }
|
||||
}
|
||||
}
|
||||
|
||||
Write-Step "Stopping gateway/web"
|
||||
try {
|
||||
& "$PSScriptRoot/stop_gateway.ps1" -Port $Port -Force:$Force
|
||||
} catch {
|
||||
if (-not $Force) { throw }
|
||||
}
|
||||
|
||||
if ($WithWikiWorker) {
|
||||
Write-Step "Stopping wiki worker"
|
||||
try {
|
||||
& "$PSScriptRoot/stop_wiki_worker.ps1" -Force:$Force
|
||||
} catch {
|
||||
if (-not $Force) { throw }
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Web stack stopped." -ForegroundColor Green
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue