@gaunt-sloth/core 2.0.0-alpha.3 → 2.0.0-alpha.30

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 (271) hide show
  1. package/README.md +52 -20
  2. package/dist/config/colour.d.ts +38 -0
  3. package/dist/config/colour.js +36 -0
  4. package/dist/config/colour.js.map +1 -0
  5. package/dist/config/defaults.d.ts +84 -0
  6. package/dist/config/defaults.js +99 -0
  7. package/dist/config/defaults.js.map +1 -0
  8. package/dist/config/filesystem-tools.d.ts +41 -0
  9. package/dist/config/filesystem-tools.js +56 -0
  10. package/dist/config/filesystem-tools.js.map +1 -0
  11. package/dist/config/jsonc.d.ts +12 -0
  12. package/dist/config/jsonc.js +41 -0
  13. package/dist/config/jsonc.js.map +1 -0
  14. package/dist/config/loader.d.ts +246 -0
  15. package/dist/config/loader.js +1321 -0
  16. package/dist/config/loader.js.map +1 -0
  17. package/dist/config/mouse.d.ts +50 -0
  18. package/dist/config/mouse.js +44 -0
  19. package/dist/config/mouse.js.map +1 -0
  20. package/dist/config/profiles.d.ts +68 -0
  21. package/dist/config/profiles.js +93 -0
  22. package/dist/config/profiles.js.map +1 -0
  23. package/dist/config/providerKeys.d.ts +69 -0
  24. package/dist/config/providerKeys.js +69 -0
  25. package/dist/config/providerKeys.js.map +1 -0
  26. package/dist/config/schema.d.ts +2999 -0
  27. package/dist/config/schema.js +1519 -0
  28. package/dist/config/schema.js.map +1 -0
  29. package/dist/config/shell-policy.d.ts +896 -0
  30. package/dist/config/shell-policy.js +750 -0
  31. package/dist/config/shell-policy.js.map +1 -0
  32. package/dist/config/tool-descriptions.d.ts +211 -0
  33. package/dist/config/tool-descriptions.js +272 -0
  34. package/dist/config/tool-descriptions.js.map +1 -0
  35. package/dist/config/types.d.ts +760 -0
  36. package/dist/config/types.js +13 -0
  37. package/dist/config/types.js.map +1 -0
  38. package/dist/config.d.ts +34 -827
  39. package/dist/config.js +25 -657
  40. package/dist/config.js.map +1 -1
  41. package/dist/constants.d.ts +46 -0
  42. package/dist/constants.js +46 -0
  43. package/dist/constants.js.map +1 -1
  44. package/dist/core/GthAbstractAgent.d.ts +135 -2
  45. package/dist/core/GthAbstractAgent.js +496 -30
  46. package/dist/core/GthAbstractAgent.js.map +1 -1
  47. package/dist/core/GthAgentRunner.d.ts +568 -54
  48. package/dist/core/GthAgentRunner.js +1537 -136
  49. package/dist/core/GthAgentRunner.js.map +1 -1
  50. package/dist/core/GthLangChainAgent.d.ts +115 -0
  51. package/dist/core/GthLangChainAgent.js +644 -17
  52. package/dist/core/GthLangChainAgent.js.map +1 -1
  53. package/dist/core/approvals/annotations.d.ts +122 -0
  54. package/dist/core/approvals/annotations.js +137 -0
  55. package/dist/core/approvals/annotations.js.map +1 -0
  56. package/dist/core/approvals/grants.d.ts +216 -0
  57. package/dist/core/approvals/grants.js +469 -0
  58. package/dist/core/approvals/grants.js.map +1 -0
  59. package/dist/core/approvals/matcher.d.ts +202 -0
  60. package/dist/core/approvals/matcher.js +267 -0
  61. package/dist/core/approvals/matcher.js.map +1 -0
  62. package/dist/core/approvals/mcpSubjects.d.ts +40 -0
  63. package/dist/core/approvals/mcpSubjects.js +99 -0
  64. package/dist/core/approvals/mcpSubjects.js.map +1 -0
  65. package/dist/core/approvals/toolAnnotationSources.d.ts +105 -0
  66. package/dist/core/approvals/toolAnnotationSources.js +277 -0
  67. package/dist/core/approvals/toolAnnotationSources.js.map +1 -0
  68. package/dist/core/approvals/toolHost.d.ts +46 -0
  69. package/dist/core/approvals/toolHost.js +108 -0
  70. package/dist/core/approvals/toolHost.js.map +1 -0
  71. package/dist/core/debugCapture.d.ts +75 -0
  72. package/dist/core/debugCapture.js +101 -0
  73. package/dist/core/debugCapture.js.map +1 -0
  74. package/dist/core/gthLeanAgentFactory.d.ts +9 -0
  75. package/dist/core/gthLeanAgentFactory.js +10 -0
  76. package/dist/core/gthLeanAgentFactory.js.map +1 -0
  77. package/dist/core/launchBanner.d.ts +120 -0
  78. package/dist/core/launchBanner.js +418 -0
  79. package/dist/core/launchBanner.js.map +1 -0
  80. package/dist/core/plainToolIndication.d.ts +15 -0
  81. package/dist/core/plainToolIndication.js +174 -0
  82. package/dist/core/plainToolIndication.js.map +1 -0
  83. package/dist/core/reasoningBlocks.d.ts +60 -0
  84. package/dist/core/reasoningBlocks.js +98 -0
  85. package/dist/core/reasoningBlocks.js.map +1 -0
  86. package/dist/core/refusal.d.ts +53 -0
  87. package/dist/core/refusal.js +133 -0
  88. package/dist/core/refusal.js.map +1 -0
  89. package/dist/core/runStats.d.ts +52 -0
  90. package/dist/core/runStats.js +118 -0
  91. package/dist/core/runStats.js.map +1 -0
  92. package/dist/core/shell/ShellCommandFailedError.d.ts +54 -0
  93. package/dist/core/shell/ShellCommandFailedError.js +68 -0
  94. package/dist/core/shell/ShellCommandFailedError.js.map +1 -0
  95. package/dist/core/shell/abstention.d.ts +88 -0
  96. package/dist/core/shell/abstention.js +184 -0
  97. package/dist/core/shell/abstention.js.map +1 -0
  98. package/dist/core/shell/approvalCapture.d.ts +271 -0
  99. package/dist/core/shell/approvalCapture.js +108 -0
  100. package/dist/core/shell/approvalCapture.js.map +1 -0
  101. package/dist/core/shell/approvalStop.d.ts +84 -0
  102. package/dist/core/shell/approvalStop.js +119 -0
  103. package/dist/core/shell/approvalStop.js.map +1 -0
  104. package/dist/core/shell/arity.d.ts +6 -0
  105. package/dist/core/shell/arity.js +20 -6
  106. package/dist/core/shell/arity.js.map +1 -1
  107. package/dist/core/shell/denylist.d.ts +11 -0
  108. package/dist/core/shell/denylist.js +37 -0
  109. package/dist/core/shell/denylist.js.map +1 -0
  110. package/dist/core/shell/escalationSeverity.d.ts +141 -0
  111. package/dist/core/shell/escalationSeverity.js +89 -0
  112. package/dist/core/shell/escalationSeverity.js.map +1 -0
  113. package/dist/core/shell/framing.d.ts +190 -0
  114. package/dist/core/shell/framing.js +633 -0
  115. package/dist/core/shell/framing.js.map +1 -0
  116. package/dist/core/shell/hardline.d.ts +81 -0
  117. package/dist/core/shell/hardline.js +607 -0
  118. package/dist/core/shell/hardline.js.map +1 -0
  119. package/dist/core/shell/negotiation.d.ts +249 -0
  120. package/dist/core/shell/negotiation.js +355 -0
  121. package/dist/core/shell/negotiation.js.map +1 -0
  122. package/dist/core/shell/normalize.d.ts +44 -4
  123. package/dist/core/shell/normalize.js +61 -7
  124. package/dist/core/shell/normalize.js.map +1 -1
  125. package/dist/core/shell/openWorld.d.ts +263 -0
  126. package/dist/core/shell/openWorld.js +1188 -0
  127. package/dist/core/shell/openWorld.js.map +1 -0
  128. package/dist/core/shell/rater.d.ts +935 -0
  129. package/dist/core/shell/rater.js +1473 -0
  130. package/dist/core/shell/rater.js.map +1 -0
  131. package/dist/core/shell/raterModel.d.ts +41 -0
  132. package/dist/core/shell/raterModel.js +51 -0
  133. package/dist/core/shell/raterModel.js.map +1 -0
  134. package/dist/core/shell/rejection.d.ts +69 -0
  135. package/dist/core/shell/rejection.js +38 -0
  136. package/dist/core/shell/rejection.js.map +1 -0
  137. package/dist/core/toolCallRepair/grammar.d.ts +41 -0
  138. package/dist/core/toolCallRepair/grammar.js +116 -0
  139. package/dist/core/toolCallRepair/grammar.js.map +1 -0
  140. package/dist/core/toolCallRepair/index.d.ts +2 -0
  141. package/dist/core/toolCallRepair/index.js +7 -0
  142. package/dist/core/toolCallRepair/index.js.map +1 -0
  143. package/dist/core/toolCallRepair/payload.d.ts +36 -0
  144. package/dist/core/toolCallRepair/payload.js +341 -0
  145. package/dist/core/toolCallRepair/payload.js.map +1 -0
  146. package/dist/core/toolCallRepair/promote.d.ts +45 -0
  147. package/dist/core/toolCallRepair/promote.js +90 -0
  148. package/dist/core/toolCallRepair/promote.js.map +1 -0
  149. package/dist/core/toolDisplay.d.ts +123 -0
  150. package/dist/core/toolDisplay.js +451 -0
  151. package/dist/core/toolDisplay.js.map +1 -0
  152. package/dist/core/toolOutputChannel.d.ts +95 -0
  153. package/dist/core/toolOutputChannel.js +165 -0
  154. package/dist/core/toolOutputChannel.js.map +1 -0
  155. package/dist/core/types.d.ts +294 -12
  156. package/dist/core/types.js.map +1 -1
  157. package/dist/history/historyFormat.d.ts +28 -0
  158. package/dist/history/historyFormat.js +127 -0
  159. package/dist/history/historyFormat.js.map +1 -0
  160. package/dist/history/historyStore.d.ts +198 -0
  161. package/dist/history/historyStore.js +482 -0
  162. package/dist/history/historyStore.js.map +1 -0
  163. package/dist/history/recordSession.d.ts +37 -0
  164. package/dist/history/recordSession.js +56 -0
  165. package/dist/history/recordSession.js.map +1 -0
  166. package/dist/index.d.ts +4 -0
  167. package/dist/index.js +4 -0
  168. package/dist/index.js.map +1 -1
  169. package/dist/providers/anthropic.d.ts +1 -1
  170. package/dist/providers/anthropic.js +5 -10
  171. package/dist/providers/anthropic.js.map +1 -1
  172. package/dist/providers/deepseek.d.ts +1 -1
  173. package/dist/providers/deepseek.js +5 -10
  174. package/dist/providers/deepseek.js.map +1 -1
  175. package/dist/providers/geminiSchemaSanitizer.d.ts +55 -0
  176. package/dist/providers/geminiSchemaSanitizer.js +347 -0
  177. package/dist/providers/geminiSchemaSanitizer.js.map +1 -0
  178. package/dist/providers/geminiThinking.d.ts +52 -0
  179. package/dist/providers/geminiThinking.js +72 -0
  180. package/dist/providers/geminiThinking.js.map +1 -0
  181. package/dist/providers/google-genai.d.ts +1 -1
  182. package/dist/providers/google-genai.js +12 -11
  183. package/dist/providers/google-genai.js.map +1 -1
  184. package/dist/providers/groq.d.ts +1 -1
  185. package/dist/providers/groq.js +5 -10
  186. package/dist/providers/groq.js.map +1 -1
  187. package/dist/providers/huggingface.d.ts +25 -0
  188. package/dist/providers/huggingface.js +69 -0
  189. package/dist/providers/huggingface.js.map +1 -0
  190. package/dist/providers/modelCatalog.d.ts +109 -0
  191. package/dist/providers/modelCatalog.js +245 -0
  192. package/dist/providers/modelCatalog.js.map +1 -0
  193. package/dist/providers/modelDiscovery.d.ts +153 -6
  194. package/dist/providers/modelDiscovery.js +295 -41
  195. package/dist/providers/modelDiscovery.js.map +1 -1
  196. package/dist/providers/ollama.d.ts +19 -5
  197. package/dist/providers/ollama.js +60 -52
  198. package/dist/providers/ollama.js.map +1 -1
  199. package/dist/providers/openai.d.ts +1 -1
  200. package/dist/providers/openai.js +39 -10
  201. package/dist/providers/openai.js.map +1 -1
  202. package/dist/providers/openrouter.d.ts +4 -5
  203. package/dist/providers/openrouter.js +20 -35
  204. package/dist/providers/openrouter.js.map +1 -1
  205. package/dist/providers/vertexai.d.ts +1 -1
  206. package/dist/providers/vertexai.js +12 -11
  207. package/dist/providers/vertexai.js.map +1 -1
  208. package/dist/providers/xai.d.ts +1 -1
  209. package/dist/providers/xai.js +5 -10
  210. package/dist/providers/xai.js.map +1 -1
  211. package/dist/runtime/askStructured.d.ts +105 -0
  212. package/dist/runtime/askStructured.js +120 -0
  213. package/dist/runtime/askStructured.js.map +1 -0
  214. package/dist/runtime/conversation.d.ts +60 -0
  215. package/dist/runtime/conversation.js +151 -0
  216. package/dist/runtime/conversation.js.map +1 -0
  217. package/dist/runtime/singleShot.d.ts +25 -5
  218. package/dist/runtime/singleShot.js +95 -36
  219. package/dist/runtime/singleShot.js.map +1 -1
  220. package/dist/runtime/structuredOutput.d.ts +104 -0
  221. package/dist/runtime/structuredOutput.js +393 -0
  222. package/dist/runtime/structuredOutput.js.map +1 -0
  223. package/dist/utils/ProgressIndicator.d.ts +21 -0
  224. package/dist/utils/ProgressIndicator.js +30 -3
  225. package/dist/utils/ProgressIndicator.js.map +1 -1
  226. package/dist/utils/aiignoreUtils.js.map +1 -1
  227. package/dist/utils/binaryOutputUtils.js.map +1 -1
  228. package/dist/utils/consoleUtils.d.ts +52 -0
  229. package/dist/utils/consoleUtils.js +72 -2
  230. package/dist/utils/consoleUtils.js.map +1 -1
  231. package/dist/utils/crashHandler.d.ts +87 -0
  232. package/dist/utils/crashHandler.js +128 -0
  233. package/dist/utils/crashHandler.js.map +1 -0
  234. package/dist/utils/debugDump.d.ts +134 -0
  235. package/dist/utils/debugDump.js +381 -0
  236. package/dist/utils/debugDump.js.map +1 -0
  237. package/dist/utils/debugUtils.d.ts +13 -4
  238. package/dist/utils/debugUtils.js +36 -13
  239. package/dist/utils/debugUtils.js.map +1 -1
  240. package/dist/utils/displayWidth.d.ts +53 -0
  241. package/dist/utils/displayWidth.js +195 -0
  242. package/dist/utils/displayWidth.js.map +1 -0
  243. package/dist/utils/fileUtils.d.ts +24 -2
  244. package/dist/utils/fileUtils.js +54 -12
  245. package/dist/utils/fileUtils.js.map +1 -1
  246. package/dist/utils/llmUtils.d.ts +39 -8
  247. package/dist/utils/llmUtils.js +76 -8
  248. package/dist/utils/llmUtils.js.map +1 -1
  249. package/dist/utils/redactSecrets.d.ts +63 -0
  250. package/dist/utils/redactSecrets.js +286 -0
  251. package/dist/utils/redactSecrets.js.map +1 -0
  252. package/dist/utils/systemPromptNotes.d.ts +225 -0
  253. package/dist/utils/systemPromptNotes.js +340 -0
  254. package/dist/utils/systemPromptNotes.js.map +1 -0
  255. package/dist/utils/systemUtils.d.ts +49 -1
  256. package/dist/utils/systemUtils.js +67 -3
  257. package/dist/utils/systemUtils.js.map +1 -1
  258. package/dist/utils/toolMatching.d.ts +30 -0
  259. package/dist/utils/toolMatching.js +44 -0
  260. package/dist/utils/toolMatching.js.map +1 -0
  261. package/dist/utils/untrustedText.d.ts +66 -0
  262. package/dist/utils/untrustedText.js +80 -0
  263. package/dist/utils/untrustedText.js.map +1 -0
  264. package/package.json +22 -6
  265. package/schema/gsloth-config.schema.json +3134 -0
  266. package/dist/core/shell/allowlist.d.ts +0 -75
  267. package/dist/core/shell/allowlist.js +0 -187
  268. package/dist/core/shell/allowlist.js.map +0 -1
  269. package/dist/core/shell/judge.d.ts +0 -161
  270. package/dist/core/shell/judge.js +0 -261
  271. package/dist/core/shell/judge.js.map +0 -1
