@cruxy/cli 1.0.3 → 1.0.5

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 (238) hide show
  1. package/package.json +2 -2
  2. package/dist/agent/budget.d.ts +0 -52
  3. package/dist/agent/index.d.ts +0 -3
  4. package/dist/agent/loop.d.ts +0 -159
  5. package/dist/agent/prompts.d.ts +0 -69
  6. package/dist/agent/session.d.ts +0 -212
  7. package/dist/approval/classify.d.ts +0 -18
  8. package/dist/approval/index.d.ts +0 -6
  9. package/dist/approval/mutex.d.ts +0 -45
  10. package/dist/approval/policy.d.ts +0 -43
  11. package/dist/approval/prompt.d.ts +0 -48
  12. package/dist/approval/service.d.ts +0 -36
  13. package/dist/approval/types.d.ts +0 -82
  14. package/dist/brand/index.d.ts +0 -1
  15. package/dist/brand/voice.d.ts +0 -94
  16. package/dist/checkpoint/capture.d.ts +0 -17
  17. package/dist/checkpoint/gate-hook.d.ts +0 -28
  18. package/dist/checkpoint/gate.d.ts +0 -71
  19. package/dist/checkpoint/git-store.d.ts +0 -61
  20. package/dist/checkpoint/index.d.ts +0 -10
  21. package/dist/checkpoint/restore.d.ts +0 -23
  22. package/dist/checkpoint/service.d.ts +0 -89
  23. package/dist/checkpoint/set-rollback.d.ts +0 -51
  24. package/dist/checkpoint/set.d.ts +0 -44
  25. package/dist/checkpoint/shadow-store.d.ts +0 -23
  26. package/dist/checkpoint/types.d.ts +0 -164
  27. package/dist/cli/commands/checkpoint.d.ts +0 -7
  28. package/dist/cli/commands/config.d.ts +0 -2
  29. package/dist/cli/commands/hooks.d.ts +0 -8
  30. package/dist/cli/commands/index.d.ts +0 -7
  31. package/dist/cli/commands/init.d.ts +0 -7
  32. package/dist/cli/commands/login.d.ts +0 -8
  33. package/dist/cli/commands/mcp.d.ts +0 -9
  34. package/dist/cli/commands/memory.d.ts +0 -8
  35. package/dist/cli/commands/pr.d.ts +0 -8
  36. package/dist/cli/commands/rollback.d.ts +0 -18
  37. package/dist/cli/commands/run.d.ts +0 -2
  38. package/dist/cli/commands/skills.d.ts +0 -8
  39. package/dist/cli/commands/test.d.ts +0 -9
  40. package/dist/cli/commands/usage.d.ts +0 -9
  41. package/dist/cli/onboard.d.ts +0 -25
  42. package/dist/cli/program.d.ts +0 -2
  43. package/dist/cli/repl.d.ts +0 -27
  44. package/dist/cli/session-factory.d.ts +0 -42
  45. package/dist/cli/stream-print.d.ts +0 -14
  46. package/dist/components/autocomplete.d.ts +0 -32
  47. package/dist/components/frame.d.ts +0 -28
  48. package/dist/components/fuzzy.d.ts +0 -61
  49. package/dist/components/index.d.ts +0 -6
  50. package/dist/components/input.d.ts +0 -78
  51. package/dist/components/keys.d.ts +0 -48
  52. package/dist/components/select.d.ts +0 -28
  53. package/dist/config/credentials.d.ts +0 -18
  54. package/dist/config/index.d.ts +0 -5
  55. package/dist/config/manager.d.ts +0 -39
  56. package/dist/config/owner-only.d.ts +0 -19
  57. package/dist/config/paths.d.ts +0 -9
  58. package/dist/config/project.d.ts +0 -10
  59. package/dist/config/schema.d.ts +0 -2143
  60. package/dist/constants.d.ts +0 -65
  61. package/dist/errors/boundary.d.ts +0 -43
  62. package/dist/errors/constructors.d.ts +0 -411
  63. package/dist/errors/format.d.ts +0 -31
  64. package/dist/errors/index.d.ts +0 -4
  65. package/dist/errors/types.d.ts +0 -270
  66. package/dist/hooks/config.d.ts +0 -21
  67. package/dist/hooks/index.d.ts +0 -7
  68. package/dist/hooks/router.d.ts +0 -58
  69. package/dist/hooks/runner.d.ts +0 -88
  70. package/dist/hooks/service.d.ts +0 -38
  71. package/dist/hooks/slash.d.ts +0 -48
  72. package/dist/hooks/trust.d.ts +0 -46
  73. package/dist/hooks/types.d.ts +0 -147
  74. package/dist/index.d.ts +0 -2
  75. package/dist/indexing/chunker.d.ts +0 -28
  76. package/dist/indexing/embedder.d.ts +0 -98
  77. package/dist/indexing/index.d.ts +0 -9
  78. package/dist/indexing/indexer.d.ts +0 -45
  79. package/dist/indexing/retriever.d.ts +0 -61
  80. package/dist/indexing/service.d.ts +0 -49
  81. package/dist/indexing/store.d.ts +0 -103
  82. package/dist/indexing/types.d.ts +0 -78
  83. package/dist/indexing/util.d.ts +0 -34
  84. package/dist/indexing/walker.d.ts +0 -53
  85. package/dist/jobs/approval-queue.d.ts +0 -85
  86. package/dist/jobs/dispatch-tool.d.ts +0 -34
  87. package/dist/jobs/index.d.ts +0 -6
  88. package/dist/jobs/log-buffer.d.ts +0 -31
  89. package/dist/jobs/log-renderer.d.ts +0 -32
  90. package/dist/jobs/manager.d.ts +0 -139
  91. package/dist/jobs/types.d.ts +0 -81
  92. package/dist/lsp/client.d.ts +0 -25
  93. package/dist/lsp/index.d.ts +0 -8
  94. package/dist/lsp/pool.d.ts +0 -48
  95. package/dist/lsp/registry.d.ts +0 -38
  96. package/dist/lsp/server.d.ts +0 -48
  97. package/dist/lsp/service.d.ts +0 -44
  98. package/dist/lsp/tools/common.d.ts +0 -50
  99. package/dist/lsp/tools/find-definition.d.ts +0 -23
  100. package/dist/lsp/tools/find-references.d.ts +0 -23
  101. package/dist/lsp/tools/get-diagnostics.d.ts +0 -17
  102. package/dist/lsp/tools/hover.d.ts +0 -23
  103. package/dist/lsp/tools/index.d.ts +0 -4
  104. package/dist/lsp/transport.d.ts +0 -39
  105. package/dist/lsp/types.d.ts +0 -107
  106. package/dist/mcp/adapter.d.ts +0 -44
  107. package/dist/mcp/bounds.d.ts +0 -35
  108. package/dist/mcp/client.d.ts +0 -19
  109. package/dist/mcp/demarcate.d.ts +0 -12
  110. package/dist/mcp/http-transport.d.ts +0 -89
  111. package/dist/mcp/index.d.ts +0 -12
  112. package/dist/mcp/service.d.ts +0 -71
  113. package/dist/mcp/sibling-banner.d.ts +0 -25
  114. package/dist/mcp/transport.d.ts +0 -30
  115. package/dist/mcp/trust-gate.d.ts +0 -59
  116. package/dist/mcp/trust.d.ts +0 -62
  117. package/dist/mcp/types.d.ts +0 -62
  118. package/dist/mcp/url-guard.d.ts +0 -48
  119. package/dist/memory/index.d.ts +0 -7
  120. package/dist/memory/recall.d.ts +0 -56
  121. package/dist/memory/remember-tool.d.ts +0 -28
  122. package/dist/memory/secrets.d.ts +0 -29
  123. package/dist/memory/service.d.ts +0 -92
  124. package/dist/memory/store.d.ts +0 -32
  125. package/dist/memory/trust.d.ts +0 -52
  126. package/dist/memory/types.d.ts +0 -101
  127. package/dist/net/ip-guard.d.ts +0 -55
  128. package/dist/onboarding/detect.d.ts +0 -26
  129. package/dist/onboarding/flow.d.ts +0 -28
  130. package/dist/onboarding/index.d.ts +0 -5
  131. package/dist/onboarding/io.d.ts +0 -9
  132. package/dist/onboarding/steps.d.ts +0 -17
  133. package/dist/onboarding/types.d.ts +0 -81
  134. package/dist/plan/approve.d.ts +0 -16
  135. package/dist/plan/execute.d.ts +0 -28
  136. package/dist/plan/index.d.ts +0 -7
  137. package/dist/plan/policy.d.ts +0 -26
  138. package/dist/plan/render.d.ts +0 -5
  139. package/dist/plan/service.d.ts +0 -58
  140. package/dist/plan/submit-plan.d.ts +0 -33
  141. package/dist/plan/types.d.ts +0 -60
  142. package/dist/render/capabilities.d.ts +0 -31
  143. package/dist/render/diff.d.ts +0 -18
  144. package/dist/render/highlight.d.ts +0 -47
  145. package/dist/render/index.d.ts +0 -22
  146. package/dist/render/layout.d.ts +0 -59
  147. package/dist/render/motion.d.ts +0 -76
  148. package/dist/render/plain-renderer.d.ts +0 -39
  149. package/dist/render/resize.d.ts +0 -36
  150. package/dist/render/screen-reader-renderer.d.ts +0 -45
  151. package/dist/render/state.d.ts +0 -49
  152. package/dist/render/tty-renderer.d.ts +0 -106
  153. package/dist/render/types.d.ts +0 -201
  154. package/dist/routing/index.d.ts +0 -2
  155. package/dist/routing/resolve.d.ts +0 -17
  156. package/dist/routing/router.d.ts +0 -47
  157. package/dist/routing/types.d.ts +0 -42
  158. package/dist/sandbox/detect.d.ts +0 -22
  159. package/dist/sandbox/docker-runtime.d.ts +0 -32
  160. package/dist/sandbox/index.d.ts +0 -7
  161. package/dist/sandbox/policy.d.ts +0 -26
  162. package/dist/sandbox/service.d.ts +0 -64
  163. package/dist/sandbox/types.d.ts +0 -123
  164. package/dist/skills/index.d.ts +0 -4
  165. package/dist/skills/loader.d.ts +0 -43
  166. package/dist/skills/parser.d.ts +0 -31
  167. package/dist/skills/service.d.ts +0 -41
  168. package/dist/skills/types.d.ts +0 -94
  169. package/dist/subagent/index.d.ts +0 -5
  170. package/dist/subagent/orchestrator.d.ts +0 -169
  171. package/dist/subagent/registry-scope.d.ts +0 -41
  172. package/dist/subagent/semaphore.d.ts +0 -56
  173. package/dist/subagent/spawn-tool.d.ts +0 -86
  174. package/dist/subagent/types.d.ts +0 -65
  175. package/dist/testing/detect.d.ts +0 -3
  176. package/dist/testing/index.d.ts +0 -5
  177. package/dist/testing/parse.d.ts +0 -33
  178. package/dist/testing/run-tests-tool.d.ts +0 -64
  179. package/dist/testing/runner.d.ts +0 -26
  180. package/dist/testing/sandbox-runner.d.ts +0 -16
  181. package/dist/testing/types.d.ts +0 -66
  182. package/dist/theme/index.d.ts +0 -2
  183. package/dist/theme/resolve.d.ts +0 -43
  184. package/dist/theme/tokens.d.ts +0 -125
  185. package/dist/tools/create-pull-request.d.ts +0 -27
  186. package/dist/tools/file/apply-patch.d.ts +0 -94
  187. package/dist/tools/file/edit-file.d.ts +0 -12
  188. package/dist/tools/file/glob.d.ts +0 -17
  189. package/dist/tools/file/grep-files.d.ts +0 -43
  190. package/dist/tools/file/index.d.ts +0 -7
  191. package/dist/tools/file/match.d.ts +0 -43
  192. package/dist/tools/file/paths.d.ts +0 -160
  193. package/dist/tools/file/read-file.d.ts +0 -8
  194. package/dist/tools/file/write-file.d.ts +0 -10
  195. package/dist/tools/git-status.d.ts +0 -15
  196. package/dist/tools/index.d.ts +0 -9
  197. package/dist/tools/list-files.d.ts +0 -13
  198. package/dist/tools/list-skills.d.ts +0 -9
  199. package/dist/tools/load-skill.d.ts +0 -21
  200. package/dist/tools/registry.d.ts +0 -23
  201. package/dist/tools/search-codebase.d.ts +0 -35
  202. package/dist/tools/shell/exec.d.ts +0 -53
  203. package/dist/tools/shell/index.d.ts +0 -1
  204. package/dist/tools/shell/resolve-shell.d.ts +0 -81
  205. package/dist/tools/shell/run-command.d.ts +0 -14
  206. package/dist/tools/types.d.ts +0 -257
  207. package/dist/usage/collect.d.ts +0 -53
  208. package/dist/usage/cost.d.ts +0 -19
  209. package/dist/usage/index.d.ts +0 -15
  210. package/dist/usage/store.d.ts +0 -37
  211. package/dist/usage/summary.d.ts +0 -32
  212. package/dist/usage/types.d.ts +0 -283
  213. package/dist/utils/child-tree.d.ts +0 -33
  214. package/dist/utils/git.d.ts +0 -17
  215. package/dist/utils/logger.d.ts +0 -18
  216. package/dist/utils/process-tree.d.ts +0 -16
  217. package/dist/vcs/auth.d.ts +0 -22
  218. package/dist/vcs/generate.d.ts +0 -74
  219. package/dist/vcs/git.d.ts +0 -60
  220. package/dist/vcs/github.d.ts +0 -50
  221. package/dist/vcs/guidance.d.ts +0 -20
  222. package/dist/vcs/index.d.ts +0 -7
  223. package/dist/vcs/service.d.ts +0 -61
  224. package/dist/vcs/types.d.ts +0 -73
  225. package/dist/web/demarcate.d.ts +0 -13
  226. package/dist/web/fetch.d.ts +0 -11
  227. package/dist/web/index.d.ts +0 -7
  228. package/dist/web/provider.d.ts +0 -29
  229. package/dist/web/search.d.ts +0 -17
  230. package/dist/web/ssrf.d.ts +0 -41
  231. package/dist/web/tools.d.ts +0 -20
  232. package/dist/web/types.d.ts +0 -64
  233. package/dist/workspace/add-root.d.ts +0 -27
  234. package/dist/workspace/index.d.ts +0 -6
  235. package/dist/workspace/resolve.d.ts +0 -54
  236. package/dist/workspace/select.d.ts +0 -41
  237. package/dist/workspace/types.d.ts +0 -30
  238. package/dist/workspace/workspace.d.ts +0 -61
