Merge CROSSASSISTANT AI Workspace stabilization
This commit is contained in:
commit
390907cc9c
|
|
@ -32,6 +32,8 @@ Git repo:
|
||||||
- `infra/README.md`
|
- `infra/README.md`
|
||||||
- `packages/auth-sdk/README.md`
|
- `packages/auth-sdk/README.md`
|
||||||
- `services/notification-core/README.md`
|
- `services/notification-core/README.md`
|
||||||
|
- `services/ai-workspace-assistant/README.md`
|
||||||
|
- `services/ai-workspace-hub/README.md`
|
||||||
- `tasks/CODEX_PLATFORM_AUTH_TASK.md`
|
- `tasks/CODEX_PLATFORM_AUTH_TASK.md`
|
||||||
|
|
||||||
## Базовое правило
|
## Базовое правило
|
||||||
|
|
@ -39,3 +41,5 @@ Git repo:
|
||||||
Plane не переносится внутрь Launcher. Launcher не становится владельцем таблиц Plane. Authentik становится единым Identity Provider, а приложения сохраняют собственные доменные БД и роли.
|
Plane не переносится внутрь Launcher. Launcher не становится владельцем таблиц Plane. Authentik становится единым Identity Provider, а приложения сохраняют собственные доменные БД и роли.
|
||||||
|
|
||||||
Notification Core живёт в `services/notification-core` как отдельный платформенный сервис с собственным Postgres. Он не использует Authentik DB: Authentik отвечает за identity/session, Notification Core отвечает за events/deliveries/read-state.
|
Notification Core живёт в `services/notification-core` как отдельный платформенный сервис с собственным Postgres. Он не использует Authentik DB: Authentik отвечает за identity/session, Notification Core отвечает за events/deliveries/read-state.
|
||||||
|
|
||||||
|
AI Workspace Assistant живёт в `services/ai-workspace-assistant` как общий платформенный слой для пользовательских Codex executors, selected executor, shared conversations, surfaces и tool packs. AI Workspace Hub остаётся отдельным тонким транспортом для remote Codex workers и не хранит смысловое состояние ассистента.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
# AI Workspace Config Contract
|
||||||
|
|
||||||
|
This contract keeps topology differences in env/config instead of product-code branches.
|
||||||
|
|
||||||
|
## URL Classes
|
||||||
|
|
||||||
|
- Worker-facing URL: returned to or used by the Codex worker. It must be reachable from the machine that executes Codex.
|
||||||
|
- Backend-internal URL: used by app backends, Platform Assistant, Hub, Gateway, and service-to-service calls.
|
||||||
|
- Browser URL: used by user-facing UI.
|
||||||
|
- Downstream app URL: used by an adapter service to mutate/read its owned app backend.
|
||||||
|
|
||||||
|
Do not mix these classes. A URL reachable from the Mac browser is not automatically reachable from a remote Codex worker.
|
||||||
|
|
||||||
|
## Current Profiles
|
||||||
|
|
||||||
|
`local/hybrid-prod-bridge`:
|
||||||
|
|
||||||
|
- Tasker UI: `http://task.local.nodedc`
|
||||||
|
- Platform Assistant: `http://127.0.0.1:18082`
|
||||||
|
- Local Hub process: `http://127.0.0.1:18081`
|
||||||
|
- Default worker-facing Hub: `wss://ai-hub.nodedc.ru/api/ai-workspace/hub`
|
||||||
|
- Ops entitlement adapter: `http://host.docker.internal:4100/api/internal/v1/ai-workspace/entitlements` when deliberately enabled
|
||||||
|
- Ops Gateway downstream Tasker: `http://task.local.nodedc`
|
||||||
|
- This profile is valid for contract smoke and local Ops vertical smoke, not proof of live local Codex worker e2e.
|
||||||
|
|
||||||
|
`synology/prod-public`:
|
||||||
|
|
||||||
|
- Browser Launcher: `https://hub.nodedc.ru`
|
||||||
|
- Browser Ops: `https://ops.nodedc.ru`
|
||||||
|
- Worker-facing Hub: `wss://ai-hub.nodedc.ru/api/ai-workspace/hub`
|
||||||
|
- Platform Assistant internal: `http://ai-workspace-assistant:18082`
|
||||||
|
- Platform to Ops entitlement: `http://172.22.0.222:18190/api/internal/v1/ai-workspace/entitlements`
|
||||||
|
- Ops Gateway worker-facing MCP: `https://ops-agents.nodedc.ru/mcp`
|
||||||
|
- Ops Gateway downstream Tasker: `http://172.22.0.222:18090`
|
||||||
|
- This is the preferred controlled runtime e2e target.
|
||||||
|
|
||||||
|
`tailscale/tunnel-local-e2e`:
|
||||||
|
|
||||||
|
- Allowed only as an explicit profile.
|
||||||
|
- All worker-facing URLs must be reachable from the executing Codex worker through Tailscale or a named tunnel.
|
||||||
|
- No product code should auto-fallback from localhost to Tailscale to public domains.
|
||||||
|
|
||||||
|
## Required Rule
|
||||||
|
|
||||||
|
New apps must join AI Workspace through app manifests/config/adapters:
|
||||||
|
|
||||||
|
- app id and surface id;
|
||||||
|
- context schema;
|
||||||
|
- entitlement adapter URL/token;
|
||||||
|
- MCP/tool pack URL and worker-facing public URL;
|
||||||
|
- smoke test contract;
|
||||||
|
- owner repo/service.
|
||||||
|
|
||||||
|
Do not add app-specific address logic to the agent installer, Engine, Ops, or Platform Assistant runtime flow.
|
||||||
|
|
@ -44,6 +44,40 @@ Source fork:
|
||||||
/Users/dcconstructions/Downloads/mnt/data/dc_taskmanager/NODEDC_TASKMANAGER/plane-src
|
/Users/dcconstructions/Downloads/mnt/data/dc_taskmanager/NODEDC_TASKMANAGER/plane-src
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## AI Workspace Topology
|
||||||
|
|
||||||
|
Локальная доступность UI не равна честному AI Workspace e2e. Перед интерпретацией результата запускайте:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /Users/dcconstructions/Downloads/mnt/NODEDC/platform
|
||||||
|
infra/scripts/check-ai-workspace-topology.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Скрипт ничего не прокидывает и не меняет. Он только классифицирует текущий режим:
|
||||||
|
|
||||||
|
- `contract-only`: можно доверять только контрактным smoke-тестам без runtime e2e.
|
||||||
|
- `local-ops-vertical`: локальный Ops Gateway и локальный Tasker проверяются вертикально, без live Codex worker.
|
||||||
|
- `local-ui-only`: локальный UI доступен, но AI write path не доказан.
|
||||||
|
- `hybrid-prod-bridge`: часть контура локальная, а Hub/worker/MCP смотрят в публичный или другой контур. Такой результат нельзя считать local e2e.
|
||||||
|
- `true-local-e2e`: Engine, AI Workspace Assistant, Hub, Ops Gateway, Tasker и worker находятся в одной локальной топологии.
|
||||||
|
- `tunnel-local-e2e`: то же самое через явно выбранный tunnel/Tailscale-профиль.
|
||||||
|
|
||||||
|
Не надо пытаться неявно “дотянуть” Mac-local окружение до Synology. Если нужен Tailscale, это отдельный явный профиль: Hub public URL, Gateway public URL и Engine/Tasker downstream должны быть заданы так, чтобы именно выполняющий Codex worker мог их достичь. До этого UI-диалоги через удаленного агента считаются `hybrid-prod-bridge`, а не доказательством локальной записи.
|
||||||
|
|
||||||
|
Перед controlled Synology apply запускайте общий predeploy gate:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
infra/scripts/check-ai-workspace-release-gates.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Он не деплоит, не перезапускает контейнеры и не меняет `.env`. Скрипт только выполняет meaningful проверки до runtime e2e: topology classification, Platform contract smoke, Ops Gateway static/build/smoke, Engine static check и diff hygiene.
|
||||||
|
|
||||||
|
Адресная модель описана в `docs/AI_WORKSPACE_CONFIG_CONTRACT.md`. При изменении env examples, compose или AI Workspace URL запускайте:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
infra/scripts/check-ai-workspace-config-contract.sh
|
||||||
|
```
|
||||||
|
|
||||||
## Target local flow
|
## Target local flow
|
||||||
|
|
||||||
Первый local infra milestone:
|
Первый local infra milestone:
|
||||||
|
|
|
||||||
|
|
@ -52,3 +52,23 @@ NOTIFICATION_PG_DB=nodedc_notifications
|
||||||
NOTIFICATION_PG_USER=nodedc_notifications
|
NOTIFICATION_PG_USER=nodedc_notifications
|
||||||
NOTIFICATION_PG_PASS=change-me-generate-with-infra-scripts-init-dev-env
|
NOTIFICATION_PG_PASS=change-me-generate-with-infra-scripts-init-dev-env
|
||||||
NODEDC_NOTIFICATION_CORE_URL=http://notification-core:5185
|
NODEDC_NOTIFICATION_CORE_URL=http://notification-core:5185
|
||||||
|
|
||||||
|
# AI Workspace Assistant shared registry/conversations
|
||||||
|
AI_WORKSPACE_PG_DB=nodedc_ai_workspace
|
||||||
|
AI_WORKSPACE_PG_USER=nodedc_ai_workspace
|
||||||
|
AI_WORKSPACE_PG_PASS=change-me-generate-with-infra-scripts-init-dev-env
|
||||||
|
AI_WORKSPACE_ASSISTANT_TOKEN=change-me-generate-with-infra-scripts-init-dev-env
|
||||||
|
NODEDC_AI_WORKSPACE_ASSISTANT_URL=http://ai-workspace-assistant:18082
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_URL=http://host.docker.internal:4100/api/internal/v1/ai-workspace/entitlements
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_TOKEN=replace-with-ops-agent-gateway-internal-token
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_REQUIRED=false
|
||||||
|
|
||||||
|
# AI Workspace Hub for downloaded Codex workers.
|
||||||
|
# Default local development uses the deployed relay and is a hybrid-prod-bridge topology:
|
||||||
|
# local UI/services can be tested, but live Codex worker write-path e2e is not proven.
|
||||||
|
# For true local/tunnel e2e, change both Hub URLs and Ops Gateway public URL deliberately.
|
||||||
|
AI_WORKSPACE_HUB_TOKEN=change-me-generate-with-infra-scripts-init-dev-env
|
||||||
|
AI_WORKSPACE_HUB_HOST_BIND=127.0.0.1:18081
|
||||||
|
AI_WORKSPACE_HUB_PUBLIC_URL=wss://ai-hub.nodedc.ru/api/ai-workspace/hub
|
||||||
|
AI_WORKSPACE_HUB_INTERNAL_URL=https://ai-hub.nodedc.ru
|
||||||
|
AI_WORKSPACE_HUB_FALLBACK_URLS=
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ services:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
ai-workspace-hub:
|
ai-workspace-hub:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
|
ai-workspace-assistant:
|
||||||
|
condition: service_started
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
|
|
@ -128,6 +130,50 @@ services:
|
||||||
notification-postgres:
|
notification-postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
|
ai-workspace-postgres:
|
||||||
|
image: docker.io/library/postgres:16-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- path: .env
|
||||||
|
required: false
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${AI_WORKSPACE_PG_DB:-nodedc_ai_workspace}
|
||||||
|
POSTGRES_PASSWORD: ${AI_WORKSPACE_PG_PASS:-nodedc_ai_workspace}
|
||||||
|
POSTGRES_USER: ${AI_WORKSPACE_PG_USER:-nodedc_ai_workspace}
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 20s
|
||||||
|
volumes:
|
||||||
|
- ai-workspace-database:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
ai-workspace-assistant:
|
||||||
|
image: nodedc/ai-workspace-assistant:local
|
||||||
|
build:
|
||||||
|
context: ../services/ai-workspace-assistant
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- path: .env
|
||||||
|
required: false
|
||||||
|
environment:
|
||||||
|
NODE_ENV: production
|
||||||
|
PORT: 18082
|
||||||
|
DATABASE_URL: postgres://${AI_WORKSPACE_PG_USER:-nodedc_ai_workspace}:${AI_WORKSPACE_PG_PASS:-nodedc_ai_workspace}@ai-workspace-postgres:5432/${AI_WORKSPACE_PG_DB:-nodedc_ai_workspace}
|
||||||
|
AI_WORKSPACE_ASSISTANT_TOKEN: ${AI_WORKSPACE_ASSISTANT_TOKEN:-dev-ai-workspace-assistant-token}
|
||||||
|
AI_WORKSPACE_HUB_PUBLIC_URL: ${AI_WORKSPACE_HUB_PUBLIC_URL:-wss://ai-hub.nodedc.ru/api/ai-workspace/hub}
|
||||||
|
AI_WORKSPACE_HUB_INTERNAL_URL: ${AI_WORKSPACE_HUB_INTERNAL_URL:-https://ai-hub.nodedc.ru}
|
||||||
|
AI_WORKSPACE_HUB_TOKEN: ${AI_WORKSPACE_HUB_TOKEN:-}
|
||||||
|
AI_WORKSPACE_HUB_FALLBACK_URLS: ${AI_WORKSPACE_HUB_FALLBACK_URLS:-}
|
||||||
|
expose:
|
||||||
|
- "18082"
|
||||||
|
ports:
|
||||||
|
- "${AI_WORKSPACE_ASSISTANT_HOST_BIND:-127.0.0.1:18082}:18082"
|
||||||
|
depends_on:
|
||||||
|
ai-workspace-postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
ai-workspace-hub:
|
ai-workspace-hub:
|
||||||
image: nodedc/ai-workspace-hub:local
|
image: nodedc/ai-workspace-hub:local
|
||||||
build:
|
build:
|
||||||
|
|
@ -151,5 +197,6 @@ volumes:
|
||||||
authentik-data:
|
authentik-data:
|
||||||
authentik-certs:
|
authentik-certs:
|
||||||
notification-database:
|
notification-database:
|
||||||
|
ai-workspace-database:
|
||||||
caddy-data:
|
caddy-data:
|
||||||
caddy-config:
|
caddy-config:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,146 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
PLATFORM_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/../.." && pwd)
|
||||||
|
OPS_GATEWAY_REPO="${OPS_GATEWAY_REPO:-$PLATFORM_ROOT/../../data/NODEDC_TASKMANAGER_CODEXAPI}"
|
||||||
|
ENGINE_REPO="${ENGINE_REPO:-$PLATFORM_ROOT/../NODEDC_ENGINE_INFRA}"
|
||||||
|
PLATFORM_ENV="${PLATFORM_ENV:-$PLATFORM_ROOT/infra/.env}"
|
||||||
|
|
||||||
|
passed=0
|
||||||
|
failed=0
|
||||||
|
warnings=0
|
||||||
|
|
||||||
|
section() {
|
||||||
|
printf '\n== %s ==\n' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
pass() {
|
||||||
|
passed=$((passed + 1))
|
||||||
|
printf 'PASS %s\n' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
failed=$((failed + 1))
|
||||||
|
printf 'FAIL %s\n' "$1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
warn() {
|
||||||
|
warnings=$((warnings + 1))
|
||||||
|
printf 'WARN %s\n' "$1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
require_file() {
|
||||||
|
file="$1"
|
||||||
|
label="$2"
|
||||||
|
if [ -f "$file" ]; then
|
||||||
|
pass "$label"
|
||||||
|
else
|
||||||
|
fail "$label (missing file: $file)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
require_contains() {
|
||||||
|
file="$1"
|
||||||
|
needle="$2"
|
||||||
|
label="$3"
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
fail "$label (missing file: $file)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if grep -Fq "$needle" "$file"; then
|
||||||
|
pass "$label"
|
||||||
|
else
|
||||||
|
fail "$label (missing: $needle)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
read_env() {
|
||||||
|
file="$1"
|
||||||
|
key="$2"
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
awk -F= -v key="$key" '
|
||||||
|
$0 ~ "^[[:space:]]*#" { next }
|
||||||
|
$1 == key {
|
||||||
|
value = substr($0, index($0, "=") + 1)
|
||||||
|
gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
|
||||||
|
gsub(/^"|"$/, "", value)
|
||||||
|
print value
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
' "$file"
|
||||||
|
}
|
||||||
|
|
||||||
|
require_env_value() {
|
||||||
|
file="$1"
|
||||||
|
key="$2"
|
||||||
|
expected="$3"
|
||||||
|
label="$4"
|
||||||
|
actual=$(read_env "$file" "$key" || true)
|
||||||
|
if [ "$actual" = "$expected" ]; then
|
||||||
|
pass "$label"
|
||||||
|
else
|
||||||
|
fail "$label (expected $key=$expected, got ${actual:-<missing>})"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
section "Required files"
|
||||||
|
require_file "$PLATFORM_ROOT/infra/.env.example" "Platform local env example exists"
|
||||||
|
require_file "$PLATFORM_ROOT/infra/synology/.env.synology.example" "Platform Synology env example exists"
|
||||||
|
require_file "$PLATFORM_ROOT/infra/docker-compose.dev.yml" "Platform local compose exists"
|
||||||
|
require_file "$PLATFORM_ROOT/infra/synology/docker-compose.platform-http.yml" "Platform Synology compose exists"
|
||||||
|
require_file "$OPS_GATEWAY_REPO/.env.example" "Ops Gateway local env example exists"
|
||||||
|
require_file "$OPS_GATEWAY_REPO/.env.synology.example" "Ops Gateway Synology env example exists"
|
||||||
|
require_file "$OPS_GATEWAY_REPO/docker-compose.local.yml" "Ops Gateway local compose exists"
|
||||||
|
require_file "$OPS_GATEWAY_REPO/docker-compose.synology.yml" "Ops Gateway Synology compose exists"
|
||||||
|
require_file "$ENGINE_REPO/docker-compose.yml" "Engine compose exists"
|
||||||
|
|
||||||
|
section "Platform local contract"
|
||||||
|
require_env_value "$PLATFORM_ROOT/infra/.env.example" "AI_WORKSPACE_OPS_ENTITLEMENT_URL" "http://host.docker.internal:4100/api/internal/v1/ai-workspace/entitlements" "Local Platform example points Ops entitlement to local Gateway"
|
||||||
|
require_env_value "$PLATFORM_ROOT/infra/.env.example" "AI_WORKSPACE_HUB_PUBLIC_URL" "wss://ai-hub.nodedc.ru/api/ai-workspace/hub" "Local Platform example keeps deployed Hub as hybrid worker relay by default"
|
||||||
|
require_env_value "$PLATFORM_ROOT/infra/.env.example" "AI_WORKSPACE_HUB_INTERNAL_URL" "https://ai-hub.nodedc.ru" "Local Platform example has explicit Hub internal URL"
|
||||||
|
require_contains "$PLATFORM_ROOT/infra/scripts/init-dev-env.sh" "AI_WORKSPACE_OPS_ENTITLEMENT_URL=http://host.docker.internal:4100/api/internal/v1/ai-workspace/entitlements" "Local env generator emits local Ops entitlement URL"
|
||||||
|
require_contains "$PLATFORM_ROOT/infra/scripts/init-dev-env.sh" "AI_WORKSPACE_HUB_INTERNAL_URL=https://ai-hub.nodedc.ru" "Local env generator emits explicit Hub internal URL"
|
||||||
|
|
||||||
|
section "Platform Synology contract"
|
||||||
|
require_env_value "$PLATFORM_ROOT/infra/synology/.env.synology.example" "NODEDC_AI_WORKSPACE_ASSISTANT_URL" "http://ai-workspace-assistant:18082" "Synology Platform exposes Assistant to app services on compose network"
|
||||||
|
require_env_value "$PLATFORM_ROOT/infra/synology/.env.synology.example" "AI_WORKSPACE_OPS_ENTITLEMENT_URL" "http://172.22.0.222:18190/api/internal/v1/ai-workspace/entitlements" "Synology Platform points Ops entitlement to Synology Gateway"
|
||||||
|
require_env_value "$PLATFORM_ROOT/infra/synology/.env.synology.example" "AI_WORKSPACE_HUB_PUBLIC_URL" "wss://ai-hub.nodedc.ru/api/ai-workspace/hub" "Synology Platform worker-facing Hub URL is public relay"
|
||||||
|
require_env_value "$PLATFORM_ROOT/infra/synology/.env.synology.example" "AI_WORKSPACE_HUB_INTERNAL_URL" "https://ai-hub.nodedc.ru" "Synology Platform backend Hub URL is explicit"
|
||||||
|
require_contains "$PLATFORM_ROOT/infra/synology/verify-current-runtime.sh" 'AI_WORKSPACE_OPS_ENTITLEMENT_URL" = "http://172.22.0.222:18190/api/internal/v1/ai-workspace/entitlements"' "Synology verify checks Ops entitlement URL"
|
||||||
|
|
||||||
|
section "Ops Gateway contract"
|
||||||
|
require_env_value "$OPS_GATEWAY_REPO/.env.example" "NODEDC_AGENT_GATEWAY_PUBLIC_URL" "https://ops-agents.nodedc.ru" "Ops Gateway local example keeps worker-facing MCP URL explicit"
|
||||||
|
require_env_value "$OPS_GATEWAY_REPO/.env.example" "NODEDC_TASKER_INTERNAL_URL" "http://task.local.nodedc" "Ops Gateway local example points downstream to local Tasker"
|
||||||
|
require_env_value "$OPS_GATEWAY_REPO/.env.synology.example" "NODEDC_AGENT_GATEWAY_PUBLIC_URL" "https://ops-agents.nodedc.ru" "Ops Gateway Synology public MCP URL is public relay"
|
||||||
|
require_env_value "$OPS_GATEWAY_REPO/.env.synology.example" "NODEDC_TASKER_INTERNAL_URL" "http://172.22.0.222:18090" "Ops Gateway Synology downstream points to Synology Tasker"
|
||||||
|
require_contains "$OPS_GATEWAY_REPO/docker-compose.synology.yml" '${HOST_BIND:-172.22.0.222}:${HOST_PORT:-18190}:${PORT:-4100}' "Ops Gateway Synology compose binds expected internal port"
|
||||||
|
require_contains "$OPS_GATEWAY_REPO/README.md" "The response uses the AI Workspace adapter contract" "Ops Gateway README documents AI Workspace adapter contract"
|
||||||
|
|
||||||
|
section "Engine contract"
|
||||||
|
require_contains "$ENGINE_REPO/docker-compose.yml" 'NODEDC_AI_WORKSPACE_ASSISTANT_URL: ${NODEDC_AI_WORKSPACE_ASSISTANT_URL:-http://ai-workspace-assistant:18082}' "Engine compose accepts configurable Assistant URL"
|
||||||
|
require_contains "$ENGINE_REPO/docker-compose.yml" 'NDC_AI_WORKSPACE_HUB_URL: ${NDC_AI_WORKSPACE_HUB_URL:-wss://ai-hub.nodedc.ru/api/ai-workspace/hub}' "Engine compose accepts configurable worker-facing Hub URL"
|
||||||
|
require_contains "$ENGINE_REPO/docker-compose.yml" 'NDC_AI_WORKSPACE_HUB_HTTP_URL: ${NDC_AI_WORKSPACE_HUB_HTTP_URL:-https://ai-hub.nodedc.ru}' "Engine compose accepts configurable Hub HTTP URL"
|
||||||
|
require_contains "$ENGINE_REPO/nodedc-source/server/aiWorkspace/assistantRegistryClient.js" "'X-NODEDC-User-Role': role" "Engine forwards user role to Assistant"
|
||||||
|
require_contains "$ENGINE_REPO/nodedc-source/server/aiWorkspace/assistantRegistryClient.js" "'X-NODEDC-User-Groups': groups.join(',')" "Engine forwards user groups to Assistant"
|
||||||
|
|
||||||
|
section "Current local env warnings"
|
||||||
|
if [ -f "$PLATFORM_ENV" ]; then
|
||||||
|
local_ops_entitlement=$(read_env "$PLATFORM_ENV" AI_WORKSPACE_OPS_ENTITLEMENT_URL || true)
|
||||||
|
if [ -z "$local_ops_entitlement" ]; then
|
||||||
|
warn "Current Platform env has no AI_WORKSPACE_OPS_ENTITLEMENT_URL; current Mac remains hybrid/contract-only until env is deliberately updated."
|
||||||
|
else
|
||||||
|
pass "Current Platform env has AI_WORKSPACE_OPS_ENTITLEMENT_URL"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Current Platform env not found: $PLATFORM_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
section "Summary"
|
||||||
|
printf 'passed=%s failed=%s warnings=%s\n' "$passed" "$failed" "$warnings"
|
||||||
|
|
||||||
|
if [ "$failed" -ne 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
PLATFORM_ROOT=$(CDPATH= cd -- "$SCRIPT_DIR/../.." && pwd)
|
||||||
|
AI_ASSISTANT_DIR="$PLATFORM_ROOT/services/ai-workspace-assistant"
|
||||||
|
|
||||||
|
OPS_GATEWAY_REPO="${OPS_GATEWAY_REPO:-$PLATFORM_ROOT/../../data/NODEDC_TASKMANAGER_CODEXAPI}"
|
||||||
|
ENGINE_REPO="${ENGINE_REPO:-$PLATFORM_ROOT/../NODEDC_ENGINE_INFRA}"
|
||||||
|
|
||||||
|
RUN_GATEWAY_SMOKE="${RUN_GATEWAY_SMOKE:-1}"
|
||||||
|
GATEWAY_DATABASE_URL="${GATEWAY_DATABASE_URL:-postgres://nodedc_agent_gateway:replace-with-local-postgres-password@localhost:54100/nodedc_agent_gateway}"
|
||||||
|
GATEWAY_INTERNAL_TOKEN="${GATEWAY_INTERNAL_TOKEN:-replace-with-gateway-internal-token}"
|
||||||
|
GATEWAY_RUN_TOKEN_TTL_SECONDS="${GATEWAY_RUN_TOKEN_TTL_SECONDS:-43200}"
|
||||||
|
|
||||||
|
passed=0
|
||||||
|
failed=0
|
||||||
|
skipped=0
|
||||||
|
|
||||||
|
section() {
|
||||||
|
printf '\n== %s ==\n' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
pass() {
|
||||||
|
passed=$((passed + 1))
|
||||||
|
printf 'PASS %s\n' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
failed=$((failed + 1))
|
||||||
|
printf 'FAIL %s\n' "$1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
skip() {
|
||||||
|
skipped=$((skipped + 1))
|
||||||
|
printf 'SKIP %s\n' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_in() {
|
||||||
|
dir="$1"
|
||||||
|
label="$2"
|
||||||
|
command="$3"
|
||||||
|
|
||||||
|
if [ ! -d "$dir" ]; then
|
||||||
|
fail "$label (missing directory: $dir)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '\n$ %s\n' "$label"
|
||||||
|
set +e
|
||||||
|
(cd "$dir" && sh -lc "$command")
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$status" -eq 0 ]; then
|
||||||
|
pass "$label"
|
||||||
|
else
|
||||||
|
fail "$label (exit $status)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
section "AI Workspace topology classification"
|
||||||
|
run_in "$PLATFORM_ROOT" \
|
||||||
|
"Classify current topology" \
|
||||||
|
"infra/scripts/check-ai-workspace-topology.sh"
|
||||||
|
|
||||||
|
section "Platform static and contract gates"
|
||||||
|
run_in "$PLATFORM_ROOT" \
|
||||||
|
"Platform shell syntax" \
|
||||||
|
"sh -n infra/scripts/init-dev-env.sh infra/scripts/check-ai-workspace-topology.sh infra/scripts/check-ai-workspace-config-contract.sh infra/scripts/check-ai-workspace-release-gates.sh infra/synology/check-ai-workspace-apply-plan.sh infra/synology/prepare-ai-workspace-env.sh infra/synology/deploy-current.sh infra/synology/verify-current-runtime.sh infra/synology/apply-current-runtime.sh infra/synology/backup-current.sh"
|
||||||
|
run_in "$PLATFORM_ROOT" \
|
||||||
|
"AI Workspace config contract" \
|
||||||
|
"infra/scripts/check-ai-workspace-config-contract.sh"
|
||||||
|
run_in "$AI_ASSISTANT_DIR" \
|
||||||
|
"AI Workspace Assistant server syntax" \
|
||||||
|
"node --check src/server.mjs"
|
||||||
|
run_in "$AI_ASSISTANT_DIR" \
|
||||||
|
"AI Workspace run profile smoke" \
|
||||||
|
"npm run smoke:run-profile"
|
||||||
|
run_in "$PLATFORM_ROOT" \
|
||||||
|
"Platform diff hygiene" \
|
||||||
|
"git diff --check"
|
||||||
|
|
||||||
|
section "Ops Gateway static and vertical gates"
|
||||||
|
if [ -d "$OPS_GATEWAY_REPO" ]; then
|
||||||
|
run_in "$OPS_GATEWAY_REPO" \
|
||||||
|
"Ops Gateway TypeScript check" \
|
||||||
|
"npm run check"
|
||||||
|
run_in "$OPS_GATEWAY_REPO" \
|
||||||
|
"Ops Gateway build" \
|
||||||
|
"npm run build"
|
||||||
|
if [ "$RUN_GATEWAY_SMOKE" = "1" ]; then
|
||||||
|
run_in "$OPS_GATEWAY_REPO" \
|
||||||
|
"Ops Gateway smoke" \
|
||||||
|
"DATABASE_URL='$GATEWAY_DATABASE_URL' NODEDC_AGENT_GATEWAY_INTERNAL_TOKEN='$GATEWAY_INTERNAL_TOKEN' NODEDC_AI_WORKSPACE_RUN_TOKEN_TTL_SECONDS='$GATEWAY_RUN_TOKEN_TTL_SECONDS' npm run smoke:gateway"
|
||||||
|
else
|
||||||
|
skip "Ops Gateway smoke (RUN_GATEWAY_SMOKE=$RUN_GATEWAY_SMOKE)"
|
||||||
|
fi
|
||||||
|
run_in "$OPS_GATEWAY_REPO" \
|
||||||
|
"Ops Gateway diff hygiene" \
|
||||||
|
"git diff --check"
|
||||||
|
else
|
||||||
|
fail "Ops Gateway repo not found: $OPS_GATEWAY_REPO"
|
||||||
|
fi
|
||||||
|
|
||||||
|
section "Engine static gates"
|
||||||
|
if [ -d "$ENGINE_REPO" ]; then
|
||||||
|
run_in "$ENGINE_REPO" \
|
||||||
|
"Engine AI Workspace client syntax" \
|
||||||
|
"node --check nodedc-source/server/aiWorkspace/assistantRegistryClient.js"
|
||||||
|
run_in "$ENGINE_REPO" \
|
||||||
|
"Engine diff hygiene" \
|
||||||
|
"git diff --check"
|
||||||
|
else
|
||||||
|
fail "Engine repo not found: $ENGINE_REPO"
|
||||||
|
fi
|
||||||
|
|
||||||
|
section "Summary"
|
||||||
|
printf 'passed=%s failed=%s skipped=%s\n' "$passed" "$failed" "$skipped"
|
||||||
|
|
||||||
|
if [ "$failed" -ne 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,194 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
INFRA_DIR=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
|
||||||
|
PLATFORM_ENV="${PLATFORM_ENV:-$INFRA_DIR/.env}"
|
||||||
|
|
||||||
|
ASSISTANT_URL="${ASSISTANT_URL:-http://127.0.0.1:18082}"
|
||||||
|
HUB_URL="${HUB_URL:-http://127.0.0.1:18081}"
|
||||||
|
GATEWAY_URL="${GATEWAY_URL:-http://127.0.0.1:4100}"
|
||||||
|
TASK_URL="${TASK_URL:-http://task.local.nodedc/}"
|
||||||
|
ENGINE_URL="${ENGINE_URL:-http://127.0.0.1:5300/}"
|
||||||
|
|
||||||
|
read_env() {
|
||||||
|
file="$1"
|
||||||
|
key="$2"
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
awk -F= -v key="$key" '
|
||||||
|
$0 ~ "^[[:space:]]*#" { next }
|
||||||
|
$1 == key {
|
||||||
|
value = substr($0, index($0, "=") + 1)
|
||||||
|
gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
|
||||||
|
gsub(/^"|"$/, "", value)
|
||||||
|
print value
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
' "$file"
|
||||||
|
}
|
||||||
|
|
||||||
|
http_status() {
|
||||||
|
url="$1"
|
||||||
|
curl -k -sS -o /dev/null -w "%{http_code}" --max-time 3 "$url" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
http_body() {
|
||||||
|
url="$1"
|
||||||
|
curl -k -sS --max-time 3 "$url" 2>/dev/null || true
|
||||||
|
}
|
||||||
|
|
||||||
|
ok_status() {
|
||||||
|
code="$1"
|
||||||
|
case "$code" in
|
||||||
|
2*|3*) printf true ;;
|
||||||
|
*) printf false ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
json_number() {
|
||||||
|
key="$1"
|
||||||
|
sed -n "s/.*\"$key\"[[:space:]]*:[[:space:]]*\\([0-9][0-9]*\\).*/\\1/p" | head -n 1
|
||||||
|
}
|
||||||
|
|
||||||
|
url_kind() {
|
||||||
|
value="$1"
|
||||||
|
case "$value" in
|
||||||
|
"")
|
||||||
|
printf missing
|
||||||
|
;;
|
||||||
|
*127.0.0.1*|*localhost*|*host.docker.internal*|*".local.nodedc"*|*ai-workspace-hub*|*agent-gateway*)
|
||||||
|
printf local
|
||||||
|
;;
|
||||||
|
*100.[6-9][0-9].*|*100.1[01][0-9].*|*100.12[0-7].*|*.ts.net*)
|
||||||
|
printf tailscale
|
||||||
|
;;
|
||||||
|
*172.22.0.222*|*".nas.nodedc"*)
|
||||||
|
printf synology-lan
|
||||||
|
;;
|
||||||
|
*ai-hub.nodedc.ru*|*ops-agents.nodedc.ru*|*hub.nodedc.ru*|*ops.nodedc.ru*)
|
||||||
|
printf prod-public
|
||||||
|
;;
|
||||||
|
http://172.*|http://192.168.*|http://10.*)
|
||||||
|
printf lan
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf custom
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_and() {
|
||||||
|
left="$1"
|
||||||
|
right="$2"
|
||||||
|
if [ "$left" = true ] && [ "$right" = true ]; then
|
||||||
|
printf true
|
||||||
|
else
|
||||||
|
printf false
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
assistant_code=$(http_status "$ASSISTANT_URL/healthz")
|
||||||
|
hub_body=$(http_body "$HUB_URL/healthz")
|
||||||
|
hub_code=000
|
||||||
|
if [ -n "$hub_body" ]; then
|
||||||
|
hub_code=$(http_status "$HUB_URL/healthz")
|
||||||
|
fi
|
||||||
|
gateway_code=$(http_status "$GATEWAY_URL/readyz")
|
||||||
|
task_code=$(http_status "$TASK_URL")
|
||||||
|
engine_code=$(http_status "$ENGINE_URL")
|
||||||
|
|
||||||
|
assistant_ok=$(ok_status "$assistant_code")
|
||||||
|
hub_ok=$(ok_status "$hub_code")
|
||||||
|
gateway_ok=$(ok_status "$gateway_code")
|
||||||
|
task_ok=$(ok_status "$task_code")
|
||||||
|
engine_ok=$(ok_status "$engine_code")
|
||||||
|
|
||||||
|
agents_online=$(printf "%s" "$hub_body" | json_number agentsOnline)
|
||||||
|
case "$agents_online" in
|
||||||
|
""|*[!0-9]*) agents_online=0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
hub_public=$(read_env "$PLATFORM_ENV" AI_WORKSPACE_HUB_PUBLIC_URL || true)
|
||||||
|
hub_internal=$(read_env "$PLATFORM_ENV" AI_WORKSPACE_HUB_INTERNAL_URL || true)
|
||||||
|
ops_entitlement=$(read_env "$PLATFORM_ENV" AI_WORKSPACE_OPS_ENTITLEMENT_URL || true)
|
||||||
|
|
||||||
|
hub_public_kind=$(url_kind "$hub_public")
|
||||||
|
hub_internal_kind=$(url_kind "$hub_internal")
|
||||||
|
ops_entitlement_kind=$(url_kind "$ops_entitlement")
|
||||||
|
|
||||||
|
local_services_ok=$(bool_and "$(bool_and "$assistant_ok" "$hub_ok")" "$(bool_and "$gateway_ok" "$task_ok")")
|
||||||
|
worker_on_local_hub=false
|
||||||
|
if [ "$agents_online" -gt 0 ]; then
|
||||||
|
worker_on_local_hub=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
hub_runtime_kind=custom
|
||||||
|
case "$hub_public_kind:$hub_internal_kind" in
|
||||||
|
local:local|local:missing|missing:local) hub_runtime_kind=local ;;
|
||||||
|
tailscale:local|tailscale:tailscale|tailscale:missing) hub_runtime_kind=tailscale ;;
|
||||||
|
prod-public:prod-public|prod-public:missing|missing:prod-public) hub_runtime_kind=prod-public ;;
|
||||||
|
*) hub_runtime_kind=mixed ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
classification=contract-only
|
||||||
|
if [ "$local_services_ok" = true ]; then
|
||||||
|
if [ "$engine_ok" = true ] \
|
||||||
|
&& [ "$worker_on_local_hub" = true ] \
|
||||||
|
&& [ "$ops_entitlement_kind" = local ] \
|
||||||
|
&& [ "$hub_runtime_kind" = local ]; then
|
||||||
|
classification=true-local-e2e
|
||||||
|
elif [ "$engine_ok" = true ] \
|
||||||
|
&& [ "$worker_on_local_hub" = true ] \
|
||||||
|
&& { [ "$ops_entitlement_kind" = tailscale ] || [ "$hub_runtime_kind" = tailscale ]; }; then
|
||||||
|
classification=tunnel-local-e2e
|
||||||
|
elif [ "$hub_runtime_kind" = prod-public ] || [ "$worker_on_local_hub" = false ]; then
|
||||||
|
classification=hybrid-prod-bridge
|
||||||
|
else
|
||||||
|
classification=local-ops-vertical
|
||||||
|
fi
|
||||||
|
elif [ "$gateway_ok" = true ] && [ "$task_ok" = true ]; then
|
||||||
|
classification=local-ops-vertical
|
||||||
|
elif [ "$task_ok" = true ] || [ "$engine_ok" = true ]; then
|
||||||
|
classification=local-ui-only
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
classification=$classification
|
||||||
|
platform_env=$PLATFORM_ENV
|
||||||
|
assistant_health=$assistant_ok status=$assistant_code url=$ASSISTANT_URL/healthz
|
||||||
|
hub_health=$hub_ok status=$hub_code url=$HUB_URL/healthz agents_online=$agents_online
|
||||||
|
gateway_health=$gateway_ok status=$gateway_code url=$GATEWAY_URL/readyz
|
||||||
|
task_health=$task_ok status=$task_code url=$TASK_URL
|
||||||
|
engine_health=$engine_ok status=$engine_code url=$ENGINE_URL
|
||||||
|
hub_public_kind=$hub_public_kind
|
||||||
|
hub_internal_kind=$hub_internal_kind
|
||||||
|
hub_runtime_kind=$hub_runtime_kind
|
||||||
|
ops_entitlement_kind=$ops_entitlement_kind
|
||||||
|
EOF
|
||||||
|
|
||||||
|
case "$classification" in
|
||||||
|
true-local-e2e|tunnel-local-e2e)
|
||||||
|
echo "meaning=local write-path e2e can be interpreted if the worker can reach returned MCP URLs"
|
||||||
|
;;
|
||||||
|
hybrid-prod-bridge)
|
||||||
|
echo "meaning=do not treat UI dialog as local write-path proof; worker/HUB/MCP topology is mixed"
|
||||||
|
;;
|
||||||
|
local-ops-vertical)
|
||||||
|
echo "meaning=Gateway and Tasker local vertical checks are valid, but no live Codex worker e2e is proven"
|
||||||
|
;;
|
||||||
|
local-ui-only)
|
||||||
|
echo "meaning=local UI/proxy is reachable, but AI Workspace write path is not proven"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "meaning=contract tests only; no runtime topology is proven"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "${REQUIRE_TRUE_E2E:-0}" = "1" ]; then
|
||||||
|
case "$classification" in
|
||||||
|
true-local-e2e|tunnel-local-e2e) exit 0 ;;
|
||||||
|
*) exit 2 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
@ -59,6 +59,22 @@ SESSION_SECRET=$(rand 48)
|
||||||
NODEDC_INTERNAL_ACCESS_TOKEN=$(openssl rand -hex 48 | tr -d '\n')
|
NODEDC_INTERNAL_ACCESS_TOKEN=$(openssl rand -hex 48 | tr -d '\n')
|
||||||
COOKIE_DOMAIN=.local.nodedc
|
COOKIE_DOMAIN=.local.nodedc
|
||||||
COOKIE_SECURE=false
|
COOKIE_SECURE=false
|
||||||
|
|
||||||
|
# AI Workspace shared registry and Hub.
|
||||||
|
# Generated local env uses the deployed relay by default. This is suitable for
|
||||||
|
# UI/contract smoke, not proof of local live-worker write-path e2e.
|
||||||
|
AI_WORKSPACE_PG_DB=nodedc_ai_workspace
|
||||||
|
AI_WORKSPACE_PG_USER=nodedc_ai_workspace
|
||||||
|
AI_WORKSPACE_PG_PASS=$(rand 36)
|
||||||
|
AI_WORKSPACE_ASSISTANT_TOKEN=$(openssl rand -hex 48 | tr -d '\n')
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_URL=http://host.docker.internal:4100/api/internal/v1/ai-workspace/entitlements
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_TOKEN=replace-with-ops-agent-gateway-internal-token
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_REQUIRED=false
|
||||||
|
AI_WORKSPACE_HUB_TOKEN=$(openssl rand -hex 48 | tr -d '\n')
|
||||||
|
AI_WORKSPACE_HUB_HOST_BIND=127.0.0.1:18081
|
||||||
|
AI_WORKSPACE_HUB_PUBLIC_URL=wss://ai-hub.nodedc.ru/api/ai-workspace/hub
|
||||||
|
AI_WORKSPACE_HUB_INTERNAL_URL=https://ai-hub.nodedc.ru
|
||||||
|
AI_WORKSPACE_HUB_FALLBACK_URLS=
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod 600 "$ENV_FILE"
|
chmod 600 "$ENV_FILE"
|
||||||
|
|
|
||||||
|
|
@ -57,5 +57,17 @@ NOTIFICATION_PG_USER=nodedc_notifications
|
||||||
NOTIFICATION_PG_PASS=replace-with-random-synology-secret
|
NOTIFICATION_PG_PASS=replace-with-random-synology-secret
|
||||||
NODEDC_NOTIFICATION_CORE_URL=http://notification-core:5185
|
NODEDC_NOTIFICATION_CORE_URL=http://notification-core:5185
|
||||||
|
|
||||||
|
AI_WORKSPACE_PG_DB=nodedc_ai_workspace
|
||||||
|
AI_WORKSPACE_PG_USER=nodedc_ai_workspace
|
||||||
|
AI_WORKSPACE_PG_PASS=replace-with-random-synology-secret
|
||||||
|
AI_WORKSPACE_ASSISTANT_TOKEN=replace-with-random-synology-secret
|
||||||
|
NODEDC_AI_WORKSPACE_ASSISTANT_URL=http://ai-workspace-assistant:18082
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_URL=http://172.22.0.222:18190/api/internal/v1/ai-workspace/entitlements
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_TOKEN=replace-with-ops-agent-gateway-internal-token
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_REQUIRED=false
|
||||||
|
|
||||||
AI_WORKSPACE_HUB_TOKEN=replace-with-random-synology-secret
|
AI_WORKSPACE_HUB_TOKEN=replace-with-random-synology-secret
|
||||||
AI_WORKSPACE_HUB_HOST_BIND=0.0.0.0:18081
|
AI_WORKSPACE_HUB_HOST_BIND=0.0.0.0:18081
|
||||||
|
AI_WORKSPACE_HUB_PUBLIC_URL=wss://ai-hub.nodedc.ru/api/ai-workspace/hub
|
||||||
|
AI_WORKSPACE_HUB_INTERNAL_URL=https://ai-hub.nodedc.ru
|
||||||
|
AI_WORKSPACE_HUB_FALLBACK_URLS=
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,35 @@ https://ai-hub.nodedc.ru -> AI Workspace Hub / WebSocket relay
|
||||||
|
|
||||||
В `Caddyfile.http` эти домены проксируются через локальный HTTP edge, но upstream получает `X-Forwarded-Proto: https` и `X-Forwarded-Port: 443`.
|
В `Caddyfile.http` эти домены проксируются через локальный HTTP edge, но upstream получает `X-Forwarded-Proto: https` и `X-Forwarded-Port: 443`.
|
||||||
|
|
||||||
|
## AI Workspace Hub / Assistant contract
|
||||||
|
|
||||||
|
`ai-workspace-hub` remains a thin public WebSocket relay. It is the only AI Workspace service exposed through DSM/Nginx as `https://ai-hub.nodedc.ru`.
|
||||||
|
|
||||||
|
`ai-workspace-assistant` is an internal platform service for per-user executors, selected device, shared threads and installer generation. It must not be exposed as a public route. Launcher, Engine and Tasker use it through Docker networking:
|
||||||
|
|
||||||
|
```env
|
||||||
|
NODEDC_AI_WORKSPACE_ASSISTANT_URL=http://ai-workspace-assistant:18082
|
||||||
|
PLANE_NODEDC_AI_WORKSPACE_ASSISTANT_URL=http://ai-workspace-assistant:18082
|
||||||
|
```
|
||||||
|
|
||||||
|
Installer generation must always point remote Codex workers to the deployed Hub:
|
||||||
|
|
||||||
|
```env
|
||||||
|
AI_WORKSPACE_HUB_PUBLIC_URL=wss://ai-hub.nodedc.ru/api/ai-workspace/hub
|
||||||
|
AI_WORKSPACE_HUB_INTERNAL_URL=https://ai-hub.nodedc.ru
|
||||||
|
AI_WORKSPACE_HUB_FALLBACK_URLS=
|
||||||
|
```
|
||||||
|
|
||||||
|
Server-side Hub API calls, including executor status checks, use `AI_WORKSPACE_HUB_INTERNAL_URL` and require a token accepted by Hub: `AI_WORKSPACE_HUB_TOKEN`, `NDC_AI_WORKSPACE_HUB_TOKEN`, or the shared `NODEDC_INTERNAL_ACCESS_TOKEN` where that token is intentionally common across platform services.
|
||||||
|
|
||||||
|
AI Workspace Assistant also calls product entitlement adapters before every Codex run. Ops uses the Agent Gateway internal endpoint; the token must match `NODEDC_AGENT_GATEWAY_INTERNAL_TOKEN` from the Ops Agent Gateway deployment:
|
||||||
|
|
||||||
|
```env
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_URL=http://172.22.0.222:18190/api/internal/v1/ai-workspace/entitlements
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_TOKEN=<same value as Ops NODEDC_AGENT_GATEWAY_INTERNAL_TOKEN>
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_REQUIRED=false
|
||||||
|
```
|
||||||
|
|
||||||
## Локальные домены для первичной проверки
|
## Локальные домены для первичной проверки
|
||||||
|
|
||||||
На Mac для первичной проверки добавить в `/etc/hosts`:
|
На Mac для первичной проверки добавить в `/etc/hosts`:
|
||||||
|
|
@ -116,6 +145,8 @@ GATEWAY_REPO=/Users/dcconstructions/Downloads/mnt/data/NODEDC_TASKMANAGER_CODEXA
|
||||||
|
|
||||||
Скрипт не запускает Docker сам: на NAS `sudo` интерактивный, поэтому команды применения печатаются в конце.
|
Скрипт не запускает Docker сам: на NAS `sudo` интерактивный, поэтому команды применения печатаются в конце.
|
||||||
|
|
||||||
|
По умолчанию sync source-копий на SMB/NAS не сохраняет owner/group/perms/times. Для Docker build важен контент, а macOS/Synology metadata может падать на `utimensat Operation timed out`. Если metadata действительно нужно сохранить для отдельного ручного случая, запускать с `RSYNC_PRESERVE_METADATA=1`.
|
||||||
|
|
||||||
Что синхронизируется:
|
Что синхронизируется:
|
||||||
|
|
||||||
- Platform compose/Caddy.
|
- Platform compose/Caddy.
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,16 @@ echo "== ai workspace hub image build =="
|
||||||
cd "${PLATFORM_DIR}/ai-workspace-hub"
|
cd "${PLATFORM_DIR}/ai-workspace-hub"
|
||||||
"${DOCKER_BIN}" build --no-cache -t nodedc/ai-workspace-hub:local .
|
"${DOCKER_BIN}" build --no-cache -t nodedc/ai-workspace-hub:local .
|
||||||
|
|
||||||
|
echo "== ai workspace assistant image build =="
|
||||||
|
cd "${PLATFORM_DIR}/ai-workspace-assistant"
|
||||||
|
"${DOCKER_BIN}" build --no-cache -t nodedc/ai-workspace-assistant:local .
|
||||||
|
|
||||||
echo "== platform services recreate =="
|
echo "== platform services recreate =="
|
||||||
cd "${PLATFORM_DIR}"
|
cd "${PLATFORM_DIR}"
|
||||||
"${DOCKER_BIN}" compose \
|
"${DOCKER_BIN}" compose \
|
||||||
--env-file "${ENV_FILE}" \
|
--env-file "${ENV_FILE}" \
|
||||||
-f "${COMPOSE_FILE}" \
|
-f "${COMPOSE_FILE}" \
|
||||||
up -d --force-recreate reverse-proxy authentik-server authentik-worker notification-postgres notification-core ai-workspace-hub launcher
|
up -d --force-recreate reverse-proxy authentik-server authentik-worker notification-postgres notification-core ai-workspace-postgres ai-workspace-assistant ai-workspace-hub launcher
|
||||||
|
|
||||||
echo "== notification core health check =="
|
echo "== notification core health check =="
|
||||||
"${DOCKER_BIN}" exec nodedc-platform-notification-core-1 sh -lc \
|
"${DOCKER_BIN}" exec nodedc-platform-notification-core-1 sh -lc \
|
||||||
|
|
@ -45,6 +49,18 @@ echo "== ai workspace hub health check =="
|
||||||
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-hub-1 sh -lc \
|
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-hub-1 sh -lc \
|
||||||
'node -e '"'"'fetch("http://127.0.0.1:18081/healthz").then(async (response) => { console.log(await response.text()); process.exit(response.ok ? 0 : 1); }).catch((error) => { console.error(error); process.exit(1); })'"'"''
|
'node -e '"'"'fetch("http://127.0.0.1:18081/healthz").then(async (response) => { console.log(await response.text()); process.exit(response.ok ? 0 : 1); }).catch((error) => { console.error(error); process.exit(1); })'"'"''
|
||||||
|
|
||||||
|
echo "== ai workspace assistant health check =="
|
||||||
|
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-assistant-1 sh -lc \
|
||||||
|
'node -e '"'"'fetch("http://127.0.0.1:18082/healthz").then(async (response) => { console.log(await response.text()); process.exit(response.ok ? 0 : 1); }).catch((error) => { console.error(error); process.exit(1); })'"'"''
|
||||||
|
|
||||||
|
echo "== ai workspace assistant hub target check =="
|
||||||
|
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-assistant-1 sh -lc \
|
||||||
|
'test "$AI_WORKSPACE_HUB_PUBLIC_URL" = "wss://ai-hub.nodedc.ru/api/ai-workspace/hub" && test -z "$AI_WORKSPACE_HUB_FALLBACK_URLS" && echo ai-workspace-prod-hub-target-ok'
|
||||||
|
|
||||||
|
echo "== ai workspace assistant Ops entitlement adapter check =="
|
||||||
|
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-assistant-1 sh -lc \
|
||||||
|
'test "$AI_WORKSPACE_OPS_ENTITLEMENT_URL" = "http://172.22.0.222:18190/api/internal/v1/ai-workspace/entitlements" && test -n "$AI_WORKSPACE_OPS_ENTITLEMENT_TOKEN" && echo ai-workspace-ops-entitlement-env-ok'
|
||||||
|
|
||||||
echo "== clear authentik global brand css =="
|
echo "== clear authentik global brand css =="
|
||||||
DOCKER_BIN="${DOCKER_BIN}" bash "${PLATFORM_DIR}/clear-authentik-brand-css.sh"
|
DOCKER_BIN="${DOCKER_BIN}" bash "${PLATFORM_DIR}/clear-authentik-brand-css.sh"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ rsync_dir "${NAS_ROOT}/authentik/custom-templates/" "${BACKUP_DIR}/files/authent
|
||||||
rsync_dir "${NAS_ROOT}/platform/authentik/" "${BACKUP_DIR}/files/platform/authentik/"
|
rsync_dir "${NAS_ROOT}/platform/authentik/" "${BACKUP_DIR}/files/platform/authentik/"
|
||||||
rsync_dir "${NAS_ROOT}/platform/notification-core/" "${BACKUP_DIR}/files/platform/notification-core/"
|
rsync_dir "${NAS_ROOT}/platform/notification-core/" "${BACKUP_DIR}/files/platform/notification-core/"
|
||||||
rsync_dir "${NAS_ROOT}/platform/ai-workspace-hub/" "${BACKUP_DIR}/files/platform/ai-workspace-hub/"
|
rsync_dir "${NAS_ROOT}/platform/ai-workspace-hub/" "${BACKUP_DIR}/files/platform/ai-workspace-hub/"
|
||||||
|
rsync_dir "${NAS_ROOT}/platform/ai-workspace-assistant/" "${BACKUP_DIR}/files/platform/ai-workspace-assistant/"
|
||||||
|
|
||||||
rsync_file "${NAS_ROOT}/platform/.env.synology" "${BACKUP_DIR}/files/platform/"
|
rsync_file "${NAS_ROOT}/platform/.env.synology" "${BACKUP_DIR}/files/platform/"
|
||||||
rsync_file "${NAS_ROOT}/platform/.env.synology.example" "${BACKUP_DIR}/files/platform/"
|
rsync_file "${NAS_ROOT}/platform/.env.synology.example" "${BACKUP_DIR}/files/platform/"
|
||||||
|
|
@ -73,6 +74,7 @@ Contains:
|
||||||
- Platform runtime config: platform/.env.synology, compose, Caddyfile
|
- Platform runtime config: platform/.env.synology, compose, Caddyfile
|
||||||
- Notification Core source/config: platform/notification-core, platform compose/env
|
- Notification Core source/config: platform/notification-core, platform compose/env
|
||||||
- AI Workspace Hub source/config: platform/ai-workspace-hub, platform compose/env
|
- AI Workspace Hub source/config: platform/ai-workspace-hub, platform compose/env
|
||||||
|
- AI Workspace Assistant source/config: platform/ai-workspace-assistant, platform compose/env
|
||||||
- Tasker runtime config: tasker/plane-app/.env.synology, compose, Synology override
|
- Tasker runtime config: tasker/plane-app/.env.synology, compose, Synology override
|
||||||
- Ops Agents Gateway runtime config: ops-agents/.env, compose
|
- Ops Agents Gateway runtime config: ops-agents/.env, compose
|
||||||
|
|
||||||
|
|
@ -101,8 +103,24 @@ sudo "${DOCKER_BIN}" compose \\
|
||||||
--env-file "${ENV_FILE}" \\
|
--env-file "${ENV_FILE}" \\
|
||||||
-f "${COMPOSE_FILE}" \\
|
-f "${COMPOSE_FILE}" \\
|
||||||
exec -T postgresql-authentik \\
|
exec -T postgresql-authentik \\
|
||||||
sh -lc 'pg_restore --list /dev/stdin >/dev/null' \\
|
rm -f /tmp/authentik-postgres.dump
|
||||||
< "\${BACKUP_DIR}/authentik-postgres.dump"
|
|
||||||
|
sudo "${DOCKER_BIN}" compose \\
|
||||||
|
--env-file "${ENV_FILE}" \\
|
||||||
|
-f "${COMPOSE_FILE}" \\
|
||||||
|
cp "\${BACKUP_DIR}/authentik-postgres.dump" postgresql-authentik:/tmp/authentik-postgres.dump
|
||||||
|
|
||||||
|
sudo "${DOCKER_BIN}" compose \\
|
||||||
|
--env-file "${ENV_FILE}" \\
|
||||||
|
-f "${COMPOSE_FILE}" \\
|
||||||
|
exec -T postgresql-authentik \\
|
||||||
|
pg_restore --list /tmp/authentik-postgres.dump >/dev/null
|
||||||
|
|
||||||
|
sudo "${DOCKER_BIN}" compose \\
|
||||||
|
--env-file "${ENV_FILE}" \\
|
||||||
|
-f "${COMPOSE_FILE}" \\
|
||||||
|
exec -T postgresql-authentik \\
|
||||||
|
rm -f /tmp/authentik-postgres.dump
|
||||||
|
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
if command -v sha256sum >/dev/null 2>&1; then
|
||||||
(cd "\${BACKUP_DIR}" && sha256sum authentik-postgres.dump > SHA256SUMS)
|
(cd "\${BACKUP_DIR}" && sha256sum authentik-postgres.dump > SHA256SUMS)
|
||||||
|
|
@ -132,8 +150,24 @@ sudo "${DOCKER_BIN}" compose \\
|
||||||
--env-file "${ENV_FILE}" \\
|
--env-file "${ENV_FILE}" \\
|
||||||
-f "${COMPOSE_FILE}" \\
|
-f "${COMPOSE_FILE}" \\
|
||||||
exec -T notification-postgres \\
|
exec -T notification-postgres \\
|
||||||
sh -lc 'pg_restore --list /dev/stdin >/dev/null' \\
|
rm -f /tmp/notification-postgres.dump
|
||||||
< "\${BACKUP_DIR}/notification-postgres.dump"
|
|
||||||
|
sudo "${DOCKER_BIN}" compose \\
|
||||||
|
--env-file "${ENV_FILE}" \\
|
||||||
|
-f "${COMPOSE_FILE}" \\
|
||||||
|
cp "\${BACKUP_DIR}/notification-postgres.dump" notification-postgres:/tmp/notification-postgres.dump
|
||||||
|
|
||||||
|
sudo "${DOCKER_BIN}" compose \\
|
||||||
|
--env-file "${ENV_FILE}" \\
|
||||||
|
-f "${COMPOSE_FILE}" \\
|
||||||
|
exec -T notification-postgres \\
|
||||||
|
pg_restore --list /tmp/notification-postgres.dump >/dev/null
|
||||||
|
|
||||||
|
sudo "${DOCKER_BIN}" compose \\
|
||||||
|
--env-file "${ENV_FILE}" \\
|
||||||
|
-f "${COMPOSE_FILE}" \\
|
||||||
|
exec -T notification-postgres \\
|
||||||
|
rm -f /tmp/notification-postgres.dump
|
||||||
|
|
||||||
echo "notification-db-dump-ok: \${BACKUP_DIR}/notification-postgres.dump"
|
echo "notification-db-dump-ok: \${BACKUP_DIR}/notification-postgres.dump"
|
||||||
EOF
|
EOF
|
||||||
|
|
@ -158,8 +192,18 @@ sudo "${DOCKER_BIN}" "\${compose_args[@]}" \\
|
||||||
|
|
||||||
sudo "${DOCKER_BIN}" "\${compose_args[@]}" \\
|
sudo "${DOCKER_BIN}" "\${compose_args[@]}" \\
|
||||||
exec -T plane-db \\
|
exec -T plane-db \\
|
||||||
sh -lc 'pg_restore --list /dev/stdin >/dev/null' \\
|
rm -f /tmp/tasker-postgres.dump
|
||||||
< "\${BACKUP_DIR}/tasker-postgres.dump"
|
|
||||||
|
sudo "${DOCKER_BIN}" "\${compose_args[@]}" \\
|
||||||
|
cp "\${BACKUP_DIR}/tasker-postgres.dump" plane-db:/tmp/tasker-postgres.dump
|
||||||
|
|
||||||
|
sudo "${DOCKER_BIN}" "\${compose_args[@]}" \\
|
||||||
|
exec -T plane-db \\
|
||||||
|
pg_restore --list /tmp/tasker-postgres.dump >/dev/null
|
||||||
|
|
||||||
|
sudo "${DOCKER_BIN}" "\${compose_args[@]}" \\
|
||||||
|
exec -T plane-db \\
|
||||||
|
rm -f /tmp/tasker-postgres.dump
|
||||||
|
|
||||||
echo "tasker-db-dump-ok: \${BACKUP_DIR}/tasker-postgres.dump"
|
echo "tasker-db-dump-ok: \${BACKUP_DIR}/tasker-postgres.dump"
|
||||||
EOF
|
EOF
|
||||||
|
|
@ -183,8 +227,24 @@ sudo "${DOCKER_BIN}" compose \\
|
||||||
--env-file .env \\
|
--env-file .env \\
|
||||||
-f docker-compose.synology.yml \\
|
-f docker-compose.synology.yml \\
|
||||||
exec -T postgres \\
|
exec -T postgres \\
|
||||||
sh -lc 'pg_restore --list /dev/stdin >/dev/null' \\
|
rm -f /tmp/ops-agents-postgres.dump
|
||||||
< "\${BACKUP_DIR}/ops-agents-postgres.dump"
|
|
||||||
|
sudo "${DOCKER_BIN}" compose \\
|
||||||
|
--env-file .env \\
|
||||||
|
-f docker-compose.synology.yml \\
|
||||||
|
cp "\${BACKUP_DIR}/ops-agents-postgres.dump" postgres:/tmp/ops-agents-postgres.dump
|
||||||
|
|
||||||
|
sudo "${DOCKER_BIN}" compose \\
|
||||||
|
--env-file .env \\
|
||||||
|
-f docker-compose.synology.yml \\
|
||||||
|
exec -T postgres \\
|
||||||
|
pg_restore --list /tmp/ops-agents-postgres.dump >/dev/null
|
||||||
|
|
||||||
|
sudo "${DOCKER_BIN}" compose \\
|
||||||
|
--env-file .env \\
|
||||||
|
-f docker-compose.synology.yml \\
|
||||||
|
exec -T postgres \\
|
||||||
|
rm -f /tmp/ops-agents-postgres.dump
|
||||||
|
|
||||||
echo "ops-agents-db-dump-ok: \${BACKUP_DIR}/ops-agents-postgres.dump"
|
echo "ops-agents-db-dump-ok: \${BACKUP_DIR}/ops-agents-postgres.dump"
|
||||||
EOF
|
EOF
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,190 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
PLATFORM_REPO="$(cd -- "${SCRIPT_DIR}/../.." && pwd)"
|
||||||
|
NAS_ROOT="${NAS_ROOT:-/Volumes/docker/nodedc-platform}"
|
||||||
|
GATEWAY_REPO="${GATEWAY_REPO:-${PLATFORM_REPO}/../../data/NODEDC_TASKMANAGER_CODEXAPI}"
|
||||||
|
ENGINE_REPO="${ENGINE_REPO:-${PLATFORM_REPO}/../NODEDC_ENGINE_INFRA}"
|
||||||
|
|
||||||
|
NAS_PLATFORM_ENV="${NAS_PLATFORM_ENV:-${NAS_ROOT}/platform/.env.synology}"
|
||||||
|
NAS_GATEWAY_ENV="${NAS_GATEWAY_ENV:-${NAS_ROOT}/ops-agents/.env}"
|
||||||
|
|
||||||
|
passed=0
|
||||||
|
failed=0
|
||||||
|
warnings=0
|
||||||
|
|
||||||
|
section() {
|
||||||
|
printf '\n== %s ==\n' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
pass() {
|
||||||
|
passed=$((passed + 1))
|
||||||
|
printf 'PASS %s\n' "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
failed=$((failed + 1))
|
||||||
|
printf 'FAIL %s\n' "$1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
warn() {
|
||||||
|
warnings=$((warnings + 1))
|
||||||
|
printf 'WARN %s\n' "$1" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
read_env() {
|
||||||
|
local file="$1"
|
||||||
|
local key="$2"
|
||||||
|
[[ -f "${file}" ]] || return 0
|
||||||
|
awk -F= -v key="${key}" '
|
||||||
|
$0 ~ "^[[:space:]]*#" { next }
|
||||||
|
$1 == key {
|
||||||
|
value = substr($0, index($0, "=") + 1)
|
||||||
|
gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
|
||||||
|
gsub(/^"|"$/, "", value)
|
||||||
|
print value
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
' "${file}"
|
||||||
|
}
|
||||||
|
|
||||||
|
require_path() {
|
||||||
|
local path="$1"
|
||||||
|
local label="$2"
|
||||||
|
if [[ -e "${path}" ]]; then
|
||||||
|
pass "${label}"
|
||||||
|
else
|
||||||
|
fail "${label} (missing: ${path})"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
require_file_contains() {
|
||||||
|
local file="$1"
|
||||||
|
local needle="$2"
|
||||||
|
local label="$3"
|
||||||
|
if [[ ! -f "${file}" ]]; then
|
||||||
|
fail "${label} (missing file: ${file})"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if grep -Fq "${needle}" "${file}"; then
|
||||||
|
pass "${label}"
|
||||||
|
else
|
||||||
|
fail "${label} (missing: ${needle})"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
require_env_value() {
|
||||||
|
local file="$1"
|
||||||
|
local key="$2"
|
||||||
|
local expected="$3"
|
||||||
|
local label="$4"
|
||||||
|
local actual
|
||||||
|
actual="$(read_env "${file}" "${key}" || true)"
|
||||||
|
if [[ "${actual}" == "${expected}" ]]; then
|
||||||
|
pass "${label}"
|
||||||
|
else
|
||||||
|
fail "${label} (expected ${key}=${expected}, got ${actual:-<missing>})"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
require_env_nonempty() {
|
||||||
|
local file="$1"
|
||||||
|
local key="$2"
|
||||||
|
local label="$3"
|
||||||
|
local actual
|
||||||
|
actual="$(read_env "${file}" "${key}" || true)"
|
||||||
|
if [[ -n "${actual}" && "${actual}" != replace-with-* && "${actual}" != change-me-* ]]; then
|
||||||
|
pass "${label}"
|
||||||
|
else
|
||||||
|
fail "${label} (${key} missing or placeholder)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
section "Local prerequisites"
|
||||||
|
require_path "${NAS_ROOT}" "NAS mount exists"
|
||||||
|
require_path "${GATEWAY_REPO}" "Ops Gateway repo exists"
|
||||||
|
require_path "${ENGINE_REPO}" "Engine repo exists"
|
||||||
|
require_path "${PLATFORM_REPO}/infra/scripts/check-ai-workspace-release-gates.sh" "Predeploy gate runner exists"
|
||||||
|
require_path "${PLATFORM_REPO}/infra/scripts/check-ai-workspace-config-contract.sh" "Config contract checker exists"
|
||||||
|
require_path "${PLATFORM_REPO}/infra/synology/backup-current.sh" "Synology backup script exists"
|
||||||
|
require_path "${PLATFORM_REPO}/infra/synology/apply-current-runtime.sh" "Synology apply script exists"
|
||||||
|
require_path "${PLATFORM_REPO}/infra/synology/verify-current-runtime.sh" "Synology verify script exists"
|
||||||
|
|
||||||
|
section "Source and migration audit"
|
||||||
|
require_path "${PLATFORM_REPO}/services/ai-workspace-assistant/src/server.mjs" "AI Workspace Assistant source present"
|
||||||
|
require_path "${PLATFORM_REPO}/services/ai-workspace-assistant/src/templates/install-windows.ps1" "Worker installer template present"
|
||||||
|
require_path "${GATEWAY_REPO}/migrations/004_run_grants.sql" "Ops Gateway token-scoped run grants migration present"
|
||||||
|
require_file_contains "${GATEWAY_REPO}/docker-entrypoint.sh" "npm run migrate:dist" "Ops Gateway image applies migrations on startup"
|
||||||
|
require_file_contains "${PLATFORM_REPO}/infra/synology/backup-current.sh" "ai-workspace-assistant" "Backup includes AI Workspace Assistant source"
|
||||||
|
require_file_contains "${PLATFORM_REPO}/infra/synology/deploy-current.sh" "RSYNC_METADATA_ARGS" "Deploy sync avoids fragile NAS metadata by default"
|
||||||
|
require_file_contains "${PLATFORM_REPO}/infra/synology/apply-current-runtime.sh" "ai-workspace-ops-entitlement-env-ok" "Apply verifies Ops entitlement env"
|
||||||
|
require_file_contains "${PLATFORM_REPO}/infra/synology/verify-current-runtime.sh" "ai-workspace-ops-entitlement-env-ok" "Verify checks Ops entitlement env"
|
||||||
|
|
||||||
|
section "NAS env readiness"
|
||||||
|
if [[ -f "${NAS_PLATFORM_ENV}" ]]; then
|
||||||
|
pass "NAS Platform env exists"
|
||||||
|
require_env_value "${NAS_PLATFORM_ENV}" "AI_WORKSPACE_HUB_PUBLIC_URL" "wss://ai-hub.nodedc.ru/api/ai-workspace/hub" "NAS Platform worker-facing Hub URL"
|
||||||
|
require_env_value "${NAS_PLATFORM_ENV}" "AI_WORKSPACE_HUB_INTERNAL_URL" "https://ai-hub.nodedc.ru" "NAS Platform internal Hub URL"
|
||||||
|
require_env_value "${NAS_PLATFORM_ENV}" "AI_WORKSPACE_HUB_FALLBACK_URLS" "" "NAS Platform Hub fallback URLs disabled"
|
||||||
|
require_env_value "${NAS_PLATFORM_ENV}" "AI_WORKSPACE_OPS_ENTITLEMENT_URL" "http://172.22.0.222:18190/api/internal/v1/ai-workspace/entitlements" "NAS Platform Ops entitlement URL"
|
||||||
|
require_env_nonempty "${NAS_PLATFORM_ENV}" "AI_WORKSPACE_OPS_ENTITLEMENT_TOKEN" "NAS Platform Ops entitlement token configured"
|
||||||
|
require_env_nonempty "${NAS_PLATFORM_ENV}" "AI_WORKSPACE_ASSISTANT_TOKEN" "NAS Platform Assistant token configured"
|
||||||
|
require_env_nonempty "${NAS_PLATFORM_ENV}" "AI_WORKSPACE_HUB_TOKEN" "NAS Platform Hub token configured"
|
||||||
|
else
|
||||||
|
fail "NAS Platform env missing: ${NAS_PLATFORM_ENV}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "${NAS_GATEWAY_ENV}" ]]; then
|
||||||
|
pass "NAS Ops Gateway env exists"
|
||||||
|
require_env_value "${NAS_GATEWAY_ENV}" "NODEDC_AGENT_GATEWAY_PUBLIC_URL" "https://ops-agents.nodedc.ru" "NAS Gateway worker-facing MCP URL"
|
||||||
|
require_env_value "${NAS_GATEWAY_ENV}" "NODEDC_TASKER_INTERNAL_URL" "http://172.22.0.222:18090" "NAS Gateway downstream Tasker URL"
|
||||||
|
require_env_value "${NAS_GATEWAY_ENV}" "NODEDC_AI_WORKSPACE_RUN_TOKEN_TTL_SECONDS" "43200" "NAS Gateway AI Workspace run token TTL"
|
||||||
|
require_env_nonempty "${NAS_GATEWAY_ENV}" "NODEDC_AGENT_GATEWAY_INTERNAL_TOKEN" "NAS Gateway internal token configured"
|
||||||
|
require_env_nonempty "${NAS_GATEWAY_ENV}" "NODEDC_INTERNAL_ACCESS_TOKEN" "NAS Gateway Tasker internal token configured"
|
||||||
|
require_env_nonempty "${NAS_GATEWAY_ENV}" "POSTGRES_PASSWORD" "NAS Gateway Postgres password configured"
|
||||||
|
else
|
||||||
|
fail "NAS Ops Gateway env missing: ${NAS_GATEWAY_ENV}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
section "Controlled apply order"
|
||||||
|
cat <<EOF
|
||||||
|
1. Run local predeploy gate:
|
||||||
|
cd ${PLATFORM_REPO}
|
||||||
|
infra/scripts/check-ai-workspace-release-gates.sh
|
||||||
|
|
||||||
|
2. Create file backup from mounted NAS share:
|
||||||
|
cd ${PLATFORM_REPO}
|
||||||
|
NAS_ROOT=${NAS_ROOT} infra/synology/backup-current.sh
|
||||||
|
|
||||||
|
3. On Synology, run DB dumps from the backup folder:
|
||||||
|
bash /volume1/docker/nodedc-platform/backups/<backup-id>/run-authentik-db-dump-on-synology.sh
|
||||||
|
bash /volume1/docker/nodedc-platform/backups/<backup-id>/run-notification-db-dump-on-synology.sh
|
||||||
|
bash /volume1/docker/nodedc-platform/backups/<backup-id>/run-ops-agents-db-dump-on-synology.sh
|
||||||
|
# Tasker DB dump only if Tasker backend/schema changes are included:
|
||||||
|
bash /volume1/docker/nodedc-platform/backups/<backup-id>/run-tasker-db-dump-on-synology.sh
|
||||||
|
|
||||||
|
4. Sync source to NAS mount:
|
||||||
|
cd ${PLATFORM_REPO}
|
||||||
|
NAS_ROOT=${NAS_ROOT} GATEWAY_REPO=${GATEWAY_REPO} infra/synology/deploy-current.sh
|
||||||
|
|
||||||
|
5. Apply Ops Gateway first on Synology:
|
||||||
|
cd /volume1/docker/nodedc-platform/ops-agents
|
||||||
|
sudo /usr/local/bin/docker compose --env-file .env -f docker-compose.synology.yml up -d --build --force-recreate
|
||||||
|
curl -fsS http://172.22.0.222:18190/readyz
|
||||||
|
|
||||||
|
6. Apply Platform AI Workspace services on Synology:
|
||||||
|
cd /volume1/docker/nodedc-platform/platform
|
||||||
|
sudo bash apply-current-runtime.sh
|
||||||
|
|
||||||
|
7. Verify runtime:
|
||||||
|
cd /volume1/docker/nodedc-platform/platform
|
||||||
|
sudo bash verify-current-runtime.sh
|
||||||
|
EOF
|
||||||
|
|
||||||
|
section "Summary"
|
||||||
|
printf 'passed=%s failed=%s warnings=%s\n' "${passed}" "${failed}" "${warnings}"
|
||||||
|
|
||||||
|
if [[ "${failed}" -ne 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
@ -11,6 +11,11 @@ TASKER_CHANGED_BASE="${TASKER_CHANGED_BASE:-}"
|
||||||
GATEWAY_REPO="${GATEWAY_REPO:-}"
|
GATEWAY_REPO="${GATEWAY_REPO:-}"
|
||||||
SYNC_AUTHENTIK_TEMPLATES="${SYNC_AUTHENTIK_TEMPLATES:-0}"
|
SYNC_AUTHENTIK_TEMPLATES="${SYNC_AUTHENTIK_TEMPLATES:-0}"
|
||||||
|
|
||||||
|
RSYNC_METADATA_ARGS=()
|
||||||
|
if [[ "${RSYNC_PRESERVE_METADATA:-0}" != "1" ]]; then
|
||||||
|
RSYNC_METADATA_ARGS=(--no-times --no-perms --no-owner --no-group)
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -d "${NAS_ROOT}" ]]; then
|
if [[ ! -d "${NAS_ROOT}" ]]; then
|
||||||
echo "NAS_ROOT not found: ${NAS_ROOT}" >&2
|
echo "NAS_ROOT not found: ${NAS_ROOT}" >&2
|
||||||
echo "Set NAS_ROOT=/path/to/nodedc-platform when the Synology share is mounted elsewhere." >&2
|
echo "Set NAS_ROOT=/path/to/nodedc-platform when the Synology share is mounted elsewhere." >&2
|
||||||
|
|
@ -19,15 +24,15 @@ fi
|
||||||
|
|
||||||
mkdir -p "${NAS_ROOT}/platform"
|
mkdir -p "${NAS_ROOT}/platform"
|
||||||
|
|
||||||
rsync -av \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" \
|
||||||
"${PLATFORM_REPO}/infra/synology/docker-compose.platform-http.yml" \
|
"${PLATFORM_REPO}/infra/synology/docker-compose.platform-http.yml" \
|
||||||
"${NAS_ROOT}/platform/docker-compose.platform-http.yml"
|
"${NAS_ROOT}/platform/docker-compose.platform-http.yml"
|
||||||
|
|
||||||
rsync -av \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" \
|
||||||
"${PLATFORM_REPO}/infra/synology/Caddyfile.http" \
|
"${PLATFORM_REPO}/infra/synology/Caddyfile.http" \
|
||||||
"${NAS_ROOT}/platform/Caddyfile.http"
|
"${NAS_ROOT}/platform/Caddyfile.http"
|
||||||
|
|
||||||
rsync -av \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" \
|
||||||
"${PLATFORM_REPO}/infra/synology/deploy-current.sh" \
|
"${PLATFORM_REPO}/infra/synology/deploy-current.sh" \
|
||||||
"${PLATFORM_REPO}/infra/synology/backup-current.sh" \
|
"${PLATFORM_REPO}/infra/synology/backup-current.sh" \
|
||||||
"${PLATFORM_REPO}/infra/synology/apply-current-runtime.sh" \
|
"${PLATFORM_REPO}/infra/synology/apply-current-runtime.sh" \
|
||||||
|
|
@ -36,7 +41,7 @@ rsync -av \
|
||||||
"${NAS_ROOT}/platform/"
|
"${NAS_ROOT}/platform/"
|
||||||
|
|
||||||
mkdir -p "${NAS_ROOT}/platform/notification-core"
|
mkdir -p "${NAS_ROOT}/platform/notification-core"
|
||||||
rsync -av --delete \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" --delete \
|
||||||
--exclude='node_modules/' \
|
--exclude='node_modules/' \
|
||||||
--exclude='.env' \
|
--exclude='.env' \
|
||||||
--exclude='.env.*' \
|
--exclude='.env.*' \
|
||||||
|
|
@ -44,16 +49,24 @@ rsync -av --delete \
|
||||||
"${NAS_ROOT}/platform/notification-core/"
|
"${NAS_ROOT}/platform/notification-core/"
|
||||||
|
|
||||||
mkdir -p "${NAS_ROOT}/platform/ai-workspace-hub"
|
mkdir -p "${NAS_ROOT}/platform/ai-workspace-hub"
|
||||||
rsync -av --delete \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" --delete \
|
||||||
--exclude='node_modules/' \
|
--exclude='node_modules/' \
|
||||||
--exclude='.env' \
|
--exclude='.env' \
|
||||||
--exclude='.env.*' \
|
--exclude='.env.*' \
|
||||||
"${PLATFORM_REPO}/services/ai-workspace-hub/" \
|
"${PLATFORM_REPO}/services/ai-workspace-hub/" \
|
||||||
"${NAS_ROOT}/platform/ai-workspace-hub/"
|
"${NAS_ROOT}/platform/ai-workspace-hub/"
|
||||||
|
|
||||||
|
mkdir -p "${NAS_ROOT}/platform/ai-workspace-assistant"
|
||||||
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" --delete \
|
||||||
|
--exclude='node_modules/' \
|
||||||
|
--exclude='.env' \
|
||||||
|
--exclude='.env.*' \
|
||||||
|
"${PLATFORM_REPO}/services/ai-workspace-assistant/" \
|
||||||
|
"${NAS_ROOT}/platform/ai-workspace-assistant/"
|
||||||
|
|
||||||
if [[ "${SYNC_AUTHENTIK_TEMPLATES}" == "1" ]]; then
|
if [[ "${SYNC_AUTHENTIK_TEMPLATES}" == "1" ]]; then
|
||||||
mkdir -p "${NAS_ROOT}/authentik/custom-templates"
|
mkdir -p "${NAS_ROOT}/authentik/custom-templates"
|
||||||
rsync -av --delete \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" --delete \
|
||||||
"${PLATFORM_REPO}/infra/authentik/custom-templates/" \
|
"${PLATFORM_REPO}/infra/authentik/custom-templates/" \
|
||||||
"${NAS_ROOT}/authentik/custom-templates/"
|
"${NAS_ROOT}/authentik/custom-templates/"
|
||||||
else
|
else
|
||||||
|
|
@ -67,7 +80,7 @@ if [[ -n "${LAUNCHER_REPO}" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "${NAS_ROOT}/launcher/source"
|
mkdir -p "${NAS_ROOT}/launcher/source"
|
||||||
rsync -av --delete \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" --delete \
|
||||||
--exclude='.git/' \
|
--exclude='.git/' \
|
||||||
--exclude='node_modules/' \
|
--exclude='node_modules/' \
|
||||||
--exclude='dist/' \
|
--exclude='dist/' \
|
||||||
|
|
@ -87,7 +100,7 @@ if [[ -n "${TASKER_REPO}" ]]; then
|
||||||
|
|
||||||
mkdir -p "${NAS_ROOT}/tasker/plane-src" "${NAS_ROOT}/tasker/plane-app"
|
mkdir -p "${NAS_ROOT}/tasker/plane-src" "${NAS_ROOT}/tasker/plane-app"
|
||||||
|
|
||||||
rsync -av \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" \
|
||||||
"${TASKER_REPO}/plane-app/docker-compose.yaml" \
|
"${TASKER_REPO}/plane-app/docker-compose.yaml" \
|
||||||
"${NAS_ROOT}/tasker/plane-app/docker-compose.yaml"
|
"${NAS_ROOT}/tasker/plane-app/docker-compose.yaml"
|
||||||
|
|
||||||
|
|
@ -113,14 +126,14 @@ if [[ -n "${TASKER_REPO}" ]]; then
|
||||||
|
|
||||||
if [[ -f "${source_path}" ]]; then
|
if [[ -f "${source_path}" ]]; then
|
||||||
mkdir -p "$(dirname -- "${target_path}")"
|
mkdir -p "$(dirname -- "${target_path}")"
|
||||||
rsync -av "${source_path}" "${target_path}"
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" "${source_path}" "${target_path}"
|
||||||
else
|
else
|
||||||
echo "skip deleted Tasker file in changed sync: ${changed_file}"
|
echo "skip deleted Tasker file in changed sync: ${changed_file}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
elif [[ "${TASKER_SYNC_SOURCE}" == "1" ]]; then
|
elif [[ "${TASKER_SYNC_SOURCE}" == "1" ]]; then
|
||||||
echo "TASKER_SYNC_SOURCE=1: syncing full Tasker source without delete"
|
echo "TASKER_SYNC_SOURCE=1: syncing full Tasker source without delete"
|
||||||
rsync -av \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" \
|
||||||
--exclude='.git/' \
|
--exclude='.git/' \
|
||||||
--exclude='node_modules/' \
|
--exclude='node_modules/' \
|
||||||
--exclude='.pnpm-store/' \
|
--exclude='.pnpm-store/' \
|
||||||
|
|
@ -145,7 +158,7 @@ if [[ -n "${TASKER_REPO}" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "${TASKER_REPO}/plane-app/docker-compose.synology.override.yml" ]]; then
|
if [[ -f "${TASKER_REPO}/plane-app/docker-compose.synology.override.yml" ]]; then
|
||||||
rsync -av \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" \
|
||||||
"${TASKER_REPO}/plane-app/docker-compose.synology.override.yml" \
|
"${TASKER_REPO}/plane-app/docker-compose.synology.override.yml" \
|
||||||
"${NAS_ROOT}/tasker/plane-app/docker-compose.synology.override.yml"
|
"${NAS_ROOT}/tasker/plane-app/docker-compose.synology.override.yml"
|
||||||
else
|
else
|
||||||
|
|
@ -162,7 +175,7 @@ if [[ -n "${GATEWAY_REPO}" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "${NAS_ROOT}/ops-agents"
|
mkdir -p "${NAS_ROOT}/ops-agents"
|
||||||
rsync -av --delete \
|
rsync -av "${RSYNC_METADATA_ARGS[@]}" --delete \
|
||||||
--exclude='.git/' \
|
--exclude='.git/' \
|
||||||
--exclude='node_modules/' \
|
--exclude='node_modules/' \
|
||||||
--exclude='dist/' \
|
--exclude='dist/' \
|
||||||
|
|
@ -201,14 +214,14 @@ cd /volume1/docker/nodedc-platform/platform
|
||||||
sudo /usr/local/bin/docker compose \
|
sudo /usr/local/bin/docker compose \
|
||||||
--env-file /volume1/docker/nodedc-platform/platform/.env.synology \
|
--env-file /volume1/docker/nodedc-platform/platform/.env.synology \
|
||||||
-f /volume1/docker/nodedc-platform/platform/docker-compose.platform-http.yml \
|
-f /volume1/docker/nodedc-platform/platform/docker-compose.platform-http.yml \
|
||||||
up -d --build --force-recreate --no-deps ai-workspace-hub notification-core launcher
|
up -d --build --force-recreate --no-deps ai-workspace-hub ai-workspace-assistant notification-core launcher
|
||||||
|
|
||||||
Optional Platform/Auth infra apply, only after deliberate compose/proxy/Auth templates changes:
|
Optional Platform/Auth infra apply, only after deliberate compose/proxy/Auth templates changes:
|
||||||
|
|
||||||
sudo /usr/local/bin/docker compose \
|
sudo /usr/local/bin/docker compose \
|
||||||
--env-file /volume1/docker/nodedc-platform/platform/.env.synology \
|
--env-file /volume1/docker/nodedc-platform/platform/.env.synology \
|
||||||
-f /volume1/docker/nodedc-platform/platform/docker-compose.platform-http.yml \
|
-f /volume1/docker/nodedc-platform/platform/docker-compose.platform-http.yml \
|
||||||
up -d --build --force-recreate --no-deps reverse-proxy authentik-server authentik-worker ai-workspace-hub notification-core launcher
|
up -d --build --force-recreate --no-deps reverse-proxy authentik-server authentik-worker ai-workspace-hub ai-workspace-assistant notification-core launcher
|
||||||
|
|
||||||
After Authentik template rollout, clear global Brand custom CSS from the live DB.
|
After Authentik template rollout, clear global Brand custom CSS from the live DB.
|
||||||
NODE.DC login CSS must be template-scoped, not stored in Brand.branding_custom_css:
|
NODE.DC login CSS must be template-scoped, not stored in Brand.branding_custom_css:
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ services:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
ai-workspace-hub:
|
ai-workspace-hub:
|
||||||
condition: service_started
|
condition: service_started
|
||||||
|
ai-workspace-assistant:
|
||||||
|
condition: service_started
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "id.nodedc.ru:host-gateway"
|
- "id.nodedc.ru:host-gateway"
|
||||||
- "hub.nodedc.ru:host-gateway"
|
- "hub.nodedc.ru:host-gateway"
|
||||||
|
|
@ -43,6 +45,7 @@ services:
|
||||||
NODEDC_AUTHENTIK_BASE_URL: http://nodedc-platform-authentik-server:9000
|
NODEDC_AUTHENTIK_BASE_URL: http://nodedc-platform-authentik-server:9000
|
||||||
AUTHENTIK_BASE_URL: http://nodedc-platform-authentik-server:9000
|
AUTHENTIK_BASE_URL: http://nodedc-platform-authentik-server:9000
|
||||||
NODEDC_NOTIFICATION_CORE_URL: http://notification-core:5185
|
NODEDC_NOTIFICATION_CORE_URL: http://notification-core:5185
|
||||||
|
NODEDC_AI_WORKSPACE_ASSISTANT_URL: http://ai-workspace-assistant:18082
|
||||||
expose:
|
expose:
|
||||||
- "5173"
|
- "5173"
|
||||||
volumes:
|
volumes:
|
||||||
|
|
@ -102,6 +105,54 @@ services:
|
||||||
- identity
|
- identity
|
||||||
- engine
|
- engine
|
||||||
|
|
||||||
|
ai-workspace-postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- ${NODEDC_SYNOLOGY_ENV_FILE:-.env.synology}
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${AI_WORKSPACE_PG_DB:-nodedc_ai_workspace}
|
||||||
|
POSTGRES_PASSWORD: ${AI_WORKSPACE_PG_PASS:?ai workspace database password required}
|
||||||
|
POSTGRES_USER: ${AI_WORKSPACE_PG_USER:-nodedc_ai_workspace}
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 20s
|
||||||
|
volumes:
|
||||||
|
- ai-workspace-database:/var/lib/postgresql/data
|
||||||
|
networks:
|
||||||
|
- identity
|
||||||
|
|
||||||
|
ai-workspace-assistant:
|
||||||
|
image: nodedc/ai-workspace-assistant:local
|
||||||
|
build:
|
||||||
|
context: ./ai-workspace-assistant
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- ${NODEDC_SYNOLOGY_ENV_FILE:-.env.synology}
|
||||||
|
environment:
|
||||||
|
NODE_ENV: production
|
||||||
|
PORT: 18082
|
||||||
|
DATABASE_URL: postgres://${AI_WORKSPACE_PG_USER:-nodedc_ai_workspace}:${AI_WORKSPACE_PG_PASS:?ai workspace database password required}@ai-workspace-postgres:5432/${AI_WORKSPACE_PG_DB:-nodedc_ai_workspace}
|
||||||
|
AI_WORKSPACE_ASSISTANT_TOKEN: ${AI_WORKSPACE_ASSISTANT_TOKEN:?ai workspace assistant token required}
|
||||||
|
NODEDC_INTERNAL_ACCESS_TOKEN: ${NODEDC_INTERNAL_ACCESS_TOKEN:-}
|
||||||
|
AI_WORKSPACE_HUB_PUBLIC_URL: ${AI_WORKSPACE_HUB_PUBLIC_URL:-wss://ai-hub.nodedc.ru/api/ai-workspace/hub}
|
||||||
|
AI_WORKSPACE_HUB_INTERNAL_URL: ${AI_WORKSPACE_HUB_INTERNAL_URL:-https://ai-hub.nodedc.ru}
|
||||||
|
AI_WORKSPACE_HUB_TOKEN: ${AI_WORKSPACE_HUB_TOKEN:?ai workspace hub token required}
|
||||||
|
AI_WORKSPACE_HUB_FALLBACK_URLS: ${AI_WORKSPACE_HUB_FALLBACK_URLS:-}
|
||||||
|
expose:
|
||||||
|
- "18082"
|
||||||
|
ports:
|
||||||
|
- "${AI_WORKSPACE_ASSISTANT_HOST_BIND:-127.0.0.1:18082}:18082"
|
||||||
|
depends_on:
|
||||||
|
ai-workspace-postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- identity
|
||||||
|
- engine
|
||||||
|
|
||||||
ai-workspace-hub:
|
ai-workspace-hub:
|
||||||
image: nodedc/ai-workspace-hub:local
|
image: nodedc/ai-workspace-hub:local
|
||||||
build:
|
build:
|
||||||
|
|
@ -209,5 +260,6 @@ volumes:
|
||||||
authentik-data:
|
authentik-data:
|
||||||
authentik-certs:
|
authentik-certs:
|
||||||
notification-database:
|
notification-database:
|
||||||
|
ai-workspace-database:
|
||||||
caddy-data:
|
caddy-data:
|
||||||
caddy-config:
|
caddy-config:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
NAS_ROOT="${NAS_ROOT:-/Volumes/docker/nodedc-platform}"
|
||||||
|
PLATFORM_ENV="${PLATFORM_ENV:-${NAS_ROOT}/platform/.env.synology}"
|
||||||
|
GATEWAY_ENV="${GATEWAY_ENV:-${NAS_ROOT}/ops-agents/.env}"
|
||||||
|
BACKUP_ROOT="${BACKUP_ROOT:-${NAS_ROOT}/backups/env-prep}"
|
||||||
|
TIMESTAMP="${TIMESTAMP:-$(date +%Y%m%d-%H%M%S)}"
|
||||||
|
BACKUP_DIR="${BACKUP_DIR:-${BACKUP_ROOT}/${TIMESTAMP}}"
|
||||||
|
|
||||||
|
mkdir -p "${BACKUP_DIR}"
|
||||||
|
|
||||||
|
read_env() {
|
||||||
|
local file="$1"
|
||||||
|
local key="$2"
|
||||||
|
[[ -f "${file}" ]] || return 0
|
||||||
|
awk -F= -v key="${key}" '
|
||||||
|
$0 ~ "^[[:space:]]*#" { next }
|
||||||
|
$1 == key {
|
||||||
|
value = substr($0, index($0, "=") + 1)
|
||||||
|
gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
|
||||||
|
gsub(/^"|"$/, "", value)
|
||||||
|
print value
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
' "${file}"
|
||||||
|
}
|
||||||
|
|
||||||
|
backup_file() {
|
||||||
|
local file="$1"
|
||||||
|
local label="$2"
|
||||||
|
if [[ ! -f "${file}" ]]; then
|
||||||
|
echo "missing ${label}: ${file}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
local backup_path="${BACKUP_DIR}/$(basename "${file}").${label}.bak"
|
||||||
|
if ! COPYFILE_DISABLE=1 cp -X "${file}" "${backup_path}" 2>/dev/null; then
|
||||||
|
cat "${file}" > "${backup_path}"
|
||||||
|
fi
|
||||||
|
chmod 600 "${backup_path}"
|
||||||
|
}
|
||||||
|
|
||||||
|
set_env_value() {
|
||||||
|
local file="$1"
|
||||||
|
local key="$2"
|
||||||
|
local value="$3"
|
||||||
|
local tmp
|
||||||
|
tmp="$(mktemp)"
|
||||||
|
if grep -qE "^${key}=" "${file}"; then
|
||||||
|
awk -v key="${key}" -v value="${value}" '
|
||||||
|
BEGIN { replaced = 0 }
|
||||||
|
$0 ~ "^[[:space:]]*#" { print; next }
|
||||||
|
index($0, key "=") == 1 {
|
||||||
|
print key "=" value
|
||||||
|
replaced = 1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
{ print }
|
||||||
|
END {
|
||||||
|
if (!replaced) {
|
||||||
|
print key "=" value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' "${file}" > "${tmp}"
|
||||||
|
else
|
||||||
|
cat "${file}" > "${tmp}"
|
||||||
|
printf '\n%s=%s\n' "${key}" "${value}" >> "${tmp}"
|
||||||
|
fi
|
||||||
|
cat "${tmp}" > "${file}"
|
||||||
|
rm -f "${tmp}"
|
||||||
|
chmod 600 "${file}"
|
||||||
|
}
|
||||||
|
|
||||||
|
gateway_internal_token="$(read_env "${GATEWAY_ENV}" NODEDC_AGENT_GATEWAY_INTERNAL_TOKEN || true)"
|
||||||
|
if [[ -z "${gateway_internal_token}" || "${gateway_internal_token}" == replace-with-* || "${gateway_internal_token}" == change-me-* ]]; then
|
||||||
|
echo "Gateway NODEDC_AGENT_GATEWAY_INTERNAL_TOKEN is missing or placeholder in ${GATEWAY_ENV}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
backup_file "${PLATFORM_ENV}" platform
|
||||||
|
backup_file "${GATEWAY_ENV}" ops-agents
|
||||||
|
|
||||||
|
set_env_value "${PLATFORM_ENV}" AI_WORKSPACE_HUB_PUBLIC_URL "wss://ai-hub.nodedc.ru/api/ai-workspace/hub"
|
||||||
|
set_env_value "${PLATFORM_ENV}" AI_WORKSPACE_HUB_INTERNAL_URL "https://ai-hub.nodedc.ru"
|
||||||
|
set_env_value "${PLATFORM_ENV}" AI_WORKSPACE_HUB_FALLBACK_URLS ""
|
||||||
|
set_env_value "${PLATFORM_ENV}" AI_WORKSPACE_OPS_ENTITLEMENT_URL "http://172.22.0.222:18190/api/internal/v1/ai-workspace/entitlements"
|
||||||
|
set_env_value "${PLATFORM_ENV}" AI_WORKSPACE_OPS_ENTITLEMENT_TOKEN "${gateway_internal_token}"
|
||||||
|
set_env_value "${PLATFORM_ENV}" AI_WORKSPACE_OPS_ENTITLEMENT_REQUIRED "false"
|
||||||
|
|
||||||
|
set_env_value "${GATEWAY_ENV}" NODEDC_AI_WORKSPACE_RUN_TOKEN_TTL_SECONDS "43200"
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
ai-workspace-env-prep-ok
|
||||||
|
backup_dir=${BACKUP_DIR}
|
||||||
|
updated_platform_env=${PLATFORM_ENV}
|
||||||
|
updated_gateway_env=${GATEWAY_ENV}
|
||||||
|
secrets_printed=false
|
||||||
|
EOF
|
||||||
|
|
@ -59,6 +59,18 @@ echo "== ai workspace hub health check =="
|
||||||
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-hub-1 sh -lc \
|
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-hub-1 sh -lc \
|
||||||
'node -e '"'"'fetch("http://127.0.0.1:18081/healthz").then(async (response) => { console.log(await response.text()); process.exit(response.ok ? 0 : 1); }).catch((error) => { console.error(error); process.exit(1); })'"'"''
|
'node -e '"'"'fetch("http://127.0.0.1:18081/healthz").then(async (response) => { console.log(await response.text()); process.exit(response.ok ? 0 : 1); }).catch((error) => { console.error(error); process.exit(1); })'"'"''
|
||||||
|
|
||||||
|
echo "== ai workspace assistant health check =="
|
||||||
|
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-assistant-1 sh -lc \
|
||||||
|
'node -e '"'"'fetch("http://127.0.0.1:18082/healthz").then(async (response) => { console.log(await response.text()); process.exit(response.ok ? 0 : 1); }).catch((error) => { console.error(error); process.exit(1); })'"'"''
|
||||||
|
|
||||||
|
echo "== ai workspace assistant hub target check =="
|
||||||
|
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-assistant-1 sh -lc \
|
||||||
|
'test "$AI_WORKSPACE_HUB_PUBLIC_URL" = "wss://ai-hub.nodedc.ru/api/ai-workspace/hub" && test -z "$AI_WORKSPACE_HUB_FALLBACK_URLS" && echo ai-workspace-prod-hub-target-ok'
|
||||||
|
|
||||||
|
echo "== ai workspace assistant Ops entitlement adapter check =="
|
||||||
|
"${DOCKER_BIN}" exec nodedc-platform-ai-workspace-assistant-1 sh -lc \
|
||||||
|
'test "$AI_WORKSPACE_OPS_ENTITLEMENT_URL" = "http://172.22.0.222:18190/api/internal/v1/ai-workspace/entitlements" && test -n "$AI_WORKSPACE_OPS_ENTITLEMENT_TOKEN" && echo ai-workspace-ops-entitlement-env-ok'
|
||||||
|
|
||||||
echo "== auth flow check =="
|
echo "== auth flow check =="
|
||||||
auth_flow="$(fetch_with_retry https://id.nodedc.ru/if/flow/default-authentication-flow/)"
|
auth_flow="$(fetch_with_retry https://id.nodedc.ru/if/flow/default-authentication-flow/)"
|
||||||
printf '%s' "$auth_flow" \
|
printf '%s' "$auth_flow" \
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
FROM node:22-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN npm ci --omit=dev
|
||||||
|
|
||||||
|
COPY src ./src
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
EXPOSE 18082
|
||||||
|
|
||||||
|
CMD ["npm", "start"]
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
# NODE.DC AI Workspace Assistant
|
||||||
|
|
||||||
|
Platform-owned shared state service for the cross-surface AI Workspace assistant.
|
||||||
|
|
||||||
|
It owns:
|
||||||
|
|
||||||
|
- user AI Workspace executors/devices and selected executor;
|
||||||
|
- assistant conversation/thread metadata;
|
||||||
|
- surface context and enabled tool packs;
|
||||||
|
- linked artifacts between Engine, Ops and future platform surfaces.
|
||||||
|
|
||||||
|
It does not replace the AI Workspace Hub. The Hub remains the thin transport/rendezvous layer for remote Codex workers.
|
||||||
|
|
||||||
|
It does not replace the legacy Ops MCP config flow:
|
||||||
|
|
||||||
|
```text
|
||||||
|
external Codex client -> ~/.codex/config.toml -> nodedc-ops-agent MCP -> Ops Agent Gateway
|
||||||
|
```
|
||||||
|
|
||||||
|
That flow remains a separate product path.
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
All endpoints require the shared internal token. App BFFs pass the resolved platform subject through:
|
||||||
|
|
||||||
|
```text
|
||||||
|
X-NODEDC-User-Id
|
||||||
|
X-NODEDC-User-Email
|
||||||
|
X-NODEDC-User-Role
|
||||||
|
X-NODEDC-User-Groups
|
||||||
|
```
|
||||||
|
|
||||||
|
`Role` and `Groups` are identity inputs for entitlement adapters. App backends still own object-level ACL enforcement.
|
||||||
|
|
||||||
|
Executor registry:
|
||||||
|
|
||||||
|
```text
|
||||||
|
GET /api/ai-workspace/assistant/v1/executors
|
||||||
|
POST /api/ai-workspace/assistant/v1/executors
|
||||||
|
PATCH /api/ai-workspace/assistant/v1/executors/:executorId
|
||||||
|
DELETE /api/ai-workspace/assistant/v1/executors/:executorId
|
||||||
|
POST /api/ai-workspace/assistant/v1/executors/:executorId/select
|
||||||
|
```
|
||||||
|
|
||||||
|
Conversations:
|
||||||
|
|
||||||
|
```text
|
||||||
|
GET /api/ai-workspace/assistant/v1/threads
|
||||||
|
POST /api/ai-workspace/assistant/v1/threads
|
||||||
|
GET /api/ai-workspace/assistant/v1/threads/:threadId
|
||||||
|
PATCH /api/ai-workspace/assistant/v1/threads/:threadId
|
||||||
|
POST /api/ai-workspace/assistant/v1/threads/:threadId/messages
|
||||||
|
GET /api/ai-workspace/assistant/v1/threads/:threadId/messages
|
||||||
|
```
|
||||||
|
|
||||||
|
Supported initial surfaces:
|
||||||
|
|
||||||
|
- `engine`
|
||||||
|
- `ops`
|
||||||
|
- `global`
|
||||||
|
|
||||||
|
Supported initial tool packs:
|
||||||
|
|
||||||
|
- `engine`
|
||||||
|
- `ops`
|
||||||
|
- `ndc-agent-core`
|
||||||
|
- `deploy`
|
||||||
|
- `docs`
|
||||||
|
|
||||||
|
## Run Profile
|
||||||
|
|
||||||
|
Every dispatch builds an `ai-workspace.run-profile.v1` payload. The raw profile is sent only to the bridge worker; public API responses and run metadata keep MCP headers redacted.
|
||||||
|
|
||||||
|
The worker uses `runProfile.toolProfile.mcpServers` to create an isolated per-run `CODEX_HOME/config.toml`. Install-time MCP config remains only as a legacy fallback when no dynamic profile is available.
|
||||||
|
|
||||||
|
Runtime deploy readiness is tracked in [TEST_MATRIX.md](./TEST_MATRIX.md). The `smoke:run-profile` script covers the entitlement adapter to run profile contract and public secret redaction.
|
||||||
|
|
||||||
|
## Entitlement Adapters
|
||||||
|
|
||||||
|
App grants can be resolved dynamically before dispatch through adapter endpoints. Configure adapters with:
|
||||||
|
|
||||||
|
```text
|
||||||
|
AI_WORKSPACE_ENTITLEMENT_ADAPTERS_JSON='{"ops":{"url":"https://ops.example/api/ai-workspace/entitlements","tokenEnv":"NODEDC_INTERNAL_ACCESS_TOKEN","required":false}}'
|
||||||
|
```
|
||||||
|
|
||||||
|
or app-specific variables:
|
||||||
|
|
||||||
|
```text
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_URL=https://ops.example/api/ai-workspace/entitlements
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_TOKEN=...
|
||||||
|
AI_WORKSPACE_OPS_ENTITLEMENT_REQUIRED=false
|
||||||
|
```
|
||||||
|
|
||||||
|
Adapter request body:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"schemaVersion": "ai-workspace.entitlement-request.v1",
|
||||||
|
"appId": "ops",
|
||||||
|
"owner": {},
|
||||||
|
"activeContext": {},
|
||||||
|
"runContext": {},
|
||||||
|
"requestedAt": "2026-06-13T00:00:00.000Z"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Adapter response can return `appGrants`, `grants`, `grant`, `appGrant`, or a top-level grant with `mcpServers` and `scopes`. Adapter grants override matching settings grants for the current run only.
|
||||||
|
|
@ -0,0 +1,178 @@
|
||||||
|
# AI Workspace Test Matrix
|
||||||
|
|
||||||
|
This matrix defines what blocks a runtime deploy while the assistant control plane moves from prototype to a scalable multi-app system.
|
||||||
|
|
||||||
|
## Gate -1: Topology Classification
|
||||||
|
|
||||||
|
Run this before interpreting any local AI Workspace result.
|
||||||
|
|
||||||
|
Command:
|
||||||
|
|
||||||
|
- `infra/scripts/check-ai-workspace-topology.sh`
|
||||||
|
|
||||||
|
Current Mac-local shape observed on 2026-06-13:
|
||||||
|
|
||||||
|
- `task.local.nodedc` resolves to `127.0.0.1` and returns local Plane/Tasker HTML through the local reverse proxy.
|
||||||
|
- Local containers are up for Tasker runtime, Ops Agent Gateway `:4100`, AI Workspace Hub `:18081`, and AI Workspace Assistant `:18082`.
|
||||||
|
- Local AI Workspace Hub reports `agentsOnline: 0`.
|
||||||
|
- Local AI Workspace Assistant still points at public `ai-hub.nodedc.ru` for Hub public/internal URLs.
|
||||||
|
- Local AI Workspace Assistant is not configured with a local Ops entitlement adapter URL.
|
||||||
|
- Engine dev server `127.0.0.1:5300` is not part of the currently running local process set unless started separately.
|
||||||
|
- Local Ops Agent Gateway points Tasker downstream to `task.local.nodedc`, but its public MCP URL can be a LAN address, not a universally reachable URL.
|
||||||
|
|
||||||
|
Progress:
|
||||||
|
|
||||||
|
- The test explicitly labels itself as one of: `contract-only`, `local-ops-vertical`, `local-ui-only`, `hybrid-prod-bridge`, or `true-local-e2e`.
|
||||||
|
- `contract-only` and `local-ops-vertical` are allowed before deploy and do not require a live Codex worker.
|
||||||
|
- `true-local-e2e` is claimed only when Engine, Platform Assistant, Hub, Ops Gateway, Tasker, and the Codex worker all use the same intended local/tunnel topology.
|
||||||
|
|
||||||
|
Regression:
|
||||||
|
|
||||||
|
- A hybrid test is treated as proof that the local end-to-end path works.
|
||||||
|
- A UI conversation is counted as a write-path pass while the active Codex worker is connected to public `ai-hub.nodedc.ru` and local Hub has zero online agents.
|
||||||
|
- A local run writes through a Gateway/Tasker target that is not the expected local Tasker runtime.
|
||||||
|
- A returned MCP URL is not reachable from the worker that will execute the run.
|
||||||
|
|
||||||
|
Ignore:
|
||||||
|
|
||||||
|
- `task.local.nodedc` returning HTML proves only local Tasker UI/proxy availability.
|
||||||
|
- Local Hub availability on `127.0.0.1:18081` proves only relay process health, not worker connectivity.
|
||||||
|
- Engine UI on `127.0.0.1:5300` proves only frontend/dev server availability unless its backend AI Workspace URLs point to the same local/tunnel control plane.
|
||||||
|
|
||||||
|
True local e2e prerequisites:
|
||||||
|
|
||||||
|
- Start Engine dev/runtime and point it to local Platform Assistant.
|
||||||
|
- Configure local Platform Assistant with local Ops entitlement adapter: `AI_WORKSPACE_OPS_ENTITLEMENT_URL=http://host.docker.internal:4100/api/internal/v1/ai-workspace/entitlements` plus the matching internal token.
|
||||||
|
- Make Platform Assistant and the executing Codex worker use the same Hub endpoint.
|
||||||
|
- Make `NODEDC_AGENT_GATEWAY_PUBLIC_URL` reachable from that worker, not only from the Mac host.
|
||||||
|
- Keep Ops Gateway `NODEDC_TASKER_INTERNAL_URL` pointed at the intended local Tasker runtime.
|
||||||
|
- If the worker is not on the Mac/local network, expose local Hub and Gateway through an explicit tunnel and mark the test as `tunnel-local-e2e`, not pure local.
|
||||||
|
|
||||||
|
## Gate 0: Static Hygiene
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
|
||||||
|
- All current predeploy gates: `infra/scripts/check-ai-workspace-release-gates.sh`
|
||||||
|
- Config contract: `infra/scripts/check-ai-workspace-config-contract.sh`
|
||||||
|
- Controlled Synology apply plan: `infra/synology/check-ai-workspace-apply-plan.sh`
|
||||||
|
- Platform: `node --check src/server.mjs && npm run smoke:run-profile`
|
||||||
|
- Ops Gateway: `npm run check && npm run build`
|
||||||
|
- Global: `git diff --check`
|
||||||
|
|
||||||
|
Progress:
|
||||||
|
|
||||||
|
- Code parses cleanly.
|
||||||
|
- TypeScript and build checks pass.
|
||||||
|
- No whitespace damage in tracked diffs.
|
||||||
|
|
||||||
|
Regression:
|
||||||
|
|
||||||
|
- Any syntax, build, type, or diff hygiene failure.
|
||||||
|
|
||||||
|
Ignore:
|
||||||
|
|
||||||
|
- NAS runtime not changing after source sync only. It is expected until container env and recreate are applied.
|
||||||
|
|
||||||
|
## Gate 1: Entitlement Adapter Boundary
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
|
||||||
|
- Platform: `npm run smoke:run-profile`
|
||||||
|
|
||||||
|
Progress:
|
||||||
|
|
||||||
|
- Adapter response with `appGrants.ops.mcpServers` becomes `runProfile.toolProfile.mcpServers`.
|
||||||
|
- Runtime profile keeps real MCP headers for the worker.
|
||||||
|
- Public run profile and diagnostics redact MCP headers and tokens.
|
||||||
|
- MCP server names are normalized and stable.
|
||||||
|
|
||||||
|
Regression:
|
||||||
|
|
||||||
|
- Dynamic MCP server disappears from the run profile.
|
||||||
|
- Runtime headers are dropped before worker dispatch.
|
||||||
|
- Public metadata contains a bearer token or raw authorization header.
|
||||||
|
- Adapter grants fail to override same-app static grants for the current run.
|
||||||
|
|
||||||
|
Ignore:
|
||||||
|
|
||||||
|
- This gate does not prove a live Codex worker can reach Ops. It only proves the Platform contract shape before dispatch.
|
||||||
|
|
||||||
|
## Gate 2: Ops Gateway Vertical Smoke
|
||||||
|
|
||||||
|
Command:
|
||||||
|
|
||||||
|
- `DATABASE_URL=... NODEDC_AGENT_GATEWAY_INTERNAL_TOKEN=... NODEDC_AI_WORKSPACE_RUN_TOKEN_TTL_SECONDS=43200 npm run smoke:gateway`
|
||||||
|
|
||||||
|
Progress:
|
||||||
|
|
||||||
|
- Lifecycle internal auth is enforced.
|
||||||
|
- Owner lifecycle API creates and lists agent state.
|
||||||
|
- Preflight returns readiness without issuing a token.
|
||||||
|
- Entitlement call issues a short-lived run token only when target workspace/project context is present.
|
||||||
|
- Run token session reports `grant_source=token` and `grant_scope=token`.
|
||||||
|
- Run token is narrowed to the requested project and scope intersection.
|
||||||
|
- MCP `tools/list` exposes only tools allowed by the token grant.
|
||||||
|
- Cross-project or out-of-scope writes return 403.
|
||||||
|
- Write tools still require idempotency.
|
||||||
|
|
||||||
|
Regression:
|
||||||
|
|
||||||
|
- No-context entitlement issues a broad token.
|
||||||
|
- Token-scoped entitlement inherits unrelated project grants.
|
||||||
|
- Read-only run token can see write tools.
|
||||||
|
- Cross-project write reaches Tasker.
|
||||||
|
- Missing internal token is accepted.
|
||||||
|
- Existing long-lived agent token flow breaks unexpectedly.
|
||||||
|
|
||||||
|
Ignore:
|
||||||
|
|
||||||
|
- A Tasker boundary 403/503 in the final write leg can be acceptable in local smoke if the Gateway proved the request reached the downstream boundary with the expected auth context.
|
||||||
|
- Legacy long-lived manual tokens may still expose all agent grants by design; AI Workspace run tokens must not.
|
||||||
|
|
||||||
|
## Gate 3: Worker Config Boundary
|
||||||
|
|
||||||
|
Progress:
|
||||||
|
|
||||||
|
- Worker creates per-run isolated `CODEX_HOME/config.toml` from `runProfile.toolProfile.mcpServers`.
|
||||||
|
- Dynamic run profile takes priority over install-time MCP config.
|
||||||
|
- Legacy install-time Ops MCP config is used only when no dynamic profile exists.
|
||||||
|
- Worker health/event output reports dynamic MCP names but not token values.
|
||||||
|
|
||||||
|
Regression:
|
||||||
|
|
||||||
|
- Worker merges stale install-time MCP credentials into a dynamic run.
|
||||||
|
- Worker prints MCP tokens in events, logs, health, or errors.
|
||||||
|
- A new app requires rebuilding the worker instead of adding an entitlement adapter/grant response.
|
||||||
|
|
||||||
|
Ignore:
|
||||||
|
|
||||||
|
- Existing local agent installation files are not the source of truth for new AI Workspace runs once dynamic profile is present.
|
||||||
|
|
||||||
|
## Gate 4: Controlled Runtime Before Deploy
|
||||||
|
|
||||||
|
Scenarios:
|
||||||
|
|
||||||
|
- Engine user with Ops read grant opens an Ops-targeted run and can read the target card.
|
||||||
|
- Engine user with Ops write grant creates or updates in the target Ops project.
|
||||||
|
- Engine user without target Ops grant gets preflight denied and no token.
|
||||||
|
- Ops-origin run can call Engine-side context once the Engine entitlement adapter exists.
|
||||||
|
- Admin grants a user a new project permission; new AI Workspace run receives it without reinstalling the agent.
|
||||||
|
- Admin revokes a project permission; new run token loses it and existing source-linked token grants stop resolving through deleted grants.
|
||||||
|
|
||||||
|
Progress:
|
||||||
|
|
||||||
|
- New apps are onboarded by adding entitlement adapter config and app grant response shape.
|
||||||
|
- User access changes flow through Authentik/app ACL to entitlement preflight and run tokens.
|
||||||
|
- Agent installation remains a bridge/bootstrap layer, not a per-user ACL store.
|
||||||
|
|
||||||
|
Regression:
|
||||||
|
|
||||||
|
- Any app requires hard-coded MCP config in the installer.
|
||||||
|
- User ACL changes require reinstalling a worker.
|
||||||
|
- Run tokens remain valid with revoked source grants.
|
||||||
|
- One project grant leaks to another project or app.
|
||||||
|
|
||||||
|
Ignore:
|
||||||
|
|
||||||
|
- SSH access from the current workstation to Synology can time out; it is not evidence of app regression.
|
||||||
|
- Source files synced to NAS are not active runtime until env and container recreate are explicitly applied.
|
||||||
|
|
@ -0,0 +1,990 @@
|
||||||
|
{
|
||||||
|
"name": "@nodedc/ai-workspace-assistant",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "@nodedc/ai-workspace-assistant",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^5.2.1",
|
||||||
|
"pg": "^8.18.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/accepts": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-types": "^3.0.0",
|
||||||
|
"negotiator": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/body-parser": {
|
||||||
|
"version": "2.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz",
|
||||||
|
"integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"bytes": "^3.1.2",
|
||||||
|
"content-type": "^1.0.5",
|
||||||
|
"debug": "^4.4.3",
|
||||||
|
"http-errors": "^2.0.0",
|
||||||
|
"iconv-lite": "^0.7.0",
|
||||||
|
"on-finished": "^2.4.1",
|
||||||
|
"qs": "^6.14.1",
|
||||||
|
"raw-body": "^3.0.1",
|
||||||
|
"type-is": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/bytes": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/call-bind-apply-helpers": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"function-bind": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/call-bound": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind-apply-helpers": "^1.0.2",
|
||||||
|
"get-intrinsic": "^1.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/content-disposition": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/content-type": {
|
||||||
|
"version": "1.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
||||||
|
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/cookie": {
|
||||||
|
"version": "0.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
||||||
|
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/cookie-signature": {
|
||||||
|
"version": "1.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
|
||||||
|
"integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/debug": {
|
||||||
|
"version": "4.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||||
|
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "^2.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"supports-color": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/depd": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/dunder-proto": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind-apply-helpers": "^1.0.1",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"gopd": "^1.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ee-first": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/encodeurl": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/es-define-property": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/es-errors": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/es-object-atoms": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/escape-html": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/etag": {
|
||||||
|
"version": "1.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||||
|
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/express": {
|
||||||
|
"version": "5.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz",
|
||||||
|
"integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"accepts": "^2.0.0",
|
||||||
|
"body-parser": "^2.2.1",
|
||||||
|
"content-disposition": "^1.0.0",
|
||||||
|
"content-type": "^1.0.5",
|
||||||
|
"cookie": "^0.7.1",
|
||||||
|
"cookie-signature": "^1.2.1",
|
||||||
|
"debug": "^4.4.0",
|
||||||
|
"depd": "^2.0.0",
|
||||||
|
"encodeurl": "^2.0.0",
|
||||||
|
"escape-html": "^1.0.3",
|
||||||
|
"etag": "^1.8.1",
|
||||||
|
"finalhandler": "^2.1.0",
|
||||||
|
"fresh": "^2.0.0",
|
||||||
|
"http-errors": "^2.0.0",
|
||||||
|
"merge-descriptors": "^2.0.0",
|
||||||
|
"mime-types": "^3.0.0",
|
||||||
|
"on-finished": "^2.4.1",
|
||||||
|
"once": "^1.4.0",
|
||||||
|
"parseurl": "^1.3.3",
|
||||||
|
"proxy-addr": "^2.0.7",
|
||||||
|
"qs": "^6.14.0",
|
||||||
|
"range-parser": "^1.2.1",
|
||||||
|
"router": "^2.2.0",
|
||||||
|
"send": "^1.1.0",
|
||||||
|
"serve-static": "^2.2.0",
|
||||||
|
"statuses": "^2.0.1",
|
||||||
|
"type-is": "^2.0.1",
|
||||||
|
"vary": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/finalhandler": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.4.0",
|
||||||
|
"encodeurl": "^2.0.0",
|
||||||
|
"escape-html": "^1.0.3",
|
||||||
|
"on-finished": "^2.4.1",
|
||||||
|
"parseurl": "^1.3.3",
|
||||||
|
"statuses": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/forwarded": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fresh": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/function-bind": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-intrinsic": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind-apply-helpers": "^1.0.2",
|
||||||
|
"es-define-property": "^1.0.1",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"es-object-atoms": "^1.1.1",
|
||||||
|
"function-bind": "^1.1.2",
|
||||||
|
"get-proto": "^1.0.1",
|
||||||
|
"gopd": "^1.2.0",
|
||||||
|
"has-symbols": "^1.1.0",
|
||||||
|
"hasown": "^2.0.2",
|
||||||
|
"math-intrinsics": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-proto": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"dunder-proto": "^1.0.1",
|
||||||
|
"es-object-atoms": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/gopd": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/has-symbols": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/hasown": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"function-bind": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/http-errors": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"depd": "~2.0.0",
|
||||||
|
"inherits": "~2.0.4",
|
||||||
|
"setprototypeof": "~1.2.0",
|
||||||
|
"statuses": "~2.0.2",
|
||||||
|
"toidentifier": "~1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/iconv-lite": {
|
||||||
|
"version": "0.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz",
|
||||||
|
"integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"safer-buffer": ">= 2.1.2 < 3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/ipaddr.js": {
|
||||||
|
"version": "1.9.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||||
|
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/is-promise": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/math-intrinsics": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/media-typer": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/merge-descriptors": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-db": {
|
||||||
|
"version": "1.54.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
|
||||||
|
"integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-types": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "^1.54.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ms": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/negotiator": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/object-inspect": {
|
||||||
|
"version": "1.13.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||||
|
"integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/on-finished": {
|
||||||
|
"version": "2.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
|
||||||
|
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ee-first": "1.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/once": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"wrappy": "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/parseurl": {
|
||||||
|
"version": "1.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||||
|
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-to-regexp": {
|
||||||
|
"version": "8.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.2.tgz",
|
||||||
|
"integrity": "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pg": {
|
||||||
|
"version": "8.21.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pg/-/pg-8.21.0.tgz",
|
||||||
|
"integrity": "sha512-AUP1EYJuHraQGsVoCQVIcM7TEJVGtDzxWtGFZd8rds9d+CCXlU5Js1rYgfLNvxy9iJrpHjGrRjoi/3BT9fRyiA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"pg-connection-string": "^2.13.0",
|
||||||
|
"pg-pool": "^3.14.0",
|
||||||
|
"pg-protocol": "^1.14.0",
|
||||||
|
"pg-types": "2.2.0",
|
||||||
|
"pgpass": "1.0.5"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 16.0.0"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"pg-cloudflare": "^1.4.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"pg-native": ">=3.0.1"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"pg-native": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pg-cloudflare": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-Vo7z/6rrQYxpNRylp4Tlob2elzbh+N/MOQbxFVWCxS7oEx6jF53GTJFxK2WWpKuBRkmiin4Mt+xofFDjx09R0A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"node_modules/pg-connection-string": {
|
||||||
|
"version": "2.13.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.13.0.tgz",
|
||||||
|
"integrity": "sha512-EMnU9E2fSULdsbErBbMaXJvFeD9B4+nPcM3f+4lsiCR0BHLPrLVjv3DbyM2hgQQviKJaTWIRRTjKjWlHg3p2ig==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/pg-int8": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pg-pool": {
|
||||||
|
"version": "3.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.14.0.tgz",
|
||||||
|
"integrity": "sha512-gKtPkFdQPU3DksooVLi9LsjZxrsBUZIpa+7aVx+LV5pNh0KzP4Zleud2po+ConrxbuXGBJ6Hfer6hdgpIBpBaw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"pg": ">=8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pg-protocol": {
|
||||||
|
"version": "1.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.14.0.tgz",
|
||||||
|
"integrity": "sha512-n5taZ1kO3s9ngDTVxsEznOqCyToTgz0FLuPq0B33COy5pPpuWJpY3/2oRBVETuOgzdqRXfWpM9HIhp2LBBT1BA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/pg-types": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"pg-int8": "1.0.1",
|
||||||
|
"postgres-array": "~2.0.0",
|
||||||
|
"postgres-bytea": "~1.0.0",
|
||||||
|
"postgres-date": "~1.0.4",
|
||||||
|
"postgres-interval": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pgpass": {
|
||||||
|
"version": "1.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
|
||||||
|
"integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"split2": "^4.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/postgres-array": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/postgres-bytea": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-5+5HqXnsZPE65IJZSMkZtURARZelel2oXUEO8rH83VS/hxH5vv1uHquPg5wZs8yMAfdv971IU+kcPUczi7NVBQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/postgres-date": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/postgres-interval": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"xtend": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/proxy-addr": {
|
||||||
|
"version": "2.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
|
||||||
|
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"forwarded": "0.2.0",
|
||||||
|
"ipaddr.js": "1.9.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qs": {
|
||||||
|
"version": "6.15.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz",
|
||||||
|
"integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"side-channel": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/range-parser": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/raw-body": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"bytes": "~3.1.2",
|
||||||
|
"http-errors": "~2.0.1",
|
||||||
|
"iconv-lite": "~0.7.0",
|
||||||
|
"unpipe": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/router": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.4.0",
|
||||||
|
"depd": "^2.0.0",
|
||||||
|
"is-promise": "^4.0.0",
|
||||||
|
"parseurl": "^1.3.3",
|
||||||
|
"path-to-regexp": "^8.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/safer-buffer": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/send": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.4.3",
|
||||||
|
"encodeurl": "^2.0.0",
|
||||||
|
"escape-html": "^1.0.3",
|
||||||
|
"etag": "^1.8.1",
|
||||||
|
"fresh": "^2.0.0",
|
||||||
|
"http-errors": "^2.0.1",
|
||||||
|
"mime-types": "^3.0.2",
|
||||||
|
"ms": "^2.1.3",
|
||||||
|
"on-finished": "^2.4.1",
|
||||||
|
"range-parser": "^1.2.1",
|
||||||
|
"statuses": "^2.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/serve-static": {
|
||||||
|
"version": "2.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz",
|
||||||
|
"integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"encodeurl": "^2.0.0",
|
||||||
|
"escape-html": "^1.0.3",
|
||||||
|
"parseurl": "^1.3.3",
|
||||||
|
"send": "^1.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/setprototypeof": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/side-channel": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"object-inspect": "^1.13.4",
|
||||||
|
"side-channel-list": "^1.0.1",
|
||||||
|
"side-channel-map": "^1.0.1",
|
||||||
|
"side-channel-weakmap": "^1.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/side-channel-list": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"object-inspect": "^1.13.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/side-channel-map": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bound": "^1.0.2",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"get-intrinsic": "^1.2.5",
|
||||||
|
"object-inspect": "^1.13.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/side-channel-weakmap": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bound": "^1.0.2",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"get-intrinsic": "^1.2.5",
|
||||||
|
"object-inspect": "^1.13.3",
|
||||||
|
"side-channel-map": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/split2": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.x"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/statuses": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/toidentifier": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/type-is": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-is/-/type-is-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"content-type": "^2.0.0",
|
||||||
|
"media-typer": "^1.1.0",
|
||||||
|
"mime-types": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/type-is/node_modules/content-type": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/content-type/-/content-type-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/unpipe": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/vary": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/wrappy": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/xtend": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"name": "@nodedc/ai-workspace-assistant",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node src/server.mjs",
|
||||||
|
"dev": "node --watch src/server.mjs",
|
||||||
|
"smoke:run-profile": "node src/scripts/smoke-run-profile.mjs"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^5.2.1",
|
||||||
|
"pg": "^8.18.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,347 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { createHash, randomUUID } from "node:crypto";
|
||||||
|
|
||||||
|
const SECRET_TOKEN = "secret-run-token-for-smoke";
|
||||||
|
|
||||||
|
const adapter = {
|
||||||
|
id: "ops",
|
||||||
|
appId: "ops",
|
||||||
|
title: "NODE.DC Ops",
|
||||||
|
};
|
||||||
|
|
||||||
|
const adapterPayload = {
|
||||||
|
ok: true,
|
||||||
|
appGrants: {
|
||||||
|
ops: {
|
||||||
|
appTitle: "NODE.DC Ops",
|
||||||
|
surface: "ops",
|
||||||
|
grantMode: "token-scoped-run-grants",
|
||||||
|
context: {
|
||||||
|
opsWorkspaceSlug: "nodedc",
|
||||||
|
opsProjectId: "86629a11-eaff-4ad2-9f89-e5245a344fcc",
|
||||||
|
},
|
||||||
|
scopes: ["workspace:read", "project:read", "issue:read"],
|
||||||
|
mcpServers: [
|
||||||
|
{
|
||||||
|
serverName: "nodedc ops agent",
|
||||||
|
url: "https://ops-agents.nodedc.ru/mcp",
|
||||||
|
required: true,
|
||||||
|
startupTimeoutSec: 20,
|
||||||
|
toolTimeoutSec: 60,
|
||||||
|
httpHeaders: {
|
||||||
|
Authorization: `Bearer ${SECRET_TOKEN}`,
|
||||||
|
Accept: "application/json",
|
||||||
|
"MCP-Protocol-Version": "2025-06-18",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const appGrants = normalizeEntitlementAdapterAppGrants(adapterPayload, adapter);
|
||||||
|
const mcpServers = runProfileMcpServersFromAppGrants({}, appGrants);
|
||||||
|
const appGrantSummary = summarizeRunAppGrants({ appGrants });
|
||||||
|
const runProfile = {
|
||||||
|
schemaVersion: "ai-workspace.run-profile.v1",
|
||||||
|
runId: randomUUID(),
|
||||||
|
createdAt: new Date("2026-06-13T00:00:00.000Z").toISOString(),
|
||||||
|
owner: {
|
||||||
|
ownerKey: "user:smoke-user",
|
||||||
|
userId: "smoke-user",
|
||||||
|
email: "smoke@example.test",
|
||||||
|
role: "member",
|
||||||
|
groups: ["engineering"],
|
||||||
|
},
|
||||||
|
sourceSurface: "engine",
|
||||||
|
modeId: "ops",
|
||||||
|
targetContexts: {
|
||||||
|
ops: {
|
||||||
|
opsWorkspaceSlug: "nodedc",
|
||||||
|
opsProjectId: "86629a11-eaff-4ad2-9f89-e5245a344fcc",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
enabledToolPacks: ["engine", "ops", "ndc-agent-core"],
|
||||||
|
appGrants: appGrantSummary,
|
||||||
|
toolProfile: {
|
||||||
|
schemaVersion: "ai-workspace.tool-profile.v1",
|
||||||
|
enabledToolPacks: ["engine", "ops", "ndc-agent-core"],
|
||||||
|
mcpServers,
|
||||||
|
mcpServerNames: mcpServers.map((server) => server.serverName),
|
||||||
|
requiredMcpServerNames: mcpServers.filter((server) => server.required).map((server) => server.serverName),
|
||||||
|
},
|
||||||
|
diagnostics: {
|
||||||
|
schemaVersion: "ai-workspace.run-profile.diagnostics.v1",
|
||||||
|
dynamicProfile: true,
|
||||||
|
sourceSurface: "engine",
|
||||||
|
modeId: "ops",
|
||||||
|
entitlementAdapters: {
|
||||||
|
source: "adapters+settings",
|
||||||
|
adapters: [{ appId: "ops", status: "ok", required: true }],
|
||||||
|
},
|
||||||
|
mcpServerNames: mcpServers.map((server) => server.serverName),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
runProfile.diagnostics.profileHash = runProfileHash(runProfile);
|
||||||
|
const publicProfile = redactRunProfile(runProfile);
|
||||||
|
|
||||||
|
assert.deepEqual(Object.keys(appGrants), ["ops"]);
|
||||||
|
assert.equal(appGrants.ops.source, "entitlement-adapter");
|
||||||
|
assert.equal(appGrants.ops.appId, "ops");
|
||||||
|
assert.deepEqual(appGrantSummary.ops.scopes, ["workspace:read", "project:read", "issue:read"]);
|
||||||
|
assert.equal(appGrantSummary.ops.hasMcpServers, true);
|
||||||
|
assert.deepEqual(appGrantSummary.ops.mcpServerNames, ["nodedc_ops_agent"]);
|
||||||
|
|
||||||
|
assert.equal(mcpServers.length, 1);
|
||||||
|
assert.equal(mcpServers[0].appId, "ops");
|
||||||
|
assert.equal(mcpServers[0].serverName, "nodedc_ops_agent");
|
||||||
|
assert.equal(mcpServers[0].required, true);
|
||||||
|
assert.equal(mcpServers[0].httpHeaders.Authorization, `Bearer ${SECRET_TOKEN}`);
|
||||||
|
assert.equal(mcpServers[0].httpHeaders.Accept, "application/json");
|
||||||
|
|
||||||
|
assert.equal(publicProfile.toolProfile.mcpServers.length, 1);
|
||||||
|
assert.equal(publicProfile.toolProfile.mcpServers[0].serverName, "nodedc_ops_agent");
|
||||||
|
assert.equal(publicProfile.toolProfile.mcpServers[0].httpHeaders.Authorization, "<redacted>");
|
||||||
|
assert.equal(publicProfile.toolProfile.mcpServers[0].httpHeaders.Accept, "<redacted>");
|
||||||
|
assert.equal(publicProfile.toolProfile.mcpServers[0].headers, undefined);
|
||||||
|
assert.equal(JSON.stringify(publicProfile).includes(SECRET_TOKEN), false);
|
||||||
|
assert.match(runProfile.diagnostics.profileHash, /^[a-f0-9]{16}$/);
|
||||||
|
|
||||||
|
console.log(JSON.stringify({
|
||||||
|
ok: true,
|
||||||
|
checks: [
|
||||||
|
"adapter_grant_normalized",
|
||||||
|
"token_scoped_ops_mcp_in_run_profile",
|
||||||
|
"public_run_profile_redacts_mcp_headers",
|
||||||
|
"stable_public_profile_hash",
|
||||||
|
],
|
||||||
|
mcpServerNames: runProfile.toolProfile.mcpServerNames,
|
||||||
|
profileHash: runProfile.diagnostics.profileHash,
|
||||||
|
}, null, 2));
|
||||||
|
|
||||||
|
function normalizeEntitlementAdapterAppGrants(payload, currentAdapter) {
|
||||||
|
const source = isPlainObject(payload?.appGrants)
|
||||||
|
? payload.appGrants
|
||||||
|
: Array.isArray(payload?.appGrants)
|
||||||
|
? payload.appGrants
|
||||||
|
: payload?.grant || payload?.appGrant || payload?.entitlement || payload?.entitlements || payload?.grants || payload;
|
||||||
|
const out = {};
|
||||||
|
if (Array.isArray(source)) {
|
||||||
|
for (const item of source) {
|
||||||
|
const grant = normalizeEntitlementAdapterGrant(item, currentAdapter);
|
||||||
|
if (grant?.appId) out[grant.appId] = grant;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
if (!isPlainObject(source)) return out;
|
||||||
|
if (source.mcpServers || source.scopes || source.appId || source.app_id || source.surface) {
|
||||||
|
const grant = normalizeEntitlementAdapterGrant(source, currentAdapter);
|
||||||
|
if (grant?.appId) out[grant.appId] = grant;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
for (const [key, value] of Object.entries(source)) {
|
||||||
|
const grant = normalizeEntitlementAdapterGrant(value, { ...currentAdapter, appId: normalizeKey(key) || currentAdapter.appId });
|
||||||
|
if (grant?.appId) out[grant.appId] = grant;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeEntitlementAdapterGrant(value, currentAdapter) {
|
||||||
|
if (!isPlainObject(value)) return null;
|
||||||
|
const appId = normalizeKey(value.appId || value.app_id || currentAdapter.appId);
|
||||||
|
if (!appId) return null;
|
||||||
|
return {
|
||||||
|
...value,
|
||||||
|
appId,
|
||||||
|
appTitle: optionalString(value.appTitle || value.app_title || value.title || currentAdapter.title),
|
||||||
|
surface: optionalString(value.surface) || appId,
|
||||||
|
source: "entitlement-adapter",
|
||||||
|
adapterId: currentAdapter.id,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function runProfileMcpServersFromAppGrants(settings, appGrantsInput = {}) {
|
||||||
|
const servers = [];
|
||||||
|
const metadata = isPlainObject(settings?.metadata) ? settings.metadata : {};
|
||||||
|
collectInstallerMcpServers(servers, metadata.mcpServers, {});
|
||||||
|
const grants = isPlainObject(appGrantsInput) ? appGrantsInput : {};
|
||||||
|
for (const [appId, grant] of Object.entries(grants)) {
|
||||||
|
if (!isPlainObject(grant)) continue;
|
||||||
|
collectInstallerMcpServers(servers, grant.mcpServers, {
|
||||||
|
appId: optionalString(grant.appId) || normalizeKey(appId),
|
||||||
|
appTitle: optionalString(grant.appTitle || grant.title),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const byServerName = new Map();
|
||||||
|
for (const server of servers.map(sanitizeInstallerMcpServer).filter(Boolean)) {
|
||||||
|
if (server.enabled === false) continue;
|
||||||
|
byServerName.set(server.serverName, server);
|
||||||
|
}
|
||||||
|
return Array.from(byServerName.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
function summarizeRunAppGrants(metadata) {
|
||||||
|
const grants = isPlainObject(metadata?.appGrants) ? metadata.appGrants : {};
|
||||||
|
const out = {};
|
||||||
|
for (const [key, value] of Object.entries(grants)) {
|
||||||
|
if (!isPlainObject(value)) continue;
|
||||||
|
const appId = optionalString(value.appId) || normalizeKey(key);
|
||||||
|
if (!appId) continue;
|
||||||
|
const mcpServers = Array.isArray(value.mcpServers)
|
||||||
|
? value.mcpServers
|
||||||
|
: isPlainObject(value.mcpServers)
|
||||||
|
? Object.values(value.mcpServers)
|
||||||
|
: [];
|
||||||
|
out[appId] = {
|
||||||
|
appId,
|
||||||
|
appTitle: optionalString(value.appTitle || value.title),
|
||||||
|
surface: optionalString(value.surface) || appId,
|
||||||
|
updatedAt: optionalString(value.updatedAt || value.updated_at),
|
||||||
|
context: redactForPublicDiagnostics(isPlainObject(value.context) ? value.context : {}),
|
||||||
|
scopes: uniqueStrings(Array.isArray(value.scopes) ? value.scopes : []),
|
||||||
|
hasMcpServers: mcpServers.length > 0,
|
||||||
|
mcpServerNames: mcpServers
|
||||||
|
.map((server) => safeMcpServerName(server?.serverName || server?.server_name || server?.name))
|
||||||
|
.filter(Boolean),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function collectInstallerMcpServers(target, value, defaults = {}) {
|
||||||
|
const items = Array.isArray(value)
|
||||||
|
? value
|
||||||
|
: isPlainObject(value)
|
||||||
|
? Object.values(value)
|
||||||
|
: [];
|
||||||
|
for (const item of items) {
|
||||||
|
if (!isPlainObject(item)) continue;
|
||||||
|
target.push({ ...defaults, ...item });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sanitizeInstallerMcpServer(raw) {
|
||||||
|
if (!isPlainObject(raw)) return null;
|
||||||
|
const serverName = safeMcpServerName(raw.serverName || raw.server_name || raw.name);
|
||||||
|
const url = optionalString(raw.url);
|
||||||
|
if (!serverName || !url) return null;
|
||||||
|
const httpHeaders = sanitizeInstallerMcpHeaders(raw.httpHeaders || raw.http_headers || raw.headers);
|
||||||
|
return {
|
||||||
|
appId: normalizeKey(raw.appId || raw.app_id) || "global",
|
||||||
|
appTitle: optionalString(raw.appTitle || raw.app_title || raw.title),
|
||||||
|
serverName,
|
||||||
|
url,
|
||||||
|
enabled: raw.enabled !== false,
|
||||||
|
required: raw.required === true,
|
||||||
|
startupTimeoutSec: sanitizeInteger(raw.startupTimeoutSec || raw.startup_timeout_sec, 20, 1, 600),
|
||||||
|
toolTimeoutSec: sanitizeInteger(raw.toolTimeoutSec || raw.tool_timeout_sec, 60, 1, 3600),
|
||||||
|
httpHeaders,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function sanitizeInstallerMcpHeaders(value) {
|
||||||
|
if (!isPlainObject(value)) return {};
|
||||||
|
const headers = {};
|
||||||
|
for (const [key, rawValue] of Object.entries(value)) {
|
||||||
|
const headerName = optionalString(key);
|
||||||
|
const headerValue = optionalString(rawValue);
|
||||||
|
if (!headerName || !headerValue || headerName.length > 120 || headerValue.length > 4000) continue;
|
||||||
|
headers[headerName] = headerValue;
|
||||||
|
}
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
function runProfileHash(runProfile) {
|
||||||
|
const publicProfile = redactRunProfile(runProfile);
|
||||||
|
const stableProfile = {
|
||||||
|
...publicProfile,
|
||||||
|
runId: undefined,
|
||||||
|
createdAt: undefined,
|
||||||
|
diagnostics: {
|
||||||
|
...(isPlainObject(publicProfile?.diagnostics) ? publicProfile.diagnostics : {}),
|
||||||
|
profileHash: undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return createHash("sha256").update(JSON.stringify(stableProfile)).digest("hex").slice(0, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
function redactRunProfile(runProfile) {
|
||||||
|
if (!isPlainObject(runProfile)) return null;
|
||||||
|
return {
|
||||||
|
...runProfile,
|
||||||
|
targetContexts: redactForPublicDiagnostics(runProfile.targetContexts),
|
||||||
|
appGrants: redactForPublicDiagnostics(runProfile.appGrants),
|
||||||
|
toolProfile: {
|
||||||
|
...(isPlainObject(runProfile.toolProfile) ? runProfile.toolProfile : {}),
|
||||||
|
mcpServers: Array.isArray(runProfile.toolProfile?.mcpServers)
|
||||||
|
? runProfile.toolProfile.mcpServers.map(redactMcpServer)
|
||||||
|
: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function redactMcpServer(server) {
|
||||||
|
if (!isPlainObject(server)) return {};
|
||||||
|
const headers = isPlainObject(server.httpHeaders) ? server.httpHeaders : {};
|
||||||
|
return {
|
||||||
|
...server,
|
||||||
|
httpHeaders: Object.fromEntries(Object.keys(headers).map((key) => [key, "<redacted>"])),
|
||||||
|
headers: undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function redactForPublicDiagnostics(value, depth = 0) {
|
||||||
|
if (depth > 6) return "[max-depth]";
|
||||||
|
if (Array.isArray(value)) return value.map((item) => redactForPublicDiagnostics(item, depth + 1));
|
||||||
|
if (!isPlainObject(value)) return value;
|
||||||
|
const out = {};
|
||||||
|
for (const [key, item] of Object.entries(value)) {
|
||||||
|
const normalizedKey = normalizeKey(key);
|
||||||
|
if (
|
||||||
|
normalizedKey.includes("token")
|
||||||
|
|| normalizedKey.includes("secret")
|
||||||
|
|| normalizedKey.includes("password")
|
||||||
|
|| normalizedKey === "authorization"
|
||||||
|
|| normalizedKey === "cookie"
|
||||||
|
|| normalizedKey === "setcookie"
|
||||||
|
) {
|
||||||
|
out[key] = "<redacted>";
|
||||||
|
} else {
|
||||||
|
out[key] = redactForPublicDiagnostics(item, depth + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function safeMcpServerName(value) {
|
||||||
|
const text = optionalString(value);
|
||||||
|
if (!text) return "";
|
||||||
|
return text.replace(/[^A-Za-z0-9_-]+/g, "_").replace(/^_+|_+$/g, "").slice(0, 80);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sanitizeInteger(value, fallback, min, max) {
|
||||||
|
const number = Number(value || fallback);
|
||||||
|
if (!Number.isFinite(number)) return fallback;
|
||||||
|
return Math.min(Math.max(Math.trunc(number), min), max);
|
||||||
|
}
|
||||||
|
|
||||||
|
function uniqueStrings(values) {
|
||||||
|
return Array.from(new Set((Array.isArray(values) ? values : []).map(optionalString).filter(Boolean)));
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeKey(value) {
|
||||||
|
return optionalString(value).toLowerCase().replace(/[^a-z0-9_-]+/g, "_").replace(/^_+|_+$/g, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function optionalString(value) {
|
||||||
|
if (value === null || value === undefined) return "";
|
||||||
|
const text = String(value).trim();
|
||||||
|
return text.length ? text : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function isPlainObject(value) {
|
||||||
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -307,11 +307,12 @@ function readAgentEvents(pairingCodeRaw, options = {}) {
|
||||||
|
|
||||||
function requestMetaFromPayload(command, payload = {}) {
|
function requestMetaFromPayload(command, payload = {}) {
|
||||||
const context = payload?.context && typeof payload.context === "object" ? payload.context : {};
|
const context = payload?.context && typeof payload.context === "object" ? payload.context : {};
|
||||||
|
const publicUserMessage = payload?.displayMessage || payload?.publicUserMessage || payload?.message;
|
||||||
return {
|
return {
|
||||||
command: cleanString(command, 80),
|
command: cleanString(command, 80),
|
||||||
threadId: cleanString(payload?.threadId, 160),
|
threadId: cleanString(payload?.threadId, 160),
|
||||||
threadTitle: cleanString(payload?.threadTitle, 240),
|
threadTitle: cleanString(payload?.threadTitle, 240),
|
||||||
userMessage: cleanString(payload?.message, 12000),
|
userMessage: cleanString(publicUserMessage, 12000),
|
||||||
remoteControlMode: cleanString(context.remoteControlMode, 40),
|
remoteControlMode: cleanString(context.remoteControlMode, 40),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue