@chroxy/server 0.10.0 → 0.11.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.
Files changed (160) hide show
  1. package/CONFIG.md +411 -14
  2. package/hooks/permission-hook.sh +253 -3
  3. package/package.json +8 -15
  4. package/sidecar/node_modules/.package-lock.json +29 -0
  5. package/sidecar/node_modules/ws/LICENSE +20 -0
  6. package/sidecar/node_modules/ws/README.md +548 -0
  7. package/sidecar/node_modules/ws/browser.js +8 -0
  8. package/sidecar/node_modules/ws/index.js +22 -0
  9. package/sidecar/node_modules/ws/lib/buffer-util.js +131 -0
  10. package/sidecar/node_modules/ws/lib/constants.js +19 -0
  11. package/sidecar/node_modules/ws/lib/event-target.js +292 -0
  12. package/sidecar/node_modules/ws/lib/extension.js +203 -0
  13. package/sidecar/node_modules/ws/lib/limiter.js +55 -0
  14. package/sidecar/node_modules/ws/lib/permessage-deflate.js +528 -0
  15. package/sidecar/node_modules/ws/lib/receiver.js +706 -0
  16. package/sidecar/node_modules/ws/lib/sender.js +602 -0
  17. package/sidecar/node_modules/ws/lib/stream.js +161 -0
  18. package/sidecar/node_modules/ws/lib/subprotocol.js +62 -0
  19. package/sidecar/node_modules/ws/lib/validation.js +152 -0
  20. package/sidecar/node_modules/ws/lib/websocket-server.js +554 -0
  21. package/sidecar/node_modules/ws/lib/websocket.js +1393 -0
  22. package/sidecar/node_modules/ws/package.json +70 -0
  23. package/sidecar/node_modules/ws/wrapper.mjs +21 -0
  24. package/src/base-session.js +151 -6
  25. package/src/billing-budget.js +5 -1
  26. package/src/binary-provenance-trust.js +95 -0
  27. package/src/built-in-tools/file-ops.js +5 -4
  28. package/src/byok-mcp-client.js +1061 -13
  29. package/src/byok-mcp-config.js +1201 -4
  30. package/src/byok-mcp-fleet.js +374 -29
  31. package/src/byok-mcp-oauth-store.js +327 -0
  32. package/src/byok-mcp-oauth.js +635 -0
  33. package/src/byok-mcp-trust.js +254 -37
  34. package/src/byok-session.js +789 -13
  35. package/src/byok-tool-executor.js +20 -13
  36. package/src/checkpoint-manager.js +33 -6
  37. package/src/chroxy-host-metadata.js +122 -0
  38. package/src/claude-stream-parser.js +56 -0
  39. package/src/claude-tui/pty-driver.js +54 -14
  40. package/src/claude-tui-session.js +106 -7
  41. package/src/cli/config-cmd.js +2 -2
  42. package/src/cli/deploy-cmd.js +1 -1
  43. package/src/cli/init-cmd.js +1 -1
  44. package/src/cli/providers-cmd.js +3 -3
  45. package/src/cli/schedule-cmd.js +775 -0
  46. package/src/cli/server-cmd.js +16 -1
  47. package/src/cli/service-cmd.js +39 -19
  48. package/src/cli/shared.js +7 -4
  49. package/src/cli/tokens-cmd.js +213 -0
  50. package/src/cli/tunnel-cmd.js +1 -1
  51. package/src/cli-session.js +66 -10
  52. package/src/cli.js +4 -0
  53. package/src/codex-app-server-session.js +671 -39
  54. package/src/codex-session.js +121 -18
  55. package/src/config.js +453 -27
  56. package/src/control-room/integrations.js +16 -10
  57. package/src/control-room/skills-inventory.js +6 -1
  58. package/src/control-room/survey.js +32 -0
  59. package/src/credential-store.js +256 -10
  60. package/src/dashboard-next/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  61. package/src/diagnostics.js +3 -0
  62. package/src/docker-sdk-session.js +16 -1
  63. package/src/docker-session.js +9 -0
  64. package/src/doctor.js +19 -8
  65. package/src/environments/backends/docker.js +8 -0
  66. package/src/environments/backends/k8s.js +9 -0
  67. package/src/event-ingest.js +19 -1
  68. package/src/event-normalizer.js +354 -19
  69. package/src/external-session-registry.js +0 -0
  70. package/src/gemini-session.js +19 -2
  71. package/src/github-webhook.js +188 -4
  72. package/src/handler-utils.js +42 -8
  73. package/src/handlers/checkpoint-handlers.js +126 -19
  74. package/src/handlers/control-room-handlers.js +48 -18
  75. package/src/handlers/conversation-handlers.js +127 -2
  76. package/src/handlers/credential-handlers.js +43 -2
  77. package/src/handlers/file-handlers.js +47 -3
  78. package/src/handlers/github-webhook-handlers.js +204 -0
  79. package/src/handlers/input-handlers.js +4 -0
  80. package/src/handlers/orchestration-handlers.js +238 -0
  81. package/src/handlers/scheduler-handlers.js +510 -0
  82. package/src/handlers/session-handlers.js +10 -2
  83. package/src/handlers/settings-handlers.js +510 -11
  84. package/src/handlers/token-handlers.js +11 -2
  85. package/src/http-routes.js +159 -0
  86. package/src/jsonl-reader.js +60 -6
  87. package/src/jsonl-subprocess-session.js +35 -6
  88. package/src/keychain.js +159 -12
  89. package/src/logger.js +182 -19
  90. package/src/notification-prefs.js +88 -6
  91. package/src/notifications/discord-webhook-sink.js +30 -1
  92. package/src/orchestration/build-manager.js +56 -0
  93. package/src/orchestration/decision-contract.js +245 -0
  94. package/src/orchestration/git-ops.js +347 -0
  95. package/src/orchestration/orchestration-manager.js +1295 -0
  96. package/src/orchestration/permission-gate.js +109 -0
  97. package/src/orchestration/role-prompts.js +136 -0
  98. package/src/orchestration/run-budget.js +81 -0
  99. package/src/orchestration/run-ledger.js +487 -0
  100. package/src/orchestration/run-model.js +205 -0
  101. package/src/orchestration/run-record.js +336 -0
  102. package/src/orchestration/run-report.js +194 -0
  103. package/src/orchestration/to-wire.js +201 -0
  104. package/src/orchestration/turn-driver.js +398 -0
  105. package/src/pairing.js +146 -1
  106. package/src/permission-audit.js +79 -3
  107. package/src/permission-floor.js +455 -0
  108. package/src/permission-manager.js +492 -40
  109. package/src/permission-resolver.js +55 -7
  110. package/src/permission-rule-store.js +411 -0
  111. package/src/platform.js +367 -23
  112. package/src/providers.js +21 -2
  113. package/src/schedule-parser.js +311 -0
  114. package/src/scheduled-task-store.js +653 -0
  115. package/src/scheduler.js +1029 -0
  116. package/src/sdk-session.js +338 -5
  117. package/src/server-cli/server-orchestrator.js +23 -0
  118. package/src/server-cli/tunnel-lifecycle-handler.js +3 -2
  119. package/src/server-cli.js +238 -26
  120. package/src/server-identity.js +28 -4
  121. package/src/service.js +291 -33
  122. package/src/session-manager.js +417 -25
  123. package/src/session-message-history.js +27 -21
  124. package/src/session-title.js +168 -0
  125. package/src/session-token-store.js +60 -35
  126. package/src/skills-usage.js +20 -2
  127. package/src/statusline.js +584 -0
  128. package/src/subagent-counter.js +9 -1
  129. package/src/supervisor.js +77 -27
  130. package/src/token-manager.js +39 -9
  131. package/src/transcript-tasks.js +41 -6
  132. package/src/tunnel/cloudflare.js +115 -8
  133. package/src/tunnel/index.js +4 -1
  134. package/src/tunnel-check.js +1 -1
  135. package/src/turn-tracker.js +0 -0
  136. package/src/usage-normalize.js +118 -0
  137. package/src/user-shell-session.js +98 -32
  138. package/src/utils/componentwise-resolver.js +205 -0
  139. package/src/utils/composite-key.js +45 -0
  140. package/src/utils/iso-datetime.js +51 -0
  141. package/src/utils/preflight.js +140 -28
  142. package/src/utils/spawn-env.js +8 -2
  143. package/src/utils/verify-binary.js +276 -0
  144. package/src/utils/verify-provenance.js +241 -0
  145. package/src/utils/wire-counters.js +48 -0
  146. package/src/worktree-gc.js +4 -1
  147. package/src/ws-file-ops/browser.js +42 -11
  148. package/src/ws-file-ops/common.js +68 -1
  149. package/src/ws-file-ops/git.js +221 -3
  150. package/src/ws-file-ops/index.js +5 -0
  151. package/src/ws-file-ops/memory.js +358 -0
  152. package/src/ws-file-ops/reader.js +124 -0
  153. package/src/ws-forwarding.js +44 -16
  154. package/src/ws-handler-context.js +19 -0
  155. package/src/ws-history.js +84 -11
  156. package/src/ws-message-handlers.js +6 -0
  157. package/src/ws-outbound-schemas.js +207 -0
  158. package/src/ws-permissions.js +285 -4
  159. package/src/ws-schemas.js +1 -0
  160. package/src/ws-server.js +301 -17