@@ -1,2143 +0,0 @@
1
- import { z } from "zod";
2
- export declare const ProviderSchema: z.ZodEnum<["cruxy", "anthropic", "openai", "custom"]>;
3
- export type Provider = z.infer<typeof ProviderSchema>;
4
- export declare const ModelConfigSchema: z.ZodObject<{
5
- provider: z.ZodDefault<z.ZodEnum<["cruxy", "anthropic", "openai", "custom"]>>;
6
- model: z.ZodDefault<z.ZodString>;
7
- maxTokens: z.ZodDefault<z.ZodNumber>;
8
- temperature: z.ZodDefault<z.ZodNumber>;
9
- }, "strict", z.ZodTypeAny, {
10
- provider: "cruxy" | "anthropic" | "openai" | "custom";
11
- model: string;
12
- maxTokens: number;
13
- temperature: number;
14
- }, {
15
- provider?: "cruxy" | "anthropic" | "openai" | "custom" | undefined;
16
- model?: string | undefined;
17
- maxTokens?: number | undefined;
18
- temperature?: number | undefined;
19
- }>;
20
- /** Cruxy gateway backend settings (no secrets — the API key comes from env). */
21
- export declare const CruxyBackendConfigSchema: z.ZodObject<{
22
- gatewayUrl: z.ZodDefault<z.ZodString>;
23
- }, "strict", z.ZodTypeAny, {
24
- gatewayUrl: string;
25
- }, {
26
- gatewayUrl?: string | undefined;
27
- }>;
28
- export declare const AgentConfigSchema: z.ZodObject<{
29
- /**
30
- * Hard ceiling on agent loop turns per user turn — the interactive default.
31
- * In the REPL this is a soft checkpoint: hitting it ends the turn and the
32
- * human continues (or Ctrl-C's a runaway), so it can be generous.
33
- */
34
- maxIterations: z.ZodDefault<z.ZodNumber>;
35
- /**
36
- * Turn ceiling for a ONE-SHOT `cruxy run "task"` (non-interactive). Set higher
37
- * than {@link maxIterations} because a headless run has no human to resume it:
38
- * hitting the cap abandons the whole task (fail-loud, non-zero exit), so it
39
- * must clear the legit long tail (real "fix the failing tests" work runs
40
- * ~10-25 turns) while still bounding a runaway. Not clamped to
41
- * `maxIterations` — a user may deliberately set it lower or higher.
42
- */
43
- maxIterationsOneShot: z.ZodDefault<z.ZodNumber>;
44
- /**
45
- * Optional hard cap on combined input+output tokens for a SINGLE user turn
46
- * — a last-resort runaway guard, not cost control (cumulative session cost
47
- * is C.22's concern). OFF by default (0 = off): today's behavior is
48
- * preserved exactly and no turn is ever token-stopped. When set, a turn that
49
- * crosses the cap stops at the next turn boundary with a coherent partial
50
- * history (`stop: "budget"`); in one-shot that fails loud (exit 20), while
51
- * interactively the human simply continues. Compaction is the everyday
52
- * pressure valve for context — this only bounds a genuinely runaway turn, so
53
- * a hostile hard stop mid-work stays opt-in. Reset each `send`, never
54
- * cumulative across turns.
55
- */
56
- maxTokensPerTurn: z.ZodDefault<z.ZodNumber>;
57
- /** Skip per-action confirmation prompts. */
58
- autoApprove: z.ZodDefault<z.ZodBoolean>;
59
- /** Plan mode: propose a plan for approval before executing (C.31, opt-in). */
60
- planMode: z.ZodDefault<z.ZodBoolean>;
61
- }, "strict", z.ZodTypeAny, {
62
- maxIterations: number;
63
- maxIterationsOneShot: number;
64
- maxTokensPerTurn: number;
65
- autoApprove: boolean;
66
- planMode: boolean;
67
- }, {
68
- maxIterations?: number | undefined;
69
- maxIterationsOneShot?: number | undefined;
70
- maxTokensPerTurn?: number | undefined;
71
- autoApprove?: boolean | undefined;
72
- planMode?: boolean | undefined;
73
- }>;
74
- export declare const ToolsConfigSchema: z.ZodObject<{
75
- fileEdit: z.ZodDefault<z.ZodBoolean>;
76
- shell: z.ZodDefault<z.ZodBoolean>;
77
- }, "strict", z.ZodTypeAny, {
78
- fileEdit: boolean;
79
- shell: boolean;
80
- }, {
81
- fileEdit?: boolean | undefined;
82
- shell?: boolean | undefined;
83
- }>;
84
- export declare const GitConfigSchema: z.ZodObject<{
85
- autoCommit: z.ZodDefault<z.ZodBoolean>;
86
- /** Branches cruxy never commits/pushes to directly (PR flow branches off
87
- * first). `main` and `master` are always protected; these add to them. */
88
- protectedBranches: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
89
- /** Default base branch for generated pull requests; falls back to the
90
- * repo's default branch, then `main`, when unset. */
91
- defaultBase: z.ZodOptional<z.ZodString>;
92
- }, "strict", z.ZodTypeAny, {
93
- autoCommit: boolean;
94
- protectedBranches: string[];
95
- defaultBase?: string | undefined;
96
- }, {
97
- autoCommit?: boolean | undefined;
98
- protectedBranches?: string[] | undefined;
99
- defaultBase?: string | undefined;
100
- }>;
101
- /** Execution bounds for the `run_command` shell tool (distinct from the
102
- * `tools.shell` enable flag above). */
103
- export declare const ShellConfigSchema: z.ZodObject<{
104
- /** Kill the command (and its process tree) after this many ms. */
105
- timeoutMs: z.ZodDefault<z.ZodNumber>;
106
- /** Cap on combined stdout+stderr bytes captured; the rest is truncated. */
107
- maxOutputBytes: z.ZodDefault<z.ZodNumber>;
108
- /**
109
- * Explicit shell to run commands through, overriding platform detection. A
110
- * path (`/bin/bash`, `C:\\Program Files\\Git\\bin\\bash.exe`, `pwsh`). When
111
- * set it WINS over the Git Bash → PowerShell tiering (see resolve-shell.ts):
112
- * the user owns the choice. Unset → POSIX uses the default shell; Windows
113
- * probes for Git Bash, then PowerShell, then fails loud (CRUXY_E_NO_SHELL).
114
- */
115
- executable: z.ZodOptional<z.ZodString>;
116
- /**
117
- * The command dialect of `executable`, so the model is told which syntax to
118
- * emit. Only sniffed automatically for unambiguous basenames (bash/sh →
119
- * posix, pwsh/powershell → powershell, cmd → cmd); set this for anything else
120
- * or the override is rejected (CRUXY_E_CONFIG_INVALID). Ignored without
121
- * `executable`.
122
- */
123
- dialect: z.ZodOptional<z.ZodEnum<["posix", "powershell", "cmd"]>>;
124
- }, "strict", z.ZodTypeAny, {
125
- timeoutMs: number;
126
- maxOutputBytes: number;
127
- executable?: string | undefined;
128
- dialect?: "posix" | "powershell" | "cmd" | undefined;
129
- }, {
130
- timeoutMs?: number | undefined;
131
- maxOutputBytes?: number | undefined;
132
- executable?: string | undefined;
133
- dialect?: "posix" | "powershell" | "cmd" | undefined;
134
- }>;
135
- export type ShellConfig = z.infer<typeof ShellConfigSchema>;
136
- /** Context-window management: when to compact the running conversation. */
137
- export declare const ContextConfigSchema: z.ZodObject<{
138
- /** Approximate model context budget, in tokens (heuristic estimate). */
139
- maxTokens: z.ZodDefault<z.ZodNumber>;
140
- /** Compact once the history estimate exceeds this fraction of maxTokens. */
141
- compactThreshold: z.ZodDefault<z.ZodNumber>;
142
- /**
143
- * Fixed token allowance for request payload that `estimateTokens` never
144
- * sees — the system prompt and every tool's JSON schema — added to the
145
- * measured history before the threshold test so the trigger reflects the
146
- * real request size, not just the visible messages. Roughly the size of
147
- * the built system prompt plus the default tool catalogue today.
148
- */
149
- reserveTokens: z.ZodDefault<z.ZodNumber>;
150
- /** Most-recent messages always kept verbatim (a floor; the cut rounds up to
151
- * a clean turn boundary). */
152
- keepRecentMessages: z.ZodDefault<z.ZodNumber>;
153
- }, "strict", z.ZodTypeAny, {
154
- maxTokens: number;
155
- compactThreshold: number;
156
- reserveTokens: number;
157
- keepRecentMessages: number;
158
- }, {
159
- maxTokens?: number | undefined;
160
- compactThreshold?: number | undefined;
161
- reserveTokens?: number | undefined;
162
- keepRecentMessages?: number | undefined;
163
- }>;
164
- /**
165
- * How tool-action approval is resolved. Only `prompt` exists: ask interactively
166
- * and **deny by default** when non-interactive. There is deliberately no
167
- * auto-approve / skip mode — the policy seam for a future CI mode lives in
168
- * `src/approval` (see U.3), not behind a footgun flag.
169
- */
170
- export declare const ApprovalConfigSchema: z.ZodObject<{
171
- mode: z.ZodDefault<z.ZodEnum<["prompt"]>>;
172
- }, "strict", z.ZodTypeAny, {
173
- mode: "prompt";
174
- }, {
175
- mode?: "prompt" | undefined;
176
- }>;
177
- /**
178
- * Codebase semantic index (C.17): the local embedding index that backs the
179
- * `search_codebase` tool and `cruxy index`. Every field is defaulted so the
180
- * feature works with zero configuration.
181
- */
182
- export declare const IndexConfigSchema: z.ZodObject<{
183
- /** Master switch for `search_codebase` and `cruxy index`. */
184
- enabled: z.ZodDefault<z.ZodBoolean>;
185
- /**
186
- * Embedding backend. Only `fastembed` (bge-small-en-v1.5, local ONNX; the
187
- * model downloads and caches on first use) is selectable — if it cannot be
188
- * loaded, or the model cannot be downloaded/initialized, indexing fails
189
- * loudly rather than degrading. (The deterministic hashing embedder exists
190
- * for tests and is injected directly, never chosen here.)
191
- *
192
- * THE STORE-VS-EMBEDDER ASYMMETRY (deliberate — see `store` below). The
193
- * embedder has NO degrade path while the store's `auto` does, and that is
194
- * correct, not an inconsistency: a store fallback (sqlite → in-memory) loses
195
- * only PERSISTENCE — search results are byte-identical, you just re-index
196
- * each session, a quality-NEUTRAL trade. The embedder's only cheaper
197
- * substitute is the lexical hashing backend, whose degrade is a SILENT
198
- * QUALITY LOSS — semantic search quietly stops being semantic. That is the
199
- * "reads like success, isn't" trap C.17 forbids, so the embedder fails loud
200
- * (module-load → CRUXY_E_INDEX_EMBEDDER_UNAVAILABLE; first-run download/init
201
- * → CRUXY_E_INDEX_EMBEDDER_DOWNLOAD_FAILED) and `search_codebase` routes the
202
- * model to `grep_files` rather than substituting a weaker index.
203
- */
204
- embedder: z.ZodDefault<z.ZodEnum<["fastembed"]>>;
205
- /**
206
- * Vector store backend. `sqlite` persists to `.cruxy/index.db` via
207
- * better-sqlite3; `memory` is ephemeral (tests). `auto` prefers sqlite and
208
- * falls back to memory when the native dependency cannot be loaded — a
209
- * quality-NEUTRAL degrade (only persistence is lost; results are identical).
210
- * This is why `auto` may degrade while `embedder` may not — see the
211
- * asymmetry note above.
212
- */
213
- store: z.ZodDefault<z.ZodEnum<["auto", "sqlite", "memory"]>>;
214
- /** Hard per-file size cap, in bytes; larger files are skipped entirely. */
215
- maxFileBytes: z.ZodDefault<z.ZodNumber>;
216
- chunk: z.ZodEffects<z.ZodDefault<z.ZodObject<{
217
- /** Target chunk window, in lines. */
218
- windowLines: z.ZodDefault<z.ZodNumber>;
219
- /** Lines shared between consecutive chunks; must be < windowLines. */
220
- overlapLines: z.ZodDefault<z.ZodNumber>;
221
- }, "strict", z.ZodTypeAny, {
222
- windowLines: number;
223
- overlapLines: number;
224
- }, {
225
- windowLines?: number | undefined;
226
- overlapLines?: number | undefined;
227
- }>>, {
228
- windowLines: number;
229
- overlapLines: number;
230
- }, {
231
- windowLines?: number | undefined;
232
- overlapLines?: number | undefined;
233
- } | undefined>;
234
- search: z.ZodDefault<z.ZodObject<{
235
- /** Number of hits returned when the tool omits `k`. */
236
- defaultK: z.ZodDefault<z.ZodNumber>;
237
- /** Approximate token budget for combined snippets (chars/4 heuristic). */
238
- tokenBudget: z.ZodDefault<z.ZodNumber>;
239
- /** Maximum lines kept in any single returned snippet. */
240
- maxSnippetLines: z.ZodDefault<z.ZodNumber>;
241
- }, "strict", z.ZodTypeAny, {
242
- defaultK: number;
243
- tokenBudget: number;
244
- maxSnippetLines: number;
245
- }, {
246
- defaultK?: number | undefined;
247
- tokenBudget?: number | undefined;
248
- maxSnippetLines?: number | undefined;
249
- }>>;
250
- }, "strict", z.ZodTypeAny, {
251
- search: {
252
- defaultK: number;
253
- tokenBudget: number;
254
- maxSnippetLines: number;
255
- };
256
- enabled: boolean;
257
- embedder: "fastembed";
258
- store: "memory" | "auto" | "sqlite";
259
- maxFileBytes: number;
260
- chunk: {
261
- windowLines: number;
262
- overlapLines: number;
263
- };
264
- }, {
265
- search?: {
266
- defaultK?: number | undefined;
267
- tokenBudget?: number | undefined;
268
- maxSnippetLines?: number | undefined;
269
- } | undefined;
270
- enabled?: boolean | undefined;
271
- embedder?: "fastembed" | undefined;
272
- store?: "memory" | "auto" | "sqlite" | undefined;
273
- maxFileBytes?: number | undefined;
274
- chunk?: {
275
- windowLines?: number | undefined;
276
- overlapLines?: number | undefined;
277
- } | undefined;
278
- }>;
279
- /**
280
- * Working-tree checkpoints (C.32): a snapshot taken before an agent run's first
281
- * file mutation, so `cruxy rollback` can undo the whole run atomically.
282
- */
283
- export declare const CheckpointConfigSchema: z.ZodObject<{
284
- /** Auto-checkpoint before a run's first mutation (and enable `cruxy rollback`). */
285
- enabled: z.ZodDefault<z.ZodBoolean>;
286
- /** How many checkpoints to keep; older ones are pruned oldest-first. */
287
- retention: z.ZodDefault<z.ZodNumber>;
288
- }, "strict", z.ZodTypeAny, {
289
- enabled: boolean;
290
- retention: number;
291
- }, {
292
- enabled?: boolean | undefined;
293
- retention?: number | undefined;
294
- }>;
295
- /**
296
- * Test-execution loop (C.13): how the agent runs the project's test suite and
297
- * iterates on failures. The command is detected from package.json when unset;
298
- * cruxy never invents one.
299
- */
300
- export declare const TestConfigSchema: z.ZodObject<{
301
- /** Explicit test command (overrides package.json detection). */
302
- command: z.ZodOptional<z.ZodString>;
303
- /** Consecutive failing runs before the edit→re-run loop trips its cap. */
304
- maxIterations: z.ZodDefault<z.ZodNumber>;
305
- /** Cap on captured test output bytes (tail-biased — failures come last). */
306
- captureBytes: z.ZodDefault<z.ZodNumber>;
307
- }, "strict", z.ZodTypeAny, {
308
- maxIterations: number;
309
- captureBytes: number;
310
- command?: string | undefined;
311
- }, {
312
- command?: string | undefined;
313
- maxIterations?: number | undefined;
314
- captureBytes?: number | undefined;
315
- }>;
316
- /**
317
- * Subagent orchestration (C.14): scoped child agents the main agent can spawn
318
- * for bounded subtasks. Every cap here is a hard bound — a subagent can narrow
319
- * its budget at spawn time but never exceed these ceilings.
320
- */
321
- export declare const SubagentConfigSchema: z.ZodObject<{
322
- /**
323
- * Maximum subagent nesting depth. The main agent is depth 0; the default of
324
- * 1 lets it spawn subagents that cannot themselves spawn (no fork bombs).
325
- */
326
- maxDepth: z.ZodDefault<z.ZodNumber>;
327
- /**
328
- * Parallel fan-out breadth (C.33): the maximum number of subagents that run
329
- * concurrently across the whole session, enforced by one shared semaphore.
330
- * Parallel fan-out happens at depth 0 only and everything beneath it is
331
- * sequential, so this composes with {@link maxDepth} into a LINEAR global
332
- * ceiling (≤ maxConcurrency × maxDepth live agents) — never an exponential
333
- * depth×breadth fork bomb. Default 3.
334
- */
335
- maxConcurrency: z.ZodDefault<z.ZodNumber>;
336
- /** Per-subagent budget ceilings; spawn-time overrides are clamped to these. */
337
- defaultBudget: z.ZodDefault<z.ZodObject<{
338
- /** Hard cap on the subagent's model turns. */
339
- maxIterations: z.ZodDefault<z.ZodNumber>;
340
- /** Hard cap on the subagent's combined input+output tokens. */
341
- maxTokens: z.ZodDefault<z.ZodNumber>;
342
- /** Optional wall-clock cap; unset means no time limit. */
343
- timeoutMs: z.ZodOptional<z.ZodNumber>;
344
- }, "strict", z.ZodTypeAny, {
345
- maxIterations: number;
346
- maxTokens: number;
347
- timeoutMs?: number | undefined;
348
- }, {
349
- timeoutMs?: number | undefined;
350
- maxIterations?: number | undefined;
351
- maxTokens?: number | undefined;
352
- }>>;
353
- }, "strict", z.ZodTypeAny, {
354
- maxDepth: number;
355
- maxConcurrency: number;
356
- defaultBudget: {
357
- maxIterations: number;
358
- maxTokens: number;
359
- timeoutMs?: number | undefined;
360
- };
361
- }, {
362
- maxDepth?: number | undefined;
363
- maxConcurrency?: number | undefined;
364
- defaultBudget?: {
365
- timeoutMs?: number | undefined;
366
- maxIterations?: number | undefined;
367
- maxTokens?: number | undefined;
368
- } | undefined;
369
- }>;
370
- /**
371
- * Session-scoped background jobs (C.28): non-interactive orchestration the main
372
- * agent dispatches with `run_in_background`, running CONCURRENTLY with the
373
- * foreground session but bound to it — nothing survives session exit (NOT a
374
- * daemon). A job hitting a gated action enqueues an approval request into the one
375
- * foreground queue and pauses until a human services it; a paused job releases
376
- * its execution slot.
377
- *
378
- * Two distinct ceilings, stated explicitly because they bound different things:
379
- * • {@link maxJobs} — how many background JOBS may exist at once (queued +
380
- * running + paused). A dispatch past it is refused (`CRUXY_E_JOB_LIMIT`).
381
- * • the shared execution cap is `subagent.maxConcurrency` (default 3) — how many
382
- * runs (subagents AND jobs, combined) may EXECUTE at once. It is NOT
383
- * duplicated here: jobs and subagents draw from the one semaphore. So up to
384
- * `maxJobs` jobs can be alive while only `maxConcurrency` execute; the rest
385
- * wait for a slot (or are paused on a human).
386
- */
387
- export declare const JobsConfigSchema: z.ZodObject<{
388
- /**
389
- * Master switch. When true, the `run_in_background` tool is registered so the
390
- * agent can dispatch background jobs. OFF by default — background work is an
391
- * opt-in capability, and a session that never enables it behaves exactly as
392
- * before (no tool, no manager, no queue).
393
- */
394
- enabled: z.ZodDefault<z.ZodBoolean>;
395
- /**
396
- * Ceiling on live background jobs (queued + running + paused). Distinct from
397
- * the shared execution cap (`subagent.maxConcurrency`): this bounds how many
398
- * jobs can be OUTSTANDING, not how many run at once. Default 5.
399
- */
400
- maxJobs: z.ZodDefault<z.ZodNumber>;
401
- /**
402
- * How many of a job's most-recent log lines are retained in its ring buffer
403
- * for `cruxy logs <id>`. Bounded so a chatty job can't grow memory without
404
- * limit; older lines roll off oldest-first. Default 1000.
405
- */
406
- logBufferLines: z.ZodDefault<z.ZodNumber>;
407
- }, "strict", z.ZodTypeAny, {
408
- maxJobs: number;
409
- enabled: boolean;
410
- logBufferLines: number;
411
- }, {
412
- maxJobs?: number | undefined;
413
- enabled?: boolean | undefined;
414
- logBufferLines?: number | undefined;
415
- }>;
416
- export type JobsConfig = z.infer<typeof JobsConfigSchema>;
417
- /**
418
- * Sandbox / container execution (C.16): defense-in-depth beneath the U.3 gate.
419
- * When enabled, `run_command` and `run_tests` execute inside an isolated,
420
- * network-denied, resource-capped, non-root container with only the project
421
- * workdir mounted — never on the host directly. OFF by default (a container
422
- * runtime isn't universal); turning it on is a hard promise, so if the runtime
423
- * is missing execution FAILS LOUD rather than silently falling back to the host.
424
- */
425
- export declare const SandboxConfigSchema: z.ZodObject<{
426
- /** Master switch. When true, shell + test commands run in the sandbox. */
427
- enabled: z.ZodDefault<z.ZodBoolean>;
428
- /**
429
- * Base image the container runs. Must ship a POSIX `sh`. Pin by digest
430
- * (`name@sha256:…`) where possible; cruxy never builds or substitutes one.
431
- */
432
- image: z.ZodDefault<z.ZodString>;
433
- /**
434
- * Egress policy. `none` denies all network (default deny); `host-loopback`
435
- * permits reaching services on the host; `full` allows outbound. Anything
436
- * other than `none` is a deliberate widening the user must opt into.
437
- */
438
- network: z.ZodDefault<z.ZodEnum<["none", "host-loopback", "full"]>>;
439
- /** Memory cap (docker `--memory` syntax, e.g. `512m`, `2g`). */
440
- memory: z.ZodDefault<z.ZodString>;
441
- /** Process/thread cap (`--pids-limit`) — a fork-bomb guard. */
442
- pids: z.ZodDefault<z.ZodNumber>;
443
- /** CPU cap (docker `--cpus`, fractional allowed). */
444
- cpus: z.ZodDefault<z.ZodNumber>;
445
- /** Wall-clock timeout in ms; falls back to `shell.timeoutMs` when unset. */
446
- timeout: z.ZodOptional<z.ZodNumber>;
447
- /**
448
- * Extra bind mounts beyond the workdir + tmp, each `src:dst[:ro|:rw]`.
449
- * Explicit by construction — the default exposes ONLY the workdir. The
450
- * docker socket and the cruxy home are rejected here (see policy.ts).
451
- */
452
- mounts: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
453
- }, "strict", z.ZodTypeAny, {
454
- memory: string;
455
- image: string;
456
- enabled: boolean;
457
- network: "none" | "host-loopback" | "full";
458
- pids: number;
459
- cpus: number;
460
- mounts: string[];
461
- timeout?: number | undefined;
462
- }, {
463
- memory?: string | undefined;
464
- image?: string | undefined;
465
- enabled?: boolean | undefined;
466
- network?: "none" | "host-loopback" | "full" | undefined;
467
- pids?: number | undefined;
468
- cpus?: number | undefined;
469
- timeout?: number | undefined;
470
- mounts?: string[] | undefined;
471
- }>;
472
- export type SandboxConfig = z.infer<typeof SandboxConfigSchema>;
473
- /**
474
- * Hooks + custom slash commands (C.19). Hooks run user-authored shell commands
475
- * on lifecycle events — a real execution surface — so they are OFF by default
476
- * and, when on, still funnel through the SAME U.3 gate + C.16 sandbox as any
477
- * agent command (never a bypass). The hook *definitions* live in layered
478
- * `hooks.json` files (project > user, source-tracked for the trust model); this
479
- * schema holds only the global toggles.
480
- */
481
- export declare const HooksConfigSchema: z.ZodObject<{
482
- /** Master switch. When false, NO hook ever fires (config with hooks stays
483
- * inert until explicitly enabled). */
484
- enabled: z.ZodDefault<z.ZodBoolean>;
485
- /**
486
- * Whether to interactively prompt to trust a project's hooks the first time
487
- * they would run. When false, untrusted project hooks fail loud
488
- * (CRUXY_E_HOOK_UNTRUSTED) instead of prompting — never auto-trust.
489
- */
490
- trustPrompt: z.ZodDefault<z.ZodBoolean>;
491
- }, "strict", z.ZodTypeAny, {
492
- enabled: boolean;
493
- trustPrompt: boolean;
494
- }, {
495
- enabled?: boolean | undefined;
496
- trustPrompt?: boolean | undefined;
497
- }>;
498
- export type HooksConfig = z.infer<typeof HooksConfigSchema>;
499
- /**
500
- * Multi-model routing (C.30): map declared task classes to tiers so mechanical
501
- * work runs on a cheap tier and hard reasoning on a strong one. Fully opt-in —
502
- * with an empty `map` and no `default`, every task class routes to the session's
503
- * single tier and behavior is unchanged (routing stays inert until configured).
504
- * Only tier names appear here; upstream model names never do (U.8). Keys are the
505
- * fixed {@link TASK_CLASSES}, so a mistyped class is rejected at config load.
506
- */
507
- export declare const RoutingConfigSchema: z.ZodObject<{
508
- /** Tier for any task class not in `map`. Unset → the tier implied by
509
- * `model.model` (a real tier, or the auto-fallback tier). */
510
- default: z.ZodOptional<z.ZodEnum<["kavi", "vaani", "mira"]>>;
511
- /** Per-task-class tier overrides; anything omitted takes `default`. */
512
- map: z.ZodDefault<z.ZodRecord<z.ZodEnum<["main-turn", "subagent", "plan", "commit-msg", "classify", "summarize"]>, z.ZodEnum<["kavi", "vaani", "mira"]>>>;
513
- }, "strict", z.ZodTypeAny, {
514
- map: Partial<Record<"main-turn" | "subagent" | "plan" | "commit-msg" | "classify" | "summarize", "kavi" | "vaani" | "mira">>;
515
- default?: "kavi" | "vaani" | "mira" | undefined;
516
- }, {
517
- map?: Partial<Record<"main-turn" | "subagent" | "plan" | "commit-msg" | "classify" | "summarize", "kavi" | "vaani" | "mira">> | undefined;
518
- default?: "kavi" | "vaani" | "mira" | undefined;
519
- }>;
520
- /**
521
- * Persistent memory (C.29): structured notes recalled across sessions. ON by
522
- * default and safe to be so — user memory is self-authored (nothing you didn't
523
- * write is injected) and project memory still requires an explicit
524
- * `cruxy memory trust`, so a cloned repo never auto-injects. Recall is bounded
525
- * by a token budget; the `remember` tool refuses to persist secrets.
526
- */
527
- export declare const MemoryConfigSchema: z.ZodObject<{
528
- /** Master switch. When false, nothing is recalled and the `remember` tool
529
- * is not registered (memory stays fully inert). */
530
- enabled: z.ZodDefault<z.ZodBoolean>;
531
- /** Token budget for the recalled block injected at session start; entries
532
- * beyond it are pruned oldest-first (the omission is stated, never silent). */
533
- maxRecallTokens: z.ZodDefault<z.ZodNumber>;
534
- }, "strict", z.ZodTypeAny, {
535
- enabled: boolean;
536
- maxRecallTokens: number;
537
- }, {
538
- enabled?: boolean | undefined;
539
- maxRecallTokens?: number | undefined;
540
- }>;
541
- export type MemoryConfig = z.infer<typeof MemoryConfigSchema>;
542
- /**
543
- * Per-language LSP integration (C.12): read-only, symbol-aware tools
544
- * (find_definition, find_references, get_diagnostics, hover) backed by a
545
- * managed pool of language servers. OFF by default — like the sandbox and
546
- * hooks, it spawns and manages EXTERNAL server processes, a real execution
547
- * surface the user opts into explicitly. When on, a missing server binary is
548
- * an actionable, coded failure (CRUXY_E_LSP_SERVER_NOT_FOUND), never a silent
549
- * empty result. Servers spawn lazily per language, are reused for the session,
550
- * and are shut down cleanly (with a process-exit kill-tree backstop).
551
- */
552
- export declare const LspConfigSchema: z.ZodObject<{
553
- /** Master switch. When false, the four LSP tools are not registered and no
554
- * server ever spawns (the feature stays fully inert). */
555
- enabled: z.ZodDefault<z.ZodBoolean>;
556
- /**
557
- * Per-language command overrides, keyed by language id (e.g. `typescript`,
558
- * `python`, `go`, `rust`). The value is the full command line
559
- * (`"gopls -remote=auto"`); it is split on whitespace. Anything omitted
560
- * falls back to the built-in default table (see `lsp/registry.ts`).
561
- */
562
- servers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
563
- /** Kill and fail (CRUXY_E_LSP_TIMEOUT) if the `initialize` handshake does
564
- * not complete within this many ms. */
565
- startupTimeout: z.ZodDefault<z.ZodNumber>;
566
- /** Fail a single query (CRUXY_E_LSP_TIMEOUT) if the server does not respond
567
- * within this many ms — the server is kept alive, only the request errors. */
568
- requestTimeout: z.ZodDefault<z.ZodNumber>;
569
- /** Maximum concurrently-running language servers; acquiring past the cap
570
- * evicts the idle-oldest server first. */
571
- maxServers: z.ZodDefault<z.ZodNumber>;
572
- /** Shut a server down after it has been idle this many ms. */
573
- idleTimeout: z.ZodDefault<z.ZodNumber>;
574
- /** Cap on locations/diagnostics returned by a single tool call; the rest are
575
- * summarized as an "N more" note (bounded output). */
576
- maxResults: z.ZodDefault<z.ZodNumber>;
577
- }, "strict", z.ZodTypeAny, {
578
- startupTimeout: number;
579
- requestTimeout: number;
580
- servers: Record<string, string>;
581
- enabled: boolean;
582
- maxServers: number;
583
- idleTimeout: number;
584
- maxResults: number;
585
- }, {
586
- startupTimeout?: number | undefined;
587
- requestTimeout?: number | undefined;
588
- servers?: Record<string, string> | undefined;
589
- enabled?: boolean | undefined;
590
- maxServers?: number | undefined;
591
- idleTimeout?: number | undefined;
592
- maxResults?: number | undefined;
593
- }>;
594
- export type LspConfig = z.infer<typeof LspConfigSchema>;
595
- /** A per-tier price, in the user's own currency, PER MILLION TOKENS (C.22). */
596
- export declare const TierPriceSchema: z.ZodObject<{
597
- /** Price per 1,000,000 input tokens. */
598
- input: z.ZodNumber;
599
- /** Price per 1,000,000 output tokens. */
600
- output: z.ZodNumber;
601
- }, "strict", z.ZodTypeAny, {
602
- input: number;
603
- output: number;
604
- }, {
605
- input: number;
606
- output: number;
607
- }>;
608
- /**
609
- * Usage telemetry + cost tracking (C.22): LOCAL usage accounting only — nothing
610
- * here is ever transmitted. Costs are opt-in and honest: prices are per-TIER and
611
- * per-million-tokens, configured by the user; with none set, tokens are shown
612
- * and cost is omitted (cruxy ships no bundled price table). The `prices` keys are
613
- * the fixed {@link MODEL_TIERS}, so an upstream model name can never appear here
614
- * (U.8 gag holds by construction) and a mistyped tier is rejected at config load.
615
- */
616
- export declare const UsageConfigSchema: z.ZodObject<{
617
- /** Master switch. When false, no usage is collected, persisted, or shown. */
618
- enabled: z.ZodDefault<z.ZodBoolean>;
619
- /** Currency label to prefix costs with (e.g. "$", "€"). Empty ⇒ no symbol is
620
- * assumed — a bare number is shown, since the user configured the prices. */
621
- currency: z.ZodDefault<z.ZodString>;
622
- /** How many past runs to keep in the store; older ones are pruned oldest-first. */
623
- retention: z.ZodDefault<z.ZodNumber>;
624
- /** Per-tier prices. Any tier omitted is simply unpriced (cost omitted for it). */
625
- prices: z.ZodDefault<z.ZodObject<{
626
- kavi: z.ZodOptional<z.ZodObject<{
627
- /** Price per 1,000,000 input tokens. */
628
- input: z.ZodNumber;
629
- /** Price per 1,000,000 output tokens. */
630
- output: z.ZodNumber;
631
- }, "strict", z.ZodTypeAny, {
632
- input: number;
633
- output: number;
634
- }, {
635
- input: number;
636
- output: number;
637
- }>>;
638
- vaani: z.ZodOptional<z.ZodObject<{
639
- /** Price per 1,000,000 input tokens. */
640
- input: z.ZodNumber;
641
- /** Price per 1,000,000 output tokens. */
642
- output: z.ZodNumber;
643
- }, "strict", z.ZodTypeAny, {
644
- input: number;
645
- output: number;
646
- }, {
647
- input: number;
648
- output: number;
649
- }>>;
650
- mira: z.ZodOptional<z.ZodObject<{
651
- /** Price per 1,000,000 input tokens. */
652
- input: z.ZodNumber;
653
- /** Price per 1,000,000 output tokens. */
654
- output: z.ZodNumber;
655
- }, "strict", z.ZodTypeAny, {
656
- input: number;
657
- output: number;
658
- }, {
659
- input: number;
660
- output: number;
661
- }>>;
662
- }, "strict", z.ZodTypeAny, {
663
- kavi?: {
664
- input: number;
665
- output: number;
666
- } | undefined;
667
- vaani?: {
668
- input: number;
669
- output: number;
670
- } | undefined;
671
- mira?: {
672
- input: number;
673
- output: number;
674
- } | undefined;
675
- }, {
676
- kavi?: {
677
- input: number;
678
- output: number;
679
- } | undefined;
680
- vaani?: {
681
- input: number;
682
- output: number;
683
- } | undefined;
684
- mira?: {
685
- input: number;
686
- output: number;
687
- } | undefined;
688
- }>>;
689
- }, "strict", z.ZodTypeAny, {
690
- enabled: boolean;
691
- retention: number;
692
- currency: string;
693
- prices: {
694
- kavi?: {
695
- input: number;
696
- output: number;
697
- } | undefined;
698
- vaani?: {
699
- input: number;
700
- output: number;
701
- } | undefined;
702
- mira?: {
703
- input: number;
704
- output: number;
705
- } | undefined;
706
- };
707
- }, {
708
- enabled?: boolean | undefined;
709
- retention?: number | undefined;
710
- currency?: string | undefined;
711
- prices?: {
712
- kavi?: {
713
- input: number;
714
- output: number;
715
- } | undefined;
716
- vaani?: {
717
- input: number;
718
- output: number;
719
- } | undefined;
720
- mira?: {
721
- input: number;
722
- output: number;
723
- } | undefined;
724
- } | undefined;
725
- }>;
726
- export type UsageConfig = z.infer<typeof UsageConfigSchema>;
727
- /**
728
- * One MCP server entry. A `command` (+ optional `args`/`env`) is a stdio server
729
- * cruxy spawns as a child process (C.27); a `url` names a remote server reached
730
- * over Streamable HTTP (C.27b). Exactly one transport must be given.
731
- *
732
- * Both are gated by an explicit, fingerprinted trust decision (`mcp/trust.ts`),
733
- * but the escalation differs: a stdio server runs its code UNSANDBOXED with your
734
- * privileges, while a `url` server runs remotely — cruxy sends it your tool
735
- * arguments over the network (https + cert-validated + pinned to a public IP; http
736
- * only for a loopback dev server) and treats its responses as untrusted data. A
737
- * url's trust also binds its resolved IP set at trust time, so a later IP-set
738
- * change re-gates (weaker than a local binary fingerprint — see `mcp/types.ts`).
739
- */
740
- export declare const McpServerSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
741
- /** stdio transport: the server program to spawn. */
742
- command: z.ZodOptional<z.ZodString>;
743
- /** Arguments for `command`. */
744
- args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
745
- /** Extra environment variables for the spawned server (stdio only). */
746
- env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
747
- /** Remote transport: the server URL (mutually exclusive with `command`). */
748
- url: z.ZodOptional<z.ZodString>;
749
- /**
750
- * Remote auth (C.27c, url only): the NAME of a bearer credential, resolved
751
- * solely from `~/.cruxy/credentials.json` (0600) as `Authorization: Bearer …`.
752
- * This field holds a NAME, never the secret — a project config may name a
753
- * credential it does not contain, so the value never lives in-repo. Resolution
754
- * never consults the environment or any config file. Requires an `https` URL.
755
- */
756
- credentialRef: z.ZodOptional<z.ZodString>;
757
- /**
758
- * Remote auth (C.27c, url only): raw request headers sent to the endpoint.
759
- * A LIVE header value is a secret, so this is accepted ONLY from user-scope
760
- * config (`~/.cruxy/config.json`) — the loader REJECTS it from project-scope
761
- * config (a cloned repo must not inject live headers). Prefer `credentialRef`.
762
- * Requires an `https` URL; reserved framing headers cannot be overridden.
763
- */
764
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
765
- }, "strict", z.ZodTypeAny, {
766
- args: string[];
767
- env: Record<string, string>;
768
- command?: string | undefined;
769
- credentialRef?: string | undefined;
770
- url?: string | undefined;
771
- headers?: Record<string, string> | undefined;
772
- }, {
773
- command?: string | undefined;
774
- credentialRef?: string | undefined;
775
- url?: string | undefined;
776
- args?: string[] | undefined;
777
- env?: Record<string, string> | undefined;
778
- headers?: Record<string, string> | undefined;
779
- }>, {
780
- args: string[];
781
- env: Record<string, string>;
782
- command?: string | undefined;
783
- credentialRef?: string | undefined;
784
- url?: string | undefined;
785
- headers?: Record<string, string> | undefined;
786
- }, {
787
- command?: string | undefined;
788
- credentialRef?: string | undefined;
789
- url?: string | undefined;
790
- args?: string[] | undefined;
791
- env?: Record<string, string> | undefined;
792
- headers?: Record<string, string> | undefined;
793
- }>, {
794
- args: string[];
795
- env: Record<string, string>;
796
- command?: string | undefined;
797
- credentialRef?: string | undefined;
798
- url?: string | undefined;
799
- headers?: Record<string, string> | undefined;
800
- }, {
801
- command?: string | undefined;
802
- credentialRef?: string | undefined;
803
- url?: string | undefined;
804
- args?: string[] | undefined;
805
- env?: Record<string, string> | undefined;
806
- headers?: Record<string, string> | undefined;
807
- }>, {
808
- args: string[];
809
- env: Record<string, string>;
810
- command?: string | undefined;
811
- credentialRef?: string | undefined;
812
- url?: string | undefined;
813
- headers?: Record<string, string> | undefined;
814
- }, {
815
- command?: string | undefined;
816
- credentialRef?: string | undefined;
817
- url?: string | undefined;
818
- args?: string[] | undefined;
819
- env?: Record<string, string> | undefined;
820
- headers?: Record<string, string> | undefined;
821
- }>;
822
- export type McpServerConfig = z.infer<typeof McpServerSchema>;
823
- /**
824
- * MCP client integration (C.27): connect to trusted MCP servers and expose their
825
- * tools to the agent. OFF by default — like the sandbox, LSP, and hooks, it runs
826
- * EXTERNAL code (a stdio server executes UNSANDBOXED with your privileges), a
827
- * real execution surface you opt into explicitly. When off, nothing connects or
828
- * spawns and no MCP tool is ever registered. Every server-advertised tool is
829
- * gated (destructive tier — a server can never self-declare a tool "safe"), its
830
- * description and results are demarcated as untrusted external data with upstream
831
- * model names scrubbed, and results are NEVER persisted. The tool list a server
832
- * advertises is bounded (count + per-tool description/schema size) so a hostile
833
- * server can't blow the context budget.
834
- */
835
- export declare const McpConfigSchema: z.ZodObject<{
836
- /** Master switch. When false, no server is connected/spawned and no MCP tool
837
- * is registered (the feature stays fully inert). */
838
- enabled: z.ZodDefault<z.ZodBoolean>;
839
- /** Named MCP servers, keyed by a short server id used as the tool prefix
840
- * (`mcp__<server>__<tool>`) and in the trust prompt. */
841
- servers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
842
- /** stdio transport: the server program to spawn. */
843
- command: z.ZodOptional<z.ZodString>;
844
- /** Arguments for `command`. */
845
- args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
846
- /** Extra environment variables for the spawned server (stdio only). */
847
- env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
848
- /** Remote transport: the server URL (mutually exclusive with `command`). */
849
- url: z.ZodOptional<z.ZodString>;
850
- /**
851
- * Remote auth (C.27c, url only): the NAME of a bearer credential, resolved
852
- * solely from `~/.cruxy/credentials.json` (0600) as `Authorization: Bearer …`.
853
- * This field holds a NAME, never the secret — a project config may name a
854
- * credential it does not contain, so the value never lives in-repo. Resolution
855
- * never consults the environment or any config file. Requires an `https` URL.
856
- */
857
- credentialRef: z.ZodOptional<z.ZodString>;
858
- /**
859
- * Remote auth (C.27c, url only): raw request headers sent to the endpoint.
860
- * A LIVE header value is a secret, so this is accepted ONLY from user-scope
861
- * config (`~/.cruxy/config.json`) — the loader REJECTS it from project-scope
862
- * config (a cloned repo must not inject live headers). Prefer `credentialRef`.
863
- * Requires an `https` URL; reserved framing headers cannot be overridden.
864
- */
865
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
866
- }, "strict", z.ZodTypeAny, {
867
- args: string[];
868
- env: Record<string, string>;
869
- command?: string | undefined;
870
- credentialRef?: string | undefined;
871
- url?: string | undefined;
872
- headers?: Record<string, string> | undefined;
873
- }, {
874
- command?: string | undefined;
875
- credentialRef?: string | undefined;
876
- url?: string | undefined;
877
- args?: string[] | undefined;
878
- env?: Record<string, string> | undefined;
879
- headers?: Record<string, string> | undefined;
880
- }>, {
881
- args: string[];
882
- env: Record<string, string>;
883
- command?: string | undefined;
884
- credentialRef?: string | undefined;
885
- url?: string | undefined;
886
- headers?: Record<string, string> | undefined;
887
- }, {
888
- command?: string | undefined;
889
- credentialRef?: string | undefined;
890
- url?: string | undefined;
891
- args?: string[] | undefined;
892
- env?: Record<string, string> | undefined;
893
- headers?: Record<string, string> | undefined;
894
- }>, {
895
- args: string[];
896
- env: Record<string, string>;
897
- command?: string | undefined;
898
- credentialRef?: string | undefined;
899
- url?: string | undefined;
900
- headers?: Record<string, string> | undefined;
901
- }, {
902
- command?: string | undefined;
903
- credentialRef?: string | undefined;
904
- url?: string | undefined;
905
- args?: string[] | undefined;
906
- env?: Record<string, string> | undefined;
907
- headers?: Record<string, string> | undefined;
908
- }>, {
909
- args: string[];
910
- env: Record<string, string>;
911
- command?: string | undefined;
912
- credentialRef?: string | undefined;
913
- url?: string | undefined;
914
- headers?: Record<string, string> | undefined;
915
- }, {
916
- command?: string | undefined;
917
- credentialRef?: string | undefined;
918
- url?: string | undefined;
919
- args?: string[] | undefined;
920
- env?: Record<string, string> | undefined;
921
- headers?: Record<string, string> | undefined;
922
- }>>>;
923
- /** Fail a server's `initialize` handshake (its tools are skipped) if it does
924
- * not complete within this many ms. */
925
- startupTimeout: z.ZodDefault<z.ZodNumber>;
926
- /** Fail a single `tools/call` if the server does not respond within this many
927
- * ms — the connection is kept, only the one call errors. */
928
- requestTimeout: z.ZodDefault<z.ZodNumber>;
929
- /** Max tools accepted from ONE server; extras are dropped with a visible note
930
- * (a hostile server can't advertise thousands of tools to flood context). */
931
- maxToolsPerServer: z.ZodDefault<z.ZodNumber>;
932
- /** Max characters kept from a single tool's description; the rest is truncated
933
- * with a visible marker. */
934
- maxDescriptionChars: z.ZodDefault<z.ZodNumber>;
935
- /** Max bytes kept from a single tool's advertised JSON input schema; an
936
- * over-cap schema is replaced with a permissive one and a visible note. */
937
- maxSchemaBytes: z.ZodDefault<z.ZodNumber>;
938
- }, "strict", z.ZodTypeAny, {
939
- startupTimeout: number;
940
- requestTimeout: number;
941
- servers: Record<string, {
942
- args: string[];
943
- env: Record<string, string>;
944
- command?: string | undefined;
945
- credentialRef?: string | undefined;
946
- url?: string | undefined;
947
- headers?: Record<string, string> | undefined;
948
- }>;
949
- enabled: boolean;
950
- maxToolsPerServer: number;
951
- maxDescriptionChars: number;
952
- maxSchemaBytes: number;
953
- }, {
954
- startupTimeout?: number | undefined;
955
- requestTimeout?: number | undefined;
956
- servers?: Record<string, {
957
- command?: string | undefined;
958
- credentialRef?: string | undefined;
959
- url?: string | undefined;
960
- args?: string[] | undefined;
961
- env?: Record<string, string> | undefined;
962
- headers?: Record<string, string> | undefined;
963
- }> | undefined;
964
- enabled?: boolean | undefined;
965
- maxToolsPerServer?: number | undefined;
966
- maxDescriptionChars?: number | undefined;
967
- maxSchemaBytes?: number | undefined;
968
- }>;
969
- export type McpConfig = z.infer<typeof McpConfigSchema>;
970
- /**
971
- * Web-search + web-fetch subtool (C.20). OFF by default. When enabled, the agent
972
- * gets a bounded `web_search` (query → ranked title/url/snippet) and a `web_fetch`
973
- * (read one URL as text). Both surface EXTERNAL, attacker-controllable data:
974
- * results and fetched pages are wrapped as untrusted data (do-not-follow-instructions
975
- * envelope, fence-forgery neutralized) with upstream model names scrubbed, and
976
- * are NEVER persisted to memory/index/checkpoint. `web_fetch` refuses non-http(s)
977
- * schemes and any host that resolves into a private/loopback/link-local range
978
- * (SSRF guard) — the request is never dispatched. No provider is constructed and
979
- * no tool is registered while this is off. Search runs through a swappable
980
- * `SearchProvider` seam; the direct provider's API key comes from the environment
981
- * (`apiKeyEnv`), never from config-in-repo and never logged.
982
- */
983
- export declare const WebConfigSchema: z.ZodObject<{
984
- /** Master switch. When false, neither tool is registered and no provider is
985
- * constructed (the feature stays fully inert). */
986
- enabled: z.ZodDefault<z.ZodBoolean>;
987
- /** Which search backend to use behind the `SearchProvider` seam. A gateway
988
- * provider slots in here first-class if the backend ever proxies search. */
989
- provider: z.ZodDefault<z.ZodEnum<["tavily"]>>;
990
- /** Environment variable holding the direct provider's API key. The key is
991
- * read at call time, sent only in the provider's auth field, and never
992
- * logged or written to the repo. */
993
- apiKeyEnv: z.ZodDefault<z.ZodString>;
994
- /** Max search results returned to the model (top-N; the rest are dropped). */
995
- maxResults: z.ZodDefault<z.ZodNumber>;
996
- /** Max characters kept from a single result's snippet; the rest is truncated
997
- * with a visible marker. */
998
- snippetMaxChars: z.ZodDefault<z.ZodNumber>;
999
- /** Max bytes read from a single `web_fetch` page; the rest is truncated with
1000
- * a visible marker (a hostile/huge page can't blow the context budget). */
1001
- fetchMaxBytes: z.ZodDefault<z.ZodNumber>;
1002
- /** Per-request timeout (search and fetch) — a slow host errors, never hangs. */
1003
- timeoutMs: z.ZodDefault<z.ZodNumber>;
1004
- /** Max HTTP redirects `web_fetch` follows; each hop is re-checked by the SSRF
1005
- * guard so a 3xx can't bounce the request into a private range. */
1006
- maxRedirects: z.ZodDefault<z.ZodNumber>;
1007
- /** Escape hatch: allow `web_fetch` to reach private/loopback/link-local hosts.
1008
- * OFF by default (SSRF-safe); only set true for a deliberate internal-network
1009
- * use case. */
1010
- allowPrivateHosts: z.ZodDefault<z.ZodBoolean>;
1011
- }, "strict", z.ZodTypeAny, {
1012
- provider: "tavily";
1013
- timeoutMs: number;
1014
- apiKeyEnv: string;
1015
- enabled: boolean;
1016
- maxResults: number;
1017
- snippetMaxChars: number;
1018
- fetchMaxBytes: number;
1019
- maxRedirects: number;
1020
- allowPrivateHosts: boolean;
1021
- }, {
1022
- provider?: "tavily" | undefined;
1023
- timeoutMs?: number | undefined;
1024
- apiKeyEnv?: string | undefined;
1025
- enabled?: boolean | undefined;
1026
- maxResults?: number | undefined;
1027
- snippetMaxChars?: number | undefined;
1028
- fetchMaxBytes?: number | undefined;
1029
- maxRedirects?: number | undefined;
1030
- allowPrivateHosts?: boolean | undefined;
1031
- }>;
1032
- export type WebConfig = z.infer<typeof WebConfigSchema>;
1033
- export declare const CruxyConfigSchema: z.ZodObject<{
1034
- model: z.ZodDefault<z.ZodObject<{
1035
- provider: z.ZodDefault<z.ZodEnum<["cruxy", "anthropic", "openai", "custom"]>>;
1036
- model: z.ZodDefault<z.ZodString>;
1037
- maxTokens: z.ZodDefault<z.ZodNumber>;
1038
- temperature: z.ZodDefault<z.ZodNumber>;
1039
- }, "strict", z.ZodTypeAny, {
1040
- provider: "cruxy" | "anthropic" | "openai" | "custom";
1041
- model: string;
1042
- maxTokens: number;
1043
- temperature: number;
1044
- }, {
1045
- provider?: "cruxy" | "anthropic" | "openai" | "custom" | undefined;
1046
- model?: string | undefined;
1047
- maxTokens?: number | undefined;
1048
- temperature?: number | undefined;
1049
- }>>;
1050
- cruxy: z.ZodDefault<z.ZodObject<{
1051
- gatewayUrl: z.ZodDefault<z.ZodString>;
1052
- }, "strict", z.ZodTypeAny, {
1053
- gatewayUrl: string;
1054
- }, {
1055
- gatewayUrl?: string | undefined;
1056
- }>>;
1057
- agent: z.ZodDefault<z.ZodObject<{
1058
- /**
1059
- * Hard ceiling on agent loop turns per user turn — the interactive default.
1060
- * In the REPL this is a soft checkpoint: hitting it ends the turn and the
1061
- * human continues (or Ctrl-C's a runaway), so it can be generous.
1062
- */
1063
- maxIterations: z.ZodDefault<z.ZodNumber>;
1064
- /**
1065
- * Turn ceiling for a ONE-SHOT `cruxy run "task"` (non-interactive). Set higher
1066
- * than {@link maxIterations} because a headless run has no human to resume it:
1067
- * hitting the cap abandons the whole task (fail-loud, non-zero exit), so it
1068
- * must clear the legit long tail (real "fix the failing tests" work runs
1069
- * ~10-25 turns) while still bounding a runaway. Not clamped to
1070
- * `maxIterations` — a user may deliberately set it lower or higher.
1071
- */
1072
- maxIterationsOneShot: z.ZodDefault<z.ZodNumber>;
1073
- /**
1074
- * Optional hard cap on combined input+output tokens for a SINGLE user turn
1075
- * — a last-resort runaway guard, not cost control (cumulative session cost
1076
- * is C.22's concern). OFF by default (0 = off): today's behavior is
1077
- * preserved exactly and no turn is ever token-stopped. When set, a turn that
1078
- * crosses the cap stops at the next turn boundary with a coherent partial
1079
- * history (`stop: "budget"`); in one-shot that fails loud (exit 20), while
1080
- * interactively the human simply continues. Compaction is the everyday
1081
- * pressure valve for context — this only bounds a genuinely runaway turn, so
1082
- * a hostile hard stop mid-work stays opt-in. Reset each `send`, never
1083
- * cumulative across turns.
1084
- */
1085
- maxTokensPerTurn: z.ZodDefault<z.ZodNumber>;
1086
- /** Skip per-action confirmation prompts. */
1087
- autoApprove: z.ZodDefault<z.ZodBoolean>;
1088
- /** Plan mode: propose a plan for approval before executing (C.31, opt-in). */
1089
- planMode: z.ZodDefault<z.ZodBoolean>;
1090
- }, "strict", z.ZodTypeAny, {
1091
- maxIterations: number;
1092
- maxIterationsOneShot: number;
1093
- maxTokensPerTurn: number;
1094
- autoApprove: boolean;
1095
- planMode: boolean;
1096
- }, {
1097
- maxIterations?: number | undefined;
1098
- maxIterationsOneShot?: number | undefined;
1099
- maxTokensPerTurn?: number | undefined;
1100
- autoApprove?: boolean | undefined;
1101
- planMode?: boolean | undefined;
1102
- }>>;
1103
- tools: z.ZodDefault<z.ZodObject<{
1104
- fileEdit: z.ZodDefault<z.ZodBoolean>;
1105
- shell: z.ZodDefault<z.ZodBoolean>;
1106
- }, "strict", z.ZodTypeAny, {
1107
- fileEdit: boolean;
1108
- shell: boolean;
1109
- }, {
1110
- fileEdit?: boolean | undefined;
1111
- shell?: boolean | undefined;
1112
- }>>;
1113
- git: z.ZodDefault<z.ZodObject<{
1114
- autoCommit: z.ZodDefault<z.ZodBoolean>;
1115
- /** Branches cruxy never commits/pushes to directly (PR flow branches off
1116
- * first). `main` and `master` are always protected; these add to them. */
1117
- protectedBranches: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1118
- /** Default base branch for generated pull requests; falls back to the
1119
- * repo's default branch, then `main`, when unset. */
1120
- defaultBase: z.ZodOptional<z.ZodString>;
1121
- }, "strict", z.ZodTypeAny, {
1122
- autoCommit: boolean;
1123
- protectedBranches: string[];
1124
- defaultBase?: string | undefined;
1125
- }, {
1126
- autoCommit?: boolean | undefined;
1127
- protectedBranches?: string[] | undefined;
1128
- defaultBase?: string | undefined;
1129
- }>>;
1130
- shell: z.ZodDefault<z.ZodObject<{
1131
- /** Kill the command (and its process tree) after this many ms. */
1132
- timeoutMs: z.ZodDefault<z.ZodNumber>;
1133
- /** Cap on combined stdout+stderr bytes captured; the rest is truncated. */
1134
- maxOutputBytes: z.ZodDefault<z.ZodNumber>;
1135
- /**
1136
- * Explicit shell to run commands through, overriding platform detection. A
1137
- * path (`/bin/bash`, `C:\\Program Files\\Git\\bin\\bash.exe`, `pwsh`). When
1138
- * set it WINS over the Git Bash → PowerShell tiering (see resolve-shell.ts):
1139
- * the user owns the choice. Unset → POSIX uses the default shell; Windows
1140
- * probes for Git Bash, then PowerShell, then fails loud (CRUXY_E_NO_SHELL).
1141
- */
1142
- executable: z.ZodOptional<z.ZodString>;
1143
- /**
1144
- * The command dialect of `executable`, so the model is told which syntax to
1145
- * emit. Only sniffed automatically for unambiguous basenames (bash/sh →
1146
- * posix, pwsh/powershell → powershell, cmd → cmd); set this for anything else
1147
- * or the override is rejected (CRUXY_E_CONFIG_INVALID). Ignored without
1148
- * `executable`.
1149
- */
1150
- dialect: z.ZodOptional<z.ZodEnum<["posix", "powershell", "cmd"]>>;
1151
- }, "strict", z.ZodTypeAny, {
1152
- timeoutMs: number;
1153
- maxOutputBytes: number;
1154
- executable?: string | undefined;
1155
- dialect?: "posix" | "powershell" | "cmd" | undefined;
1156
- }, {
1157
- timeoutMs?: number | undefined;
1158
- maxOutputBytes?: number | undefined;
1159
- executable?: string | undefined;
1160
- dialect?: "posix" | "powershell" | "cmd" | undefined;
1161
- }>>;
1162
- context: z.ZodDefault<z.ZodObject<{
1163
- /** Approximate model context budget, in tokens (heuristic estimate). */
1164
- maxTokens: z.ZodDefault<z.ZodNumber>;
1165
- /** Compact once the history estimate exceeds this fraction of maxTokens. */
1166
- compactThreshold: z.ZodDefault<z.ZodNumber>;
1167
- /**
1168
- * Fixed token allowance for request payload that `estimateTokens` never
1169
- * sees — the system prompt and every tool's JSON schema — added to the
1170
- * measured history before the threshold test so the trigger reflects the
1171
- * real request size, not just the visible messages. Roughly the size of
1172
- * the built system prompt plus the default tool catalogue today.
1173
- */
1174
- reserveTokens: z.ZodDefault<z.ZodNumber>;
1175
- /** Most-recent messages always kept verbatim (a floor; the cut rounds up to
1176
- * a clean turn boundary). */
1177
- keepRecentMessages: z.ZodDefault<z.ZodNumber>;
1178
- }, "strict", z.ZodTypeAny, {
1179
- maxTokens: number;
1180
- compactThreshold: number;
1181
- reserveTokens: number;
1182
- keepRecentMessages: number;
1183
- }, {
1184
- maxTokens?: number | undefined;
1185
- compactThreshold?: number | undefined;
1186
- reserveTokens?: number | undefined;
1187
- keepRecentMessages?: number | undefined;
1188
- }>>;
1189
- approval: z.ZodDefault<z.ZodObject<{
1190
- mode: z.ZodDefault<z.ZodEnum<["prompt"]>>;
1191
- }, "strict", z.ZodTypeAny, {
1192
- mode: "prompt";
1193
- }, {
1194
- mode?: "prompt" | undefined;
1195
- }>>;
1196
- index: z.ZodDefault<z.ZodObject<{
1197
- /** Master switch for `search_codebase` and `cruxy index`. */
1198
- enabled: z.ZodDefault<z.ZodBoolean>;
1199
- /**
1200
- * Embedding backend. Only `fastembed` (bge-small-en-v1.5, local ONNX; the
1201
- * model downloads and caches on first use) is selectable — if it cannot be
1202
- * loaded, or the model cannot be downloaded/initialized, indexing fails
1203
- * loudly rather than degrading. (The deterministic hashing embedder exists
1204
- * for tests and is injected directly, never chosen here.)
1205
- *
1206
- * THE STORE-VS-EMBEDDER ASYMMETRY (deliberate — see `store` below). The
1207
- * embedder has NO degrade path while the store's `auto` does, and that is
1208
- * correct, not an inconsistency: a store fallback (sqlite → in-memory) loses
1209
- * only PERSISTENCE — search results are byte-identical, you just re-index
1210
- * each session, a quality-NEUTRAL trade. The embedder's only cheaper
1211
- * substitute is the lexical hashing backend, whose degrade is a SILENT
1212
- * QUALITY LOSS — semantic search quietly stops being semantic. That is the
1213
- * "reads like success, isn't" trap C.17 forbids, so the embedder fails loud
1214
- * (module-load → CRUXY_E_INDEX_EMBEDDER_UNAVAILABLE; first-run download/init
1215
- * → CRUXY_E_INDEX_EMBEDDER_DOWNLOAD_FAILED) and `search_codebase` routes the
1216
- * model to `grep_files` rather than substituting a weaker index.
1217
- */
1218
- embedder: z.ZodDefault<z.ZodEnum<["fastembed"]>>;
1219
- /**
1220
- * Vector store backend. `sqlite` persists to `.cruxy/index.db` via
1221
- * better-sqlite3; `memory` is ephemeral (tests). `auto` prefers sqlite and
1222
- * falls back to memory when the native dependency cannot be loaded — a
1223
- * quality-NEUTRAL degrade (only persistence is lost; results are identical).
1224
- * This is why `auto` may degrade while `embedder` may not — see the
1225
- * asymmetry note above.
1226
- */
1227
- store: z.ZodDefault<z.ZodEnum<["auto", "sqlite", "memory"]>>;
1228
- /** Hard per-file size cap, in bytes; larger files are skipped entirely. */
1229
- maxFileBytes: z.ZodDefault<z.ZodNumber>;
1230
- chunk: z.ZodEffects<z.ZodDefault<z.ZodObject<{
1231
- /** Target chunk window, in lines. */
1232
- windowLines: z.ZodDefault<z.ZodNumber>;
1233
- /** Lines shared between consecutive chunks; must be < windowLines. */
1234
- overlapLines: z.ZodDefault<z.ZodNumber>;
1235
- }, "strict", z.ZodTypeAny, {
1236
- windowLines: number;
1237
- overlapLines: number;
1238
- }, {
1239
- windowLines?: number | undefined;
1240
- overlapLines?: number | undefined;
1241
- }>>, {
1242
- windowLines: number;
1243
- overlapLines: number;
1244
- }, {
1245
- windowLines?: number | undefined;
1246
- overlapLines?: number | undefined;
1247
- } | undefined>;
1248
- search: z.ZodDefault<z.ZodObject<{
1249
- /** Number of hits returned when the tool omits `k`. */
1250
- defaultK: z.ZodDefault<z.ZodNumber>;
1251
- /** Approximate token budget for combined snippets (chars/4 heuristic). */
1252
- tokenBudget: z.ZodDefault<z.ZodNumber>;
1253
- /** Maximum lines kept in any single returned snippet. */
1254
- maxSnippetLines: z.ZodDefault<z.ZodNumber>;
1255
- }, "strict", z.ZodTypeAny, {
1256
- defaultK: number;
1257
- tokenBudget: number;
1258
- maxSnippetLines: number;
1259
- }, {
1260
- defaultK?: number | undefined;
1261
- tokenBudget?: number | undefined;
1262
- maxSnippetLines?: number | undefined;
1263
- }>>;
1264
- }, "strict", z.ZodTypeAny, {
1265
- search: {
1266
- defaultK: number;
1267
- tokenBudget: number;
1268
- maxSnippetLines: number;
1269
- };
1270
- enabled: boolean;
1271
- embedder: "fastembed";
1272
- store: "memory" | "auto" | "sqlite";
1273
- maxFileBytes: number;
1274
- chunk: {
1275
- windowLines: number;
1276
- overlapLines: number;
1277
- };
1278
- }, {
1279
- search?: {
1280
- defaultK?: number | undefined;
1281
- tokenBudget?: number | undefined;
1282
- maxSnippetLines?: number | undefined;
1283
- } | undefined;
1284
- enabled?: boolean | undefined;
1285
- embedder?: "fastembed" | undefined;
1286
- store?: "memory" | "auto" | "sqlite" | undefined;
1287
- maxFileBytes?: number | undefined;
1288
- chunk?: {
1289
- windowLines?: number | undefined;
1290
- overlapLines?: number | undefined;
1291
- } | undefined;
1292
- }>>;
1293
- lsp: z.ZodDefault<z.ZodObject<{
1294
- /** Master switch. When false, the four LSP tools are not registered and no
1295
- * server ever spawns (the feature stays fully inert). */
1296
- enabled: z.ZodDefault<z.ZodBoolean>;
1297
- /**
1298
- * Per-language command overrides, keyed by language id (e.g. `typescript`,
1299
- * `python`, `go`, `rust`). The value is the full command line
1300
- * (`"gopls -remote=auto"`); it is split on whitespace. Anything omitted
1301
- * falls back to the built-in default table (see `lsp/registry.ts`).
1302
- */
1303
- servers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
1304
- /** Kill and fail (CRUXY_E_LSP_TIMEOUT) if the `initialize` handshake does
1305
- * not complete within this many ms. */
1306
- startupTimeout: z.ZodDefault<z.ZodNumber>;
1307
- /** Fail a single query (CRUXY_E_LSP_TIMEOUT) if the server does not respond
1308
- * within this many ms — the server is kept alive, only the request errors. */
1309
- requestTimeout: z.ZodDefault<z.ZodNumber>;
1310
- /** Maximum concurrently-running language servers; acquiring past the cap
1311
- * evicts the idle-oldest server first. */
1312
- maxServers: z.ZodDefault<z.ZodNumber>;
1313
- /** Shut a server down after it has been idle this many ms. */
1314
- idleTimeout: z.ZodDefault<z.ZodNumber>;
1315
- /** Cap on locations/diagnostics returned by a single tool call; the rest are
1316
- * summarized as an "N more" note (bounded output). */
1317
- maxResults: z.ZodDefault<z.ZodNumber>;
1318
- }, "strict", z.ZodTypeAny, {
1319
- startupTimeout: number;
1320
- requestTimeout: number;
1321
- servers: Record<string, string>;
1322
- enabled: boolean;
1323
- maxServers: number;
1324
- idleTimeout: number;
1325
- maxResults: number;
1326
- }, {
1327
- startupTimeout?: number | undefined;
1328
- requestTimeout?: number | undefined;
1329
- servers?: Record<string, string> | undefined;
1330
- enabled?: boolean | undefined;
1331
- maxServers?: number | undefined;
1332
- idleTimeout?: number | undefined;
1333
- maxResults?: number | undefined;
1334
- }>>;
1335
- checkpoint: z.ZodDefault<z.ZodObject<{
1336
- /** Auto-checkpoint before a run's first mutation (and enable `cruxy rollback`). */
1337
- enabled: z.ZodDefault<z.ZodBoolean>;
1338
- /** How many checkpoints to keep; older ones are pruned oldest-first. */
1339
- retention: z.ZodDefault<z.ZodNumber>;
1340
- }, "strict", z.ZodTypeAny, {
1341
- enabled: boolean;
1342
- retention: number;
1343
- }, {
1344
- enabled?: boolean | undefined;
1345
- retention?: number | undefined;
1346
- }>>;
1347
- subagent: z.ZodDefault<z.ZodObject<{
1348
- /**
1349
- * Maximum subagent nesting depth. The main agent is depth 0; the default of
1350
- * 1 lets it spawn subagents that cannot themselves spawn (no fork bombs).
1351
- */
1352
- maxDepth: z.ZodDefault<z.ZodNumber>;
1353
- /**
1354
- * Parallel fan-out breadth (C.33): the maximum number of subagents that run
1355
- * concurrently across the whole session, enforced by one shared semaphore.
1356
- * Parallel fan-out happens at depth 0 only and everything beneath it is
1357
- * sequential, so this composes with {@link maxDepth} into a LINEAR global
1358
- * ceiling (≤ maxConcurrency × maxDepth live agents) — never an exponential
1359
- * depth×breadth fork bomb. Default 3.
1360
- */
1361
- maxConcurrency: z.ZodDefault<z.ZodNumber>;
1362
- /** Per-subagent budget ceilings; spawn-time overrides are clamped to these. */
1363
- defaultBudget: z.ZodDefault<z.ZodObject<{
1364
- /** Hard cap on the subagent's model turns. */
1365
- maxIterations: z.ZodDefault<z.ZodNumber>;
1366
- /** Hard cap on the subagent's combined input+output tokens. */
1367
- maxTokens: z.ZodDefault<z.ZodNumber>;
1368
- /** Optional wall-clock cap; unset means no time limit. */
1369
- timeoutMs: z.ZodOptional<z.ZodNumber>;
1370
- }, "strict", z.ZodTypeAny, {
1371
- maxIterations: number;
1372
- maxTokens: number;
1373
- timeoutMs?: number | undefined;
1374
- }, {
1375
- timeoutMs?: number | undefined;
1376
- maxIterations?: number | undefined;
1377
- maxTokens?: number | undefined;
1378
- }>>;
1379
- }, "strict", z.ZodTypeAny, {
1380
- maxDepth: number;
1381
- maxConcurrency: number;
1382
- defaultBudget: {
1383
- maxIterations: number;
1384
- maxTokens: number;
1385
- timeoutMs?: number | undefined;
1386
- };
1387
- }, {
1388
- maxDepth?: number | undefined;
1389
- maxConcurrency?: number | undefined;
1390
- defaultBudget?: {
1391
- timeoutMs?: number | undefined;
1392
- maxIterations?: number | undefined;
1393
- maxTokens?: number | undefined;
1394
- } | undefined;
1395
- }>>;
1396
- jobs: z.ZodDefault<z.ZodObject<{
1397
- /**
1398
- * Master switch. When true, the `run_in_background` tool is registered so the
1399
- * agent can dispatch background jobs. OFF by default — background work is an
1400
- * opt-in capability, and a session that never enables it behaves exactly as
1401
- * before (no tool, no manager, no queue).
1402
- */
1403
- enabled: z.ZodDefault<z.ZodBoolean>;
1404
- /**
1405
- * Ceiling on live background jobs (queued + running + paused). Distinct from
1406
- * the shared execution cap (`subagent.maxConcurrency`): this bounds how many
1407
- * jobs can be OUTSTANDING, not how many run at once. Default 5.
1408
- */
1409
- maxJobs: z.ZodDefault<z.ZodNumber>;
1410
- /**
1411
- * How many of a job's most-recent log lines are retained in its ring buffer
1412
- * for `cruxy logs <id>`. Bounded so a chatty job can't grow memory without
1413
- * limit; older lines roll off oldest-first. Default 1000.
1414
- */
1415
- logBufferLines: z.ZodDefault<z.ZodNumber>;
1416
- }, "strict", z.ZodTypeAny, {
1417
- maxJobs: number;
1418
- enabled: boolean;
1419
- logBufferLines: number;
1420
- }, {
1421
- maxJobs?: number | undefined;
1422
- enabled?: boolean | undefined;
1423
- logBufferLines?: number | undefined;
1424
- }>>;
1425
- test: z.ZodDefault<z.ZodObject<{
1426
- /** Explicit test command (overrides package.json detection). */
1427
- command: z.ZodOptional<z.ZodString>;
1428
- /** Consecutive failing runs before the edit→re-run loop trips its cap. */
1429
- maxIterations: z.ZodDefault<z.ZodNumber>;
1430
- /** Cap on captured test output bytes (tail-biased — failures come last). */
1431
- captureBytes: z.ZodDefault<z.ZodNumber>;
1432
- }, "strict", z.ZodTypeAny, {
1433
- maxIterations: number;
1434
- captureBytes: number;
1435
- command?: string | undefined;
1436
- }, {
1437
- command?: string | undefined;
1438
- maxIterations?: number | undefined;
1439
- captureBytes?: number | undefined;
1440
- }>>;
1441
- sandbox: z.ZodDefault<z.ZodObject<{
1442
- /** Master switch. When true, shell + test commands run in the sandbox. */
1443
- enabled: z.ZodDefault<z.ZodBoolean>;
1444
- /**
1445
- * Base image the container runs. Must ship a POSIX `sh`. Pin by digest
1446
- * (`name@sha256:…`) where possible; cruxy never builds or substitutes one.
1447
- */
1448
- image: z.ZodDefault<z.ZodString>;
1449
- /**
1450
- * Egress policy. `none` denies all network (default deny); `host-loopback`
1451
- * permits reaching services on the host; `full` allows outbound. Anything
1452
- * other than `none` is a deliberate widening the user must opt into.
1453
- */
1454
- network: z.ZodDefault<z.ZodEnum<["none", "host-loopback", "full"]>>;
1455
- /** Memory cap (docker `--memory` syntax, e.g. `512m`, `2g`). */
1456
- memory: z.ZodDefault<z.ZodString>;
1457
- /** Process/thread cap (`--pids-limit`) — a fork-bomb guard. */
1458
- pids: z.ZodDefault<z.ZodNumber>;
1459
- /** CPU cap (docker `--cpus`, fractional allowed). */
1460
- cpus: z.ZodDefault<z.ZodNumber>;
1461
- /** Wall-clock timeout in ms; falls back to `shell.timeoutMs` when unset. */
1462
- timeout: z.ZodOptional<z.ZodNumber>;
1463
- /**
1464
- * Extra bind mounts beyond the workdir + tmp, each `src:dst[:ro|:rw]`.
1465
- * Explicit by construction — the default exposes ONLY the workdir. The
1466
- * docker socket and the cruxy home are rejected here (see policy.ts).
1467
- */
1468
- mounts: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1469
- }, "strict", z.ZodTypeAny, {
1470
- memory: string;
1471
- image: string;
1472
- enabled: boolean;
1473
- network: "none" | "host-loopback" | "full";
1474
- pids: number;
1475
- cpus: number;
1476
- mounts: string[];
1477
- timeout?: number | undefined;
1478
- }, {
1479
- memory?: string | undefined;
1480
- image?: string | undefined;
1481
- enabled?: boolean | undefined;
1482
- network?: "none" | "host-loopback" | "full" | undefined;
1483
- pids?: number | undefined;
1484
- cpus?: number | undefined;
1485
- timeout?: number | undefined;
1486
- mounts?: string[] | undefined;
1487
- }>>;
1488
- hooks: z.ZodDefault<z.ZodObject<{
1489
- /** Master switch. When false, NO hook ever fires (config with hooks stays
1490
- * inert until explicitly enabled). */
1491
- enabled: z.ZodDefault<z.ZodBoolean>;
1492
- /**
1493
- * Whether to interactively prompt to trust a project's hooks the first time
1494
- * they would run. When false, untrusted project hooks fail loud
1495
- * (CRUXY_E_HOOK_UNTRUSTED) instead of prompting — never auto-trust.
1496
- */
1497
- trustPrompt: z.ZodDefault<z.ZodBoolean>;
1498
- }, "strict", z.ZodTypeAny, {
1499
- enabled: boolean;
1500
- trustPrompt: boolean;
1501
- }, {
1502
- enabled?: boolean | undefined;
1503
- trustPrompt?: boolean | undefined;
1504
- }>>;
1505
- routing: z.ZodDefault<z.ZodObject<{
1506
- /** Tier for any task class not in `map`. Unset → the tier implied by
1507
- * `model.model` (a real tier, or the auto-fallback tier). */
1508
- default: z.ZodOptional<z.ZodEnum<["kavi", "vaani", "mira"]>>;
1509
- /** Per-task-class tier overrides; anything omitted takes `default`. */
1510
- map: z.ZodDefault<z.ZodRecord<z.ZodEnum<["main-turn", "subagent", "plan", "commit-msg", "classify", "summarize"]>, z.ZodEnum<["kavi", "vaani", "mira"]>>>;
1511
- }, "strict", z.ZodTypeAny, {
1512
- map: Partial<Record<"main-turn" | "subagent" | "plan" | "commit-msg" | "classify" | "summarize", "kavi" | "vaani" | "mira">>;
1513
- default?: "kavi" | "vaani" | "mira" | undefined;
1514
- }, {
1515
- map?: Partial<Record<"main-turn" | "subagent" | "plan" | "commit-msg" | "classify" | "summarize", "kavi" | "vaani" | "mira">> | undefined;
1516
- default?: "kavi" | "vaani" | "mira" | undefined;
1517
- }>>;
1518
- memory: z.ZodDefault<z.ZodObject<{
1519
- /** Master switch. When false, nothing is recalled and the `remember` tool
1520
- * is not registered (memory stays fully inert). */
1521
- enabled: z.ZodDefault<z.ZodBoolean>;
1522
- /** Token budget for the recalled block injected at session start; entries
1523
- * beyond it are pruned oldest-first (the omission is stated, never silent). */
1524
- maxRecallTokens: z.ZodDefault<z.ZodNumber>;
1525
- }, "strict", z.ZodTypeAny, {
1526
- enabled: boolean;
1527
- maxRecallTokens: number;
1528
- }, {
1529
- enabled?: boolean | undefined;
1530
- maxRecallTokens?: number | undefined;
1531
- }>>;
1532
- usage: z.ZodDefault<z.ZodObject<{
1533
- /** Master switch. When false, no usage is collected, persisted, or shown. */
1534
- enabled: z.ZodDefault<z.ZodBoolean>;
1535
- /** Currency label to prefix costs with (e.g. "$", "€"). Empty ⇒ no symbol is
1536
- * assumed — a bare number is shown, since the user configured the prices. */
1537
- currency: z.ZodDefault<z.ZodString>;
1538
- /** How many past runs to keep in the store; older ones are pruned oldest-first. */
1539
- retention: z.ZodDefault<z.ZodNumber>;
1540
- /** Per-tier prices. Any tier omitted is simply unpriced (cost omitted for it). */
1541
- prices: z.ZodDefault<z.ZodObject<{
1542
- kavi: z.ZodOptional<z.ZodObject<{
1543
- /** Price per 1,000,000 input tokens. */
1544
- input: z.ZodNumber;
1545
- /** Price per 1,000,000 output tokens. */
1546
- output: z.ZodNumber;
1547
- }, "strict", z.ZodTypeAny, {
1548
- input: number;
1549
- output: number;
1550
- }, {
1551
- input: number;
1552
- output: number;
1553
- }>>;
1554
- vaani: z.ZodOptional<z.ZodObject<{
1555
- /** Price per 1,000,000 input tokens. */
1556
- input: z.ZodNumber;
1557
- /** Price per 1,000,000 output tokens. */
1558
- output: z.ZodNumber;
1559
- }, "strict", z.ZodTypeAny, {
1560
- input: number;
1561
- output: number;
1562
- }, {
1563
- input: number;
1564
- output: number;
1565
- }>>;
1566
- mira: z.ZodOptional<z.ZodObject<{
1567
- /** Price per 1,000,000 input tokens. */
1568
- input: z.ZodNumber;
1569
- /** Price per 1,000,000 output tokens. */
1570
- output: z.ZodNumber;
1571
- }, "strict", z.ZodTypeAny, {
1572
- input: number;
1573
- output: number;
1574
- }, {
1575
- input: number;
1576
- output: number;
1577
- }>>;
1578
- }, "strict", z.ZodTypeAny, {
1579
- kavi?: {
1580
- input: number;
1581
- output: number;
1582
- } | undefined;
1583
- vaani?: {
1584
- input: number;
1585
- output: number;
1586
- } | undefined;
1587
- mira?: {
1588
- input: number;
1589
- output: number;
1590
- } | undefined;
1591
- }, {
1592
- kavi?: {
1593
- input: number;
1594
- output: number;
1595
- } | undefined;
1596
- vaani?: {
1597
- input: number;
1598
- output: number;
1599
- } | undefined;
1600
- mira?: {
1601
- input: number;
1602
- output: number;
1603
- } | undefined;
1604
- }>>;
1605
- }, "strict", z.ZodTypeAny, {
1606
- enabled: boolean;
1607
- retention: number;
1608
- currency: string;
1609
- prices: {
1610
- kavi?: {
1611
- input: number;
1612
- output: number;
1613
- } | undefined;
1614
- vaani?: {
1615
- input: number;
1616
- output: number;
1617
- } | undefined;
1618
- mira?: {
1619
- input: number;
1620
- output: number;
1621
- } | undefined;
1622
- };
1623
- }, {
1624
- enabled?: boolean | undefined;
1625
- retention?: number | undefined;
1626
- currency?: string | undefined;
1627
- prices?: {
1628
- kavi?: {
1629
- input: number;
1630
- output: number;
1631
- } | undefined;
1632
- vaani?: {
1633
- input: number;
1634
- output: number;
1635
- } | undefined;
1636
- mira?: {
1637
- input: number;
1638
- output: number;
1639
- } | undefined;
1640
- } | undefined;
1641
- }>>;
1642
- mcp: z.ZodDefault<z.ZodObject<{
1643
- /** Master switch. When false, no server is connected/spawned and no MCP tool
1644
- * is registered (the feature stays fully inert). */
1645
- enabled: z.ZodDefault<z.ZodBoolean>;
1646
- /** Named MCP servers, keyed by a short server id used as the tool prefix
1647
- * (`mcp__<server>__<tool>`) and in the trust prompt. */
1648
- servers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
1649
- /** stdio transport: the server program to spawn. */
1650
- command: z.ZodOptional<z.ZodString>;
1651
- /** Arguments for `command`. */
1652
- args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1653
- /** Extra environment variables for the spawned server (stdio only). */
1654
- env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
1655
- /** Remote transport: the server URL (mutually exclusive with `command`). */
1656
- url: z.ZodOptional<z.ZodString>;
1657
- /**
1658
- * Remote auth (C.27c, url only): the NAME of a bearer credential, resolved
1659
- * solely from `~/.cruxy/credentials.json` (0600) as `Authorization: Bearer …`.
1660
- * This field holds a NAME, never the secret — a project config may name a
1661
- * credential it does not contain, so the value never lives in-repo. Resolution
1662
- * never consults the environment or any config file. Requires an `https` URL.
1663
- */
1664
- credentialRef: z.ZodOptional<z.ZodString>;
1665
- /**
1666
- * Remote auth (C.27c, url only): raw request headers sent to the endpoint.
1667
- * A LIVE header value is a secret, so this is accepted ONLY from user-scope
1668
- * config (`~/.cruxy/config.json`) — the loader REJECTS it from project-scope
1669
- * config (a cloned repo must not inject live headers). Prefer `credentialRef`.
1670
- * Requires an `https` URL; reserved framing headers cannot be overridden.
1671
- */
1672
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1673
- }, "strict", z.ZodTypeAny, {
1674
- args: string[];
1675
- env: Record<string, string>;
1676
- command?: string | undefined;
1677
- credentialRef?: string | undefined;
1678
- url?: string | undefined;
1679
- headers?: Record<string, string> | undefined;
1680
- }, {
1681
- command?: string | undefined;
1682
- credentialRef?: string | undefined;
1683
- url?: string | undefined;
1684
- args?: string[] | undefined;
1685
- env?: Record<string, string> | undefined;
1686
- headers?: Record<string, string> | undefined;
1687
- }>, {
1688
- args: string[];
1689
- env: Record<string, string>;
1690
- command?: string | undefined;
1691
- credentialRef?: string | undefined;
1692
- url?: string | undefined;
1693
- headers?: Record<string, string> | undefined;
1694
- }, {
1695
- command?: string | undefined;
1696
- credentialRef?: string | undefined;
1697
- url?: string | undefined;
1698
- args?: string[] | undefined;
1699
- env?: Record<string, string> | undefined;
1700
- headers?: Record<string, string> | undefined;
1701
- }>, {
1702
- args: string[];
1703
- env: Record<string, string>;
1704
- command?: string | undefined;
1705
- credentialRef?: string | undefined;
1706
- url?: string | undefined;
1707
- headers?: Record<string, string> | undefined;
1708
- }, {
1709
- command?: string | undefined;
1710
- credentialRef?: string | undefined;
1711
- url?: string | undefined;
1712
- args?: string[] | undefined;
1713
- env?: Record<string, string> | undefined;
1714
- headers?: Record<string, string> | undefined;
1715
- }>, {
1716
- args: string[];
1717
- env: Record<string, string>;
1718
- command?: string | undefined;
1719
- credentialRef?: string | undefined;
1720
- url?: string | undefined;
1721
- headers?: Record<string, string> | undefined;
1722
- }, {
1723
- command?: string | undefined;
1724
- credentialRef?: string | undefined;
1725
- url?: string | undefined;
1726
- args?: string[] | undefined;
1727
- env?: Record<string, string> | undefined;
1728
- headers?: Record<string, string> | undefined;
1729
- }>>>;
1730
- /** Fail a server's `initialize` handshake (its tools are skipped) if it does
1731
- * not complete within this many ms. */
1732
- startupTimeout: z.ZodDefault<z.ZodNumber>;
1733
- /** Fail a single `tools/call` if the server does not respond within this many
1734
- * ms — the connection is kept, only the one call errors. */
1735
- requestTimeout: z.ZodDefault<z.ZodNumber>;
1736
- /** Max tools accepted from ONE server; extras are dropped with a visible note
1737
- * (a hostile server can't advertise thousands of tools to flood context). */
1738
- maxToolsPerServer: z.ZodDefault<z.ZodNumber>;
1739
- /** Max characters kept from a single tool's description; the rest is truncated
1740
- * with a visible marker. */
1741
- maxDescriptionChars: z.ZodDefault<z.ZodNumber>;
1742
- /** Max bytes kept from a single tool's advertised JSON input schema; an
1743
- * over-cap schema is replaced with a permissive one and a visible note. */
1744
- maxSchemaBytes: z.ZodDefault<z.ZodNumber>;
1745
- }, "strict", z.ZodTypeAny, {
1746
- startupTimeout: number;
1747
- requestTimeout: number;
1748
- servers: Record<string, {
1749
- args: string[];
1750
- env: Record<string, string>;
1751
- command?: string | undefined;
1752
- credentialRef?: string | undefined;
1753
- url?: string | undefined;
1754
- headers?: Record<string, string> | undefined;
1755
- }>;
1756
- enabled: boolean;
1757
- maxToolsPerServer: number;
1758
- maxDescriptionChars: number;
1759
- maxSchemaBytes: number;
1760
- }, {
1761
- startupTimeout?: number | undefined;
1762
- requestTimeout?: number | undefined;
1763
- servers?: Record<string, {
1764
- command?: string | undefined;
1765
- credentialRef?: string | undefined;
1766
- url?: string | undefined;
1767
- args?: string[] | undefined;
1768
- env?: Record<string, string> | undefined;
1769
- headers?: Record<string, string> | undefined;
1770
- }> | undefined;
1771
- enabled?: boolean | undefined;
1772
- maxToolsPerServer?: number | undefined;
1773
- maxDescriptionChars?: number | undefined;
1774
- maxSchemaBytes?: number | undefined;
1775
- }>>;
1776
- web: z.ZodDefault<z.ZodObject<{
1777
- /** Master switch. When false, neither tool is registered and no provider is
1778
- * constructed (the feature stays fully inert). */
1779
- enabled: z.ZodDefault<z.ZodBoolean>;
1780
- /** Which search backend to use behind the `SearchProvider` seam. A gateway
1781
- * provider slots in here first-class if the backend ever proxies search. */
1782
- provider: z.ZodDefault<z.ZodEnum<["tavily"]>>;
1783
- /** Environment variable holding the direct provider's API key. The key is
1784
- * read at call time, sent only in the provider's auth field, and never
1785
- * logged or written to the repo. */
1786
- apiKeyEnv: z.ZodDefault<z.ZodString>;
1787
- /** Max search results returned to the model (top-N; the rest are dropped). */
1788
- maxResults: z.ZodDefault<z.ZodNumber>;
1789
- /** Max characters kept from a single result's snippet; the rest is truncated
1790
- * with a visible marker. */
1791
- snippetMaxChars: z.ZodDefault<z.ZodNumber>;
1792
- /** Max bytes read from a single `web_fetch` page; the rest is truncated with
1793
- * a visible marker (a hostile/huge page can't blow the context budget). */
1794
- fetchMaxBytes: z.ZodDefault<z.ZodNumber>;
1795
- /** Per-request timeout (search and fetch) — a slow host errors, never hangs. */
1796
- timeoutMs: z.ZodDefault<z.ZodNumber>;
1797
- /** Max HTTP redirects `web_fetch` follows; each hop is re-checked by the SSRF
1798
- * guard so a 3xx can't bounce the request into a private range. */
1799
- maxRedirects: z.ZodDefault<z.ZodNumber>;
1800
- /** Escape hatch: allow `web_fetch` to reach private/loopback/link-local hosts.
1801
- * OFF by default (SSRF-safe); only set true for a deliberate internal-network
1802
- * use case. */
1803
- allowPrivateHosts: z.ZodDefault<z.ZodBoolean>;
1804
- }, "strict", z.ZodTypeAny, {
1805
- provider: "tavily";
1806
- timeoutMs: number;
1807
- apiKeyEnv: string;
1808
- enabled: boolean;
1809
- maxResults: number;
1810
- snippetMaxChars: number;
1811
- fetchMaxBytes: number;
1812
- maxRedirects: number;
1813
- allowPrivateHosts: boolean;
1814
- }, {
1815
- provider?: "tavily" | undefined;
1816
- timeoutMs?: number | undefined;
1817
- apiKeyEnv?: string | undefined;
1818
- enabled?: boolean | undefined;
1819
- maxResults?: number | undefined;
1820
- snippetMaxChars?: number | undefined;
1821
- fetchMaxBytes?: number | undefined;
1822
- maxRedirects?: number | undefined;
1823
- allowPrivateHosts?: boolean | undefined;
1824
- }>>;
1825
- logLevel: z.ZodDefault<z.ZodEnum<["debug", "info", "warn", "error", "silent"]>>;
1826
- }, "strict", z.ZodTypeAny, {
1827
- cruxy: {
1828
- gatewayUrl: string;
1829
- };
1830
- memory: {
1831
- enabled: boolean;
1832
- maxRecallTokens: number;
1833
- };
1834
- usage: {
1835
- enabled: boolean;
1836
- retention: number;
1837
- currency: string;
1838
- prices: {
1839
- kavi?: {
1840
- input: number;
1841
- output: number;
1842
- } | undefined;
1843
- vaani?: {
1844
- input: number;
1845
- output: number;
1846
- } | undefined;
1847
- mira?: {
1848
- input: number;
1849
- output: number;
1850
- } | undefined;
1851
- };
1852
- };
1853
- checkpoint: {
1854
- enabled: boolean;
1855
- retention: number;
1856
- };
1857
- sandbox: {
1858
- memory: string;
1859
- image: string;
1860
- enabled: boolean;
1861
- network: "none" | "host-loopback" | "full";
1862
- pids: number;
1863
- cpus: number;
1864
- mounts: string[];
1865
- timeout?: number | undefined;
1866
- };
1867
- approval: {
1868
- mode: "prompt";
1869
- };
1870
- mcp: {
1871
- startupTimeout: number;
1872
- requestTimeout: number;
1873
- servers: Record<string, {
1874
- args: string[];
1875
- env: Record<string, string>;
1876
- command?: string | undefined;
1877
- credentialRef?: string | undefined;
1878
- url?: string | undefined;
1879
- headers?: Record<string, string> | undefined;
1880
- }>;
1881
- enabled: boolean;
1882
- maxToolsPerServer: number;
1883
- maxDescriptionChars: number;
1884
- maxSchemaBytes: number;
1885
- };
1886
- subagent: {
1887
- maxDepth: number;
1888
- maxConcurrency: number;
1889
- defaultBudget: {
1890
- maxIterations: number;
1891
- maxTokens: number;
1892
- timeoutMs?: number | undefined;
1893
- };
1894
- };
1895
- model: {
1896
- provider: "cruxy" | "anthropic" | "openai" | "custom";
1897
- model: string;
1898
- maxTokens: number;
1899
- temperature: number;
1900
- };
1901
- shell: {
1902
- timeoutMs: number;
1903
- maxOutputBytes: number;
1904
- executable?: string | undefined;
1905
- dialect?: "posix" | "powershell" | "cmd" | undefined;
1906
- };
1907
- agent: {
1908
- maxIterations: number;
1909
- maxIterationsOneShot: number;
1910
- maxTokensPerTurn: number;
1911
- autoApprove: boolean;
1912
- planMode: boolean;
1913
- };
1914
- tools: {
1915
- fileEdit: boolean;
1916
- shell: boolean;
1917
- };
1918
- git: {
1919
- autoCommit: boolean;
1920
- protectedBranches: string[];
1921
- defaultBase?: string | undefined;
1922
- };
1923
- context: {
1924
- maxTokens: number;
1925
- compactThreshold: number;
1926
- reserveTokens: number;
1927
- keepRecentMessages: number;
1928
- };
1929
- index: {
1930
- search: {
1931
- defaultK: number;
1932
- tokenBudget: number;
1933
- maxSnippetLines: number;
1934
- };
1935
- enabled: boolean;
1936
- embedder: "fastembed";
1937
- store: "memory" | "auto" | "sqlite";
1938
- maxFileBytes: number;
1939
- chunk: {
1940
- windowLines: number;
1941
- overlapLines: number;
1942
- };
1943
- };
1944
- lsp: {
1945
- startupTimeout: number;
1946
- requestTimeout: number;
1947
- servers: Record<string, string>;
1948
- enabled: boolean;
1949
- maxServers: number;
1950
- idleTimeout: number;
1951
- maxResults: number;
1952
- };
1953
- jobs: {
1954
- maxJobs: number;
1955
- enabled: boolean;
1956
- logBufferLines: number;
1957
- };
1958
- test: {
1959
- maxIterations: number;
1960
- captureBytes: number;
1961
- command?: string | undefined;
1962
- };
1963
- hooks: {
1964
- enabled: boolean;
1965
- trustPrompt: boolean;
1966
- };
1967
- routing: {
1968
- map: Partial<Record<"main-turn" | "subagent" | "plan" | "commit-msg" | "classify" | "summarize", "kavi" | "vaani" | "mira">>;
1969
- default?: "kavi" | "vaani" | "mira" | undefined;
1970
- };
1971
- web: {
1972
- provider: "tavily";
1973
- timeoutMs: number;
1974
- apiKeyEnv: string;
1975
- enabled: boolean;
1976
- maxResults: number;
1977
- snippetMaxChars: number;
1978
- fetchMaxBytes: number;
1979
- maxRedirects: number;
1980
- allowPrivateHosts: boolean;
1981
- };
1982
- logLevel: "debug" | "info" | "warn" | "error" | "silent";
1983
- }, {
1984
- cruxy?: {
1985
- gatewayUrl?: string | undefined;
1986
- } | undefined;
1987
- memory?: {
1988
- enabled?: boolean | undefined;
1989
- maxRecallTokens?: number | undefined;
1990
- } | undefined;
1991
- usage?: {
1992
- enabled?: boolean | undefined;
1993
- retention?: number | undefined;
1994
- currency?: string | undefined;
1995
- prices?: {
1996
- kavi?: {
1997
- input: number;
1998
- output: number;
1999
- } | undefined;
2000
- vaani?: {
2001
- input: number;
2002
- output: number;
2003
- } | undefined;
2004
- mira?: {
2005
- input: number;
2006
- output: number;
2007
- } | undefined;
2008
- } | undefined;
2009
- } | undefined;
2010
- checkpoint?: {
2011
- enabled?: boolean | undefined;
2012
- retention?: number | undefined;
2013
- } | undefined;
2014
- sandbox?: {
2015
- memory?: string | undefined;
2016
- image?: string | undefined;
2017
- enabled?: boolean | undefined;
2018
- network?: "none" | "host-loopback" | "full" | undefined;
2019
- pids?: number | undefined;
2020
- cpus?: number | undefined;
2021
- timeout?: number | undefined;
2022
- mounts?: string[] | undefined;
2023
- } | undefined;
2024
- approval?: {
2025
- mode?: "prompt" | undefined;
2026
- } | undefined;
2027
- mcp?: {
2028
- startupTimeout?: number | undefined;
2029
- requestTimeout?: number | undefined;
2030
- servers?: Record<string, {
2031
- command?: string | undefined;
2032
- credentialRef?: string | undefined;
2033
- url?: string | undefined;
2034
- args?: string[] | undefined;
2035
- env?: Record<string, string> | undefined;
2036
- headers?: Record<string, string> | undefined;
2037
- }> | undefined;
2038
- enabled?: boolean | undefined;
2039
- maxToolsPerServer?: number | undefined;
2040
- maxDescriptionChars?: number | undefined;
2041
- maxSchemaBytes?: number | undefined;
2042
- } | undefined;
2043
- subagent?: {
2044
- maxDepth?: number | undefined;
2045
- maxConcurrency?: number | undefined;
2046
- defaultBudget?: {
2047
- timeoutMs?: number | undefined;
2048
- maxIterations?: number | undefined;
2049
- maxTokens?: number | undefined;
2050
- } | undefined;
2051
- } | undefined;
2052
- model?: {
2053
- provider?: "cruxy" | "anthropic" | "openai" | "custom" | undefined;
2054
- model?: string | undefined;
2055
- maxTokens?: number | undefined;
2056
- temperature?: number | undefined;
2057
- } | undefined;
2058
- shell?: {
2059
- timeoutMs?: number | undefined;
2060
- maxOutputBytes?: number | undefined;
2061
- executable?: string | undefined;
2062
- dialect?: "posix" | "powershell" | "cmd" | undefined;
2063
- } | undefined;
2064
- agent?: {
2065
- maxIterations?: number | undefined;
2066
- maxIterationsOneShot?: number | undefined;
2067
- maxTokensPerTurn?: number | undefined;
2068
- autoApprove?: boolean | undefined;
2069
- planMode?: boolean | undefined;
2070
- } | undefined;
2071
- tools?: {
2072
- fileEdit?: boolean | undefined;
2073
- shell?: boolean | undefined;
2074
- } | undefined;
2075
- git?: {
2076
- autoCommit?: boolean | undefined;
2077
- protectedBranches?: string[] | undefined;
2078
- defaultBase?: string | undefined;
2079
- } | undefined;
2080
- context?: {
2081
- maxTokens?: number | undefined;
2082
- compactThreshold?: number | undefined;
2083
- reserveTokens?: number | undefined;
2084
- keepRecentMessages?: number | undefined;
2085
- } | undefined;
2086
- index?: {
2087
- search?: {
2088
- defaultK?: number | undefined;
2089
- tokenBudget?: number | undefined;
2090
- maxSnippetLines?: number | undefined;
2091
- } | undefined;
2092
- enabled?: boolean | undefined;
2093
- embedder?: "fastembed" | undefined;
2094
- store?: "memory" | "auto" | "sqlite" | undefined;
2095
- maxFileBytes?: number | undefined;
2096
- chunk?: {
2097
- windowLines?: number | undefined;
2098
- overlapLines?: number | undefined;
2099
- } | undefined;
2100
- } | undefined;
2101
- lsp?: {
2102
- startupTimeout?: number | undefined;
2103
- requestTimeout?: number | undefined;
2104
- servers?: Record<string, string> | undefined;
2105
- enabled?: boolean | undefined;
2106
- maxServers?: number | undefined;
2107
- idleTimeout?: number | undefined;
2108
- maxResults?: number | undefined;
2109
- } | undefined;
2110
- jobs?: {
2111
- maxJobs?: number | undefined;
2112
- enabled?: boolean | undefined;
2113
- logBufferLines?: number | undefined;
2114
- } | undefined;
2115
- test?: {
2116
- command?: string | undefined;
2117
- maxIterations?: number | undefined;
2118
- captureBytes?: number | undefined;
2119
- } | undefined;
2120
- hooks?: {
2121
- enabled?: boolean | undefined;
2122
- trustPrompt?: boolean | undefined;
2123
- } | undefined;
2124
- routing?: {
2125
- map?: Partial<Record<"main-turn" | "subagent" | "plan" | "commit-msg" | "classify" | "summarize", "kavi" | "vaani" | "mira">> | undefined;
2126
- default?: "kavi" | "vaani" | "mira" | undefined;
2127
- } | undefined;
2128
- web?: {
2129
- provider?: "tavily" | undefined;
2130
- timeoutMs?: number | undefined;
2131
- apiKeyEnv?: string | undefined;
2132
- enabled?: boolean | undefined;
2133
- maxResults?: number | undefined;
2134
- snippetMaxChars?: number | undefined;
2135
- fetchMaxBytes?: number | undefined;
2136
- maxRedirects?: number | undefined;
2137
- allowPrivateHosts?: boolean | undefined;
2138
- } | undefined;
2139
- logLevel?: "debug" | "info" | "warn" | "error" | "silent" | undefined;
2140
- }>;
2141
- export type CruxyConfig = z.infer<typeof CruxyConfigSchema>;
2142
- /** Fully-populated defaults (every field resolved). */
2143
- export declare function defaultConfig(): CruxyConfig;