@@ -0,0 +1,760 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * Gaunt Sloth configuration types. Extracted verbatim from the former `config.ts`
4
+ * god-file; the public type surface is unchanged. The shell/dev-tools policy types
5
+ * live in `./shell-policy.ts`; defaults in `./defaults.ts`; the loader in `./loader.ts`.
6
+ */
7
+ import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
8
+ import type { BaseToolkit, StructuredToolInterface } from '@langchain/core/tools';
9
+ import type { StatusLevel } from '#src/core/types.js';
10
+ import type { ApprovalsConfig, BuiltInToolsSetting } from '#src/config/shell-policy.js';
11
+ /**
12
+ * GS2-43 — the seven configurable prompt segments. Each maps to a prompt file with a
13
+ * well-known default name (`.gsloth.backstory.md`, `.gsloth.guidelines.md`,
14
+ * `.gsloth.system.md`, `.gsloth.chat.md`, `.gsloth.code.md`, `.gsloth.exec.md`,
15
+ * `.gsloth.review.md`) and can be retargeted / disabled / composed via
16
+ * {@link GthConfig.prompts}.
17
+ */
18
+ export type PromptSegmentName = 'backstory' | 'guidelines' | 'system' | 'chat' | 'code' | 'exec' | 'review';
19
+ /**
20
+ * GS2-43 — configuration for one prompt segment.
21
+ */
22
+ export interface PromptSegmentConfig {
23
+ /**
24
+ * File to read for this segment. Resolved like every prompt file: the config dir
25
+ * (`.gsloth/.gsloth-settings[/<profile>]/`) first, then relative to the project root.
26
+ */
27
+ path?: string;
28
+ /**
29
+ * `false` drops the segment entirely — even its bundled default. Default `true`.
30
+ */
31
+ enabled?: boolean;
32
+ /**
33
+ * `'replace'` (default): the {@link path} file replaces the built-in segment content.
34
+ * `'append'`: the file content is appended after the built-in content.
35
+ */
36
+ mode?: 'replace' | 'append';
37
+ }
38
+ /**
39
+ * GS2-43 — one segment's setting: a `string` path (shorthand for `{ path }`) or a
40
+ * {@link PromptSegmentConfig} object.
41
+ */
42
+ export type PromptSegmentSetting = string | PromptSegmentConfig;
43
+ /**
44
+ * GS2-43 — the unified `prompts` config object. Replaces the removed flat
45
+ * `projectGuidelines` / `projectReviewInstructions` keys and makes all seven prompt
46
+ * segments retargetable through config. Sibling keys are trivially addable (GS2-44 will
47
+ * add `agents` for AGENTS.md auto-discovery), so keep segment names and future siblings
48
+ * in this one flat namespace.
49
+ */
50
+ export type PromptsConfig = Partial<Record<PromptSegmentName, PromptSegmentSetting>>;
51
+ /**
52
+ * Shared per-command tooling configuration (the knobs every actionable command carries).
53
+ * Reused across the per-command types in {@link GthConfig.commands} and by
54
+ * {@link PrCommandConfig}. Type-level dedupe only — no runtime/behaviour change.
55
+ *
56
+ * NOTE: `commands.api` intentionally does NOT use this shape (it only has
57
+ * `filesystem`/`builtInTools` plus `port`/`cors`), so it stays bespoke below.
58
+ */
59
+ export interface CommandToolingConfig {
60
+ filesystem?: string[] | 'all' | 'read' | 'none';
61
+ builtInTools?: BuiltInToolsSetting;
62
+ /**
63
+ * §9.1 — per-command approvals posture. It overrides only the fields it NAMES: `mode`,
64
+ * `rater`, `raterTimeoutMs` and `allow` replace the root's, while `deny` and `escalate`
65
+ * concatenate with it. See {@link GthConfig.approvals}.
66
+ */
67
+ approvals?: ApprovalsConfig;
68
+ customTools?: CustomToolsConfig | false;
69
+ /** See {@link GthConfig.allowedTools}. */
70
+ allowedTools?: string[];
71
+ binaryFormats?: false | BinaryFormatConfig[];
72
+ }
73
+ /**
74
+ * GS2-33 — one profile-backed subagent declaration. When the parent agent spawns this subagent
75
+ * (the deepagents `task` tool), the CHILD resolves the named config {@link profile} through the
76
+ * GS2-1 cascade, so it runs under THAT profile's model + tools + prompt (e.g. a cheap flash-lite
77
+ * profile for recall/search subagents while the parent runs on a strong model).
78
+ *
79
+ * The `profile` is a named profile block created by `gth config profile create <name>` — a
80
+ * `.gsloth/.gsloth-settings/<name>/` config dir, the same discovery convention `--profile` /
81
+ * `--identity-profile` resolve.
82
+ */
83
+ export interface SubagentProfileSpec {
84
+ /** Identifier the model selects this subagent by (the task-tool subagent name). */
85
+ name: string;
86
+ /** Description shown to the model when it chooses a subagent. Defaults to a profile note. */
87
+ description?: string;
88
+ /**
89
+ * Named config profile whose model + tools + prompt the CHILD resolves. Threaded through the
90
+ * subagent-spawn config resolution as {@link CommandLineConfigOverrides.identityProfile}.
91
+ */
92
+ profile: string;
93
+ }
94
+ /**
95
+ * This is a processed Gaunt Sloth config ready to be passed down into components.
96
+ *
97
+ * Default values can be found in {@link DEFAULT_CONFIG}
98
+ */
99
+ export interface GthConfig {
100
+ llm: BaseChatModel;
101
+ /**
102
+ * Selects the agent backend.
103
+ * - `lean` (default when omitted): the plain LangChain agent ({@link GthLangChainAgent}). It is
104
+ * given gsloth's full toolset (filesystem + hardened dev/shell + the `gth_checklist` planning
105
+ * tool), with no deepagents machinery (no `/large_tool_results` offload). This is the
106
+ * recommended backend and the default for the CLI (code/chat), single-shot (ask/exec), and
107
+ * the AG-UI/api server.
108
+ * - `deep` (**experimental**, opt-in): the deepagents runtime (subagents, `write_todos`,
109
+ * summarization, tool-result offload). Selecting it emits a warning. It can exhibit
110
+ * path-divergence and sporadic failures and carries extra internal workarounds; prefer `lean`.
111
+ *
112
+ * **Command-scoped**, and `docs/configuration/profiles.md` carries the one list of which commands
113
+ * honor it — don't restate it here, or the copies drift. What the type itself must say: `review`
114
+ * and `pr` — including the `pr` change-requirements discovery agent — always run lean, because
115
+ * `@gaunt-sloth/review` cannot reach the deep backend; a run that asks for `deep` there says so
116
+ * rather than dropping the key silently. The ACP server is the mirror image: structurally
117
+ * deep-only, it always runs deep and rejects `lean` outright.
118
+ */
119
+ agent?: {
120
+ backend?: 'deep' | 'lean';
121
+ };
122
+ /**
123
+ * GS2-7 (B20) — local, opt-in session history store. DEFAULT OFF (absent = disabled): a default
124
+ * run persists nothing and behaves exactly as before. When `enabled`, each run is recorded to a
125
+ * local SQLite DB (`~/.gsloth/history.db` by default, overridable via `dbPath`) for
126
+ * `gth history search` / `gth insights`. Local only — no telemetry leaves the machine.
127
+ */
128
+ history?: {
129
+ enabled?: boolean;
130
+ dbPath?: string;
131
+ };
132
+ /**
133
+ * GS2-7 (B21) — opt-in file-backed memory (MEMORY.md / USER.md). DEFAULT OFF. Forward-compat
134
+ * toggle only; the feature is a deferred follow-up.
135
+ */
136
+ memory?: {
137
+ enabled?: boolean;
138
+ };
139
+ /**
140
+ * Binary format support configuration.
141
+ * Disabled by default unless explicitly configured.
142
+ */
143
+ binaryFormats?: false | BinaryFormatConfig[];
144
+ /**
145
+ * Content source type. Source used to fetch content (usually diff) for `review` or `pr` command.
146
+ *
147
+ * {@link DEFAULT_CONFIG#contentSource}
148
+ */
149
+ contentSource: string;
150
+ /**
151
+ * Requirement source type. Source used to fetch requirements for `review` or `pr` command.
152
+ */
153
+ requirementSource: string;
154
+ /**
155
+ * GS2-43 — the unified prompt-segment config (see {@link PromptsConfig}). Each of the seven
156
+ * segments (`backstory | guidelines | system | chat | code | exec | review`) accepts a string
157
+ * path (e.g. `"guidelines": "AGENTS.md"`) or an object (`{ path?, enabled?, mode? }`). When a
158
+ * segment is omitted its default-named file / bundled default applies unchanged.
159
+ */
160
+ prompts?: PromptsConfig;
161
+ /**
162
+ * Separate identity profile.
163
+ * May include separate identity, guidelines and command protocol,
164
+ * making gsloth behave as an agent different from default profile behaviour.
165
+ * for example, `devops` profile to detect changes such as properties and environment variables.
166
+ * Custom config can still win over this one.
167
+ * This setting requires .gsloth/.gsloth-settings directory to exist.
168
+ */
169
+ identityProfile?: string;
170
+ /**
171
+ * Whether to include the current date in the project review instructions or not.
172
+ */
173
+ includeCurrentDateAfterGuidelines: boolean;
174
+ /**
175
+ * Organisation name, locale and timezone.
176
+ * Only used with {@link includeCurrentDateAfterGuidelines}.
177
+ * timeZone and locale should be in format supported by Intl.DateTimeFormat
178
+ */
179
+ organization?: {
180
+ name?: string;
181
+ locale?: string;
182
+ timezone?: string;
183
+ };
184
+ /**
185
+ * If true, only use user-provided system prompts. Do not fall back to the
186
+ * bundled `.gsloth.*.md` prompt files shipped with the installation.
187
+ * This applies to all `.gsloth.*.md` files (backstory, system, chat, code, guidelines, review).
188
+ */
189
+ noDefaultPrompts?: boolean;
190
+ filesystem: string[] | 'all' | 'read' | 'none';
191
+ /**
192
+ * Selects and configures the built-in tools the agent loads. Either a `string[]` of tool names
193
+ * (each enabled) or a registry keyed by tool name whose values enable (`true`), force-disable
194
+ * (`false`), or configure ({@link BuiltInToolConfig}) each tool. CFG-18 folded the former
195
+ * per-command `devTools` (the `run_*` commands + `run_shell_command`'s EXT-9/10/12 config) into
196
+ * this single registry: e.g. `{ "run_tests": { "command": "npm test" }, "run_shell_command": {
197
+ * "timeout": 300000 } }`. Settable at the root or per command (`commands.<command>.builtInTools`);
198
+ * a per-command value replaces the top-level one.
199
+ */
200
+ builtInTools?: BuiltInToolsSetting;
201
+ /**
202
+ * CFG-27 — the tool-approval **ladder**: one of the five rungs (`manual` · `write` ·
203
+ * `assisted` · `auto` · `bypass`), written either as the bare rung name or as an object
204
+ * carrying the rater's identity profile and the declared allow/deny lists. Each rung fully
205
+ * determines behaviour — there are no severity thresholds, no strictness levels and no
206
+ * independent rater switch.
207
+ *
208
+ * Settable at the root or per command (`commands.<command>.approvals`). §9.1 — a per-command
209
+ * value overrides only the fields it NAMES. `mode`, `rater` and `raterTimeoutMs` replace the
210
+ * root's; `deny` and `escalate` CONCATENATE across every scope, so a per-command rung can never
211
+ * discard the root's prohibitions; `allow` is REPLACED when the command states its own and
212
+ * inherited when it does not, so a scope may narrow what runs unprompted and may never widen
213
+ * what is prohibited (§3.1: a too-broad allow entry runs unrated, a missed deny entry does not).
214
+ * Absent = `assisted`, resolved by `resolveApprovals`.
215
+ */
216
+ approvals?: ApprovalsConfig;
217
+ tools?: StructuredToolInterface[] | BaseToolkit[] | ServerTool[];
218
+ /**
219
+ * Restrict the agent to this allow-list of tool names, applied after every tool source
220
+ * (filesystem, built-in, custom, MCP, A2A, and `tools`) is resolved. This is the only knob
221
+ * that can gate MCP and A2A tools, which have no per-source override of their own.
222
+ *
223
+ * - omitted/undefined: no filtering, all resolved tools remain available.
224
+ * - non-empty array: keep only tools whose name is in the list.
225
+ * - empty array `[]`: disable every tool. MCP servers are not even contacted (no OAuth),
226
+ * which is useful for agents that only need to reason over the prompt (e.g. the review
227
+ * agent).
228
+ *
229
+ * Can be overridden per command via `commands.<command>.allowedTools`.
230
+ */
231
+ allowedTools?: string[];
232
+ /**
233
+ * Middleware configuration for LangChain v1.
234
+ * Middleware provides hooks to intercept and control agent execution at critical points.
235
+ *
236
+ * Middleware can be:
237
+ * - Predefined middleware (string or config object) - works in both JSON and JS configs
238
+ * - Custom middleware objects - only available in JS configs
239
+ *
240
+ * Example (JSON config):
241
+ * ```json
242
+ * {
243
+ * "middleware": [
244
+ * "summarization",
245
+ * { "name": "anthropic-prompt-caching", "ttl": "5m" }
246
+ * ]
247
+ * }
248
+ * ```
249
+ *
250
+ * Example (JS config):
251
+ * ```js
252
+ * {
253
+ * middleware: [
254
+ * "summarization",
255
+ * { beforeModel: (state) => { /* custom logic *\/ return state; } }
256
+ * ]
257
+ * }
258
+ * ```
259
+ *
260
+ * Available predefined middleware:
261
+ * - `anthropic-prompt-caching`: Reduces API costs by caching prompts (Anthropic only)
262
+ * - `summarization`: Condenses conversation history when approaching token limits
263
+ */
264
+ middleware?: unknown[];
265
+ /**
266
+ * Stream output. Some models do not support streaming. Set value to `false` for them.
267
+ *
268
+ * {@link DEFAULT_CONFIG#streamOutput}
269
+ */
270
+ streamOutput: boolean;
271
+ /**
272
+ * Should the output be written to md file.
273
+ * (e.g. gth_2025-07-26_22-59-06_REVIEW.md).
274
+ * Defaults to `false` (no file is written); set to `true` for the standard
275
+ * `gth_<timestamp>_<COMMAND>.md` name.
276
+ * Can be set to false with `-wn` or `-w0`
277
+ * Can be set to a specific filename or path by passing a string:
278
+ * - Bare filenames (e.g. `"review.md"`) are placed in `.gsloth/` when it exists, otherwise project root
279
+ * - Paths with separators (e.g. `"./review.md"` or `"reviews/last.md"`) are always relative to project root
280
+ * Please note the string does not accept absolute path, but allows to exit project with `..` if necessary.
281
+ */
282
+ writeOutputToFile: boolean | string;
283
+ /**
284
+ * Whether binary model outputs should be written to files instead of printed inline.
285
+ * When enabled, supported binary content blocks are materialized as `gth_*.<ext>` files.
286
+ */
287
+ writeBinaryOutputsToFile: boolean;
288
+ /**
289
+ * Use colour in output
290
+ */
291
+ useColour: boolean;
292
+ /**
293
+ * Enable terminal mouse reporting in the Ink TUI, making its affordances clickable.
294
+ * On by default in an interactive terminal. While it is on the terminal's own text selection
295
+ * needs a modifier (Shift, or Option in some macOS terminals) — set this to `false`, or set
296
+ * `GTH_NO_MOUSE`, to get unmodified selection back.
297
+ */
298
+ useMouse: boolean;
299
+ /**
300
+ * Stream session log instead of writing it when inference streaming is complete.
301
+ * (only works when {@link streamOutput} is true)
302
+ */
303
+ streamSessionInferenceLog: boolean;
304
+ /**
305
+ * Allow inference to be interrupted with esc. Only has an effect in TTY mode.
306
+ */
307
+ canInterruptInferenceWithEsc: boolean;
308
+ /**
309
+ * Log messages and events to gaunt-sloth.log,
310
+ * use llm.verbose or `gth --verbose` as more intrusive option, setting verbose to LangChain / LangGraph
311
+ */
312
+ debugLog?: boolean;
313
+ /**
314
+ * LangGraph recursion limit for an agent run — the maximum number of
315
+ * super-steps (model ↔ tool round-trips) before the graph throws. Defaults to
316
+ * 1000, which suits long coding chains; embodied / tight-loop consumers can
317
+ * lower it so a stuck run fails fast and visibly instead of grinding.
318
+ */
319
+ recursionLimit?: number;
320
+ /**
321
+ * Console logging level. Only messages at or above this level will be displayed.
322
+ * Valid values: 'debug', 'info', 'display', 'success', 'warning', 'error', 'stream'
323
+ * Default: 'info' (not debug)
324
+ */
325
+ consoleLevel?: StatusLevel;
326
+ customTools?: CustomToolsConfig;
327
+ requirementSourceConfig?: Record<string, unknown>;
328
+ contentSourceConfig?: Record<string, unknown>;
329
+ /**
330
+ * MCP (Model Context Protocol) server connections.
331
+ * Allows connecting to external MCP servers including those requiring OAuth.
332
+ * @see {@link https://modelcontextprotocol.io/}
333
+ */
334
+ mcpServers?: Record<string, unknown>;
335
+ /**
336
+ * TLS trust for outbound HTTPS. Primarily so an `http`-transport MCP server behind a
337
+ * private/corporate CA can be reached without prepending `NODE_EXTRA_CA_CERTS` on every
338
+ * invocation. The mechanism is a process-global undici dispatcher, so it applies to ALL
339
+ * outbound `fetch` this process makes (LLM provider calls included), not only MCP.
340
+ */
341
+ tls?: {
342
+ /**
343
+ * Extra CA certificate file(s) to trust IN ADDITION to Node's built-in roots. Paths resolve
344
+ * relative to the project dir (or `~`/absolute). Additive — never removes a default root.
345
+ */
346
+ extraCaCerts?: string[];
347
+ /**
348
+ * DANGER — `false` disables TLS certificate verification for ALL outbound HTTPS this process
349
+ * makes, not just MCP. Escape hatch only; a loud security warning is emitted every session.
350
+ */
351
+ rejectUnauthorized?: boolean;
352
+ };
353
+ /**
354
+ * A2A (Agent-to-Agent) protocol agents configuration.
355
+ * Enables delegation of tasks to external AI agents.
356
+ * Each agent becomes available as a tool named `a2a_agent_<agentId>`.
357
+ * @experimental This feature is experimental and may change.
358
+ * @see {@link https://a2a-protocol.org/}
359
+ */
360
+ a2aAgents?: Record<string, unknown>;
361
+ builtInToolsConfig?: BuiltInToolsConfig;
362
+ aiignore?: {
363
+ enabled?: boolean;
364
+ patterns?: string[];
365
+ };
366
+ commands?: {
367
+ pr?: PrCommandConfig;
368
+ review?: CommandToolingConfig & {
369
+ contentSource?: string;
370
+ requirementSource?: string;
371
+ rating?: RatingConfig;
372
+ };
373
+ ask?: CommandToolingConfig;
374
+ chat?: CommandToolingConfig;
375
+ /**
376
+ * `gth code` — interactive coding session. Carries the do-the-job tool/filesystem knobs; the
377
+ * dev/shell tools (CFG-18) are configured via {@link CommandToolingConfig.builtInTools}.
378
+ */
379
+ code?: CommandToolingConfig;
380
+ /**
381
+ * `gth exec` — prompt-as-script runtime. Like `code`, an exec run may need to actually
382
+ * do the job (read/write files, run commands), so it carries the same tool/filesystem knobs.
383
+ */
384
+ exec?: CommandToolingConfig;
385
+ api?: {
386
+ filesystem?: string[] | 'all' | 'read' | 'none';
387
+ builtInTools?: BuiltInToolsSetting;
388
+ /**
389
+ * §9.1 — per-command approvals posture. It overrides only the fields it NAMES: `mode`,
390
+ * `rater`, `raterTimeoutMs` and `allow` replace the root's, while `deny` and `escalate`
391
+ * concatenate with it. See {@link GthConfig.approvals}.
392
+ */
393
+ approvals?: ApprovalsConfig;
394
+ port?: number;
395
+ cors?: {
396
+ allowOrigin?: string;
397
+ allowMethods?: string;
398
+ allowHeaders?: string;
399
+ };
400
+ };
401
+ };
402
+ /**
403
+ * GS2-35/EXT-83 — identity for the `Co-Authored-By` trailer of agent-authored git commits. Gaunt
404
+ * Sloth has no dedicated commit tool (it commits via `run_shell_command`), so this identity is
405
+ * injected into the code-mode system prompt, which instructs the agent to co-author commits as
406
+ * this account. Optional and defaulted, each field independently: when the name is unset the
407
+ * default is {@link DEFAULT_COMMIT_CO_AUTHOR_NAME} decorated with the resolved active model —
408
+ * `Gaunt Sloth (provider:model)` — falling back to the bare
409
+ * {@link DEFAULT_COMMIT_CO_AUTHOR_NAME} when no model resolves or {@link injectModelContext} is
410
+ * `false`; when the email is unset it is {@link DEFAULT_COMMIT_CO_AUTHOR_EMAIL}. A CONFIGURED
411
+ * name is emitted verbatim — the model identity decorates only the default.
412
+ */
413
+ commit?: {
414
+ coAuthor?: {
415
+ name?: string;
416
+ email?: string;
417
+ };
418
+ };
419
+ modelDisplayName?: string;
420
+ /**
421
+ * GS2-53 — the configured provider `type` string (`openrouter`/`deepseek`/`xai`/`anthropic`/…),
422
+ * stashed by the loader from the raw `llm.type` before the built `BaseChatModel` replaces the raw
423
+ * spec. INTERNAL (loader-set, never user-supplied), so it is deliberately absent from the config
424
+ * schema. {@link import('#src/utils/systemPromptNotes.js').resolveModelIdentity} PREFERS this over
425
+ * the live model's `_llmType()` for the injected identity, because OpenAI-compatible shims
426
+ * (openrouter/deepseek/xai all extend `ChatOpenAI`) report `_llmType() === 'openai'` and would
427
+ * otherwise mislabel the provider half. Absent for module configs (which hand us an already-built
428
+ * LLM with no raw `type`), where resolution falls back to the guarded `_llmType()`.
429
+ */
430
+ modelProviderType?: string;
431
+ /**
432
+ * GS2-34 — inject the resolved active `provider:model` identity into the assembled system prompt
433
+ * so the agent knows which model is serving it (to answer "what model are you?" and reason about
434
+ * its own capabilities/limits). Default ON (omitted = inject). Opt out with
435
+ * `injectModelContext: false` to keep reproducible / model-agnostic runs (e.g. review) blind to
436
+ * the identity — when off, the assembled prompt is exactly as it is without this feature.
437
+ *
438
+ * EXT-83 — it governs the model identity EVERYWHERE in the prompt, not just the identity line:
439
+ * in `code` mode the same resolved identity decorates the default git commit co-author name
440
+ * ({@link GthConfig.commit}), so turning this off also removes the model from the commit trailer,
441
+ * which degrades to the plain default name. The identity LINE applies in all modes; the trailer
442
+ * it also feeds is code-mode-only, like the cwd/os-shell notes. Defaulted at the read site (not
443
+ * in {@link DEFAULT_CONFIG}) to avoid churning the effective-config snapshot.
444
+ */
445
+ injectModelContext?: boolean;
446
+ /**
447
+ * GS2-47 — controls the shared secret-redaction pass applied to `/debug-dump` archives. Default
448
+ * ON (omitted = redact): secret-named env-var values, inline config secrets, provider-key/auth
449
+ * patterns and sensitive config fields are masked before any artifact hits disk. Set
450
+ * `debugDump.redact: false` (or run `/debug-dump --unsafe-no-redact`) to write a RAW archive, which
451
+ * the command flags with a loud "may contain secrets" warning. Defaulted at the read site (not in
452
+ * {@link DEFAULT_CONFIG}) to avoid churning the effective-config snapshot.
453
+ */
454
+ debugDump?: {
455
+ redact?: boolean;
456
+ };
457
+ /**
458
+ * Transient (runtime-only) extra filesystem roots the agent is allowed to read/write for
459
+ * THIS run, in addition to the cwd sandbox. Populated by `gth exec --allow-dir <path>`
460
+ * (repeatable); never persisted to a config file. When set, the deep agent's
461
+ * {@link FilesystemBackend} drops `virtualMode` (so absolute paths and `..` resolve on the
462
+ * real filesystem) and access is constrained to cwd + these dirs via permission allow-rules.
463
+ * Removing the cwd-only sandbox is a guardrail removal, so callers announce it loudly.
464
+ */
465
+ allowDirs?: string[];
466
+ /**
467
+ * Transient (runtime-only) flag set by `gth ask --write`: opt `ask` into the same
468
+ * "do-the-job" filesystem + dev tools that `exec`/`code` get, so a question can act
469
+ * (read/write files, run commands) rather than only chat. Never persisted to a config file.
470
+ */
471
+ askWriteMode?: boolean;
472
+ /**
473
+ * GS2-63 — output surface controls.
474
+ *
475
+ * `output.header` DEFAULTS ON (omitted = show). Set `false` to suppress the technical run-header
476
+ * preamble — the Workdir/Model/Tools/Middleware status block, the `Press Escape or Q to interrupt`
477
+ * hint, and their surrounding blank lines — in NON-TUI text modes (`--no-tui`, `ask`, `exec`,
478
+ * `eval`, `pr`, `review`, piped/CI), so captured stdout and log diffs stay clean. The interactive
479
+ * TUI ignores the setting and always shows the header. Only the preamble is suppressed — never
480
+ * model/tool output, errors, or config-validation warnings, and never the live `Thinking…`
481
+ * indicator. Defaulted at the read site (`!== false`), not in {@link DEFAULT_CONFIG}, to avoid
482
+ * churning the effective-config snapshot.
483
+ */
484
+ output?: {
485
+ header?: boolean;
486
+ };
487
+ /**
488
+ * EXT-36 — the tool-loop guard: a repeated-identical-`(tool, args)` / no-progress detector that
489
+ * runs as a lean-backend `beforeModel` middleware, the orthogonal sibling of GS2-36's
490
+ * consecutive-tool-ERROR budget. It catches the case GS2-36 leaves open — a model re-issuing the
491
+ * SAME call verbatim, whether it keeps erroring or keeps "succeeding" with the same result.
492
+ *
493
+ * - `false` disables it entirely.
494
+ * - `true` / omitted → WARN on, HALT off, default threshold ({@link DEFAULT_TOOL_LOOP_THRESHOLD}).
495
+ * - object → per-field: `warn` (default ON) injects a control-flow-free nudge at the threshold;
496
+ * `halt` (default OFF, opt-in) ends the run cleanly (`jumpTo:'end'`, never a throw) at the
497
+ * threshold; `threshold` is the number of consecutive identical calls that trip it.
498
+ *
499
+ * WARN is provably harmless (no routing effect, one nudge per signature per streak). The WARN-on
500
+ * default is applied at the read site (not in {@link DEFAULT_CONFIG}) to avoid churning the
501
+ * effective-config snapshot.
502
+ */
503
+ toolLoopGuard?: boolean | {
504
+ warn?: boolean;
505
+ halt?: boolean;
506
+ threshold?: number;
507
+ };
508
+ /**
509
+ * CFG-37 — persistent surface preference for the `chat`/`code` interactive sessions, settable in
510
+ * both the global and the project config (the project layer wins). `true` asks for the Ink TUI,
511
+ * `false` for the plain readline session, absent leaves the terminal auto-detect in charge —
512
+ * which is why it must stay optional, exactly as {@link useColour}/{@link useMouse} do.
513
+ *
514
+ * This is the CONFIG-FILE preference, one rung of a chain rather than the answer: the
515
+ * `--tui`/`--no-tui` flags and the `GTH_NO_TUI` escape hatch both outrank it, and the capability
516
+ * gates (no TTY, `TERM=dumb`, `ink` not installed) outrank everything because they are checks and
517
+ * not preferences — so `true` degrades to readline rather than forcing a crash. Deliberately NOT
518
+ * in {@link DEFAULT_CONFIG}. The flag arrives separately as
519
+ * {@link CommandLineConfigOverrides.tui}; the two meet only in `shouldUseTui`.
520
+ */
521
+ tui?: boolean;
522
+ /**
523
+ * BATCH-19 — custom `gth eval` reporters, keyed by the NAME they are selected under
524
+ * (`gth eval … --reporter <name>`). Each value is a MODULE PATH, resolved relative to the project
525
+ * dir, whose **default export** is an `EvalReporterFactory` (`() => EvalReporter`). Loaded and
526
+ * registered through the SAME seam the bundled reporters (`text`, `junit`) use, so a config
527
+ * reporter can also override a built-in of the same name (config wins). A missing file, a failed
528
+ * import, or a non-function default export is a hard error (the eval harness exits 2). Trusted:
529
+ * it is the user's own config, which already executes arbitrary JS.
530
+ */
531
+ reporters?: Record<string, string>;
532
+ /**
533
+ * GS2-33 — profile-backed subagents. Each entry names a subagent and the {@link
534
+ * SubagentProfileSpec.profile named config profile} the CHILD resolves when the parent spawns it,
535
+ * so a subagent can run under a different model/tools/prompt than the parent (a cheap profile for
536
+ * recall/search while the parent runs on a strong model). Honored by the deep (deepagents) backend
537
+ * — its `task` tool gains one selectable subagent per entry; the lean backend's own subagent
538
+ * primitive lands in GS2-25.
539
+ */
540
+ subagents?: SubagentProfileSpec[];
541
+ }
542
+ /**
543
+ * `gth pr` command configuration.
544
+ *
545
+ * Declared as a named interface (rather than inline in {@link GthConfig}) so that downstream
546
+ * packages can extend it with their own command features via TypeScript module augmentation
547
+ * (`declare module '@gaunt-sloth/core/config.js'`), keeping those features' types out of core.
548
+ * For example, the assistant package merges its PR discovery config (`discovery`) into this
549
+ * interface.
550
+ */
551
+ export interface PrCommandConfig extends CommandToolingConfig {
552
+ contentSource?: string;
553
+ requirementSource?: string;
554
+ logWorkForReviewInSeconds?: number;
555
+ rating?: RatingConfig;
556
+ }
557
+ /**
558
+ * Server tools such as Anthropic Web Search.
559
+ * These tools are meant to be magic objects like
560
+ * `{"type": "web_search_20250305", "name": "web_search", "max_uses": 10}`,
561
+ * AI Provider does the rest of the magic on their side.
562
+ */
563
+ export interface ServerTool extends Record<string, unknown> {
564
+ type: string;
565
+ name?: string;
566
+ }
567
+ /**
568
+ * Raw, unprocessed Gaunt Sloth config.
569
+ */
570
+ export type ConsoleLevelInput = StatusLevel | keyof typeof StatusLevel | Lowercase<keyof typeof StatusLevel>;
571
+ export interface RawGthConfig extends Omit<GthConfig, 'llm' | 'consoleLevel'> {
572
+ llm: LLMConfig;
573
+ consoleLevel?: ConsoleLevelInput;
574
+ /**
575
+ * GS2-41 — profile composition. When set on a NAMED profile config, this profile inherits from
576
+ * the named base profile: the base resolves first, then this profile's fields merge on top
577
+ * (last-wins). Raw-config-only — resolved and consumed at load time (`resolveConfigExtends`), so
578
+ * it never appears on the resolved {@link GthConfig}.
579
+ */
580
+ extends?: string;
581
+ }
582
+ export type BinaryFormatType = 'image' | 'file' | 'audio' | 'video' | 'binary';
583
+ export interface BinaryFormatConfig {
584
+ /**
585
+ * The type/category of binary format.
586
+ */
587
+ type: BinaryFormatType;
588
+ /**
589
+ * List of allowed extensions for this type (without leading dot).
590
+ */
591
+ extensions: string[];
592
+ /**
593
+ * Maximum file size in bytes. Defaults to 10MB when omitted.
594
+ */
595
+ maxSize?: number;
596
+ /**
597
+ * Optional MIME type overrides for extensions not in the default mapping.
598
+ */
599
+ mimeTypes?: Record<string, string>;
600
+ }
601
+ export type CustomToolsConfig = Record<string, CustomCommandConfig>;
602
+ export type BuiltInToolsConfig = Record<string, unknown>;
603
+ /**
604
+ * Configuration for review rating feature.
605
+ * Allows configuring automated review scoring with pass/fail thresholds.
606
+ */
607
+ export interface RatingConfig {
608
+ /**
609
+ * Enable or disable review rating.
610
+ * @default true
611
+ */
612
+ enabled?: boolean;
613
+ /**
614
+ * Minimum score (0-10) required to pass the review.
615
+ * @default 6
616
+ */
617
+ passThreshold?: number;
618
+ /**
619
+ * Highest allowed value on the rating scale.
620
+ * @default 10
621
+ */
622
+ maxRating?: number;
623
+ /**
624
+ * Lowest allowed value on the rating scale.
625
+ * @default 0
626
+ */
627
+ minRating?: number;
628
+ /**
629
+ * Exit with error code 1 when review fails (below threshold).
630
+ * When false, exits normally (code 0) regardless of rating.
631
+ * @default true
632
+ */
633
+ errorOnReviewFail?: boolean;
634
+ }
635
+ /**
636
+ * Validation checks that can be skipped for custom command parameters.
637
+ * Use with the `allow` property to bypass specific security checks.
638
+ *
639
+ * - `absolute-paths`: Allow absolute paths (e.g. `/dev/ttyUSB0`)
640
+ * - `directory-traversal`: Allow `..` in paths
641
+ * - `shell-injection`: Allow shell metacharacters (`|`, `&`, `;`, etc.)
642
+ * - `null-bytes`: Allow null bytes in values
643
+ */
644
+ export type ValidationCheck = 'absolute-paths' | 'directory-traversal' | 'shell-injection' | 'null-bytes';
645
+ /**
646
+ * Configuration for a custom command parameter.
647
+ * Parameters allow the model to provide dynamic values to commands.
648
+ */
649
+ export interface CustomCommandParameter {
650
+ /**
651
+ * Description of the parameter shown to the model.
652
+ */
653
+ description: string;
654
+ /**
655
+ * Optional list of validation checks to skip for this parameter's value.
656
+ * Use when this parameter legitimately requires values that would normally be blocked.
657
+ * For example, `["absolute-paths"]` allows values like `/dev/ttyUSB0` for this parameter.
658
+ *
659
+ * Available checks: `absolute-paths`, `directory-traversal`, `shell-injection`, `null-bytes`
660
+ */
661
+ allow?: ValidationCheck[];
662
+ }
663
+ /**
664
+ * Configuration for a custom command.
665
+ * Custom commands can be executed with or without parameters.
666
+ */
667
+ export interface CustomCommandConfig {
668
+ /**
669
+ * The shell command to execute.
670
+ * Can include placeholders like ${paramName} that will be replaced with parameter values.
671
+ * If no placeholder is present and parameters are provided, they are appended to the command.
672
+ */
673
+ command: string;
674
+ /**
675
+ * Description of what this command does, shown to the model.
676
+ */
677
+ description: string;
678
+ /**
679
+ * Optional parameters that the model can provide when calling this command.
680
+ * Each parameter has a name (the key) and a description.
681
+ * Parameters are validated for security (no shell injection, directory traversal, etc.).
682
+ */
683
+ parameters?: Record<string, CustomCommandParameter>;
684
+ /**
685
+ * Optional timeout in seconds.
686
+ * When set, the command will be killed if it exceeds this duration.
687
+ * When omitted, no timeout is applied.
688
+ */
689
+ timeout?: number;
690
+ }
691
+ export interface LLMConfig extends Record<string, unknown> {
692
+ type: string;
693
+ model: string;
694
+ configuration: Record<string, unknown>;
695
+ apiKeyEnvironmentVariable?: string;
696
+ }
697
+ export declare const availableDefaultConfigs: readonly ['vertexai', 'anthropic', 'groq', 'deepseek', 'openai', 'google-genai', 'xai', 'openrouter', 'huggingface', 'ollama'];
698
+ export type ConfigType = (typeof availableDefaultConfigs)[number];
699
+ export interface CommandLineConfigOverrides {
700
+ /**
701
+ * Custom config path
702
+ */
703
+ customConfigPath?: string;
704
+ /**
705
+ * Set LangChain/LangGraph to verbose mode,
706
+ * causing LangChain/LangGraph to log many details to the console.
707
+ * debugLog from config.ts may be a less intrusive option.
708
+ */
709
+ verbose?: boolean;
710
+ /**
711
+ * Should the output be written to md file.
712
+ * (e.g. gth_2025-07-26_22-59-06_REVIEW.md).
713
+ * Defaults to `false` (no file is written); set to `true` for the standard
714
+ * `gth_<timestamp>_<COMMAND>.md` name.
715
+ * Can be set to false with `-wn` or `-w0`
716
+ * Can be set to a specific filename or path by passing a string:
717
+ * - Bare filenames (e.g. `"review.md"`) are placed in `.gsloth/` when it exists, otherwise project root
718
+ * - Paths with separators (e.g. `"./review.md"` or `"reviews/last.md"`) are always relative to project root
719
+ * Please note the string does not accept absolute path, but allows to exit project with `..` if necessary.
720
+ */
721
+ writeOutputToFile?: boolean | string;
722
+ /**
723
+ * Separate identity profile.
724
+ * May include separate identity, guidelines and command protocol,
725
+ * making gsloth behave as an agent different from default profile behaviour.
726
+ * for example, `devops` profile to detect changes such as properties and environment variables.
727
+ * Custom config can still win over this one.
728
+ * This setting requires .gsloth/.gsloth-settings directory to exist.
729
+ * Important to note that the profile directory substitutes the entire config directory,
730
+ * in the case if some prompt files are missing - a file from the installation directory will be used.
731
+ */
732
+ identityProfile?: string;
733
+ /**
734
+ * Interactive TUI activation override for chat/code sessions, as passed on the command line.
735
+ * - `true` (`--tui`): force the Ink TUI on where the terminal supports it (it outranks the
736
+ * `GTH_NO_TUI` escape hatch, the {@link GthConfig.tui} config key and the CI auto-off
737
+ * heuristic).
738
+ * - `false` (`--no-tui`): force the plain readline session.
739
+ * - `undefined` (default): defer to the next rung down — `GTH_NO_TUI`, then the
740
+ * {@link GthConfig.tui} config key, then terminal auto-detect.
741
+ * This carries only the FLAG; the persistent preference is {@link GthConfig.tui}. The decision
742
+ * that ranks them lives in `gaunt-sloth`'s `shouldUseTui`.
743
+ */
744
+ tui?: boolean;
745
+ /**
746
+ * BATCH-1 fix — run with a different model than the configured `llm.model`, just for this
747
+ * `initConfig()` call. Used by `gth batch --models a,b,c` to build one genuinely fresh
748
+ * `GthConfig` (with its own freshly-constructed `.llm`) per distinct model in the matrix,
749
+ * instead of structurally cloning an already-instantiated LangChain model object (unsafe for
750
+ * any provider class that keeps state behind private `#fields`). Applied in
751
+ * {@link tryJsonConfig} by overriding `llmConfig.model` before the provider's
752
+ * `processJsonConfig()` builds the instance, so it flows through the same supported
753
+ * construction path every other model comes from.
754
+ *
755
+ * Only takes effect for JSON (`.gsloth.config.json`) configs — a `configure()`-style JS/MJS/TS
756
+ * module config already returns a fully-built `GthConfig` (LLM included) with no generic seam
757
+ * to re-target its model.
758
+ */
759
+ model?: string;
760
+ }