Files
Assistant/tests/creator_web/verify-remote.ps1
T
m 0d76c81f00
CI / test (push) Successful in 5m33s
feat: deploy Domovoy Creator web console
2026-08-16 15:41:39 +03:00

34 lines
2.2 KiB
PowerShell

param(
[string]$DockerContext = "docker-prod",
[string]$BaseURL = "http://docker.cin.su:18080"
)
$ErrorActionPreference = "Stop"
$coreContainer = "assistant-core-runtime-1"
$health = Invoke-RestMethod -Uri "$BaseURL/healthz" -Method Get
if ($health.status -ne "ok" -or $health.runtime -ne "creator-web") { throw "Creator web health response is invalid" }
$page = Invoke-WebRequest -Uri "$BaseURL/" -Method Get
if ($page.StatusCode -ne 200 -or $page.Content -notmatch "Домовой") { throw "Creator console is not available" }
if (-not $page.Headers["Content-Security-Policy"]) { throw "Creator console security headers are missing" }
$denied = Invoke-WebRequest -Uri "$BaseURL/api/focus-task-commits" -Method Post -SkipHttpErrorCheck
if ($denied.StatusCode -ne 404) { throw "Internal mutation route was exposed" }
$invalid = Invoke-WebRequest -Uri "$BaseURL/api/session/current" -Headers @{Authorization="Bearer invalid"} -SkipHttpErrorCheck
if ($invalid.StatusCode -ne 401) { throw "Invalid Creator session was not denied" }
$environment = docker --context $DockerContext inspect --format '{{range .Config.Env}}{{println .}}{{end}}' $coreContainer
$bootstrapEntry = $environment | Where-Object { $_ -like "CREATOR_BOOTSTRAP_TOKEN=*" } | Select-Object -First 1
if (-not $bootstrapEntry) { throw "Creator bootstrap token is not configured" }
$bootstrapToken = $bootstrapEntry.Substring("CREATOR_BOOTSTRAP_TOKEN=".Length)
$issued = Invoke-RestMethod -Uri "$BaseURL/api/session" -Method Post -Headers @{Authorization="Bearer $bootstrapToken"}
if (-not $issued.Token) { throw "Creator session was not issued through the gateway" }
$current = Invoke-RestMethod -Uri "$BaseURL/api/session/current" -Method Get -Headers @{Authorization="Bearer $($issued.Token)"}
if ($current.ActorID -ne "domovoy-creator-actor") { throw "Creator identity was not preserved through the gateway" }
$capability = Invoke-RestMethod -Uri "$BaseURL/api/capabilities/cognitive-proposal/health" -Method Get -Headers @{Authorization="Bearer $($issued.Token)"}
if ($capability.CapabilityID -ne "cognitive-proposal") { throw "Capability health was not returned through the gateway" }
Write-Output "DEV-000025 remote Creator web console: PASS"