package/CONFIG.md CHANGED
@@ -13,30 +13,219 @@ Configuration values are resolved in the following order (highest priority first
13
13
 
14
14
  ## Configuration Keys
15
15
 
16
+ Every key below is a real entry in `CONFIG_SCHEMA`
17
+ ([`packages/server/src/config.js`](src/config.js)) — that object is the
18
+ authoritative list, and anything not in it triggers an `Unknown config key`
19
+ warning at startup and is ignored.
20
+
21
+ The tables are grouped for readability only; every key lives at the **top level**
22
+ of `~/.chroxy/config.json` regardless of which group it appears in.
23
+
24
+ ### Core server
25
+
16
26
  | Key | Type | CLI Flag | Environment Variable | Description |
17
27
  |-----|------|----------|---------------------|-------------|
18
28
  | `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) |
29
+ | `port` | number | - | `PORT` | Local WebSocket port (default: 8765). Range `1`–`65535`. |
21
30
  | `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
31
  | `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
32
  | `noAuth` | boolean | `--no-auth` | `CHROXY_NO_AUTH` | Disable authentication (localhost only) |
33
+ | `externalUrl` | string | - | `CHROXY_EXTERNAL_URL` | Public URL clients should use instead of a Cloudflare tunnel — for operators who front the daemon with their own reverse proxy / VPN / ingress. When set, tunnel startup **and** the supervisor are skipped. Must parse as a URL with an `http:` or `https:` scheme; a malformed value warns at startup. |
34
+ | `showToken` | boolean | `--show-token` | `CHROXY_SHOW_TOKEN` | Print the full API token in the terminal connect block instead of a masked prefix. Off by default so a shared screen / recorded terminal doesn't leak the token. |
35
+ | `logFormat` | string | `--log-format <format>` | `CHROXY_LOG_FORMAT` | Log output format: `text` (default) or `json`. Any value other than the literal `json` keeps the human-readable text logger. |
36
+ | `maxRestarts` | number | `--max-restarts <count>` | `CHROXY_MAX_RESTARTS` | Max consecutive child restarts the supervisor attempts before giving up and exiting (default `10`). Only applies in supervisor mode (the default for `chroxy start` with a tunnel). |
37
+ | `terminalDownGraceMs` | number | - | `CHROXY_TERMINAL_DOWN_GRACE_MS` | How long the supervisor keeps serving a terminal `status: "down"` health response (reason `supervisor_gave_up`) after exhausting `maxRestarts`, before exiting — long enough for a polling client to latch the terminal state instead of seeing a bare connection refusal (#6022). Default `15000` (15 s); `0` restores the pre-#6022 exit-immediately behaviour. |
38
+ | `noEncrypt` | boolean | `--no-encrypt` | `CHROXY_NO_ENCRYPT` | Disable end-to-end message encryption (dev/testing only). Transport TLS from the tunnel still applies, but message payloads are no longer encrypted between client and daemon. |
39
+ | `encryptLocalhost` | boolean | - | `CHROXY_ENCRYPT_LOCALHOST` | Force E2E encryption on loopback connections too, disabling the localhost plaintext bypass unconditionally (#6564). Off by default — the bypass is already auto-disabled whenever a tunnel is active. |
40
+ | `tokenExpiry` | string | - | `CHROXY_TOKEN_EXPIRY` | Rotation lifetime for the **primary API token** (`24h`, `7d`, …). When set, the token manager rotates the token on expiry and honours a short grace window for the previous value. Unset (the default) means the primary token never expires. Distinct from `sessionTokenTtl`, which governs *paired device* session tokens. |
41
+ | `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. |
42
+ | `repos` | array | - | `CHROXY_REPOS` | Explicit list of git repository paths the Control Room surveys and `chroxy worktree gc` sweeps. Unioned with the repos auto-discovered under [`controlRoomRoot`](#control-room) — an explicit entry is never dropped even if it lives outside that root. |
43
+
44
+ ### Sessions, history, and limits
45
+
46
+ | Key | Type | CLI Flag | Environment Variable | Description |
47
+ |-----|------|----------|---------------------|-------------|
48
+ | `maxSessions` | number | - | `CHROXY_MAX_SESSIONS` | Maximum concurrent sessions (default `5`). Creating one past the cap is rejected with `SESSION_LIMIT_REACHED`. Must be ≥ 1. |
49
+ | `maxMessages` | number | `--max-messages <count>` | `CHROXY_MAX_MESSAGES` | Messages retained per session before FIFO eviction (default `1000`). |
50
+ | `maxHistory` | number | - | `CHROXY_MAX_HISTORY` | Legacy alias for `maxMessages`. `maxMessages` wins when both are set; prefer the canonical key. |
51
+ | `maxPayload` | number | `--max-payload <bytes>` | `CHROXY_MAX_PAYLOAD` | WebSocket max message size in bytes. **Effective default `10485760` (10 MB)** — large enough for image / document attachments. Range `1024` (1 KB) – `104857600` (100 MB); values outside it warn at startup. |
52
+ | `maxToolInput` | number | `--max-tool-input <bytes>` | `CHROXY_MAX_TOOL_INPUT` | Maximum tool-input size in bytes before the input is truncated and a notice is surfaced in the transcript. Default `262144` (256 KB). |
53
+ | `sessionTimeout` | string | `--session-timeout <duration>` | `CHROXY_SESSION_TIMEOUT` | Idle-session timeout as a duration string (`2h`, `30m`). **Disabled by default.** Minimum 30 s; a malformed duration or a sub-30s value warns at startup. This is a plain idle reaper — distinct from the [inactivity safety net](#inactivity-safety-net), which measures silence *within* a running turn. |
28
54
  | `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. |
55
+ | `summarize` | object | - | `CHROXY_SEMANTIC_TITLES_MODEL`, `CHROXY_SEMANTIC_TITLES_TIMEOUT_MS` *(title path only)* | Optional override for one-shot summarizer calls (#5547): `{ provider?: string, model?: string, titleTimeoutMs?: number }`. `model` makes the sidebar "Summarize & start new session" action use a cheaper model than the target session's own; `provider` is accepted for forward-compat but the one-shot path currently always runs through the SDK provider. `titleTimeoutMs` is read by the semantic-title path — see [Semantic session titles](#semantic-session-titles-featuressemantictitles). Unset ⇒ summarize with the session's own model. |
56
+ | `transforms` | array | - | `CHROXY_TRANSFORMS` | Opt-in prompt pre-processing pipeline, as a list of built-in transform names applied in order to each outgoing user message. Built-ins: `contextAnnotation` (prefixes `cwd` / `model` / `git branch` / `platform` as ambient context, skipped for messages under 10 chars) and `voiceCleanup` (strips voice-to-text filler words and normalises punctuation — only fires when the message was flagged as voice input). Empty / unset ⇒ messages pass through unchanged. |
57
+ | `sandbox` | object | - | `CHROXY_SANDBOX` | SDK sandbox settings forwarded verbatim to sessions for lightweight in-process isolation. Unset ⇒ no sandbox opts are threaded. Unrelated to the Codex per-session `codexSandbox` wire field and to the Docker/K8s [`environments`](#environments-isolation-and-worktrees) backends. |
58
+ | `promptEvaluatorSkipPattern` | string | - | *(unmapped — see [note](#environment-variable-names))* | 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. |
59
+
60
+ ### Timeouts
61
+
62
+ | Key | Type | CLI Flag | Environment Variable | Description |
63
+ |-----|------|----------|---------------------|-------------|
36
64
  | `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
65
  | `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. |
66
+ | `streamStallTimeoutMs` | number | - | `CHROXY_STREAM_STALL_TIMEOUT_MS` | Stream-stall recovery window in ms (#4467). Resets on any stream activity from the child; when silence reaches this window *while the session is busy*, the session emits a recoverable error (`code: stream_stall`), clears busy state, and clients can offer a retry. Default `300000` (5 min); range `5000`–`86400000` (5 s – 24 h), or `0` to disable for operators with legitimately long event gaps. |
67
+ | `providerStreamStallTimeoutMs` | object | - | `CHROXY_PROVIDER_STREAM_STALL_TIMEOUT_MS` | Per-provider override map for `streamStallTimeoutMs`, keyed by provider id — e.g. `{ "codex": 900000, "gemini": 600000 }`. An entry wins over the global value for sessions on that provider; providers without an entry fall through to the global value. Each entry follows the same `5000`–`86400000`-or-`0` range; a bad entry warns and is dropped (falling back to the global value) rather than failing startup. As an env var, pass JSON: `CHROXY_PROVIDER_STREAM_STALL_TIMEOUT_MS='{"codex":900000}'`. |
38
68
  | `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> }`. |
69
+ | `mcpToolCallTimeoutMs` | number | - | `CHROXY_MCP_TOOL_CALL_TIMEOUT_MS` | Per-call timeout for MCP `tools/call` requests made by BYOK sessions (#4482). Default `30000` (30 s). Range `1000` (1 s) – `600000` (10 min) — below 1 s every realistic MCP server times out, above 10 min the conversation is already lost. Unlike `streamStallTimeoutMs`, `0` is **not** a disable sentinel: any non-positive value warns and the runtime falls back to the 30 s client default. |
70
+
71
+ ### Tunnel and remote access
72
+
73
+ | Key | Type | CLI Flag | Environment Variable | Description |
74
+ |-----|------|----------|---------------------|-------------|
75
+ | `tunnel` | string | `--tunnel <mode>` | `CHROXY_TUNNEL` | Tunnel mode: `quick` (default — random Cloudflare URL, no account), `named` (stable hostname, requires a Cloudflare account + `cloudflared login`), `none`, or a `provider:mode` pair such as `cloudflare:named`. Ignored when `--no-auth` or `externalUrl` is in play. |
76
+ | `tunnelName` | string | `--tunnel-name <name>` | `CHROXY_TUNNEL_NAME` | Named-tunnel name (requires `cloudflared login`). Only meaningful with `tunnel: "named"`. |
77
+ | `tunnelHostname` | string | `--tunnel-hostname <host>` | `CHROXY_TUNNEL_HOSTNAME` | Named-tunnel public hostname, e.g. `chroxy.example.com`. Only meaningful with `tunnel: "named"`. |
78
+ | `tunnelConfig` | object | - | `CHROXY_TUNNEL_CONFIG` | Extra provider options spread into the tunnel provider's start call — an escape hatch for `cloudflared` knobs that have no dedicated key. As an env var, pass JSON. See [../../docs/named-tunnel-guide.md](../../docs/named-tunnel-guide.md). |
79
+
80
+ ### Providers and models
81
+
82
+ | Key | Type | CLI Flag | Environment Variable | Description |
83
+ |-----|------|----------|---------------------|-------------|
84
+ | `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. |
85
+ | `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. |
86
+ | `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. The object form carries two more sub-blocks: `providers.openaiCompatible` — the identical entry shape for endpoints that speak the **OpenAI Chat Completions** API instead (OpenAI, OpenRouter, LM Studio, vLLM, llama.cpp, Together, Groq, DeepInfra, custom), where `baseUrl` is an OpenAI API base typically ending in `/v1` — and `providers.allowAnyModel`, see [Unrestricted provider models](#unrestricted-provider-models-providersallowanymodel). See [Anthropic-compatible endpoints](../../docs/providers.md#anthropic-compatible-endpoints-config-driven) and [OpenAI-compatible endpoints](../../docs/providers.md#openai-compatible-endpoints-config-driven). |
87
+ | `legacyCli` | boolean | `--legacy-cli` | `CHROXY_LEGACY_CLI` | Legacy shorthand that maps to `provider: "claude-cli"` when no explicit `provider` is set. Prefer setting `provider` directly; an explicit `provider` always wins. |
88
+
89
+ ### Permissions and security gates
90
+
91
+ | Key | Type | CLI Flag | Environment Variable | Description |
92
+ |-----|------|----------|---------------------|-------------|
93
+ | `allowedTools` | array | `--allowed-tools <list>` | `CHROXY_ALLOWED_TOOLS` | Auto-approved tools (CLI mode) |
94
+ | `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. |
95
+ | `skipPermissions` | boolean | - | `CHROXY_SKIP_PERMISSIONS` | **Deprecated** alias for `dangerouslySkipPermissions`, kept in the schema so an existing config file still validates cleanly. Setting it emits a rename warning at boot even when the canonical key is also present. See [Skip permissions (TUI provider)](#skip-permissions-tui-provider). |
96
+ | `allowAutoPermissionMode` | boolean | - | *(unmapped — see [note](#environment-variable-names))* | Gates the `auto` permission mode (bypass every permission check). Off by default so fresh installs are secure-by-default: a client that tries to flip to `auto` is rejected with `AUTO_MODE_DISABLED_BY_CONFIG`. Opting in is a deliberate edit on the dev machine — physical access stands in for real user confirmation. |
97
+ | `userShell` | object | - | *(unmapped — see [note](#environment-variable-names))* | Gate for the embedded user-shell terminal, which spawns the operator's `$SHELL` (arbitrary code execution on the dev machine, reachable through the tunnel). `{ enabled?: boolean, requireApproval?: boolean }`, both **off by default** — creating a `user-shell` session is rejected with `USER_SHELL_DISABLED` until `enabled` is literally `true`. `requireApproval: true` additionally demands host-local approval per spawn (#6277). See [Nested config blocks](#nested-config-blocks-at-a-glance). |
98
+ | `workspaceRoots` | array | - | *(unmapped — see [note](#environment-variable-names))* | Allowlist of absolute directory paths a session may use as its working directory. When set and non-empty, a session `cwd` must resolve (via `realpath`) inside one of these roots or creation is rejected. When unset/empty, the legacy "must be inside `$HOME`" check applies instead. The credential-directory deny-list is defence-in-depth and stays active in **both** modes. |
99
+ | `allowedDockerImages` | array | - | *(unmapped — see [note](#environment-variable-names))* | Allowlist of Docker image patterns `create_environment` may use. Each entry is an exact image name or a prefix pattern such as `mcr.microsoft.com/devcontainers/*`. When set, a client-supplied image must match at least one entry or the request is rejected with `DOCKER_IMAGE_NOT_ALLOWED`. When unset, a built-in default list of common base images applies. |
100
+ | `binaryProvenance` | object | - | `CHROXY_BINARY_PROVENANCE`, `CHROXY_BINARY_SIGNATURE_GATE` | Opt-in provenance verification for spawned provider binaries (`claude`, `codex`, `gemini`, `cloudflared`). `mode` (`off`/`warn`/`block`) drives a cross-platform SHA-256 pin ledger; `signatureGate` (boolean) toggles a macOS `spctl` notarization gate. Both OFF by default. See [Binary provenance verification](#binary-provenance-verification) below. |
101
+
102
+ ### Skills
103
+
104
+ | Key | Type | CLI Flag | Environment Variable | Description |
105
+ |-----|------|----------|---------------------|-------------|
106
+ | `maxSkillBytes` | number | - | *(unmapped — see [note](#environment-variable-names))* | 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. |
107
+ | `maxTotalSkillBytes` | number | - | *(unmapped — see [note](#environment-variable-names))* | 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. |
108
+ | `providerSkillAllowlist` | object | - | *(unmapped — see [note](#environment-variable-names))* | 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. |
109
+ | `trustMismatchMode` | string | - | *(unmapped — see [note](#environment-variable-names))* | 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. |
110
+
111
+ ### Environments, isolation, and worktrees
112
+
113
+ | Key | Type | CLI Flag | Environment Variable | Description |
114
+ |-----|------|----------|---------------------|-------------|
115
+ | `environments` | object | `--environments`, `--environment-backend <backend>` | *(unmapped — see [note](#environment-variable-names))* | Container / cluster isolation backends. `enabled` (boolean) turns the feature on; `backend` selects `docker` (default), `k8s`, or `rancher`; `docker`, `k8s`, and `rancher` carry the per-backend connection blocks. An unrecognised `backend` warns and falls back to Docker rather than failing startup. The `--environments` / `--environment-backend` flags layer over a file-configured block rather than replacing it. See the [Kubernetes](#kubernetes-workspace-pvc-environmentsk8sworkspace) sections below and [Nested config blocks](#nested-config-blocks-at-a-glance). |
116
+ | `worktreeGc` | object | - | *(unmapped — see [note](#environment-variable-names))* | Garbage collection for orphaned agent worktrees (#5158). `{ autoReap?: boolean, reapIntervalMs?: number, maxLockAgeMs?: number }`. `autoReap` is **off by default**; when on, the daemon reclaims dead-pid-locked worktrees on startup and then every `reapIntervalMs` (default `1800000` / 30 min), clean trees only, never `--force`. `maxLockAgeMs` is an absolute-age fallback for the PID-liveness check — `0` (the default) disables it. The `chroxy worktree gc` CLI is always available for manual / dry-run use regardless of this block. |
117
+
118
+ ### Control Room
119
+
120
+ | Key | Type | CLI Flag | Environment Variable | Description |
121
+ |-----|------|----------|---------------------|-------------|
122
+ | `controlRoomRoot` | string | - | `CHROXY_CONTROL_ROOM_ROOT` | Filesystem root the Host Status survey scans for auto-discovered git repos (#5172). The discovered set is unioned with explicit [`repos`](#core-server) entries. Defaults to `~/Projects`. |
123
+ | `controlRoomRunnerRoot` | string | - | `CHROXY_RUNNER_ROOT` | Filesystem root the self-hosted GitHub Actions runner survey scans for runner installs — directories containing a `.runner` config (#5253). Defaults to `~/github-runners`. |
124
+ | `controlRoomRunnerIncludeGithub` | boolean | - | `CHROXY_RUNNER_INCLUDE_GITHUB` | Whether the runner survey enriches each runner with GitHub's view (online / busy / labels) via `gh api` (#5260). Default `true`. Set `false` for a faster local-only survey, or on hosts where `gh` isn't authenticated. |
125
+ | `controlRoomContainersIncludeStats` | boolean | - | `CHROXY_CONTAINERS_INCLUDE_STATS` | Whether the containers survey runs the `docker stats` enrichment (#6133). Default `true`. Set `false` for an inventory-only survey on a slow or socketless Docker. |
126
+ | `controlRoomRepoMemoryBin` | string | - | `CHROXY_REPO_MEMORY_BIN` | Explicit path to the `repo-memory` binary the Integrations survey shells out to (#5499). When unset the survey probes `PATH` with `which repo-memory` once per snapshot — set this on hosts where the daemon runs under a GUI/launchd `PATH` that misses npm globals. |
127
+
128
+ ### Notifications, billing, and opt-in features
129
+
130
+ | Key | Type | CLI Flag | Environment Variable | Description |
131
+ |-----|------|----------|---------------------|-------------|
132
+ | `notifications` | object | - | *(unmapped — see [note](#environment-variable-names))* | Notification-sink settings. Today the only sub-block is `notifications.discord` — see [Discord notifications](#discord-notifications-notificationsdiscord). The webhook URL is a **secret** and deliberately *not* a config key. |
133
+ | `billing` | object | - | *(unmapped — see [note](#environment-variable-names))* | Monthly programmatic-credit budget meter (#5665). `creditTier` (`pro` \| `max5x` \| `max20x`), `monthlyCreditBudgetUsd` (a raw USD cap that wins over the tier preset), `budgetWarningPercent` (1–100, default `80`), plus the #5828 canary knobs `egressCheck` (boolean, default off — an outbound public-IP lookup that warns when a subscription-billed provider runs from a cloud host) and `datacenterPrefixes` (extra IPv4 prefixes merged into the built-in datacenter classifier). See [Nested config blocks](#nested-config-blocks-at-a-glance). |
134
+ | `features` | object | - | `CHROXY_ENABLE_IDE`, `CHROXY_ENABLE_ORCHESTRATION`, `CHROXY_ENABLE_SCHEDULER`, `CHROXY_SEMANTIC_TITLES` | Opt-in feature flags, all **off by default** and all fail-closed — only a literal `true` in config (or a literal `"1"` in the env) enables one. `ide` (IDE navigation surface, epic #6469), `orchestration` (delegation harness, epic #6691), `scheduler` (headless execution of scheduled tasks, #6865), and `semanticTitles` (model-generated session titles, #6764 — `CHROXY_SEMANTIC_TITLES=0` also force-*disables*). Full inventory in [Opt-in features](#opt-in-features-features); the title flag has its own section under [Semantic session titles](#semantic-session-titles-featuressemantictitles). Each env var is read directly by its feature gate, so it overrides config regardless of the merge layer. |
135
+ | `orchestration` | object | - | `CHROXY_ORCHESTRATION` | Tuning for the orchestration engine, which only runs when `features.orchestration` is on. `maxParallelWorkers` (default `2`), `reserveSessions` (`1`), `maxCommitteeIterations` (`4`), `maxParseRetries` (`2`), `turnTimeoutMs` (`1800000` / 30 min), `diff: { maxBytes: 65536, maxFileBytes: 8192 }`, `bash: { implementAllowlist: [] }`, and `roles` (per-role provider/model overrides). Declared in the schema so a configured block doesn't trip the misleading "unknown key" warning. See [`docs/design/orchestration/`](../../docs/design/orchestration/README.md). |
136
+
137
+ ### Env-only settings
138
+
139
+ | Key | Type | CLI Flag | Environment Variable | Description |
140
+ |-----|------|----------|---------------------|-------------|
141
+ | _(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 raise or lower that per-window cap (the rate limiter's own `maxMessages` option — unrelated to the `maxMessages` config key above); 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> }`. |
142
+
143
+ ### Environment variable names
144
+
145
+ Two different mechanisms put an environment variable in the tables above, and
146
+ they are worth telling apart.
147
+
148
+ **1. Merge-layer overrides.** `mergeConfig` looks every schema key up in the
149
+ environment and, if present, that value wins over the config file. The name comes
150
+ from `envKeyForConfig()` in
151
+ [`packages/server/src/config.js`](src/config.js) — most keys have an **explicit**
152
+ entry there (`port` → `PORT`, `controlRoomRunnerRoot` → `CHROXY_RUNNER_ROOT`, …).
153
+
154
+ **2. Direct reads.** Some settings are read straight out of `process.env` by the
155
+ helper that consumes them, bypassing the merge layer entirely:
156
+ `CHROXY_ENABLE_IDE` / `CHROXY_ENABLE_ORCHESTRATION` / `CHROXY_ENABLE_SCHEDULER` /
157
+ `CHROXY_SEMANTIC_TITLES` (the four [`features` gates](#opt-in-features-features)),
158
+ `CHROXY_SEMANTIC_TITLES_MODEL` /
159
+ `CHROXY_SEMANTIC_TITLES_TIMEOUT_MS` (which override *specific fields* of
160
+ `summarize` on the title path only — they are not a general override for the
161
+ `summarize` object), and `CHROXY_BINARY_PROVENANCE` /
162
+ `CHROXY_BINARY_SIGNATURE_GATE` (`binaryProvenance`).
163
+
164
+ **The naive fallback.** 16 schema keys have no explicit `envKeyForConfig` entry,
165
+ so their *merge-layer* lookup falls back to a bare `key.toUpperCase()` — which
166
+ drops the `CHROXY_` prefix and all word separators: `features` → `FEATURES`,
167
+ `billing` → `BILLING`, `workspaceRoots` → `WORKSPACEROOTS`, `userShell` →
168
+ `USERSHELL`, `trustMismatchMode` → `TRUSTMISMATCHMODE`, `summarize` →
169
+ `SUMMARIZE`, `binaryProvenance` → `BINARYPROVENANCE`, and so on. The tables mark
170
+ these *(unmapped)* wherever the key has no direct-read env var to list instead;
171
+ `summarize`, `features`, and `binaryProvenance` are unmapped at the merge layer
172
+ too, even though their rows list the direct reads above.
173
+
174
+ Those fallback names are **not a supported interface**:
175
+
176
+ - They are generic enough that an unrelated variable already in your environment
177
+ could be picked up as chroxy config (this is exactly why `orchestration` was
178
+ given an explicit `CHROXY_ORCHESTRATION` mapping in #6691).
179
+ - Object-typed keys would have to be supplied as a JSON string.
180
+
181
+ Set these keys in `~/.chroxy/config.json` instead. If you need an env override
182
+ for one of them, add an explicit mapping to `envKeyForConfig()` rather than
183
+ relying on the fallback.
184
+
185
+ ### Nested config blocks at a glance
186
+
187
+ Several keys are object blocks whose sub-keys are validated at startup — a typo
188
+ inside one produces a non-fatal `unknown key` warning naming the supported set,
189
+ rather than being silently dropped.
190
+
191
+ | Block | Recognised sub-keys |
192
+ |-------|---------------------|
193
+ | `billing` | `creditTier`, `monthlyCreditBudgetUsd`, `budgetWarningPercent`, `egressCheck`, `datacenterPrefixes` |
194
+ | `worktreeGc` | `autoReap`, `reapIntervalMs`, `maxLockAgeMs` |
195
+ | `userShell` | `enabled`, `requireApproval` |
196
+ | `environments.k8s` | `namespace`, `inCluster`, `kubeconfigPath`, `sidecarImage`, `imagePullPolicy`, `connectMode`, `namespaceQuota`, `namespaceLimitRange`, `workspace` |
197
+ | `environments.rancher` | `rancherUrl`, `clusterId`, `token`, `tokenEnv`, `tokenFile`, `caData`, `skipTLSVerify`, `defaultProjectId` |
198
+ | `notifications.discord` | `botName`, `billingAlerts`, `colors`, `defaultColor`, `permissionColor`, `errorColor`, `updateThrottleMs`, `heartbeatIntervalMs`, `pruneAfterMs`, `staleAfterMs`, `offlineAfterMs`, `statePath`, `billingStatePath` |
199
+ | `providers` *(object form)* | `anthropicCompatible`, `openaiCompatible`, `allowAnyModel` |
200
+
201
+ `summarize`, `features`, and `orchestration` have no unknown-key check today, so
202
+ a typo in one of those is silently ignored rather than warned about.
203
+
204
+ ### Unrestricted provider models (`providers.allowAnyModel`)
205
+
206
+ The static-allowlist subprocess providers (e.g. `gemini`, `codex`, `deepseek`)
207
+ hard-reject a model id that is not in their built-in list, even when the upstream
208
+ API already serves it — which otherwise forces a chroxy release just to add one.
209
+ `providers.allowAnyModel` is an array of provider ids that opt out of that check
210
+ (#6378):
211
+
212
+ ```json
213
+ {
214
+ "providers": {
215
+ "allowAnyModel": ["codex", "gemini"]
216
+ }
217
+ }
218
+ ```
219
+
220
+ An opted-in provider passes the model id through verbatim and lets the upstream
221
+ API be the validator. Default is **off** for every provider, so the
222
+ misconfiguration-catching strictness is preserved unless you explicitly opt in.
223
+ A missing or non-array value is treated as an empty set; non-string entries are
224
+ dropped.
225
+
226
+ Note that this lives inside the **object** form of the `providers` key, which is
227
+ the same block that carries `anthropicCompatible` — it does not apply to the
228
+ legacy array form.
40
229
 
41
230
  ### Prompt evaluator skip heuristic
42
231
 
@@ -142,6 +331,45 @@ directly. Format:
142
331
  A corrupted or missing trust file is treated as empty (fail-open) so a single
143
332
  bad write can't lock every skill out of every session.
144
333
 
334
+ ### Binary provenance verification
335
+
336
+ `binaryProvenance` opts the daemon into pre-spawn provenance verification of the
337
+ external binaries it executes as providers (`claude`, `codex`, `gemini`) and of
338
+ `cloudflared`. This extends the always-on P1 integrity/quarantine check (#6708)
339
+ with two **opt-in, OFF-by-default** gates — see
340
+ [`docs/security/spawned-binary-provenance.md`](../../docs/security/spawned-binary-provenance.md).
341
+
342
+ ```jsonc
343
+ {
344
+ "binaryProvenance": {
345
+ "mode": "off", // "off" (default) | "warn" | "block"
346
+ "signatureGate": false // macOS spctl notarization gate
347
+ }
348
+ }
349
+ ```
350
+
351
+ - **`mode`** — a cross-platform SHA-256 **pin ledger** (`~/.chroxy/binary-trust.json`,
352
+ same fail-open/atomic-0600 sidecar as the skill ledger). Each binary's hash is
353
+ pinned on first sight (trust-on-first-use); a later change to that hash re-gates
354
+ the binary. `warn` logs the change and still spawns; `block` **refuses the
355
+ spawn** until the operator re-approves. Catches an in-place binary swap
356
+ regardless of signature or quarantine state. `off` (default) skips the ledger
357
+ entirely. Env override: `CHROXY_BINARY_PROVENANCE` = `off`/`warn`/`block`.
358
+ - **`signatureGate`** — when `true`, a binary that fails `spctl --assess`
359
+ (Gatekeeper / notarization) is hard-blocked. For operators who run only
360
+ notarized provider builds; chroxy's bundled providers are ad-hoc-signed and
361
+ would be rejected, so it can only ever be opt-in. **macOS-only** — a documented
362
+ no-op on Linux/Windows (the pin ledger still applies). Env override:
363
+ `CHROXY_BINARY_SIGNATURE_GATE` = `1`/`0`.
364
+
365
+ Both fail-safe: when a gate is on, a failure blocks (`block` / signature) or is
366
+ loudly surfaced (`warn`) — an unverified binary is never silently spawned. A
367
+ `block`-mode failure surfaces as a `session_error`
368
+ (`code: PROVIDER_BINARY_PROVENANCE`) for providers, or aborts the tunnel start
369
+ (`code: TUNNEL_BINARY_PROVENANCE`) for `cloudflared`. To re-approve a
370
+ legitimately-updated binary, remove its entry from `~/.chroxy/binary-trust.json`
371
+ (or delete the file — it fails open and re-pins on next spawn).
372
+
145
373
  ### Skip permissions (TUI provider)
146
374
 
147
375
  `dangerouslySkipPermissions` is a **TUI-only** opt-out from chroxy's permission
@@ -230,6 +458,16 @@ from the SDK / CLI for the configured duration.
230
458
  | 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
459
  | 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
460
 
461
+ **Whole milliseconds only (#7083).** Every millisecond option — `resultTimeoutMs`,
462
+ `hardTimeoutMs`, `streamStallTimeoutMs`, `backgroundShellHardQuiesceMs`,
463
+ `mcpToolCallTimeoutMs`, `terminalDownGraceMs`, and each entry of
464
+ `providerStreamStallTimeoutMs` — is truncated to an integer when the config is merged,
465
+ from the config file and the env var alike. A fractional value logs a warning naming the
466
+ key and the value it was changed to. They must be whole ms because they are sent on the
467
+ wire, where the protocol schemas require an integer. Note this is truncation toward zero,
468
+ so `30000.9` becomes `30000` — never rounded up into a range it did not qualify for. USD
469
+ options (`costBudget`, `billing.*`, provider `pricing.*`) are deliberately untouched.
470
+
233
471
  Both fields share the same range (`30000`–`86400000`, 30 s – 24 h) and the
234
472
  same WS schema cap (#3768). Values outside the range emit warn-only log
235
473
  lines during validation; the runtime applies whatever was set. The
@@ -492,6 +730,57 @@ swallowed) and cached per process, so it adds one read (plus a create if the
492
730
  object is missing) per configured object the first time a tenant namespace is
493
731
  used, and nothing on subsequent calls for that namespace.
494
732
 
733
+ ### Semantic session titles (`features.semanticTitles`)
734
+
735
+ By default a session's sidebar label is a raw truncation of the first user
736
+ message. With `features.semanticTitles` on, that first turn also fires a cheap
737
+ one-shot model call that summarises the message into a short title (#6764).
738
+
739
+ ```json
740
+ {
741
+ "features": {
742
+ "semanticTitles": true
743
+ },
744
+ "summarize": {
745
+ "model": "haiku",
746
+ "titleTimeoutMs": 15000
747
+ }
748
+ }
749
+ ```
750
+
751
+ **Enabling.** `features.semanticTitles: true` in config, or
752
+ `CHROXY_SEMANTIC_TITLES=1`. The env var also force-*disables* when set to `0`,
753
+ which is handy for tests and A/B runs without editing config. Like the other
754
+ `features` flags this is fail-closed — only a literal `true` (or the literal env
755
+ string `"1"`) turns it on.
756
+
757
+ **Which model.** Resolution order:
758
+
759
+ 1. `CHROXY_SEMANTIC_TITLES_MODEL`
760
+ 2. `summarize.model` — the same cheap-model override used by the sidebar
761
+ "Summarize & start new session" action, deliberately reused so an operator who
762
+ already tuned the summarizer gets the same model for titles
763
+ 3. `haiku` (the built-in default)
764
+
765
+ The default stays a cheap Haiku alias so titling never burns a premium model.
766
+
767
+ **Timeout.** Resolution order:
768
+
769
+ 1. `CHROXY_SEMANTIC_TITLES_TIMEOUT_MS`
770
+ 2. `summarize.titleTimeoutMs`
771
+ 3. `15000` (15 s)
772
+
773
+ Invalid or non-positive values in either source fall back to the default. The
774
+ timeout matters because the title call is fire-and-forget: without one, a stalled
775
+ provider connection leaves the promise pending forever, pinning the
776
+ `SessionManager` and the first message (an unbounded per-session leak) and never
777
+ tearing down the one-shot subprocess.
778
+
779
+ **Failure behaviour is always fail-open.** When the flag is off, the call fails,
780
+ the timeout fires, or no model access is available, the session silently keeps
781
+ the truncation-based label. A title is a cosmetic nicety — it never blocks or
782
+ fails a turn.
783
+
495
784
  ### Discord notifications (`notifications.discord`)
496
785
 
497
786
  The Discord webhook sink (#5413 Phase 2) maintains one status-embed message
@@ -542,6 +831,114 @@ Status-message state (message ids, current state per project) persists in
542
831
  id in `~/.chroxy/discord-billing-state.json`. Full setup walkthrough:
543
832
  [docs/guides/discord-notifications.md](../../docs/guides/discord-notifications.md).
544
833
 
834
+ ### Opt-in features (`features`)
835
+
836
+ Some surfaces are **off by default** and activate only when the operator opts in.
837
+ Each is gated by a strict-boolean config key under `features`, or by an env
838
+ override that must be exactly `1`:
839
+
840
+ ```json
841
+ {
842
+ "features": {
843
+ "scheduler": false
844
+ }
845
+ }
846
+ ```
847
+
848
+ | Key | Env override | Default | What it enables |
849
+ |-----|--------------|---------|-----------------|
850
+ | `features.scheduler` | `CHROXY_ENABLE_SCHEDULER=1` | `false` | Headless execution of scheduled tasks (#6865) |
851
+ | `features.ide` | `CHROXY_ENABLE_IDE=1` | `false` | The IDE navigation surface (epic #6469) |
852
+ | `features.orchestration` | `CHROXY_ENABLE_ORCHESTRATION=1` | `false` | The orchestration/delegation harness (epic #6691) |
853
+ | `features.semanticTitles` | `CHROXY_SEMANTIC_TITLES=1` | `false` | Model-generated session titles (#6764) — see [Semantic session titles](#semantic-session-titles-featuressemantictitles) |
854
+
855
+ All four are **fail-closed**: anything other than a literal `true` in config (or
856
+ a literal `"1"` in the env) leaves the feature off, so `"yes"`, `1`, or `"true"`
857
+ in the config file do *not* enable it. `CHROXY_SEMANTIC_TITLES` is the one env
858
+ override that also force-*disables* when set to `0`.
859
+
860
+ #### `features.scheduler` — headless scheduled execution
861
+
862
+ Scheduled tasks (`~/.chroxy/scheduled-tasks.json`) can be created, listed, and
863
+ edited at any time, but they **never fire** unless this flag is on. With the flag
864
+ off the daemon arms no scheduler timers and starts no sessions — behaviour is
865
+ identical to a daemon without the feature.
866
+
867
+ When on, at each task's due time the daemon spins up (or resumes) that task's
868
+ session and runs its prompt with **no client connected**.
869
+
870
+ ##### Supported providers — hook-routed providers (including the default) are refused
871
+
872
+ > **A scheduled task only fires on a provider that answers permission prompts
873
+ > in-process.** Right now that is `claude-sdk`, `claude-byok`, `codex` (the
874
+ > app-server driver), `deepseek`, and `ollama`. Every other provider — **including
875
+ > the daemon default `claude-tui`**, plus `claude-cli`, `claude-channel`, and
876
+ > `gemini` — is **refused**: the task does not fire, no session is created, and the
877
+ > run is recorded with status `refused` naming the provider.
878
+
879
+ This is deliberate, not an oversight. The scheduler's whole safety story is that a
880
+ permission prompt raised by an unattended turn gets **denied** and the run fails
881
+ visibly. That requires observing the prompt and answering it programmatically,
882
+ which only providers with in-process permissions expose. Hook-routed providers
883
+ instead go out through `hooks/permission-hook.sh` → `POST /permission`, which the
884
+ daemon cannot answer with no client attached — such a run would stall on every
885
+ gated tool call until the 300-second auto-deny and then finish looking successful
886
+ with nothing actually done. Refusing is the honest outcome.
887
+
888
+ **A task with no explicit `target.provider` therefore does not fire**, because it
889
+ resolves to the daemon default. Set `target.provider` to one of the supported ids.
890
+ Widening support to hook-routed providers needs a programmatic
891
+ permission-answering surface for them — tracked in
892
+ [#7003](https://github.com/blamechris/chroxy/issues/7003).
893
+
894
+ ##### The permission floor
895
+
896
+ Because nobody is watching the turn, a run that does fire runs under a hard floor:
897
+
898
+ - The run is pinned to the `approve` permission mode. A task whose stored
899
+ `target.permissionMode` is `auto` or `acceptEdits` is **clamped down** to
900
+ `approve` — a scheduled task can never grant itself auto-approval. (`plan` is
901
+ allowed: it is stricter than `approve`.)
902
+ - **The clamp is re-asserted before every fire, not just at session creation.**
903
+ A task's session is deliberately kept alive and reused across runs, and an
904
+ operator inspecting it can change its permission mode by hand — so before each
905
+ fire the daemon forces the clamped mode back on and verifies it by reading it
906
+ back. If it cannot be verified, **the fire is skipped** and recorded `refused`.
907
+ A manual switch to Auto therefore cannot leak into the next unattended run.
908
+ - The run is created with an explicit `skipPermissions: false`, so it does **not**
909
+ inherit a server-wide [`dangerouslySkipPermissions`](#skip-permissions-tui-provider).
910
+ - The task's `target.cwd` is checked against the **same working-directory
911
+ allowlist the dashboard enforces** — the credential-directory deny-list
912
+ (`~/.ssh`, `~/.aws`, `~/.config`, `~/.chroxy`, …), your `workspaceRoots`
913
+ allowlist if configured, and the `$HOME` fallback otherwise. `~/.chroxy/scheduled-tasks.json`
914
+ is an editable file, so a hand-written `target.cwd` gets no more trust than one
915
+ typed into the UI: a disallowed directory is recorded `refused` and does not fire.
916
+ - If the turn hits a permission prompt, there is no human to answer it: the prompt
917
+ is **denied**, the turn is aborted, and the run is recorded as a failed run with
918
+ the reason. A scheduled task that needs a permission fails visibly rather than
919
+ escalating silently. A run that raised any prompt is **never** recorded
920
+ `success`, even when the agent went on to finish its turn without the tool.
921
+ - To let a scheduled task actually perform a gated operation, author an explicit
922
+ **permission rule** for it. Rules are matched before a prompt is raised, so an
923
+ allow-rule is the one auditable, human-authored way to widen what a scheduled
924
+ run may do — and the protected-path / secret-read floor still cannot be
925
+ bypassed by one.
926
+
927
+ Each run records a last-run result plus its session id into the registry:
928
+
929
+ | status | meaning |
930
+ |--------|---------|
931
+ | `success` | the turn completed and no permission prompt was raised |
932
+ | `error` | the run happened and failed — including a run whose tool calls were denied |
933
+ | `timeout` | the run exceeded the per-run timeout and was abandoned |
934
+ | `skipped` | the slot passed unused (the daemon was down past the grace window) |
935
+ | `refused` | **nothing ran** — unsupported provider, disallowed cwd, or an unverifiable permission mode. A misconfiguration to fix, not a transient failure |
936
+
937
+ Runs are serialized (one at a time by default) so a burst of simultaneously-due
938
+ tasks cannot spawn a herd of sessions, a task is never re-fired while its previous
939
+ run is still in flight, and a task whose due time passed while the daemon was down
940
+ is skipped rather than fired late if it is more than an hour stale.
941
+
545
942
  ## Examples
546
943
 
547
944
  ### Using Config File Only