@gaunt-sloth/core 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (158) hide show
  1. package/.gsloth.code.md +10 -0
  2. package/README.md +6 -6
  3. package/dist/config/defaults.d.ts +85 -0
  4. package/dist/config/defaults.js +103 -0
  5. package/dist/config/defaults.js.map +1 -0
  6. package/dist/config/jsonc.d.ts +12 -0
  7. package/dist/config/jsonc.js +41 -0
  8. package/dist/config/jsonc.js.map +1 -0
  9. package/dist/config/loader.d.ts +169 -0
  10. package/dist/config/loader.js +872 -0
  11. package/dist/config/loader.js.map +1 -0
  12. package/dist/config/schema.d.ts +673 -0
  13. package/dist/config/schema.js +524 -0
  14. package/dist/config/schema.js.map +1 -0
  15. package/dist/config/shell-policy.d.ts +331 -0
  16. package/dist/config/shell-policy.js +238 -0
  17. package/dist/config/shell-policy.js.map +1 -0
  18. package/dist/config/types.d.ts +596 -0
  19. package/dist/config/types.js +13 -0
  20. package/dist/config/types.js.map +1 -0
  21. package/dist/config.d.ts +18 -647
  22. package/dist/config.js +15 -516
  23. package/dist/config.js.map +1 -1
  24. package/dist/constants.d.ts +42 -0
  25. package/dist/constants.js +42 -0
  26. package/dist/constants.js.map +1 -1
  27. package/dist/core/GthAbstractAgent.d.ts +85 -2
  28. package/dist/core/GthAbstractAgent.js +398 -28
  29. package/dist/core/GthAbstractAgent.js.map +1 -1
  30. package/dist/core/GthAgentRunner.d.ts +158 -1
  31. package/dist/core/GthAgentRunner.js +367 -4
  32. package/dist/core/GthAgentRunner.js.map +1 -1
  33. package/dist/core/GthLangChainAgent.js +193 -16
  34. package/dist/core/GthLangChainAgent.js.map +1 -1
  35. package/dist/core/debugCapture.d.ts +59 -0
  36. package/dist/core/debugCapture.js +101 -0
  37. package/dist/core/debugCapture.js.map +1 -0
  38. package/dist/core/gthLeanAgentFactory.d.ts +9 -0
  39. package/dist/core/gthLeanAgentFactory.js +10 -0
  40. package/dist/core/gthLeanAgentFactory.js.map +1 -0
  41. package/dist/core/plainToolIndication.d.ts +15 -0
  42. package/dist/core/plainToolIndication.js +148 -0
  43. package/dist/core/plainToolIndication.js.map +1 -0
  44. package/dist/core/runStats.d.ts +41 -0
  45. package/dist/core/runStats.js +73 -0
  46. package/dist/core/runStats.js.map +1 -0
  47. package/dist/core/shell/ShellCommandFailedError.d.ts +54 -0
  48. package/dist/core/shell/ShellCommandFailedError.js +68 -0
  49. package/dist/core/shell/ShellCommandFailedError.js.map +1 -0
  50. package/dist/core/shell/allowlist.d.ts +75 -0
  51. package/dist/core/shell/allowlist.js +187 -0
  52. package/dist/core/shell/allowlist.js.map +1 -0
  53. package/dist/core/shell/arity.d.ts +75 -0
  54. package/dist/core/shell/arity.js +313 -0
  55. package/dist/core/shell/arity.js.map +1 -0
  56. package/dist/core/shell/judge.d.ts +161 -0
  57. package/dist/core/shell/judge.js +261 -0
  58. package/dist/core/shell/judge.js.map +1 -0
  59. package/dist/core/shell/normalize.d.ts +27 -0
  60. package/dist/core/shell/normalize.js +53 -0
  61. package/dist/core/shell/normalize.js.map +1 -0
  62. package/dist/core/toolDisplay.d.ts +101 -0
  63. package/dist/core/toolDisplay.js +374 -0
  64. package/dist/core/toolDisplay.js.map +1 -0
  65. package/dist/core/toolOutputChannel.d.ts +68 -0
  66. package/dist/core/toolOutputChannel.js +112 -0
  67. package/dist/core/toolOutputChannel.js.map +1 -0
  68. package/dist/core/types.d.ts +173 -0
  69. package/dist/core/types.js.map +1 -1
  70. package/dist/history/historyFormat.d.ts +28 -0
  71. package/dist/history/historyFormat.js +127 -0
  72. package/dist/history/historyFormat.js.map +1 -0
  73. package/dist/history/historyStore.d.ts +198 -0
  74. package/dist/history/historyStore.js +482 -0
  75. package/dist/history/historyStore.js.map +1 -0
  76. package/dist/history/recordSession.d.ts +37 -0
  77. package/dist/history/recordSession.js +56 -0
  78. package/dist/history/recordSession.js.map +1 -0
  79. package/dist/index.d.ts +4 -0
  80. package/dist/index.js +4 -0
  81. package/dist/index.js.map +1 -1
  82. package/dist/providers/anthropic.d.ts +1 -1
  83. package/dist/providers/anthropic.js +5 -10
  84. package/dist/providers/anthropic.js.map +1 -1
  85. package/dist/providers/deepseek.d.ts +1 -1
  86. package/dist/providers/deepseek.js +5 -10
  87. package/dist/providers/deepseek.js.map +1 -1
  88. package/dist/providers/geminiSchemaSanitizer.d.ts +52 -0
  89. package/dist/providers/geminiSchemaSanitizer.js +201 -0
  90. package/dist/providers/geminiSchemaSanitizer.js.map +1 -0
  91. package/dist/providers/google-genai.d.ts +1 -1
  92. package/dist/providers/google-genai.js +9 -11
  93. package/dist/providers/google-genai.js.map +1 -1
  94. package/dist/providers/groq.d.ts +1 -1
  95. package/dist/providers/groq.js +5 -10
  96. package/dist/providers/groq.js.map +1 -1
  97. package/dist/providers/huggingface.d.ts +25 -0
  98. package/dist/providers/huggingface.js +69 -0
  99. package/dist/providers/huggingface.js.map +1 -0
  100. package/dist/providers/modelCatalog.d.ts +109 -0
  101. package/dist/providers/modelCatalog.js +245 -0
  102. package/dist/providers/modelCatalog.js.map +1 -0
  103. package/dist/providers/modelDiscovery.d.ts +111 -3
  104. package/dist/providers/modelDiscovery.js +183 -27
  105. package/dist/providers/modelDiscovery.js.map +1 -1
  106. package/dist/providers/ollama.d.ts +19 -5
  107. package/dist/providers/ollama.js +60 -52
  108. package/dist/providers/ollama.js.map +1 -1
  109. package/dist/providers/openai.d.ts +1 -1
  110. package/dist/providers/openai.js +5 -10
  111. package/dist/providers/openai.js.map +1 -1
  112. package/dist/providers/openrouter.d.ts +1 -1
  113. package/dist/providers/openrouter.js +12 -12
  114. package/dist/providers/openrouter.js.map +1 -1
  115. package/dist/providers/vertexai.d.ts +1 -1
  116. package/dist/providers/vertexai.js +9 -11
  117. package/dist/providers/vertexai.js.map +1 -1
  118. package/dist/providers/xai.d.ts +1 -1
  119. package/dist/providers/xai.js +5 -10
  120. package/dist/providers/xai.js.map +1 -1
  121. package/dist/runtime/askStructured.d.ts +62 -0
  122. package/dist/runtime/askStructured.js +76 -0
  123. package/dist/runtime/askStructured.js.map +1 -0
  124. package/dist/runtime/conversation.d.ts +59 -0
  125. package/dist/runtime/conversation.js +137 -0
  126. package/dist/runtime/conversation.js.map +1 -0
  127. package/dist/runtime/singleShot.d.ts +24 -5
  128. package/dist/runtime/singleShot.js +56 -9
  129. package/dist/runtime/singleShot.js.map +1 -1
  130. package/dist/utils/aiignoreUtils.js.map +1 -1
  131. package/dist/utils/binaryOutputUtils.js.map +1 -1
  132. package/dist/utils/consoleUtils.d.ts +22 -0
  133. package/dist/utils/consoleUtils.js +45 -0
  134. package/dist/utils/consoleUtils.js.map +1 -1
  135. package/dist/utils/debugDump.d.ts +57 -0
  136. package/dist/utils/debugDump.js +236 -0
  137. package/dist/utils/debugDump.js.map +1 -0
  138. package/dist/utils/debugUtils.d.ts +13 -4
  139. package/dist/utils/debugUtils.js +36 -13
  140. package/dist/utils/debugUtils.js.map +1 -1
  141. package/dist/utils/fileUtils.d.ts +24 -2
  142. package/dist/utils/fileUtils.js +54 -12
  143. package/dist/utils/fileUtils.js.map +1 -1
  144. package/dist/utils/llmUtils.js.map +1 -1
  145. package/dist/utils/redactSecrets.d.ts +63 -0
  146. package/dist/utils/redactSecrets.js +238 -0
  147. package/dist/utils/redactSecrets.js.map +1 -0
  148. package/dist/utils/systemPromptNotes.d.ts +181 -0
  149. package/dist/utils/systemPromptNotes.js +298 -0
  150. package/dist/utils/systemPromptNotes.js.map +1 -0
  151. package/dist/utils/systemUtils.d.ts +32 -1
  152. package/dist/utils/systemUtils.js +50 -3
  153. package/dist/utils/systemUtils.js.map +1 -1
  154. package/dist/utils/toolMatching.d.ts +30 -0
  155. package/dist/utils/toolMatching.js +44 -0
  156. package/dist/utils/toolMatching.js.map +1 -0
  157. package/package.json +17 -8
  158. package/schema/gsloth-config.schema.json +2111 -0
