Skip to content

AI Translation Notice

Translated/synchronized from the authoritative Chinese documentation (配置矩阵与运维脚本). Check source files or Chinese docs if subtle phrasing differs.

Configuration & Scripts Matrix ​

Configuration is separated cleanly into Cloudflare Worker configuration and the protected local state directory (default %USERPROFILE%\.agentdock-bridge). Never commit wrangler.jsonc, .dev.vars, or secrets.dpapi.

1. Cloudflare Worker (wrangler.jsonc & Secrets) ​

SettingExample / BindingPurpose
maincloud/index.mjsEdge entrypoint exporting default fetch, BridgeRelay, and AuthCoordinator
compatibility_date / flags2026-10-28, nodejs_compat, global_fetch_strictly_publicEnables Node compatibility and restricts Worker fetches to public endpoints
preview_urlsfalseDisables ephemeral preview hostnames that bypass PUBLIC_ORIGIN checks
vars.PUBLIC_ORIGINhttps://bridge.example.testRequired HTTPS origin checked against request host, CORS, and consent POST origin
durable_objects.bindingsRELAY (BridgeRelay), AUTH (AuthCoordinator)SQLite-backed DOs initialized via migrations v1 and v2
Secret BRIDGE_TOKENMin 32-char URL-safe random secretShared bearer token for WSS /bridge and IP rate-limit key salt
Secret OWNER_PASSWORD_HASHpbkdf2-sha256$100000$<salt>$<hash>Verifies owner login; SHA-256 shifts AUTH generation owner-v2-<hash>

2. Protected State Directory (~/.agentdock-bridge / %USERPROFILE%\.agentdock-bridge) ​

On Windows, NTFS ACLs restrict FullControl to the current user SID and SYSTEM (S-1-5-18); on Linux and macOS, local/host-safety.mjs enforces 0700 ownership and ancestor write protection:

  • secrets.dpapi (Windows DPAPI) or secrets.meta.json + Keychain / Secret Service / 0600 secrets.json (POSIX).
  • config.json: Connector configuration (see table below).
  • runtime-<timestamp>-<id>/ & installation.json: Isolated copy of local/, scripts/, package.json, pnpm-lock.yaml, production deps, and SHA-256 manifest.
  • {Start,Stop,Status,Password,Approve}.cmd (Windows) or {start,stop,status,password,approve} (0700 POSIX wrappers clearing preload/linker env vars).
  • approvals/, request-receipts/, and supervisor.sock (POSIX single-instance lock).
config.json FieldWriterMeaning & Constraint
originSetup.ps1 / host-cli.mjs setupMatches Worker PUBLIC_ORIGIN (HTTPS required outside loopback tests)
roots / defaultCwdInstall-Hardened.ps1 -Workspace / host-cli.mjs install --workspaceExactly one explicit directory mounted at /workspace (must not contain stateDir or sourceRoot)
sourceRootInstall-Hardened.ps1 / host-cli.mjs installMust equal running script root; blocks launching from unhardened folders
nodePath / nodeRoot / nodeSha256Install-NodeRuntime.ps1 / node-toolchains.mjsPinned Node 24.22.1 under ~/.agentdock-toolchains, verified on every start/approval
allowExecsetup (false) -> install (true)Enables exec_command, command_status, stop_command on the sandbox (file-worker.mjs keeps false)
requireLocalApprovaltrueRequired by Manage.ps1 and host-cli.mjs before connector start
sandbox.enabled / image / dockerPath / context / allowOutboundInstall-Hardened.ps1 / host-cli.mjs installPinned sha256:<64-hex> image, nlink === 1 docker, desktop-linux (Win/macOS) or default (Linux) context, outbound toggle (true by default)

The Windows x64 installer uses the pinned pnpm 12 binary. If it exits with 0xC0000135, check the Visual C++ v14 x64 runtime and retry as the same Windows user. Microsoft runtime downloads

3. Environment Variables, npm/pnpm & Host Scripts ​

Variable / ScriptScope & Notes
HTTPS_PROXY / HTTP_PROXY / NO_PROXYOptional proxies (plus bypass list) probed alongside Windows WinINet or macOS scutil --proxy and direct route
AGENTDOCK_DOCKER_TESTEnables real container integration tests in test/sandbox.test.mjs
AGENTDOCK_BRIDGE_TOKENExplicitly deleted from process.env at connector startup
NODE_OPTIONS, NODE_PATH, NODE_TLS_REJECT_UNAUTHORIZED, NODE_EXTRA_CA_CERTSCleared by Clear-NodeOverrides before launching Node
pnpm run devStarts wrangler dev --ip 127.0.0.1 --port 8797 for loopback testing
pnpm run check / pnpm testSyntax check across modules & Node test runner (test/*.test.mjs cloud/*.test.mjs)
scripts/Manage.ps1 / scripts/host-cli.mjsHost lifecycle (start, stop, status, approve, password, setup, install) with process start-time anti-PID-reuse checks
scripts/Rotate-Secrets.ps1 / host-cli.mjs rotate-secretsTwo-step rotation (stage next -> wrangler secret bulk -> promote to current) while stopped
scripts/acceptance-v2.mjs / verify-lifecycle.mjsExplicit maintainer live verification against public /healthz and /mcp

4. Rotating Credentials Safely ​

  1. Run Stop.cmd (Windows) or ~/.agentdock-bridge/stop (Linux/macOS) and verify both supervisor and connector exited.
  2. Run .\scripts\Rotate-Secrets.ps1 (Windows) or node scripts/host-cli.mjs rotate-secrets (Linux/macOS). If Cloudflare upload fails, staged credentials remain so retries are idempotent; once committed, old OAuth tokens fail immediately due to the shifted owner-v2-* DO generation.
  3. Re-authenticate MCP clients using the new password shown by Password.cmd or ~/.agentdock-bridge/password.