@chroxy/server 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONFIG.md +695 -0
- package/README.md +105 -0
- package/hooks/permission-hook.sh +285 -0
- package/package.json +69 -0
- package/scripts/fix-node-pty-helper.js +44 -0
- package/sidecar/Dockerfile +40 -0
- package/sidecar/PROTOCOL.md +691 -0
- package/sidecar/agent.js +1290 -0
- package/sidecar/package-lock.json +43 -0
- package/sidecar/package.json +17 -0
- package/src/activity-registry.js +491 -0
- package/src/anthropic-compatible-config.js +534 -0
- package/src/anthropic-compatible-session.js +579 -0
- package/src/anthropic-openai-shim.js +109 -0
- package/src/anthropic-openai-translate.js +377 -0
- package/src/auth-probes.js +296 -0
- package/src/background-shell-tracker.js +320 -0
- package/src/background-shells.js +125 -0
- package/src/base-session.js +1518 -0
- package/src/billing-budget.js +191 -0
- package/src/billing-canary-monitor.js +203 -0
- package/src/billing-class.js +149 -0
- package/src/bind-host.js +82 -0
- package/src/built-in-tools/bash-exec.js +167 -0
- package/src/built-in-tools/file-ops.js +198 -0
- package/src/built-in-tools/tool-transforms.js +179 -0
- package/src/builtin-commands.js +107 -0
- package/src/byok-compose-state-shared.js +31 -0
- package/src/byok-compose-state.js +234 -0
- package/src/byok-credentials.js +127 -0
- package/src/byok-event-translator.js +136 -0
- package/src/byok-mcp-client.js +404 -0
- package/src/byok-mcp-config.js +159 -0
- package/src/byok-mcp-fleet.js +214 -0
- package/src/byok-mcp-trust.js +175 -0
- package/src/byok-session.js +2019 -0
- package/src/byok-subagent-profiles.js +101 -0
- package/src/byok-tool-executor.js +813 -0
- package/src/byok-tools.js +271 -0
- package/src/channels/PACKAGING.md +181 -0
- package/src/channels/README.md +99 -0
- package/src/channels/chroxy-channel-server.js +248 -0
- package/src/checkpoint-manager.js +515 -0
- package/src/child-stream-guard.js +38 -0
- package/src/claude-channel-session.js +185 -0
- package/src/claude-model-catalog.js +266 -0
- package/src/claude-stream-parser.js +106 -0
- package/src/claude-tui/form-driver.js +874 -0
- package/src/claude-tui/pty-driver.js +520 -0
- package/src/claude-tui/tested-cli-version.js +22 -0
- package/src/claude-tui-attachments.js +342 -0
- package/src/claude-tui-session.js +4029 -0
- package/src/cli/config-cmd.js +34 -0
- package/src/cli/credentials-cmd.js +59 -0
- package/src/cli/deploy-cmd.js +167 -0
- package/src/cli/doctor-cmd.js +52 -0
- package/src/cli/identity-cmd.js +82 -0
- package/src/cli/init-cmd.js +209 -0
- package/src/cli/pages-cmd.js +167 -0
- package/src/cli/pair-code-cmd.js +108 -0
- package/src/cli/pair-discord-cmd.js +100 -0
- package/src/cli/providers-cmd.js +168 -0
- package/src/cli/server-cmd.js +94 -0
- package/src/cli/service-cmd.js +237 -0
- package/src/cli/session-cmd.js +143 -0
- package/src/cli/shared.js +194 -0
- package/src/cli/shell-cmd.js +130 -0
- package/src/cli/status-cmd.js +204 -0
- package/src/cli/tunnel-cmd.js +101 -0
- package/src/cli/update-cmd.js +45 -0
- package/src/cli/worktree-gc-cmd.js +195 -0
- package/src/cli-session.js +1820 -0
- package/src/cli.js +60 -0
- package/src/codex-app-server-client.js +156 -0
- package/src/codex-app-server-session.js +572 -0
- package/src/codex-session.js +604 -0
- package/src/config.js +1757 -0
- package/src/connection-info.js +42 -0
- package/src/connection-locality.js +55 -0
- package/src/content-blocks.js +42 -0
- package/src/control-room/byok-pool.js +130 -0
- package/src/control-room/constants.js +26 -0
- package/src/control-room/containers.js +258 -0
- package/src/control-room/emulators.js +279 -0
- package/src/control-room/handler-factory.js +142 -0
- package/src/control-room/host-prune.js +387 -0
- package/src/control-room/integrations.js +929 -0
- package/src/control-room/repo-runtime-config.js +239 -0
- package/src/control-room/repo-set.js +162 -0
- package/src/control-room/runners.js +479 -0
- package/src/control-room/simulators.js +223 -0
- package/src/control-room/skills-inventory.js +303 -0
- package/src/control-room/survey.js +685 -0
- package/src/control-room/wsl.js +182 -0
- package/src/conversation-scanner.js +270 -0
- package/src/conversation-scope.js +52 -0
- package/src/conversation-search.js +216 -0
- package/src/cost-budget-manager.js +190 -0
- package/src/credential-cipher.js +179 -0
- package/src/credential-store.js +786 -0
- package/src/credential-test.js +145 -0
- package/src/credentials-file.js +58 -0
- package/src/dashboard-next/dist/assets/index-C2ipeGlq.js +111 -0
- package/src/dashboard-next/dist/assets/index-DM-_dISG.css +1 -0
- package/src/dashboard-next/dist/index.html +13 -0
- package/src/deepseek-credentials.js +58 -0
- package/src/deepseek-session.js +192 -0
- package/src/detect-thinking-keyword.js +67 -0
- package/src/dev-preview.js +227 -0
- package/src/devcontainer-config.js +269 -0
- package/src/device-preferences.js +267 -0
- package/src/diagnostics.js +187 -0
- package/src/diff-parser.js +157 -0
- package/src/discord-credentials.js +188 -0
- package/src/discord-pair-delivery.js +113 -0
- package/src/docker-byok-pool-stats.js +221 -0
- package/src/docker-byok-pool.js +841 -0
- package/src/docker-byok-session.js +2172 -0
- package/src/docker-image-allowlist.js +99 -0
- package/src/docker-sdk-session.js +396 -0
- package/src/docker-session.js +382 -0
- package/src/doctor-billing.js +179 -0
- package/src/doctor.js +667 -0
- package/src/duration.js +77 -0
- package/src/environment-manager.js +753 -0
- package/src/environment-statuses.js +20 -0
- package/src/environments/backends/docker.js +931 -0
- package/src/environments/backends/k8s.js +3030 -0
- package/src/environments/backends/rancher.js +326 -0
- package/src/environments/backends/types.js +332 -0
- package/src/event-ingest.js +546 -0
- package/src/event-normalizer.js +1083 -0
- package/src/external-session-registry.js +0 -0
- package/src/file-store.js +52 -0
- package/src/gemini-session.js +498 -0
- package/src/get-public-ip.js +52 -0
- package/src/git.js +15 -0
- package/src/github-webhook.js +256 -0
- package/src/handler-utils.js +663 -0
- package/src/handlers/checkpoint-handlers.js +202 -0
- package/src/handlers/control-room-handlers.js +1945 -0
- package/src/handlers/conversation-handlers.js +201 -0
- package/src/handlers/credential-handlers.js +247 -0
- package/src/handlers/evaluator-handlers.js +94 -0
- package/src/handlers/feature-handlers.js +332 -0
- package/src/handlers/file-handlers.js +142 -0
- package/src/handlers/ide-handlers.js +238 -0
- package/src/handlers/input-handlers.js +1048 -0
- package/src/handlers/pairing-handlers.js +94 -0
- package/src/handlers/repo-handlers.js +295 -0
- package/src/handlers/session-handlers.js +660 -0
- package/src/handlers/settings-handlers.js +818 -0
- package/src/handlers/skills-handlers.js +682 -0
- package/src/handlers/summarize-handlers.js +172 -0
- package/src/handlers/token-handlers.js +57 -0
- package/src/http-oversize.js +51 -0
- package/src/http-routes.js +1158 -0
- package/src/ide/search.js +268 -0
- package/src/ide/symbols.js +423 -0
- package/src/ip-utils.js +85 -0
- package/src/json-state-file.js +169 -0
- package/src/jsonl-reader.js +187 -0
- package/src/jsonl-subprocess-session.js +441 -0
- package/src/keychain.js +458 -0
- package/src/lan-ip.js +38 -0
- package/src/logger.js +388 -0
- package/src/mailbox-route.js +252 -0
- package/src/mcp-tools.js +46 -0
- package/src/message-transform.js +102 -0
- package/src/metrics.js +67 -0
- package/src/model-discovery.js +288 -0
- package/src/models.js +1426 -0
- package/src/notification-prefs.js +544 -0
- package/src/notifications/discord-billing-sink.js +323 -0
- package/src/notifications/discord-webhook-client.js +187 -0
- package/src/notifications/discord-webhook-sink.js +768 -0
- package/src/notifications/expo-push-sink.js +414 -0
- package/src/notifications/ready-body.js +177 -0
- package/src/notifications/sink-registry.js +98 -0
- package/src/notifications/sink.js +82 -0
- package/src/ollama-session.js +221 -0
- package/src/ollama-tags.js +238 -0
- package/src/openai-compatible-session.js +118 -0
- package/src/pages-store.js +255 -0
- package/src/pairing.js +836 -0
- package/src/path-hash-trust-ledger.js +311 -0
- package/src/per-session-settings.js +366 -0
- package/src/permission-audit.js +120 -0
- package/src/permission-hook.js +257 -0
- package/src/permission-manager.js +829 -0
- package/src/permission-resolver.js +144 -0
- package/src/platform.js +139 -0
- package/src/prompt-evaluator.js +386 -0
- package/src/providers.js +436 -0
- package/src/push.js +565 -0
- package/src/rate-limiter.js +433 -0
- package/src/redaction.js +206 -0
- package/src/sdk-session.js +1773 -0
- package/src/semver.js +92 -0
- package/src/server-cli/push-notification-handler.js +240 -0
- package/src/server-cli/server-orchestrator.js +168 -0
- package/src/server-cli/startup-display.js +146 -0
- package/src/server-cli/tunnel-lifecycle-handler.js +219 -0
- package/src/server-cli-child.js +207 -0
- package/src/server-cli.js +1223 -0
- package/src/server-identity.js +383 -0
- package/src/service.js +835 -0
- package/src/session-context.js +49 -0
- package/src/session-lock.js +60 -0
- package/src/session-manager.js +3257 -0
- package/src/session-message-history.js +511 -0
- package/src/session-preset-trust.js +78 -0
- package/src/session-preset.js +458 -0
- package/src/session-state-persistence.js +307 -0
- package/src/session-timeout-manager.js +166 -0
- package/src/session-token-store.js +83 -0
- package/src/shell-approval-info.js +45 -0
- package/src/shell-approval-store.js +163 -0
- package/src/shell-audit.js +63 -0
- package/src/skills-budget.js +181 -0
- package/src/skills-content-validator.js +106 -0
- package/src/skills-frontmatter.js +422 -0
- package/src/skills-loader.js +1893 -0
- package/src/skills-manager.js +256 -0
- package/src/skills-trust.js +532 -0
- package/src/skills-usage.js +335 -0
- package/src/snapshots-store.js +345 -0
- package/src/ssrf-guard.js +130 -0
- package/src/subagent-counter.js +149 -0
- package/src/summarize-session.js +268 -0
- package/src/supervisor.js +929 -0
- package/src/test-client.js +131 -0
- package/src/token-compare.js +28 -0
- package/src/token-manager.js +220 -0
- package/src/tool-result.js +87 -0
- package/src/transcript-tasks.js +334 -0
- package/src/tunnel/base.js +294 -0
- package/src/tunnel/cloudflare.js +281 -0
- package/src/tunnel/index.js +54 -0
- package/src/tunnel-check.js +84 -0
- package/src/turn-tracker.js +0 -0
- package/src/user-shell-registry.js +218 -0
- package/src/user-shell-session.js +411 -0
- package/src/utils/check-dependencies.js +70 -0
- package/src/utils/concurrency.js +24 -0
- package/src/utils/context-window-learn.js +148 -0
- package/src/utils/error-message.js +25 -0
- package/src/utils/format-bytes.js +35 -0
- package/src/utils/preflight.js +143 -0
- package/src/utils/resolve-binary.js +91 -0
- package/src/utils/respawn-rate-limiter.js +59 -0
- package/src/utils/sleep.js +58 -0
- package/src/utils/spawn-env.js +193 -0
- package/src/utils/validation-patterns.js +23 -0
- package/src/utils/win-spawn.js +98 -0
- package/src/version-check.js +16 -0
- package/src/web-task-manager.js +383 -0
- package/src/worktree-gc.js +418 -0
- package/src/worktree-reaper.js +168 -0
- package/src/ws-auth.js +645 -0
- package/src/ws-broadcaster.js +385 -0
- package/src/ws-client-manager.js +476 -0
- package/src/ws-client-sender.js +115 -0
- package/src/ws-file-ops/browser.js +594 -0
- package/src/ws-file-ops/common.js +163 -0
- package/src/ws-file-ops/git.js +298 -0
- package/src/ws-file-ops/index.js +52 -0
- package/src/ws-file-ops/reader.js +595 -0
- package/src/ws-forwarding.js +543 -0
- package/src/ws-handler-context.js +196 -0
- package/src/ws-history.js +1251 -0
- package/src/ws-message-handlers.js +165 -0
- package/src/ws-permissions.js +676 -0
- package/src/ws-schemas.js +119 -0
- package/src/ws-server.js +2866 -0
package/CONFIG.md
ADDED
|
@@ -0,0 +1,695 @@
|
|
|
1
|
+
# Configuration Guide
|
|
2
|
+
|
|
3
|
+
Chroxy supports configuration from multiple sources with a clear precedence order.
|
|
4
|
+
|
|
5
|
+
## Precedence Order
|
|
6
|
+
|
|
7
|
+
Configuration values are resolved in the following order (highest priority first):
|
|
8
|
+
|
|
9
|
+
1. **CLI flags** - Command-line options passed to `npx chroxy start`
|
|
10
|
+
2. **Environment variables** - System environment variables
|
|
11
|
+
3. **Config file** - `~/.chroxy/config.json` (created with `npx chroxy init`)
|
|
12
|
+
4. **Defaults** - Built-in default values
|
|
13
|
+
|
|
14
|
+
## Configuration Keys
|
|
15
|
+
|
|
16
|
+
| Key | Type | CLI Flag | Environment Variable | Description |
|
|
17
|
+
|-----|------|----------|---------------------|-------------|
|
|
18
|
+
| `apiToken` | string | - | `API_TOKEN` | Authentication token for clients |
|
|
19
|
+
| `sessionTokenTtl` | string | - | `CHROXY_SESSION_TOKEN_TTL` | *(default `30d`)* How long a paired device's session token stays valid without reconnecting (#6598). **Sliding** — each successful connect refreshes it, so only an *idle* device expires. A duration string (`30d`, `15d`, `12h`); floored at 5 min. Tokens are persisted encrypted at rest (`~/.chroxy/session-tokens.json`), so they now survive daemon restarts. Longer = fewer re-pairs but a wider stolen-token window; you own the dial. |
|
|
20
|
+
| `port` | number | - | `PORT` | Local WebSocket port (default: 8765) |
|
|
21
|
+
| `host` | string | `--host <address>` | `CHROXY_HOST` | Bind address for the server socket. Unset binds `0.0.0.0` (all interfaces) so the mobile app / LAN clients can reach it. Set to `127.0.0.1` for a loopback-only bind that keeps auth enabled — opt-in defence-in-depth for single-device setups. `--no-auth` always forces loopback regardless of this key. When bound to loopback the mDNS `_chroxy._tcp` advertisement is suppressed (the server is not LAN-reachable). |
|
|
22
|
+
| `provider` | string | `--provider <name>` | `CHROXY_PROVIDER` | Default session backend. Allowed values: `claude-tui` (default, #5819), `claude-sdk`, `claude-cli`, `claude-channel` (research preview), `gemini`, `codex`, plus `docker-sdk` / `docker-cli` when Docker environments are enabled. The `claude-channel` provider is a research-preview scaffold whose `start()` currently throws — selectable for `chroxy doctor` / registry inspection but not yet runnable (bridge lands in #3954). See [../../docs/providers.md](../../docs/providers.md) for per-provider setup, env vars (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, …), and the capability matrix. |
|
|
23
|
+
| `shell` | string | - | `SHELL_CMD` | Shell to use (default: `$SHELL` or `/bin/zsh`) |
|
|
24
|
+
| `cwd` | string | `--cwd <path>` | `CHROXY_CWD` | Working directory (CLI mode) |
|
|
25
|
+
| `model` | string | `--model <name>` | `CHROXY_MODEL` | Model to use. Provider-specific — e.g. `claude-sonnet-4`/`haiku` for Claude, `gemini-2.5-pro` for Gemini, `gpt-5.4` for Codex. |
|
|
26
|
+
| `allowedTools` | array | `--allowed-tools <list>` | `CHROXY_ALLOWED_TOOLS` | Auto-approved tools (CLI mode) |
|
|
27
|
+
| `noAuth` | boolean | `--no-auth` | `CHROXY_NO_AUTH` | Disable authentication (localhost only) |
|
|
28
|
+
| `costBudget` | number | `--cost-budget <dollars>` | `CHROXY_COST_BUDGET` | Per-session cost budget in dollars. Applied independently to each session (not a shared pool across sessions). Warns at 80%, pauses the session at 100%. |
|
|
29
|
+
| `providers` | array \| object | - | `CHROXY_PROVIDERS` | Two forms. **Array** (legacy, written by `chroxy init`): informational list of provider ids the user opted into. **Object** (#5419): `providers.anthropicCompatible` is an array of config-driven Anthropic-compatible endpoint entries (Z.ai GLM, Moonshot Kimi, MiniMax, LM Studio, llama.cpp, vLLM, OpenRouter, custom) — each entry `{ id, label?, baseUrl, apiKeyEnv?, credentialsKey?, defaultModel, models?, pricing?, contextWindow? }` registers a first-class provider at startup, selectable via `provider` / `--provider <id>`. API keys are **never** inlined: `apiKeyEnv` names an env var, `credentialsKey` names a `~/.chroxy/credentials.json` field (mode `0600`); entries carrying literal secrets are rejected. Invalid entries are warned about and skipped; valid siblings still register. See [Anthropic-compatible endpoints](../../docs/providers.md#anthropic-compatible-endpoints-config-driven). |
|
|
30
|
+
| `promptEvaluatorSkipPattern` | string | - | - | Per-session regex source (case-insensitive) extending the default skip list used by the prompt evaluator's trivial-message heuristic. See [Prompt evaluator skip heuristic](#prompt-evaluator-skip-heuristic) below. |
|
|
31
|
+
| `maxSkillBytes` | number | - | - | Per-skill byte cap. Skills exceeding this size are rejected with a sanitised log warning. Default `32768` (32KB). Set to `0` to disable the per-skill cap. |
|
|
32
|
+
| `maxTotalSkillBytes` | number | - | - | Global skills-context budget. When a session's merged active-skill set exceeds this size, lower-priority skills are dropped first (frontmatter `priority` defaults to 100; ties broken alphabetically). Default `262144` (256KB). Set to `0` to disable the global cap. |
|
|
33
|
+
| `providerSkillAllowlist` | object | - | - | Per-provider skill allowlist. Object keyed by provider id (e.g. `codex`, `gemini`); each value is an array of skill names that may load for that provider. See [Per-provider skill allowlist](#per-provider-skill-allowlist) below. |
|
|
34
|
+
| `trustMismatchMode` | string | - | - | One of `warn` or `block`. When set, the server records a SHA-256 hash of every loaded skill on first activation and compares it on every subsequent load. See [Skill content-hash trust](#skill-content-hash-trust) below. Disabled (no hashing) when omitted. |
|
|
35
|
+
| `dangerouslySkipPermissions` | boolean | `--dangerously-skip-permissions` | `CHROXY_DANGEROUSLY_SKIP_PERMISSIONS` | Server-wide default for the per-session skip-permissions flag (#4246, #4384). Honoured only by the `claude-tui` provider — spawns claude with `--dangerously-skip-permissions` and elides chroxy's permission hook. Off by default. Legacy alias `skipPermissions` (config key) and `CHROXY_SKIP_PERMISSIONS` (env var) are still honoured for one deprecation window and emit a warning at boot — rename to the canonical key. See [Skip permissions (TUI provider)](#skip-permissions-tui-provider) below. |
|
|
36
|
+
| `resultTimeoutMs` | number | - | `CHROXY_RESULT_TIMEOUT_MS` | Per-session **soft-warning** inactivity window in milliseconds. When no SDK / CLI event arrives within this window, the server emits an `inactivity_warning` event (#3899) so clients can render a check-in chip and surface a push notification — the session stays alive. The kill path is `hardTimeoutMs` (below). See [Inactivity safety net](#inactivity-safety-net). Default `1800000` (30 min); range `30000`–`86400000` (30 s – 24 h). |
|
|
37
|
+
| `hardTimeoutMs` | number | - | `CHROXY_HARD_TIMEOUT_MS` | Per-session **hard-kill** inactivity window in milliseconds. When `resultTimeoutMs` has already fired and silence continues to this longer threshold, the server emits `permission_expired` for every outstanding permission prompt, force-clears busy state, and emits a generic `error` event with `"Response timed out after <duration> of inactivity"` (#3899). Default `7200000` (2 h); range `30000`–`86400000` (30 s – 24 h). Must be ≥ `resultTimeoutMs` or the soft warning never fires — validator warns. |
|
|
38
|
+
| `backgroundShellHardQuiesceMs` | number | - | `CHROXY_BACKGROUND_SHELL_HARD_QUIESCE_MS` | How long a background shell (`Bash` with `run_in_background: true`) may go with **no new output** before the server treats it as finished and **reaps** its liveness tracking, so a finished-but-never-polled command stops pinning the session `running` forever (#5265). Default `14400000` (4 h); range `60000`–`86400000` (60 s – 24 h), or **`0` to disable** hard-reaping (advisory-only, the #5247 behaviour). **Tradeoff:** a genuinely long-running compute that emits no output for hours (and is never polled via `BashOutput`) could have its tracking reaped and the session become idle-timeout-eligible. A noisy long-runner (e.g. a dev server logging within the window) keeps its output-file mtime fresh and is never reaped. Operators running long silent computes should raise this (e.g. 6–8 h) or set `0`. |
|
|
39
|
+
| _(env-only)_ | number | - | `CHROXY_DIAGNOSTICS_RATE_LIMIT` | Per-source-IP request cap on `GET /diagnostics` over a 60 s sliding window (#3737). The endpoint reads the on-disk log tail and iterates every session per call, so it is rate-limited to protect against a stolen-token tight loop. Default `12` requests/min with a 4-request burst. Set the env var to an **integer ≥ 1** to override `maxMessages`; the burst auto-derives as `max(1, floor(N/3))`. Invalid values (non-integer, < 1, NaN) silently fall through to the default — including sub-integer values like `0.5`, which are rejected outright (truncating to `0` would otherwise raise the limit via RateLimiter's `||` fallback). No `config.json` key is exposed; this setting is intentionally env-only. Overshoot returns `429` with a `Retry-After` header and a JSON body `{ "error": "rate limited", "retryAfterMs": <ms> }`. |
|
|
40
|
+
|
|
41
|
+
### Prompt evaluator skip heuristic
|
|
42
|
+
|
|
43
|
+
The prompt evaluator (see #3068) is gated by a fast local heuristic so trivial
|
|
44
|
+
follow-ups (`y`, `go`, `looks good`) don't pay the cost of an Anthropic
|
|
45
|
+
round-trip. A draft message **skips** evaluation when any of the following is
|
|
46
|
+
true:
|
|
47
|
+
|
|
48
|
+
- Length (after trim) is less than 20 characters
|
|
49
|
+
- The trimmed message matches the built-in continuation regex
|
|
50
|
+
(case-insensitive): `^(y|n|yes|no|go|continue|run it|ok|okay|sure|sounds good|looks good|do it)\.?$`
|
|
51
|
+
- The trimmed message matches the per-session
|
|
52
|
+
`promptEvaluatorSkipPattern` regex (also case-insensitive)
|
|
53
|
+
|
|
54
|
+
`promptEvaluatorSkipPattern` is a regex *source string* — for example
|
|
55
|
+
`"^please proceed"` or `"^(ship it|merge it|that's good)$"` — not a literal
|
|
56
|
+
phrase list. The pattern is OR-ed with the default; setting it cannot
|
|
57
|
+
**unblock** evaluation for messages already covered by the default rules. If
|
|
58
|
+
the source fails to compile (unbalanced brackets, etc.) the server logs a
|
|
59
|
+
warning and falls back to the default pattern only.
|
|
60
|
+
|
|
61
|
+
This config is consumed by the auto-evaluator hook (see `shouldSkipEvaluator`
|
|
62
|
+
in `packages/server/src/prompt-evaluator.js`); the on-demand "Evaluate"
|
|
63
|
+
button in the dashboard always evaluates, regardless of this setting.
|
|
64
|
+
|
|
65
|
+
### Per-provider skill allowlist
|
|
66
|
+
|
|
67
|
+
`providerSkillAllowlist` lets operators restrict which skills are eligible to
|
|
68
|
+
load for non-Claude providers (Codex, Gemini, etc.). Claude has its own
|
|
69
|
+
tool-gating layer; Codex and Gemini do not, so a malicious or buggy skill that
|
|
70
|
+
asks them to run a destructive shell command is harder to contain. The
|
|
71
|
+
allowlist scopes the per-session skill set to a known-good list per provider.
|
|
72
|
+
|
|
73
|
+
Shape: an object keyed by provider id (the same string used in the
|
|
74
|
+
`provider` config key); each value is an array of skill names (the file's
|
|
75
|
+
basename without the `.md` / `.markdown` extension).
|
|
76
|
+
|
|
77
|
+
```jsonc
|
|
78
|
+
{
|
|
79
|
+
"providerSkillAllowlist": {
|
|
80
|
+
"codex": ["coding-style", "git-workflow"],
|
|
81
|
+
"gemini": ["coding-style"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Behaviour:
|
|
87
|
+
|
|
88
|
+
- **Allowlist omitted entirely** — legacy permissive: every loaded skill is
|
|
89
|
+
eligible for every provider. Existing setups keep working without change.
|
|
90
|
+
- **Claude-family providers** (`claude-sdk`, `claude-cli`, `docker-sdk`,
|
|
91
|
+
`docker-cli`, bare alias `claude`) — always permissive, even when the
|
|
92
|
+
allowlist is configured. Claude's tool gating is the primary defense.
|
|
93
|
+
- **Non-Claude providers with an entry in the allowlist** — only skills
|
|
94
|
+
whose basename appears in `allowlist[provider]` load. Other skills are
|
|
95
|
+
silently filtered (a sanitised warn is logged for each drop).
|
|
96
|
+
- **Non-Claude providers with no entry, or an empty array** — fail-secure:
|
|
97
|
+
ALL skills are filtered for that provider. An operator who configures
|
|
98
|
+
the allowlist but forgets to add a key for `gemini` should NOT be
|
|
99
|
+
silently permissive.
|
|
100
|
+
|
|
101
|
+
The filter runs after the global+repo merge and before the global byte
|
|
102
|
+
budget, so a deny-listed skill never counts against the budget.
|
|
103
|
+
|
|
104
|
+
### Skill content-hash trust
|
|
105
|
+
|
|
106
|
+
`trustMismatchMode` opts the server into a per-skill SHA-256 ledger so silent
|
|
107
|
+
post-review tampering is detected. On first activation the loader records each
|
|
108
|
+
skill's body hash to `~/.chroxy/skills-trust.json`; on every subsequent load
|
|
109
|
+
the recorded hash is compared against the current body.
|
|
110
|
+
|
|
111
|
+
Modes:
|
|
112
|
+
|
|
113
|
+
- **omitted (default)** — trust check disabled. No hashes are computed or
|
|
114
|
+
written. Behaviour is identical to the pre-#3204 server.
|
|
115
|
+
- **`warn`** — mismatch logs a sanitised warning (basename + 8-char hash
|
|
116
|
+
prefixes; same anti-leak pattern as the rejection warnings) and emits a
|
|
117
|
+
`skill_changed` WS event so a paired dashboard can surface a prompt. The
|
|
118
|
+
skill still loads — operator review is the gate.
|
|
119
|
+
- **`block`** — same warn + event, but the skill is filtered out of the active
|
|
120
|
+
set so a tampered skill stops influencing prompts until the operator
|
|
121
|
+
explicitly re-trusts it.
|
|
122
|
+
|
|
123
|
+
Hash scope: only the body AFTER frontmatter parsing is hashed, so cosmetic
|
|
124
|
+
frontmatter edits (renaming, switching activation mode, adjusting priority)
|
|
125
|
+
don't trigger a mismatch every time. Body edits, deletions, or replacements
|
|
126
|
+
do.
|
|
127
|
+
|
|
128
|
+
The trust file lives at `~/.chroxy/skills-trust.json` and is intentionally a
|
|
129
|
+
sidecar (not folded into `session-state.json`) so it can be inspected
|
|
130
|
+
directly. Format:
|
|
131
|
+
|
|
132
|
+
```jsonc
|
|
133
|
+
{
|
|
134
|
+
"/Users/me/.chroxy/skills/coding-style.md": {
|
|
135
|
+
"sha256": "abc123...",
|
|
136
|
+
"firstSeen": "2026-05-03T12:34:56.000Z",
|
|
137
|
+
"lastVerified": "2026-05-03T12:34:56.000Z"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
A corrupted or missing trust file is treated as empty (fail-open) so a single
|
|
143
|
+
bad write can't lock every skill out of every session.
|
|
144
|
+
|
|
145
|
+
### Skip permissions (TUI provider)
|
|
146
|
+
|
|
147
|
+
`dangerouslySkipPermissions` is a **TUI-only** opt-out from chroxy's permission
|
|
148
|
+
gate. When enabled, sessions on the `claude-tui` provider (the legacy CLI
|
|
149
|
+
session backend that drives the real `claude` TUI through a PTY) are spawned
|
|
150
|
+
with the `--dangerously-skip-permissions` flag and the chroxy permission hook
|
|
151
|
+
is elided entirely. Other providers (`claude-sdk`, `claude-cli`,
|
|
152
|
+
`docker-sdk`/`docker-cli`, `codex`, `gemini`) ignore the flag harmlessly —
|
|
153
|
+
they have their own permission paths and chroxy does not pass this through.
|
|
154
|
+
|
|
155
|
+
**What enabling it actually does:**
|
|
156
|
+
|
|
157
|
+
- Spawns the TUI `claude` binary with `--dangerously-skip-permissions`, so
|
|
158
|
+
Claude itself stops prompting for tool approvals.
|
|
159
|
+
- Skips wiring chroxy's permission hook into the TUI session, so chroxy's own
|
|
160
|
+
permission rule engine never sees a request to gate.
|
|
161
|
+
- Logs a loud `[security]` warning at startup identifying which config key
|
|
162
|
+
surfaced the setting (see below).
|
|
163
|
+
|
|
164
|
+
**Sources, in precedence order** (highest priority first):
|
|
165
|
+
|
|
166
|
+
1. CLI flag: `chroxy start --dangerously-skip-permissions`
|
|
167
|
+
2. Config key: `dangerouslySkipPermissions` (canonical, mirrors the CLI flag name)
|
|
168
|
+
3. Config key: `skipPermissions` (legacy alias — see "Deprecation" below)
|
|
169
|
+
4. Default: `false`
|
|
170
|
+
|
|
171
|
+
Operators running headless deploys can pin the setting in `config.json`:
|
|
172
|
+
|
|
173
|
+
```jsonc
|
|
174
|
+
{
|
|
175
|
+
"dangerouslySkipPermissions": true
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
At boot, when the resolved value is `true`, the server emits:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
[security] dangerouslySkipPermissions=true (source: config.dangerouslySkipPermissions) — claude-tui sessions will spawn with --dangerously-skip-permissions and chroxy's permission gate is BYPASSED for those sessions
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Deprecation: the legacy `skipPermissions` key.**
|
|
186
|
+
|
|
187
|
+
Prior to #4246 the config-file key was `skipPermissions`. That spelling is
|
|
188
|
+
still honoured for one deprecation window so existing config files keep
|
|
189
|
+
working, but the server logs a warning at startup nudging operators to rename
|
|
190
|
+
the key:
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
[security] config key 'skipPermissions' is deprecated — rename it to 'dangerouslySkipPermissions' to match the CLI flag name. Both keys are honoured for now; the legacy key will be removed in a future release.
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
If both keys are present the canonical `dangerouslySkipPermissions` wins as
|
|
197
|
+
the value source, but the deprecation warning is still emitted to nudge
|
|
198
|
+
cleanup of the stale duplicate.
|
|
199
|
+
|
|
200
|
+
**Config-key vs wire-field distinction.**
|
|
201
|
+
|
|
202
|
+
This config key is the **server-wide default** applied to every new session
|
|
203
|
+
that does not specify the setting explicitly. It is distinct from the
|
|
204
|
+
per-session `skipPermissions` field on the WebSocket `create_session`
|
|
205
|
+
message (see `packages/protocol/src/schemas/client.ts`), which lets a single
|
|
206
|
+
session opt in at creation time — for example via the dashboard's TUI-only
|
|
207
|
+
checkbox. The per-session wire field is also `skipPermissions` (matching the
|
|
208
|
+
session-creation API surface) rather than `dangerouslySkipPermissions`; that
|
|
209
|
+
naming is intentional and does not carry the config-file deprecation.
|
|
210
|
+
|
|
211
|
+
When the per-session wire field is omitted, the session inherits the
|
|
212
|
+
server-wide default resolved from this config key. As with the config-file
|
|
213
|
+
flag, the wire field is honoured only by the `claude-tui` provider.
|
|
214
|
+
|
|
215
|
+
**Env var.** The matching environment variable is
|
|
216
|
+
`CHROXY_DANGEROUSLY_SKIP_PERMISSIONS` (canonical) with the deprecated alias
|
|
217
|
+
`CHROXY_SKIP_PERMISSIONS` honoured for the same deprecation window as the
|
|
218
|
+
config-file alias (#4384). Both follow the same precedence as their config-key
|
|
219
|
+
counterparts.
|
|
220
|
+
|
|
221
|
+
### Inactivity safety net
|
|
222
|
+
|
|
223
|
+
A session is protected by a two-stage timer pair (#3899, #3901): a soft
|
|
224
|
+
**warning** window followed by a hard **kill** window. Both fire only when
|
|
225
|
+
the server has heard nothing — no stream delta, no tool event, no result —
|
|
226
|
+
from the SDK / CLI for the configured duration.
|
|
227
|
+
|
|
228
|
+
| Stage | Key | Env var | Default | Behavior |
|
|
229
|
+
|-------|-----|---------|---------|----------|
|
|
230
|
+
| Soft | `resultTimeoutMs` | `CHROXY_RESULT_TIMEOUT_MS` | `1800000` (30 min) | Emits `inactivity_warning` event + push notification. Session stays alive. Clients render a "check in" chip in the activity indicator. |
|
|
231
|
+
| Hard | `hardTimeoutMs` | `CHROXY_HARD_TIMEOUT_MS` | `7200000` (2 h) | Emits `permission_expired` for every outstanding permission request, force-clears busy state, aborts any in-flight SDK query, and emits a generic `error` event (`"Response timed out after <duration> of inactivity"`). Session must be re-driven by the user. |
|
|
232
|
+
|
|
233
|
+
Both fields share the same range (`30000`–`86400000`, 30 s – 24 h) and the
|
|
234
|
+
same WS schema cap (#3768). Values outside the range emit warn-only log
|
|
235
|
+
lines during validation; the runtime applies whatever was set. The
|
|
236
|
+
validator also warns if `hardTimeoutMs < resultTimeoutMs` — the soft
|
|
237
|
+
warning would never fire before the kill.
|
|
238
|
+
|
|
239
|
+
The legacy single-timer value was 5 min (#3749), which proved too aggressive
|
|
240
|
+
for legitimately slow tools (large fetches, long Bash commands, extended
|
|
241
|
+
thinking). The split lets operators keep the **warning** noisy (catch
|
|
242
|
+
genuinely stuck sessions early) while leaving the **kill** generous (don't
|
|
243
|
+
murder a 90-minute Bash build).
|
|
244
|
+
|
|
245
|
+
While a permission prompt is outstanding both timers are paused; on
|
|
246
|
+
resolution they re-arm with their respective windows (#2831, #3757). The
|
|
247
|
+
configured `resultTimeoutMs` is broadcast to clients on the `auth_ok`
|
|
248
|
+
message (#3760), letting the dashboard / app `ActivityIndicator` warn the
|
|
249
|
+
user when a turn is approaching the soft window. The matching
|
|
250
|
+
`inactivity_warning` event payload is `{ messageId, idleMs, prefab }`,
|
|
251
|
+
where `idleMs` is `resultTimeoutMs` and `prefab` is a suggested
|
|
252
|
+
check-in string (`"Status update?"`). Consumed by the dashboard
|
|
253
|
+
check-in chip in #3908 and the mobile chip in #3913. Both
|
|
254
|
+
`resultTimeoutMs` and `hardTimeoutMs` are broadcast as fields on
|
|
255
|
+
`auth_ok` so clients can render both the "approaching soft window"
|
|
256
|
+
warning and a "kill in Xh" countdown against the real configured
|
|
257
|
+
values rather than the BaseSession defaults (#3760, #3905).
|
|
258
|
+
|
|
259
|
+
### Provider selection
|
|
260
|
+
|
|
261
|
+
The `provider` key picks which AI CLI backs a session by default:
|
|
262
|
+
|
|
263
|
+
| Value | Backing binary / SDK | Required env |
|
|
264
|
+
|-------|----------------------|--------------|
|
|
265
|
+
| `claude-tui` (default) | drives the interactive `claude` TUI under a PTY (#5819) | Claude Code subscription login |
|
|
266
|
+
| `claude-sdk` | `@anthropic-ai/claude-agent-sdk` | Claude Code login or `ANTHROPIC_API_KEY` |
|
|
267
|
+
| `claude-cli` | `claude -p` (Claude Code CLI) | Claude Code login (CLI intentionally strips `ANTHROPIC_API_KEY` from its environment) |
|
|
268
|
+
| `claude-channel` *(research preview)* | `claude --channels` (Claude Code CLI, MCP channel transport) | Claude Code subscription login (rejects `ANTHROPIC_API_KEY`). Requires `claude` ≥ 2.1.80 |
|
|
269
|
+
| `gemini` | `gemini -p` CLI | `GEMINI_API_KEY` |
|
|
270
|
+
| `codex` | `codex exec` CLI | `OPENAI_API_KEY` |
|
|
271
|
+
| `docker-sdk` / `docker-cli` | Claude SDK/CLI inside a Docker container | Requires `environments.enabled=true` + Docker |
|
|
272
|
+
|
|
273
|
+
Clients can override the default per-session by passing `provider` in a `create_session` WebSocket message. See [../../docs/providers.md](../../docs/providers.md) for capability differences (plan mode, permission handling, resume, attachments) and troubleshooting.
|
|
274
|
+
|
|
275
|
+
### `claude-channel` (research preview)
|
|
276
|
+
|
|
277
|
+
`claude-channel` drives Claude through Anthropic's first-party **channels MCP
|
|
278
|
+
protocol** (`claude --channels`) instead of scraping the interactive TUI
|
|
279
|
+
(`claude-tui`) or calling the SDK / `claude -p` (`claude-sdk` / `claude-cli`).
|
|
280
|
+
A *channel* is a stdio MCP server that **pushes** events into a running
|
|
281
|
+
interactive `claude` session; chroxy bridges those events onto its normal
|
|
282
|
+
WebSocket/event pipeline. It bills the same way `claude-tui` does — against your
|
|
283
|
+
Claude subscription's **interactive allowance**, bypassing the programmatic
|
|
284
|
+
credit pool — because the events arrive in a real interactive session, not a
|
|
285
|
+
`claude -p` subprocess.
|
|
286
|
+
|
|
287
|
+
> **Status — scaffold only.** As of this writing the provider is a registered
|
|
288
|
+
> scaffold (#3953): it is listed by the registry and runs its `chroxy doctor`
|
|
289
|
+
> preflight, but `start()` throws "not yet implemented". The live bridge
|
|
290
|
+
> (spawn + IPC round-trip) lands in #3954. Selecting `claude-channel` today
|
|
291
|
+
> fails fast with a clear error rather than spawning anything.
|
|
292
|
+
|
|
293
|
+
**When to pick it over `claude-tui` / `claude-sdk`:**
|
|
294
|
+
|
|
295
|
+
- Over **`claude-tui`**: once the bridge lands, the channel transport replaces
|
|
296
|
+
the fragile ANSI-scrape + PTY-keystroke approach with a documented MCP
|
|
297
|
+
contract, and adds **live streaming** plus a **first-party permission relay**
|
|
298
|
+
(Anthropic's `claude/channel/permission`, instead of the sidecar
|
|
299
|
+
`permission-hook.sh`). Same subscription billing surface.
|
|
300
|
+
- Over **`claude-sdk` / `claude-cli`**: pick the channel path (like
|
|
301
|
+
`claude-tui`) only when you want sessions to bill against your Claude.ai Pro /
|
|
302
|
+
Max / Team **subscription** rather than the programmatic credit pool. The SDK
|
|
303
|
+
remains the default and most-featured backend for programmatic billing.
|
|
304
|
+
- It is **not a strict superset of `claude-tui`**: the channel surface does
|
|
305
|
+
**not** expose model switching or permission-mode switching (those stay the
|
|
306
|
+
same gap `claude-tui` has), and resume / plan mode / thinking-level are not in
|
|
307
|
+
the channel contract.
|
|
308
|
+
|
|
309
|
+
**Requirements and caveats:**
|
|
310
|
+
|
|
311
|
+
- **`claude` ≥ 2.1.80.** The `--channels` transport ships from this version
|
|
312
|
+
(the locally-installed CLI used for the spike was v2.1.163). Permission relay
|
|
313
|
+
additionally needs ≥ 2.1.81, but that surface lands with #3955; the scaffold
|
|
314
|
+
preflight gates on the 2.1.80 channel-transport floor only. The dashboard
|
|
315
|
+
picker should disable the option with an explanatory tooltip below 2.1.80
|
|
316
|
+
(deferred — see [`docs/providers.md`](../../docs/providers.md#claude-channel-research-preview)).
|
|
317
|
+
- **`--dangerously-load-development-channels` is required during the preview.**
|
|
318
|
+
Custom (non-allowlisted) channels are not on Anthropic's approved channels
|
|
319
|
+
allowlist, so chroxy must pass this flag to load `chroxy-channel`. The flag
|
|
320
|
+
bypasses **only** the channel allowlist, not org policy. A
|
|
321
|
+
marketplace-approved `chroxy-channel` plugin removes the need for it — see
|
|
322
|
+
[`packages/server/src/channels/PACKAGING.md`](src/channels/PACKAGING.md).
|
|
323
|
+
- **Protocol instability (preview).** Anthropic documents the channels contract
|
|
324
|
+
as a research preview that "may change based on feedback". Treat each Claude
|
|
325
|
+
Code minor bump as a smoke-test trigger for this provider; `claude-tui`
|
|
326
|
+
remains the stable subscription-billed fallback.
|
|
327
|
+
- **Org / platform gating.** Channels are **not** available on Bedrock / Vertex
|
|
328
|
+
/ Foundry, and Team/Enterprise orgs must enable `channelsEnabled` in managed
|
|
329
|
+
settings. `chroxy doctor` surfaces the binary + version preflight; org-policy
|
|
330
|
+
failures surface at session start.
|
|
331
|
+
|
|
332
|
+
For the verified protocol contract, the capability matrix, and the go/no-go
|
|
333
|
+
rationale, see the spike:
|
|
334
|
+
[`docs/architecture/claude-channels-provider-spike.md`](../../docs/architecture/claude-channels-provider-spike.md).
|
|
335
|
+
|
|
336
|
+
### Kubernetes workspace PVC (`environments.k8s.workspace`)
|
|
337
|
+
|
|
338
|
+
When the K8s environment backend is active on a **multi-node** cluster, the
|
|
339
|
+
default `hostPath` workspace mount only works for Pods scheduled on the node
|
|
340
|
+
that owns the host directory — on every other node the Pod silently mounts an
|
|
341
|
+
empty `DirectoryOrCreate` and the workload sees no workspace. To make the
|
|
342
|
+
workspace cluster-wide, K8sBackend supports mounting a pre-provisioned
|
|
343
|
+
`PersistentVolumeClaim` instead (`#3385` / `#4547`).
|
|
344
|
+
|
|
345
|
+
The PVC strategy is **operator-side configuration**: the claim, mount path, and
|
|
346
|
+
read-only flag are cluster-ops concerns that don't vary per project, per
|
|
347
|
+
session, or per user. Set the block once in `~/.chroxy/config.json` and every
|
|
348
|
+
environment created on the K8s backend picks it up automatically (`#4556`).
|
|
349
|
+
|
|
350
|
+
```json
|
|
351
|
+
{
|
|
352
|
+
"environments": {
|
|
353
|
+
"enabled": true,
|
|
354
|
+
"k8s": {
|
|
355
|
+
"workspace": {
|
|
356
|
+
"claimName": "chroxy-workspace-pvc",
|
|
357
|
+
"mountPath": "/workspace",
|
|
358
|
+
"readOnly": false
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
| Field | Type | Required | Default | Notes |
|
|
366
|
+
|-------|------|----------|---------|-------|
|
|
367
|
+
| `claimName` | string | yes | — | Name of a pre-provisioned PVC in the target namespace. Must be a non-empty string. |
|
|
368
|
+
| `mountPath` | string | no | `/workspace` | Pod-side mount path. |
|
|
369
|
+
| `readOnly` | boolean | no | `false` | Mount the PVC read-only. |
|
|
370
|
+
|
|
371
|
+
The block shape is validated at config-load time — a typo (missing `claimName`,
|
|
372
|
+
wrong type) surfaces at startup, not at the first environment-creation call.
|
|
373
|
+
Docker and other non-K8s backends silently ignore the block, so it's safe to
|
|
374
|
+
leave in config when switching backends.
|
|
375
|
+
|
|
376
|
+
Per-create callers (a future dashboard or CLI flag) can pass an explicit
|
|
377
|
+
`workspacePVC` opt to override the configured default for a single environment;
|
|
378
|
+
the per-call value always wins. With no caller override and no config block,
|
|
379
|
+
the manager omits the field entirely and the K8s backend falls back to the
|
|
380
|
+
`hostPath` strategy (single-node clusters).
|
|
381
|
+
|
|
382
|
+
### Kubernetes resource quotas (CPU / memory requests & limits)
|
|
383
|
+
|
|
384
|
+
When the K8s environment backend is active, every Pod it creates carries CPU and
|
|
385
|
+
memory **requests** (what the scheduler reserves and the pod is guaranteed) and
|
|
386
|
+
**limits** (the hard ceiling enforced by the kernel/cgroup). This keeps a single
|
|
387
|
+
runaway session from starving the node (`#3195`).
|
|
388
|
+
|
|
389
|
+
If a `createEnvironment` call does not specify resources, the backend applies
|
|
390
|
+
these built-in defaults:
|
|
391
|
+
|
|
392
|
+
| Dimension | Request | Limit |
|
|
393
|
+
|-----------|---------|-------|
|
|
394
|
+
| CPU | `500m` | `2` |
|
|
395
|
+
| Memory | `512Mi` | `4Gi` |
|
|
396
|
+
|
|
397
|
+
All values are standard [Kubernetes resource quantities](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/):
|
|
398
|
+
CPU as a decimal number or milli-cpu (`500m`, `1`, `2`), memory as a binary-SI
|
|
399
|
+
quantity (`512Mi`, `2Gi`) or bytes. Docker-style memory suffixes (`512m`, `2g`)
|
|
400
|
+
are normalised to their binary-SI equivalents (`512Mi`, `2Gi`). Malformed
|
|
401
|
+
quantities are rejected before any Pod or Secret is created.
|
|
402
|
+
|
|
403
|
+
Per-create callers can override any field via the structured `resources` opt:
|
|
404
|
+
|
|
405
|
+
```js
|
|
406
|
+
await environmentManager.create({
|
|
407
|
+
name: 'big-build',
|
|
408
|
+
cwd: '/path/to/project',
|
|
409
|
+
resources: {
|
|
410
|
+
cpu: '1', // requests.cpu
|
|
411
|
+
memory: '1Gi', // requests.memory
|
|
412
|
+
cpuLimit: '4', // limits.cpu
|
|
413
|
+
memoryLimit: '8Gi' // limits.memory
|
|
414
|
+
},
|
|
415
|
+
})
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Unset fields fall back to the legacy flat `memoryLimit`/`cpuLimit` opts (applied
|
|
419
|
+
to both the request and the limit for that dimension) and then to the defaults
|
|
420
|
+
above. The structured `resources` opt always wins where both are present.
|
|
421
|
+
|
|
422
|
+
Docker and other non-K8s backends ignore the `resources` opt entirely.
|
|
423
|
+
|
|
424
|
+
Operators can also change the cluster-wide defaults when constructing the
|
|
425
|
+
backend: pass `defaultResources` as a partial `{ cpu, memory, cpuLimit,
|
|
426
|
+
memoryLimit }` object (merged over the built-ins) to raise/lower them, or
|
|
427
|
+
`defaultResources: null` to disable defaults so only explicit per-call values
|
|
428
|
+
produce a `resources` block.
|
|
429
|
+
|
|
430
|
+
### Kubernetes per-tenant namespace caps (`ResourceQuota` / `LimitRange`)
|
|
431
|
+
|
|
432
|
+
The pod-level `resources` block above limits each individual Pod. Now that the
|
|
433
|
+
K8s backend gives every tenant their own namespace (`#3194`), you can also set
|
|
434
|
+
**namespace-level** guardrails that apply to the tenant as a whole (`#5142`).
|
|
435
|
+
Both are **opt-in**; when unset the namespace-ensure path is unchanged. They are
|
|
436
|
+
only applied to per-tenant namespaces — never to the static default namespace.
|
|
437
|
+
|
|
438
|
+
**`environments.k8s.namespaceQuota`** ensures an idempotent `ResourceQuota` that
|
|
439
|
+
caps the AGGREGATE resources a tenant may consume across ALL their Pods:
|
|
440
|
+
|
|
441
|
+
```json
|
|
442
|
+
{
|
|
443
|
+
"environments": {
|
|
444
|
+
"backend": "k8s",
|
|
445
|
+
"k8s": {
|
|
446
|
+
"namespaceQuota": {
|
|
447
|
+
"cpu": "8", // aggregate requests.cpu cap
|
|
448
|
+
"memory": "16Gi", // aggregate requests.memory cap
|
|
449
|
+
"cpuLimit": "16", // aggregate limits.cpu cap
|
|
450
|
+
"memoryLimit": "32Gi", // aggregate limits.memory cap
|
|
451
|
+
"pods": 10 // max Pods in the namespace
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
At least one field is required. `cpu`/`memory` map to the aggregate `requests.*`
|
|
459
|
+
keys, `cpuLimit`/`memoryLimit` to the aggregate `limits.*` keys, and `pods` to
|
|
460
|
+
the object-count quota. With a quota in place, Pods that lack their own
|
|
461
|
+
requests/limits will be REJECTED by the cluster — pair it with a `LimitRange`
|
|
462
|
+
(below) or the backend's own `defaultResources` so every Pod carries values.
|
|
463
|
+
|
|
464
|
+
**`environments.k8s.namespaceLimitRange`** ensures an idempotent `LimitRange`
|
|
465
|
+
that supplies cluster-level DEFAULT requests/limits, so Pods created without
|
|
466
|
+
explicit resources inherit namespace defaults (defence-in-depth on top of the
|
|
467
|
+
backend's own `defaultResources`):
|
|
468
|
+
|
|
469
|
+
```json
|
|
470
|
+
{
|
|
471
|
+
"environments": {
|
|
472
|
+
"k8s": {
|
|
473
|
+
"namespaceLimitRange": {
|
|
474
|
+
"cpu": "250m", // defaultRequest.cpu
|
|
475
|
+
"memory": "256Mi", // defaultRequest.memory
|
|
476
|
+
"cpuLimit": "1", // default.cpu (the limit)
|
|
477
|
+
"memoryLimit": "1Gi" // default.memory (the limit)
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
At least one field is required. `cpu`/`memory` become the LimitRange
|
|
485
|
+
`defaultRequest`, while `cpuLimit`/`memoryLimit` become the `default` (limit).
|
|
486
|
+
|
|
487
|
+
Both blocks accept the same quantity grammar as the per-pod `resources` opt
|
|
488
|
+
(CPU as a decimal/milli-cpu string, memory as a binary-SI quantity; Docker-style
|
|
489
|
+
suffixes are normalised). Malformed quantities are rejected at startup. Each
|
|
490
|
+
configured object's ensure is idempotent (read-or-create, already-exists
|
|
491
|
+
swallowed) and cached per process, so it adds one read (plus a create if the
|
|
492
|
+
object is missing) per configured object the first time a tenant namespace is
|
|
493
|
+
used, and nothing on subsequent calls for that namespace.
|
|
494
|
+
|
|
495
|
+
### Discord notifications (`notifications.discord`)
|
|
496
|
+
|
|
497
|
+
The Discord webhook sink (#5413 Phase 2) maintains one status-embed message
|
|
498
|
+
per project in a Discord channel, alongside (or instead of) Expo push. It is
|
|
499
|
+
**off by default** — it activates only when a webhook URL is present.
|
|
500
|
+
|
|
501
|
+
The webhook URL is a **secret** (anyone holding it can post to the channel)
|
|
502
|
+
and is therefore NOT a config key. Provide it via either:
|
|
503
|
+
|
|
504
|
+
- `CHROXY_DISCORD_WEBHOOK_URL` environment variable, or
|
|
505
|
+
- `~/.chroxy/credentials.json` (must be mode `0600`):
|
|
506
|
+
`{ "discordWebhookUrl": "https://discord.com/api/webhooks/<id>/<token>" }`
|
|
507
|
+
|
|
508
|
+
The non-secret knobs live under `notifications.discord` in `config.json`:
|
|
509
|
+
|
|
510
|
+
```json
|
|
511
|
+
{
|
|
512
|
+
"notifications": {
|
|
513
|
+
"discord": {
|
|
514
|
+
"botName": "Chroxy",
|
|
515
|
+
"colors": { "chroxy": 1752220, "my-other-project": 10181046 },
|
|
516
|
+
"defaultColor": 5793266,
|
|
517
|
+
"permissionColor": 16753920,
|
|
518
|
+
"errorColor": 15158332,
|
|
519
|
+
"updateThrottleMs": 15000,
|
|
520
|
+
"heartbeatIntervalMs": 300000,
|
|
521
|
+
"pruneAfterMs": 86400000,
|
|
522
|
+
"billingAlerts": true
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
| Field | Type | Description |
|
|
529
|
+
|-------|------|-------------|
|
|
530
|
+
| `botName` | string | Webhook display name + embed footer label (default `Chroxy`) |
|
|
531
|
+
| `colors` | object | Per-project embed sidebar colors, project name → decimal 24-bit RGB (`0`–`16777215`) |
|
|
532
|
+
| `defaultColor` | number | Sidebar color for projects without an override (default `5793266`, Discord blurple) |
|
|
533
|
+
| `permissionColor` | number | Sidebar color for the needs-approval state (default `16753920`, orange) |
|
|
534
|
+
| `errorColor` | number | Sidebar color for the session-error state (default `15158332`, red) |
|
|
535
|
+
| `updateThrottleMs` | number | Minimum interval between same-state routine embed updates per project (default `15000`; state changes always go out) |
|
|
536
|
+
| `heartbeatIntervalMs` | number | Elapsed-time footer refresh interval for live embeds — offline embeds are final and never re-PATCHed (default `300000`; `0` disables; minimum `10000`) |
|
|
537
|
+
| `pruneAfterMs` | number | Retention for state-store entries: entries untouched longer than this are dropped on load (default `86400000` / 24h; `0` disables; minimum `60000` / 60s — smaller values fall back to the default, since a retention shorter than the gap between events prunes the tracked message id in between and turns the embed into message-per-event spam; the last Discord message is kept). Heartbeat refreshes don't reset the clock — only real pipeline events do |
|
|
538
|
+
| `billingAlerts` | boolean | Kill-switch for the daemon-global billing-alert message (the 2026-06-15 billing canary). Default `true` when a webhook is configured; `false` keeps billing alerts off Discord while the per-project status embed stays on |
|
|
539
|
+
|
|
540
|
+
Status-message state (message ids, current state per project) persists in
|
|
541
|
+
`~/.chroxy/discord-webhook-state.json`; the billing-alert message tracks its own
|
|
542
|
+
id in `~/.chroxy/discord-billing-state.json`. Full setup walkthrough:
|
|
543
|
+
[docs/guides/discord-notifications.md](../../docs/guides/discord-notifications.md).
|
|
544
|
+
|
|
545
|
+
## Examples
|
|
546
|
+
|
|
547
|
+
### Using Config File Only
|
|
548
|
+
|
|
549
|
+
```bash
|
|
550
|
+
npx chroxy init # Creates ~/.chroxy/config.json
|
|
551
|
+
npx chroxy start
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### Overriding with Environment Variables
|
|
555
|
+
|
|
556
|
+
```bash
|
|
557
|
+
PORT=9000 CHROXY_MODEL=opus npx chroxy start
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
### Overriding with CLI Flags
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
npx chroxy start --model haiku --cwd ~/projects/myapp
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Combined Example
|
|
567
|
+
|
|
568
|
+
```bash
|
|
569
|
+
# Config file has: port=8765, model=sonnet
|
|
570
|
+
# Environment has: PORT=9000
|
|
571
|
+
# CLI flag has: --model haiku
|
|
572
|
+
|
|
573
|
+
npx chroxy start --model haiku
|
|
574
|
+
|
|
575
|
+
# Result: port=9000 (ENV), model=haiku (CLI)
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
## Validation
|
|
579
|
+
|
|
580
|
+
Chroxy validates the configuration at startup:
|
|
581
|
+
|
|
582
|
+
- **Unknown keys** in the config file trigger warnings (they are ignored)
|
|
583
|
+
- **Type mismatches** trigger warnings (e.g., port should be a number, not a string)
|
|
584
|
+
- Warnings are non-fatal - the server will still start
|
|
585
|
+
|
|
586
|
+
### Verbose Mode
|
|
587
|
+
|
|
588
|
+
Use `--verbose` to see exactly where each config value comes from:
|
|
589
|
+
|
|
590
|
+
```bash
|
|
591
|
+
npx chroxy start --verbose
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
Output example:
|
|
595
|
+
```
|
|
596
|
+
[config] Configuration sources:
|
|
597
|
+
apiToken = "abc12345..." (config file)
|
|
598
|
+
port = 9000 (ENV)
|
|
599
|
+
model = "haiku" (CLI)
|
|
600
|
+
cwd = "/Users/me/project" (default)
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
## `--no-auth` Trust Model
|
|
604
|
+
|
|
605
|
+
`--no-auth` is a **dev-only** mode. It is intended for running Chroxy against
|
|
606
|
+
loopback while iterating locally. When enabled:
|
|
607
|
+
|
|
608
|
+
- The server binds to `127.0.0.1` only — tunnel startup is skipped (any
|
|
609
|
+
`--tunnel` flag is ignored, with an error logged if one was passed) and
|
|
610
|
+
mDNS/Bonjour advertisement is disabled.
|
|
611
|
+
- Connecting clients are auto-authenticated immediately on WebSocket upgrade,
|
|
612
|
+
without presenting an API token or going through the pairing flow.
|
|
613
|
+
- The token manager, pairing manager, and periodic token rotation are all
|
|
614
|
+
disabled.
|
|
615
|
+
|
|
616
|
+
### Protocol-version assumption
|
|
617
|
+
|
|
618
|
+
Because `--no-auth` skips the auth handshake, the client never advertises its
|
|
619
|
+
protocol version. In that case the server pins the client's effective version
|
|
620
|
+
to its own `SERVER_PROTOCOL_VERSION` so that version-gated broadcasts (for
|
|
621
|
+
example the `server_status` tunnel-warming / ready events that require the
|
|
622
|
+
`TUNNEL_STATUS_MIN_PROTOCOL_VERSION` floor) reach dev clients instead of being
|
|
623
|
+
silently filtered out.
|
|
624
|
+
|
|
625
|
+
**The assumption is: a client connecting to a `--no-auth` dev server is built
|
|
626
|
+
from the same commit as the server and therefore speaks
|
|
627
|
+
`SERVER_PROTOCOL_VERSION`.** The server trusts itself and its local clients.
|
|
628
|
+
This is correct for the intended use — a freshly-built dashboard, app, or
|
|
629
|
+
`test-client.js` on the same developer machine.
|
|
630
|
+
|
|
631
|
+
**Known limitation:** if a stale-build client (shipped before a protocol
|
|
632
|
+
version bump) connects to a newer `--no-auth` dev server, it will receive
|
|
633
|
+
message shapes it cannot parse and may mis-render them. Rebuild the client
|
|
634
|
+
against the same commit as the server when you hit this. This is why
|
|
635
|
+
`--no-auth` is gated to loopback and why it must **not** be broadened to
|
|
636
|
+
remote fleets (CI runners, containerised test rigs reachable off-host, shared
|
|
637
|
+
dev hosts) without first reintroducing a protocol-version negotiation step
|
|
638
|
+
for un-authenticated clients.
|
|
639
|
+
|
|
640
|
+
### Operational guardrails
|
|
641
|
+
|
|
642
|
+
- `--no-auth` forces loopback-only binding and skips tunnel startup, so the
|
|
643
|
+
server cannot be accidentally exposed to the public internet while auth is
|
|
644
|
+
off. A warning is logged at startup, and an additional error is logged if
|
|
645
|
+
a `--tunnel` flag was also passed.
|
|
646
|
+
- `chroxy dev` refuses to start with `noAuth: true` — the supervised dev
|
|
647
|
+
workflow always requires a token.
|
|
648
|
+
|
|
649
|
+
## Best Practices
|
|
650
|
+
|
|
651
|
+
1. **Keep secrets in config file or environment variables** - Don't pass `--api-token` as a CLI flag (it would be visible in process lists)
|
|
652
|
+
2. **Use environment variables for deployment-specific values** - port, working directory, model selection
|
|
653
|
+
3. **Use CLI flags for one-off overrides** - testing different models, changing working directory temporarily
|
|
654
|
+
4. **Run `npx chroxy config`** to see your current config file contents
|
|
655
|
+
5. **Treat `--no-auth` as dev-only** - see the [`--no-auth` Trust Model](#--no-auth-trust-model) section above. Never pair `--no-auth` with a tunnel or a non-loopback bind.
|
|
656
|
+
|
|
657
|
+
## Troubleshooting
|
|
658
|
+
|
|
659
|
+
### Unknown key warnings
|
|
660
|
+
|
|
661
|
+
If you see warnings like:
|
|
662
|
+
```
|
|
663
|
+
⚠ Configuration warnings:
|
|
664
|
+
- Unknown config key: 'maxConnections' (will be ignored)
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
This means your config file contains keys that Chroxy doesn't recognize. They will be ignored. Check for typos or remove unused keys.
|
|
668
|
+
|
|
669
|
+
### Type mismatch warnings
|
|
670
|
+
|
|
671
|
+
If you see warnings like:
|
|
672
|
+
```
|
|
673
|
+
⚠ Configuration warnings:
|
|
674
|
+
- Invalid type for 'port': expected number, got string
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
Fix the type in your config file:
|
|
678
|
+
```json
|
|
679
|
+
{
|
|
680
|
+
"port": 8765, // number, not "8765" string
|
|
681
|
+
"resume": true // boolean, not "true" string
|
|
682
|
+
}
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
### Config not found
|
|
686
|
+
|
|
687
|
+
If you see:
|
|
688
|
+
```
|
|
689
|
+
❌ No config found. Run 'npx chroxy init' first.
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
Run `npx chroxy init` to create the config file, or specify a custom path:
|
|
693
|
+
```bash
|
|
694
|
+
npx chroxy start --config /path/to/config.json
|
|
695
|
+
```
|