@@ -0,0 +1,596 @@
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 { BuiltInToolsSetting } from '#src/config/shell-policy.js';
11
+ /**
12
+ * Shared per-command tooling configuration (the knobs every actionable command carries).
13
+ * Reused across the per-command types in {@link GthConfig.commands} and by
14
+ * {@link PrCommandConfig}. Type-level dedupe only — no runtime/behaviour change.
15
+ *
16
+ * NOTE: `commands.api` intentionally does NOT use this shape (it only has
17
+ * `filesystem`/`builtInTools` plus `port`/`cors`), so it stays bespoke below.
18
+ */
19
+ export interface CommandToolingConfig {
20
+ filesystem?: string[] | 'all' | 'read' | 'none';
21
+ builtInTools?: BuiltInToolsSetting;
22
+ customTools?: CustomToolsConfig | false;
23
+ /** See {@link GthConfig.allowedTools}. */
24
+ allowedTools?: string[];
25
+ binaryFormats?: false | BinaryFormatConfig[];
26
+ }
27
+ /**
28
+ * This is a processed Gaunt Sloth config ready to be passed down into components.
29
+ *
30
+ * Default values can be found in {@link DEFAULT_CONFIG}
31
+ */
32
+ export interface GthConfig {
33
+ llm: BaseChatModel;
34
+ /**
35
+ * Selects the agent backend.
36
+ * - `lean` (default when omitted): the plain LangChain agent ({@link GthLangChainAgent}). It is
37
+ * given gsloth's full toolset (filesystem + hardened dev/shell + the `gth_checklist` planning
38
+ * tool), with no deepagents machinery (no `/large_tool_results` offload). This is the
39
+ * recommended backend and the default for the CLI (code/chat), single-shot (ask/exec), and
40
+ * the AG-UI/api server.
41
+ * - `deep` (**experimental**, opt-in): the deepagents runtime (subagents, `write_todos`,
42
+ * summarization, tool-result offload). Selecting it emits a warning. It can exhibit
43
+ * path-divergence and sporadic failures and carries extra internal workarounds; prefer `lean`.
44
+ *
45
+ * Honored everywhere; the ACP server is still structurally deep-only and always runs deep.
46
+ */
47
+ agent?: {
48
+ backend?: 'deep' | 'lean';
49
+ };
50
+ /**
51
+ * GS2-7 (B20) — local, opt-in session history store. DEFAULT OFF (absent = disabled): a default
52
+ * run persists nothing and behaves exactly as before. When `enabled`, each run is recorded to a
53
+ * local SQLite DB (`~/.gsloth/history.db` by default, overridable via `dbPath`) for
54
+ * `gth history search` / `gth insights`. Local only — no telemetry leaves the machine.
55
+ */
56
+ history?: {
57
+ enabled?: boolean;
58
+ dbPath?: string;
59
+ };
60
+ /**
61
+ * GS2-7 (B21) — opt-in file-backed memory (MEMORY.md / USER.md). DEFAULT OFF. Forward-compat
62
+ * toggle only; the feature is a deferred follow-up.
63
+ */
64
+ memory?: {
65
+ enabled?: boolean;
66
+ };
67
+ /**
68
+ * Binary format support configuration.
69
+ * Disabled by default unless explicitly configured.
70
+ */
71
+ binaryFormats?: false | BinaryFormatConfig[];
72
+ /**
73
+ * Content source type. Source used to fetch content (usually diff) for `review` or `pr` command.
74
+ *
75
+ * {@link DEFAULT_CONFIG#contentSource}
76
+ */
77
+ contentSource: string;
78
+ /**
79
+ * Requirement source type. Source used to fetch requirements for `review` or `pr` command.
80
+ */
81
+ requirementSource: string;
82
+ /**
83
+ * Path to project-specific guidelines.
84
+ * The default is `.gsloth.guidelines.md`; this config may be used to point Gaunt Sloth to a different file,
85
+ * for example, to AGENTS.md
86
+ */
87
+ projectGuidelines: string;
88
+ /**
89
+ * Separate identity profile.
90
+ * May include separate identity, guidelines and command protocol,
91
+ * making gsloth behave as an agent different from default profile behaviour.
92
+ * for example, `devops` profile to detect changes such as properties and environment variables.
93
+ * Custom config can still win over this one.
94
+ * This setting requires .gsloth/.gsloth-settings directory to exist.
95
+ */
96
+ identityProfile?: string;
97
+ /**
98
+ * Whether to include the current date in the project review instructions or not.
99
+ */
100
+ includeCurrentDateAfterGuidelines: boolean;
101
+ /**
102
+ * Organisation name, locale and timezone.
103
+ * Only used with {@link includeCurrentDateAfterGuidelines}.
104
+ * timeZone and locale should be in format supported by Intl.DateTimeFormat
105
+ */
106
+ organization?: {
107
+ name?: string;
108
+ locale?: string;
109
+ timezone?: string;
110
+ };
111
+ projectReviewInstructions: string;
112
+ /**
113
+ * If true, only use user-provided system prompts. Do not fall back to the
114
+ * bundled `.gsloth.*.md` prompt files shipped with the installation.
115
+ * This applies to all `.gsloth.*.md` files (backstory, system, chat, code, guidelines, review).
116
+ */
117
+ noDefaultPrompts?: boolean;
118
+ filesystem: string[] | 'all' | 'read' | 'none';
119
+ /**
120
+ * Selects and configures the built-in tools the agent loads. Either a `string[]` of tool names
121
+ * (each enabled) or a registry keyed by tool name whose values enable (`true`), force-disable
122
+ * (`false`), or configure ({@link BuiltInToolConfig}) each tool. CFG-18 folded the former
123
+ * per-command `devTools` (the `run_*` commands + `run_shell_command`'s EXT-9/10/12 config) into
124
+ * this single registry: e.g. `{ "run_tests": { "command": "npm test" }, "run_shell_command": {
125
+ * "timeout": 300000 } }`. Settable at the root or per command (`commands.<command>.builtInTools`);
126
+ * a per-command value replaces the top-level one.
127
+ */
128
+ builtInTools?: BuiltInToolsSetting;
129
+ tools?: StructuredToolInterface[] | BaseToolkit[] | ServerTool[];
130
+ /**
131
+ * Restrict the agent to this allow-list of tool names, applied after every tool source
132
+ * (filesystem, built-in, custom, MCP, A2A, and `tools`) is resolved. This is the only knob
133
+ * that can gate MCP and A2A tools, which have no per-source override of their own.
134
+ *
135
+ * - omitted/undefined: no filtering, all resolved tools remain available.
136
+ * - non-empty array: keep only tools whose name is in the list.
137
+ * - empty array `[]`: disable every tool. MCP servers are not even contacted (no OAuth),
138
+ * which is useful for agents that only need to reason over the prompt (e.g. the review
139
+ * agent).
140
+ *
141
+ * Can be overridden per command via `commands.<command>.allowedTools`.
142
+ */
143
+ allowedTools?: string[];
144
+ /**
145
+ * Middleware configuration for LangChain v1.
146
+ * Middleware provides hooks to intercept and control agent execution at critical points.
147
+ *
148
+ * Middleware can be:
149
+ * - Predefined middleware (string or config object) - works in both JSON and JS configs
150
+ * - Custom middleware objects - only available in JS configs
151
+ *
152
+ * Example (JSON config):
153
+ * ```json
154
+ * {
155
+ * "middleware": [
156
+ * "summarization",
157
+ * { "name": "anthropic-prompt-caching", "ttl": "5m" }
158
+ * ]
159
+ * }
160
+ * ```
161
+ *
162
+ * Example (JS config):
163
+ * ```js
164
+ * {
165
+ * middleware: [
166
+ * "summarization",
167
+ * { beforeModel: (state) => { /* custom logic *\/ return state; } }
168
+ * ]
169
+ * }
170
+ * ```
171
+ *
172
+ * Available predefined middleware:
173
+ * - `anthropic-prompt-caching`: Reduces API costs by caching prompts (Anthropic only)
174
+ * - `summarization`: Condenses conversation history when approaching token limits
175
+ */
176
+ middleware?: unknown[];
177
+ /**
178
+ * Stream output. Some models do not support streaming. Set value to `false` for them.
179
+ *
180
+ * {@link DEFAULT_CONFIG#streamOutput}
181
+ */
182
+ streamOutput: boolean;
183
+ /**
184
+ * Should the output be written to md file.
185
+ * (e.g. gth_2025-07-26_22-59-06_REVIEW.md).
186
+ * Defaults to `false` (no file is written); set to `true` for the standard
187
+ * `gth_<timestamp>_<COMMAND>.md` name.
188
+ * Can be set to false with `-wn` or `-w0`
189
+ * Can be set to a specific filename or path by passing a string:
190
+ * - Bare filenames (e.g. `"review.md"`) are placed in `.gsloth/` when it exists, otherwise project root
191
+ * - Paths with separators (e.g. `"./review.md"` or `"reviews/last.md"`) are always relative to project root
192
+ * Please note the string does not accept absolute path, but allows to exit project with `..` if necessary.
193
+ */
194
+ writeOutputToFile: boolean | string;
195
+ /**
196
+ * Whether binary model outputs should be written to files instead of printed inline.
197
+ * When enabled, supported binary content blocks are materialized as `gth_*.<ext>` files.
198
+ */
199
+ writeBinaryOutputsToFile: boolean;
200
+ /**
201
+ * Use colour in output
202
+ */
203
+ useColour: boolean;
204
+ /**
205
+ * Stream session log instead of writing it when inference streaming is complete.
206
+ * (only works when {@link streamOutput} is true)
207
+ */
208
+ streamSessionInferenceLog: boolean;
209
+ /**
210
+ * Allow inference to be interrupted with esc. Only has an effect in TTY mode.
211
+ */
212
+ canInterruptInferenceWithEsc: boolean;
213
+ /**
214
+ * Log messages and events to gaunt-sloth.log,
215
+ * use llm.verbose or `gth --verbose` as more intrusive option, setting verbose to LangChain / LangGraph
216
+ */
217
+ debugLog?: boolean;
218
+ /**
219
+ * LangGraph recursion limit for an agent run — the maximum number of
220
+ * super-steps (model ↔ tool round-trips) before the graph throws. Defaults to
221
+ * 1000, which suits long coding chains; embodied / tight-loop consumers can
222
+ * lower it so a stuck run fails fast and visibly instead of grinding.
223
+ */
224
+ recursionLimit?: number;
225
+ /**
226
+ * Console logging level. Only messages at or above this level will be displayed.
227
+ * Valid values: 'debug', 'info', 'display', 'success', 'warning', 'error', 'stream'
228
+ * Default: 'info' (not debug)
229
+ */
230
+ consoleLevel?: StatusLevel;
231
+ customTools?: CustomToolsConfig;
232
+ requirementSourceConfig?: Record<string, unknown>;
233
+ contentSourceConfig?: Record<string, unknown>;
234
+ /**
235
+ * MCP (Model Context Protocol) server connections.
236
+ * Allows connecting to external MCP servers including those requiring OAuth.
237
+ * @see {@link https://modelcontextprotocol.io/}
238
+ */
239
+ mcpServers?: Record<string, unknown>;
240
+ /**
241
+ * TLS trust for outbound HTTPS. Primarily so an `http`-transport MCP server behind a
242
+ * private/corporate CA can be reached without prepending `NODE_EXTRA_CA_CERTS` on every
243
+ * invocation. The mechanism is a process-global undici dispatcher, so it applies to ALL
244
+ * outbound `fetch` this process makes (LLM provider calls included), not only MCP.
245
+ */
246
+ tls?: {
247
+ /**
248
+ * Extra CA certificate file(s) to trust IN ADDITION to Node's built-in roots. Paths resolve
249
+ * relative to the project dir (or `~`/absolute). Additive — never removes a default root.
250
+ */
251
+ extraCaCerts?: string[];
252
+ /**
253
+ * DANGER — `false` disables TLS certificate verification for ALL outbound HTTPS this process
254
+ * makes, not just MCP. Escape hatch only; a loud security warning is emitted every session.
255
+ */
256
+ rejectUnauthorized?: boolean;
257
+ };
258
+ /**
259
+ * A2A (Agent-to-Agent) protocol agents configuration.
260
+ * Enables delegation of tasks to external AI agents.
261
+ * Each agent becomes available as a tool named `a2a_agent_<agentId>`.
262
+ * @experimental This feature is experimental and may change.
263
+ * @see {@link https://a2a-protocol.org/}
264
+ */
265
+ a2aAgents?: Record<string, unknown>;
266
+ builtInToolsConfig?: BuiltInToolsConfig;
267
+ aiignore?: {
268
+ enabled?: boolean;
269
+ patterns?: string[];
270
+ };
271
+ commands?: {
272
+ pr?: PrCommandConfig;
273
+ review?: CommandToolingConfig & {
274
+ contentSource?: string;
275
+ requirementSource?: string;
276
+ rating?: RatingConfig;
277
+ };
278
+ ask?: CommandToolingConfig;
279
+ chat?: CommandToolingConfig;
280
+ /**
281
+ * `gth code` — interactive coding session. Carries the do-the-job tool/filesystem knobs; the
282
+ * dev/shell tools (CFG-18) are configured via {@link CommandToolingConfig.builtInTools}.
283
+ */
284
+ code?: CommandToolingConfig;
285
+ /**
286
+ * `gth exec` — prompt-as-script runtime. Like `code`, an exec run may need to actually
287
+ * do the job (read/write files, run commands), so it carries the same tool/filesystem knobs.
288
+ */
289
+ exec?: CommandToolingConfig;
290
+ api?: {
291
+ filesystem?: string[] | 'all' | 'read' | 'none';
292
+ builtInTools?: BuiltInToolsSetting;
293
+ port?: number;
294
+ cors?: {
295
+ allowOrigin?: string;
296
+ allowMethods?: string;
297
+ allowHeaders?: string;
298
+ };
299
+ };
300
+ };
301
+ /**
302
+ * GS2-35 — identity for the `Co-Authored-By` trailer of agent-authored git commits. Gaunt Sloth
303
+ * has no dedicated commit tool (it commits via `run_shell_command`), so this identity is injected
304
+ * into the code-mode system prompt, which instructs the agent to co-author commits as this account
305
+ * and NEVER as the underlying model. Optional and defaulted: when unset (or a field is unset) the
306
+ * agent co-authors as {@link DEFAULT_COMMIT_CO_AUTHOR_NAME} `<`{@link DEFAULT_COMMIT_CO_AUTHOR_EMAIL}`>`.
307
+ */
308
+ commit?: {
309
+ coAuthor?: {
310
+ name?: string;
311
+ email?: string;
312
+ };
313
+ };
314
+ modelDisplayName?: string;
315
+ /**
316
+ * GS2-53 — the configured provider `type` string (`openrouter`/`deepseek`/`xai`/`anthropic`/…),
317
+ * stashed by the loader from the raw `llm.type` before the built `BaseChatModel` replaces the raw
318
+ * spec. INTERNAL (loader-set, never user-supplied), so it is deliberately absent from the config
319
+ * schema. {@link import('#src/utils/systemPromptNotes.js').resolveModelIdentity} PREFERS this over
320
+ * the live model's `_llmType()` for the injected identity, because OpenAI-compatible shims
321
+ * (openrouter/deepseek/xai all extend `ChatOpenAI`) report `_llmType() === 'openai'` and would
322
+ * otherwise mislabel the provider half. Absent for module configs (which hand us an already-built
323
+ * LLM with no raw `type`), where resolution falls back to the guarded `_llmType()`.
324
+ */
325
+ modelProviderType?: string;
326
+ /**
327
+ * GS2-34 — inject the resolved active `provider:model` identity into the assembled system prompt
328
+ * so the agent knows which model is serving it (to answer "what model are you?" and reason about
329
+ * its own capabilities/limits). Default ON (omitted = inject). Opt out with
330
+ * `injectModelContext: false` to keep reproducible / model-agnostic runs (e.g. review) blind to
331
+ * the identity — when off, the assembled prompt is exactly as it is without this feature. Applies
332
+ * in ALL modes (unlike the code-mode-only cwd/os-shell/commit notes). Defaulted at the read site
333
+ * (not in {@link DEFAULT_CONFIG}) to avoid churning the effective-config snapshot.
334
+ */
335
+ injectModelContext?: boolean;
336
+ /**
337
+ * GS2-47 — controls the shared secret-redaction pass applied to `/debug-dump` archives. Default
338
+ * ON (omitted = redact): secret-named env-var values, inline config secrets, provider-key/auth
339
+ * patterns and sensitive config fields are masked before any artifact hits disk. Set
340
+ * `debugDump.redact: false` (or run `/debug-dump --unsafe-no-redact`) to write a RAW archive, which
341
+ * the command flags with a loud "may contain secrets" warning. Defaulted at the read site (not in
342
+ * {@link DEFAULT_CONFIG}) to avoid churning the effective-config snapshot.
343
+ */
344
+ debugDump?: {
345
+ redact?: boolean;
346
+ };
347
+ /**
348
+ * Transient (runtime-only) extra filesystem roots the agent is allowed to read/write for
349
+ * THIS run, in addition to the cwd sandbox. Populated by `gth exec --allow-dir <path>`
350
+ * (repeatable); never persisted to a config file. When set, the deep agent's
351
+ * {@link FilesystemBackend} drops `virtualMode` (so absolute paths and `..` resolve on the
352
+ * real filesystem) and access is constrained to cwd + these dirs via permission allow-rules.
353
+ * Removing the cwd-only sandbox is a guardrail removal, so callers announce it loudly.
354
+ */
355
+ allowDirs?: string[];
356
+ /**
357
+ * Transient (runtime-only) flag set by `gth ask --write`: opt `ask` into the same
358
+ * "do-the-job" filesystem + dev tools that `exec`/`code` get, so a question can act
359
+ * (read/write files, run commands) rather than only chat. Never persisted to a config file.
360
+ */
361
+ askWriteMode?: boolean;
362
+ /**
363
+ * GS2-63 — output surface controls.
364
+ *
365
+ * `output.header` DEFAULTS ON (omitted = show). Set `false` to suppress the technical run-header
366
+ * preamble — the Workdir/Model/Tools/Middleware status block, the `Press Escape or Q to interrupt`
367
+ * hint, and their surrounding blank lines — in NON-TUI text modes (`--no-tui`, `ask`, `exec`,
368
+ * `eval`, `pr`, `review`, piped/CI), so captured stdout and log diffs stay clean. The interactive
369
+ * TUI ignores the setting and always shows the header. Only the preamble is suppressed — never
370
+ * model/tool output, errors, or config-validation warnings, and never the live `Thinking…`
371
+ * indicator. Defaulted at the read site (`!== false`), not in {@link DEFAULT_CONFIG}, to avoid
372
+ * churning the effective-config snapshot.
373
+ */
374
+ output?: {
375
+ header?: boolean;
376
+ };
377
+ /**
378
+ * BATCH-19 — custom `gth eval` reporters, keyed by the NAME they are selected under
379
+ * (`gth eval … --reporter <name>`). Each value is a MODULE PATH, resolved relative to the project
380
+ * dir, whose **default export** is an `EvalReporterFactory` (`() => EvalReporter`). Loaded and
381
+ * registered through the SAME seam the bundled reporters (`text`, `junit`) use, so a config
382
+ * reporter can also override a built-in of the same name (config wins). A missing file, a failed
383
+ * import, or a non-function default export is a hard error (the eval harness exits 2). Trusted:
384
+ * it is the user's own config, which already executes arbitrary JS.
385
+ */
386
+ reporters?: Record<string, string>;
387
+ }
388
+ /**
389
+ * `gth pr` command configuration.
390
+ *
391
+ * Declared as a named interface (rather than inline in {@link GthConfig}) so that downstream
392
+ * packages can extend it with their own command features via TypeScript module augmentation
393
+ * (`declare module '@gaunt-sloth/core/config.js'`), keeping those features' types out of core.
394
+ * For example, the assistant package merges its PR discovery config (`discovery`) into this
395
+ * interface.
396
+ */
397
+ export interface PrCommandConfig extends CommandToolingConfig {
398
+ contentSource?: string;
399
+ requirementSource?: string;
400
+ logWorkForReviewInSeconds?: number;
401
+ rating?: RatingConfig;
402
+ }
403
+ /**
404
+ * Server tools such as Anthropic Web Search.
405
+ * These tools are meant to be magic objects like
406
+ * `{"type": "web_search_20250305", "name": "web_search", "max_uses": 10}`,
407
+ * AI Provider does the rest of the magic on their side.
408
+ */
409
+ export interface ServerTool extends Record<string, unknown> {
410
+ type: string;
411
+ name?: string;
412
+ }
413
+ /**
414
+ * Raw, unprocessed Gaunt Sloth config.
415
+ */
416
+ export type ConsoleLevelInput = StatusLevel | keyof typeof StatusLevel | Lowercase<keyof typeof StatusLevel>;
417
+ export interface RawGthConfig extends Omit<GthConfig, 'llm' | 'consoleLevel'> {
418
+ llm: LLMConfig;
419
+ consoleLevel?: ConsoleLevelInput;
420
+ }
421
+ export type BinaryFormatType = 'image' | 'file' | 'audio' | 'video' | 'binary';
422
+ export interface BinaryFormatConfig {
423
+ /**
424
+ * The type/category of binary format.
425
+ */
426
+ type: BinaryFormatType;
427
+ /**
428
+ * List of allowed extensions for this type (without leading dot).
429
+ */
430
+ extensions: string[];
431
+ /**
432
+ * Maximum file size in bytes. Defaults to 10MB when omitted.
433
+ */
434
+ maxSize?: number;
435
+ /**
436
+ * Optional MIME type overrides for extensions not in the default mapping.
437
+ */
438
+ mimeTypes?: Record<string, string>;
439
+ }
440
+ export type CustomToolsConfig = Record<string, CustomCommandConfig>;
441
+ export type BuiltInToolsConfig = Record<string, unknown>;
442
+ /**
443
+ * Configuration for review rating feature.
444
+ * Allows configuring automated review scoring with pass/fail thresholds.
445
+ */
446
+ export interface RatingConfig {
447
+ /**
448
+ * Enable or disable review rating.
449
+ * @default true
450
+ */
451
+ enabled?: boolean;
452
+ /**
453
+ * Minimum score (0-10) required to pass the review.
454
+ * @default 6
455
+ */
456
+ passThreshold?: number;
457
+ /**
458
+ * Highest allowed value on the rating scale.
459
+ * @default 10
460
+ */
461
+ maxRating?: number;
462
+ /**
463
+ * Lowest allowed value on the rating scale.
464
+ * @default 0
465
+ */
466
+ minRating?: number;
467
+ /**
468
+ * Exit with error code 1 when review fails (below threshold).
469
+ * When false, exits normally (code 0) regardless of rating.
470
+ * @default true
471
+ */
472
+ errorOnReviewFail?: boolean;
473
+ }
474
+ /**
475
+ * Validation checks that can be skipped for custom command parameters.
476
+ * Use with the `allow` property to bypass specific security checks.
477
+ *
478
+ * - `absolute-paths`: Allow absolute paths (e.g. `/dev/ttyUSB0`)
479
+ * - `directory-traversal`: Allow `..` in paths
480
+ * - `shell-injection`: Allow shell metacharacters (`|`, `&`, `;`, etc.)
481
+ * - `null-bytes`: Allow null bytes in values
482
+ */
483
+ export type ValidationCheck = 'absolute-paths' | 'directory-traversal' | 'shell-injection' | 'null-bytes';
484
+ /**
485
+ * Configuration for a custom command parameter.
486
+ * Parameters allow the model to provide dynamic values to commands.
487
+ */
488
+ export interface CustomCommandParameter {
489
+ /**
490
+ * Description of the parameter shown to the model.
491
+ */
492
+ description: string;
493
+ /**
494
+ * Optional list of validation checks to skip for this parameter's value.
495
+ * Use when this parameter legitimately requires values that would normally be blocked.
496
+ * For example, `["absolute-paths"]` allows values like `/dev/ttyUSB0` for this parameter.
497
+ *
498
+ * Available checks: `absolute-paths`, `directory-traversal`, `shell-injection`, `null-bytes`
499
+ */
500
+ allow?: ValidationCheck[];
501
+ }
502
+ /**
503
+ * Configuration for a custom command.
504
+ * Custom commands can be executed with or without parameters.
505
+ */
506
+ export interface CustomCommandConfig {
507
+ /**
508
+ * The shell command to execute.
509
+ * Can include placeholders like ${paramName} that will be replaced with parameter values.
510
+ * If no placeholder is present and parameters are provided, they are appended to the command.
511
+ */
512
+ command: string;
513
+ /**
514
+ * Description of what this command does, shown to the model.
515
+ */
516
+ description: string;
517
+ /**
518
+ * Optional parameters that the model can provide when calling this command.
519
+ * Each parameter has a name (the key) and a description.
520
+ * Parameters are validated for security (no shell injection, directory traversal, etc.).
521
+ */
522
+ parameters?: Record<string, CustomCommandParameter>;
523
+ /**
524
+ * Optional timeout in seconds.
525
+ * When set, the command will be killed if it exceeds this duration.
526
+ * When omitted, no timeout is applied.
527
+ */
528
+ timeout?: number;
529
+ }
530
+ export interface LLMConfig extends Record<string, unknown> {
531
+ type: string;
532
+ model: string;
533
+ configuration: Record<string, unknown>;
534
+ apiKeyEnvironmentVariable?: string;
535
+ }
536
+ export declare const availableDefaultConfigs: readonly ['vertexai', 'anthropic', 'groq', 'deepseek', 'openai', 'google-genai', 'xai', 'openrouter', 'huggingface', 'ollama'];
537
+ export type ConfigType = (typeof availableDefaultConfigs)[number];
538
+ export interface CommandLineConfigOverrides {
539
+ /**
540
+ * Custom config path
541
+ */
542
+ customConfigPath?: string;
543
+ /**
544
+ * Set LangChain/LangGraph to verbose mode,
545
+ * causing LangChain/LangGraph to log many details to the console.
546
+ * debugLog from config.ts may be a less intrusive option.
547
+ */
548
+ verbose?: boolean;
549
+ /**
550
+ * Should the output be written to md file.
551
+ * (e.g. gth_2025-07-26_22-59-06_REVIEW.md).
552
+ * Defaults to `false` (no file is written); set to `true` for the standard
553
+ * `gth_<timestamp>_<COMMAND>.md` name.
554
+ * Can be set to false with `-wn` or `-w0`
555
+ * Can be set to a specific filename or path by passing a string:
556
+ * - Bare filenames (e.g. `"review.md"`) are placed in `.gsloth/` when it exists, otherwise project root
557
+ * - Paths with separators (e.g. `"./review.md"` or `"reviews/last.md"`) are always relative to project root
558
+ * Please note the string does not accept absolute path, but allows to exit project with `..` if necessary.
559
+ */
560
+ writeOutputToFile?: boolean | string;
561
+ /**
562
+ * Separate identity profile.
563
+ * May include separate identity, guidelines and command protocol,
564
+ * making gsloth behave as an agent different from default profile behaviour.
565
+ * for example, `devops` profile to detect changes such as properties and environment variables.
566
+ * Custom config can still win over this one.
567
+ * This setting requires .gsloth/.gsloth-settings directory to exist.
568
+ * Important to note that the profile directory substitutes the entire config directory,
569
+ * in the case if some prompt files are missing - a file from the installation directory will be used.
570
+ */
571
+ identityProfile?: string;
572
+ /**
573
+ * Interactive TUI activation override for chat/code sessions.
574
+ * - `true` (`--tui`): force the Ink TUI on where the terminal supports it (also overrides
575
+ * the CI auto-off heuristic).
576
+ * - `false` (`--no-tui`): force the plain readline session.
577
+ * - `undefined` (default): auto-detect from the terminal.
578
+ * The decision itself lives in `gaunt-sloth`'s `shouldUseTui`; this only carries the flag.
579
+ */
580
+ tui?: boolean;
581
+ /**
582
+ * BATCH-1 fix — run with a different model than the configured `llm.model`, just for this
583
+ * `initConfig()` call. Used by `gth batch --models a,b,c` to build one genuinely fresh
584
+ * `GthConfig` (with its own freshly-constructed `.llm`) per distinct model in the matrix,
585
+ * instead of structurally cloning an already-instantiated LangChain model object (unsafe for
586
+ * any provider class that keeps state behind private `#fields`). Applied in
587
+ * {@link tryJsonConfig} by overriding `llmConfig.model` before the provider's
588
+ * `processJsonConfig()` builds the instance, so it flows through the same supported
589
+ * construction path every other model comes from.
590
+ *
591
+ * Only takes effect for JSON (`.gsloth.config.json`) configs — a `configure()`-style JS/MJS/TS
592
+ * module config already returns a fully-built `GthConfig` (LLM included) with no generic seam
593
+ * to re-target its model.
594
+ */
595
+ model?: string;
596
+ }
@@ -0,0 +1,13 @@
1
+ export const availableDefaultConfigs = [
2
+ 'vertexai',
3
+ 'anthropic',
4
+ 'groq',
5
+ 'deepseek',
6
+ 'openai',
7
+ 'google-genai',
8
+ 'xai',
9
+ 'openrouter',
10
+ 'huggingface',
11
+ 'ollama',
12
+ ];
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAiiBA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,UAAU;IACV,WAAW;IACX,MAAM;IACN,UAAU;IACV,QAAQ;IACR,cAAc;IACd,KAAK;IACL,YAAY;IACZ,aAAa;IACb,QAAQ;CACA,CAAC"}