Files
gyxx-flow/workbench/bin/start-workbench.ps1
T
wangyunlong 01218b2907 feat: add deepseek-harness workbench plugin and console diagnosis API
- console: GET /api/workflows/{id}, /runs/{run_id}, /runs/{run_id}/diagnosis
  (journal trace + sanitized bounded log tails, workflow/run pairing enforced)
- workbench/: dsh 宿主插件(7 个工作流工具、中文系统提示词、失败监控器、
  本机回环桥接服务)+ 侧边栏面板客户端包(sidebar.footer.action 与
  shell.overlay 追加插槽)+ 降级独立面板 + 一键启动脚本
- adapters/browser: 收敛 looks_like_login_url 到共享层,修复
  jd_main_image_collector 对 gyxx_flow.accounts 的越层导入
- tests: 新端点覆盖;replay_policy 断言对齐已迁移的 catalog(repeatable)
2026-09-04 11:10:16 +08:00

77 lines
3.4 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# GYXX 智能工作台一键启动(Windows PowerShell
# 用法:
# powershell -File workbench\bin\start-workbench.ps1
# powershell -File workbench\bin\start-workbench.ps1 -ConsoleEnvFile D:\product-collector-analyze-flow\.env
#
# 行为:
# 1. 渲染 workbench/cordis.local.yml(插件绝对路径)
# 2. 若 8765 控制台未运行,则以 --env-file 注入云端凭据启动 gyxx console
# 3. 启动 dsh Web UI 并应用工作台补丁(优先 $env:DSH_HOME 源码目录,其次 npx @deepseek-ai/dsh
[CmdletBinding()]
param(
[string]$ConsoleEnvFile = 'D:\product-collector-analyze-flow\.env',
[int]$ConsolePort = 8765,
[int]$BridgePort = 8790,
[switch]$SkipConsole
)
$ErrorActionPreference = 'Stop'
$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
$WorkbenchDir = Join-Path $RepoRoot 'workbench'
$PluginDir = Join-Path $WorkbenchDir 'plugin'
$LocalYml = Join-Path $WorkbenchDir 'cordis.local.yml'
# 1) 渲染 cordis.local.yml
$template = Get-Content (Join-Path $WorkbenchDir 'cordis.template.yml') -Raw -Encoding UTF8
$pluginDirPosix = ($PluginDir -replace '\\', '/')
$projectRootPosix = ($RepoRoot -replace '\\', '/')
$rendered = $template.Replace('__PLUGIN_DIR__', $pluginDirPosix).Replace('__PROJECT_ROOT__', $projectRootPosix)
$rendered = $rendered -replace 'bridgePort: 8790', "bridgePort: $BridgePort"
$rendered = $rendered -replace "consoleBaseUrl: 'http://127.0.0.1:8765'", "consoleBaseUrl: 'http://127.0.0.1:$ConsolePort'"
[System.IO.File]::WriteAllText($LocalYml, $rendered, (New-Object System.Text.UTF8Encoding($false)))
Write-Host "[workbench] 已生成 $LocalYml"
# 2) 确保 gyxx console 在运行
if (-not $SkipConsole) {
$consoleUp = $false
try {
$null = Invoke-WebRequest -UseBasicParsing -Uri "http://127.0.0.1:$ConsolePort/api/overview" -TimeoutSec 3
$consoleUp = $true
} catch { $consoleUp = $false }
if ($consoleUp) {
Write-Host "[workbench] gyxx console 已在 http://127.0.0.1:$ConsolePort 运行"
} else {
if (-not (Test-Path $ConsoleEnvFile)) {
Write-Warning "缺少 $ConsoleEnvFile —— 正式执行将无法注入云端凭据(AGENTS.md 约定)。"
}
$consoleArgs = @('run', 'gyxx', 'console', '--port', "$ConsolePort", '--env-file', $ConsoleEnvFile)
Write-Host "[workbench] 启动 gyxx console: uv $($consoleArgs -join ' ')"
Start-Process -FilePath 'uv' -ArgumentList $consoleArgs -WorkingDirectory $RepoRoot -WindowStyle Minimized
$deadline = (Get-Date).AddSeconds(30)
do {
Start-Sleep -Milliseconds 800
try {
$null = Invoke-WebRequest -UseBasicParsing -Uri "http://127.0.0.1:$ConsolePort/api/overview" -TimeoutSec 2
$consoleUp = $true
} catch { $consoleUp = $false }
} until ($consoleUp -or (Get-Date) -gt $deadline)
if (-not $consoleUp) { Write-Warning 'gyxx console 启动超时,工作台仍可启动但工具会提示控制台离线。' }
}
}
# 3) 启动 dsh Web UI
if ($env:DSH_HOME -and (Test-Path (Join-Path $env:DSH_HOME 'package.json'))) {
Write-Host "[workbench] 使用源码版 dsh: $($env:DSH_HOME)"
Push-Location $env:DSH_HOME
try {
& pnpm dsh web --patch $LocalYml
} finally {
Pop-Location
}
} else {
Write-Host '[workbench] 使用 npm 版 dshnpx @deepseek-ai/dsh'
& npx -y '@deepseek-ai/dsh' web --patch $LocalYml
}