@gaunt-sloth/core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gsloth.backstory.md +17 -0
- package/.gsloth.chat.md +11 -0
- package/.gsloth.code.md +27 -0
- package/.gsloth.guidelines.md +1 -0
- package/.gsloth.review.md +15 -0
- package/.gsloth.system.md +10 -0
- package/README.md +27 -0
- package/dist/config.d.ts +533 -0
- package/dist/config.js +412 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/GthAgentRunner.d.ts +27 -0
- package/dist/core/GthAgentRunner.js +109 -0
- package/dist/core/GthAgentRunner.js.map +1 -0
- package/dist/core/GthLangChainAgent.d.ts +56 -0
- package/dist/core/GthLangChainAgent.js +355 -0
- package/dist/core/GthLangChainAgent.js.map +1 -0
- package/dist/core/types.d.ts +39 -0
- package/dist/core/types.js +16 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/anthropic.d.ts +7 -0
- package/dist/providers/anthropic.js +34 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/deepseek.d.ts +4 -0
- package/dist/providers/deepseek.js +30 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/fake.d.ts +3 -0
- package/dist/providers/fake.js +12 -0
- package/dist/providers/fake.js.map +1 -0
- package/dist/providers/google-genai.d.ts +7 -0
- package/dist/providers/google-genai.js +34 -0
- package/dist/providers/google-genai.js.map +1 -0
- package/dist/providers/groq.d.ts +4 -0
- package/dist/providers/groq.js +30 -0
- package/dist/providers/groq.js.map +1 -0
- package/dist/providers/openai.d.ts +5 -0
- package/dist/providers/openai.js +46 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/openrouter.d.ts +5 -0
- package/dist/providers/openrouter.js +57 -0
- package/dist/providers/openrouter.js.map +1 -0
- package/dist/providers/vertexai.d.ts +7 -0
- package/dist/providers/vertexai.js +41 -0
- package/dist/providers/vertexai.js.map +1 -0
- package/dist/providers/xai.d.ts +4 -0
- package/dist/providers/xai.js +30 -0
- package/dist/providers/xai.js.map +1 -0
- package/dist/state/artifactStore.d.ts +21 -0
- package/dist/state/artifactStore.js +30 -0
- package/dist/state/artifactStore.js.map +1 -0
- package/dist/utils/ProgressIndicator.d.ts +7 -0
- package/dist/utils/ProgressIndicator.js +26 -0
- package/dist/utils/ProgressIndicator.js.map +1 -0
- package/dist/utils/aiignoreUtils.d.ts +29 -0
- package/dist/utils/aiignoreUtils.js +82 -0
- package/dist/utils/aiignoreUtils.js.map +1 -0
- package/dist/utils/binaryOutputUtils.d.ts +13 -0
- package/dist/utils/binaryOutputUtils.js +138 -0
- package/dist/utils/binaryOutputUtils.js.map +1 -0
- package/dist/utils/consoleUtils.d.ts +76 -0
- package/dist/utils/consoleUtils.js +230 -0
- package/dist/utils/consoleUtils.js.map +1 -0
- package/dist/utils/debugUtils.d.ts +20 -0
- package/dist/utils/debugUtils.js +89 -0
- package/dist/utils/debugUtils.js.map +1 -0
- package/dist/utils/fileUtils.d.ts +68 -0
- package/dist/utils/fileUtils.js +216 -0
- package/dist/utils/fileUtils.js.map +1 -0
- package/dist/utils/globalConfigUtils.d.ts +28 -0
- package/dist/utils/globalConfigUtils.js +61 -0
- package/dist/utils/globalConfigUtils.js.map +1 -0
- package/dist/utils/llmUtils.d.ts +39 -0
- package/dist/utils/llmUtils.js +153 -0
- package/dist/utils/llmUtils.js.map +1 -0
- package/dist/utils/stringUtils.d.ts +4 -0
- package/dist/utils/stringUtils.js +10 -0
- package/dist/utils/stringUtils.js.map +1 -0
- package/dist/utils/systemUtils.d.ts +70 -0
- package/dist/utils/systemUtils.js +207 -0
- package/dist/utils/systemUtils.js.map +1 -0
- package/dist/utils/vertexaiUtils.d.ts +2 -0
- package/dist/utils/vertexaiUtils.js +18 -0
- package/dist/utils/vertexaiUtils.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Your name is Gaunt Sloth, a programmer with comprehensive expertise across programming languages. Maintain a
|
|
2
|
+
professional, direct communication style. Begin responses with substance, not pleasantries or self-promotion.
|
|
3
|
+
|
|
4
|
+
Your priority is code correctness and bug prevention over social niceties, though you remain courteous in all
|
|
5
|
+
interactions. Focus on technical accuracy and practical solutions.
|
|
6
|
+
|
|
7
|
+
Use visual indicators when providing feedback:
|
|
8
|
+
|
|
9
|
+
- ✅ for correct implementations (and approvals)
|
|
10
|
+
- ⚠️ for potential issues or areas needing attention
|
|
11
|
+
- ❌ for errors or problematic approaches (and rejections)
|
|
12
|
+
|
|
13
|
+
You may enhance communication with relevant emojis throughout your responses to improve clarity and readability,
|
|
14
|
+
but do not include foolish smiley faces.
|
|
15
|
+
|
|
16
|
+
Never include decorative emojis within code snippets — only use them in code when they're part of the actual
|
|
17
|
+
logic, string literals, or were present in the original code being discussed.
|
package/.gsloth.chat.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Chat Mode Instructions
|
|
2
|
+
|
|
3
|
+
You are a helpful AI assistant engaged in a conversational chat session. Your role is to:
|
|
4
|
+
|
|
5
|
+
- Provide informative, accurate, and helpful responses to user queries
|
|
6
|
+
- Maintain context throughout the conversation
|
|
7
|
+
- Be conversational and friendly while remaining professional
|
|
8
|
+
- Ask clarifying questions when needed to better understand the user's intent
|
|
9
|
+
- Provide examples and explanations when appropriate
|
|
10
|
+
|
|
11
|
+
Remember that this is an interactive chat session, so keep your responses concise and engaging. Focus on being helpful while maintaining a natural conversational flow.
|
package/.gsloth.code.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Code Mode Instructions
|
|
2
|
+
|
|
3
|
+
You are an AI coding assistant with full file system access within the user's project. Your role is to:
|
|
4
|
+
|
|
5
|
+
- Help write, modify, and debug code
|
|
6
|
+
- Understand and work with the existing codebase
|
|
7
|
+
- Follow project conventions and best practices
|
|
8
|
+
- Create, read, update, and delete files as needed to complete coding tasks
|
|
9
|
+
- Run commands and scripts to test and validate changes
|
|
10
|
+
- Provide clear explanations of the changes you make
|
|
11
|
+
|
|
12
|
+
You have access to the entire project directory and can:
|
|
13
|
+
- Navigate the file system
|
|
14
|
+
- Read and analyze existing code
|
|
15
|
+
- Make modifications to implement features or fix bugs
|
|
16
|
+
- Create new files and directories as needed
|
|
17
|
+
- Execute commands to run tests, build the project or run static analysis (lint)
|
|
18
|
+
|
|
19
|
+
Focus on writing clean, maintainable code that follows the project's established patterns and conventions. Always test your changes when possible and explain what you're doing and why.
|
|
20
|
+
|
|
21
|
+
## Running tests
|
|
22
|
+
|
|
23
|
+
- When working on functionality always prefer running a single test, over the entire suite;
|
|
24
|
+
- Abstain from running tests in circles, run the test once, if it fails — inspect the output carefully and try to fix it;
|
|
25
|
+
- Run full tests suite as a penultimate step, when everything is fixed, but before running the lint;
|
|
26
|
+
- Run lint only as a final step when everything else is fixed;
|
|
27
|
+
- If nothing seems to work, ask for user's assistance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
If requirements were provided, first check that the implemented code implements these requirements.
|
|
2
|
+
Document that you checked the code to implement requirements.
|
|
3
|
+
Reject the change if it appears to implement something else instead of required change.
|
|
4
|
+
|
|
5
|
+
Provide specific feedback on any areas of concern or suggestions for improvement.
|
|
6
|
+
Please categorize your feedback (e.g., "Bug," "Suggestion," "Nitpick").
|
|
7
|
+
|
|
8
|
+
Important! In the end, conclude if you would recommend approving this PR or not.
|
|
9
|
+
Use ✅⚠️❌ symbols to highlight your feedback appropriately.
|
|
10
|
+
|
|
11
|
+
Finish with a short 1-2 sentence summary that captures the overall state of the review.
|
|
12
|
+
|
|
13
|
+
Thank you for your thorough review!
|
|
14
|
+
|
|
15
|
+
Important! You are likely to be dealing with git diff below, please don't confuse removed and added lines.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Filesystem Context
|
|
2
|
+
|
|
3
|
+
When the user mentions directories and files without specifying an exact location, this is likely referring to files in the current working directory (`.`).
|
|
4
|
+
|
|
5
|
+
For example:
|
|
6
|
+
- "Read the config file" likely means a configuration file in the current directory
|
|
7
|
+
- "Check the tests" likely refers to test files in the current project
|
|
8
|
+
- "Look at the source code" typically means source files in the current directory structure
|
|
9
|
+
|
|
10
|
+
Always consider the current working directory as the default context for file operations unless the user specifies an absolute path or different location.
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# @gaunt-sloth/core
|
|
2
|
+
|
|
3
|
+
Core utilities and types for Gaunt Sloth.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- Configuration system (`GthConfig`, `RawGthConfig`, config loading and post-processing)
|
|
8
|
+
- Agent infrastructure: `GthLangChainAgent`, `GthAgentRunner`
|
|
9
|
+
- LLM provider wrappers: anthropic, deepseek, google-genai, groq, openai, openrouter, vertexai, xai, fake
|
|
10
|
+
- Utility modules: `consoleUtils`, `debugUtils`, `fileUtils`, `llmUtils`, `systemUtils`, `stringUtils`, `aiignoreUtils`, `binaryOutputUtils`, `vertexaiUtils`, `globalConfigUtils`, `ProgressIndicator`
|
|
11
|
+
- State and artifact storage: `artifactStore`
|
|
12
|
+
- Shared constants and types
|
|
13
|
+
|
|
14
|
+
AI vendor packages are not direct dependencies. Each vendor package is an optional peer dependency, resolved at runtime by whichever consumer (e.g. `gaunt-sloth-assistant`) pulls them in.
|
|
15
|
+
|
|
16
|
+
## Dependencies
|
|
17
|
+
|
|
18
|
+
No other `@gaunt-sloth/*` packages.
|
|
19
|
+
|
|
20
|
+
## Exports
|
|
21
|
+
|
|
22
|
+
All modules are exported via the `./` export map pattern (`./*.js`), e.g.:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { GthAgentRunner } from '@gaunt-sloth/core/agentRunner.js';
|
|
26
|
+
import { display } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
27
|
+
```
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
import { StatusLevel } from '#src/core/types.js';
|
|
2
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
3
|
+
import type { BaseToolkit, StructuredToolInterface } from '@langchain/core/tools';
|
|
4
|
+
/**
|
|
5
|
+
* This is a processed Gaunt Sloth config ready to be passed down into components.
|
|
6
|
+
*
|
|
7
|
+
* Default values can be found in {@link DEFAULT_CONFIG}
|
|
8
|
+
*/
|
|
9
|
+
export interface GthConfig {
|
|
10
|
+
llm: BaseChatModel;
|
|
11
|
+
/**
|
|
12
|
+
* Binary format support configuration.
|
|
13
|
+
* Disabled by default unless explicitly configured.
|
|
14
|
+
*/
|
|
15
|
+
binaryFormats?: false | BinaryFormatConfig[];
|
|
16
|
+
/**
|
|
17
|
+
* Content Provider. Provider used to fetch content (usually diff) for `review` or `pr` command.
|
|
18
|
+
*
|
|
19
|
+
* {@link DEFAULT_CONFIG#contentProvider}
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Content source type. Preferred name for contentProvider.
|
|
23
|
+
*/
|
|
24
|
+
contentSource: string;
|
|
25
|
+
/**
|
|
26
|
+
* Requirement source type. Preferred name for requirementsProvider.
|
|
27
|
+
*/
|
|
28
|
+
requirementSource: string;
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use contentSource instead
|
|
31
|
+
*/
|
|
32
|
+
contentProvider: string;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use requirementSource instead
|
|
35
|
+
*/
|
|
36
|
+
requirementsProvider: string;
|
|
37
|
+
/**
|
|
38
|
+
* Path to project-specific guidelines.
|
|
39
|
+
* The default is `.gsloth.guidelines.md`; this config may be used to point Gaunt Sloth to a different file,
|
|
40
|
+
* for example, to AGENTS.md
|
|
41
|
+
*/
|
|
42
|
+
projectGuidelines: string;
|
|
43
|
+
/**
|
|
44
|
+
* Separate identity profile.
|
|
45
|
+
* May include separate identity, guidelines and command protocol,
|
|
46
|
+
* making gsloth behave as an agent different from default profile behaviour.
|
|
47
|
+
* for example, `devops` profile to detect changes such as properties and environment variables.
|
|
48
|
+
* Custom config can still win over this one.
|
|
49
|
+
* This setting requires .gsloth/.gsloth-settings directory to exist.
|
|
50
|
+
*/
|
|
51
|
+
identityProfile?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to include the current date in the project review instructions or not.
|
|
54
|
+
*/
|
|
55
|
+
includeCurrentDateAfterGuidelines: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Organisation name, locale and timezone.
|
|
58
|
+
* Only used with {@link includeCurrentDateAfterGuidelines}.
|
|
59
|
+
* timeZone and locale should be in format supported by Intl.DateTimeFormat
|
|
60
|
+
*/
|
|
61
|
+
organization?: {
|
|
62
|
+
name?: string;
|
|
63
|
+
locale?: string;
|
|
64
|
+
timezone?: string;
|
|
65
|
+
};
|
|
66
|
+
projectReviewInstructions: string;
|
|
67
|
+
/**
|
|
68
|
+
* If true, only use user-provided system prompts. Do not fall back to the
|
|
69
|
+
* bundled `.gsloth.*.md` prompt files shipped with the installation.
|
|
70
|
+
* This applies to all `.gsloth.*.md` files (backstory, system, chat, code, guidelines, review).
|
|
71
|
+
*/
|
|
72
|
+
noDefaultPrompts?: boolean;
|
|
73
|
+
filesystem: string[] | 'all' | 'read' | 'none';
|
|
74
|
+
builtInTools?: string[];
|
|
75
|
+
tools?: StructuredToolInterface[] | BaseToolkit[] | ServerTool[];
|
|
76
|
+
/**
|
|
77
|
+
* Middleware configuration for LangChain v1.
|
|
78
|
+
* Middleware provides hooks to intercept and control agent execution at critical points.
|
|
79
|
+
*
|
|
80
|
+
* Middleware can be:
|
|
81
|
+
* - Predefined middleware (string or config object) - works in both JSON and JS configs
|
|
82
|
+
* - Custom middleware objects - only available in JS configs
|
|
83
|
+
*
|
|
84
|
+
* Example (JSON config):
|
|
85
|
+
* ```json
|
|
86
|
+
* {
|
|
87
|
+
* "middleware": [
|
|
88
|
+
* "summarization",
|
|
89
|
+
* { "name": "anthropic-prompt-caching", "ttl": "5m" }
|
|
90
|
+
* ]
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* Example (JS config):
|
|
95
|
+
* ```js
|
|
96
|
+
* {
|
|
97
|
+
* middleware: [
|
|
98
|
+
* "summarization",
|
|
99
|
+
* { beforeModel: (state) => { /* custom logic *\/ return state; } }
|
|
100
|
+
* ]
|
|
101
|
+
* }
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* Available predefined middleware:
|
|
105
|
+
* - `anthropic-prompt-caching`: Reduces API costs by caching prompts (Anthropic only)
|
|
106
|
+
* - `summarization`: Condenses conversation history when approaching token limits
|
|
107
|
+
*/
|
|
108
|
+
middleware?: unknown[];
|
|
109
|
+
/**
|
|
110
|
+
* Stream output. Some models do not support streaming. Set value to `false` for them.
|
|
111
|
+
*
|
|
112
|
+
* {@link DEFAULT_CONFIG#streamOutput}
|
|
113
|
+
*/
|
|
114
|
+
streamOutput: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Should the output be written to md file.
|
|
117
|
+
* (e.g. gth_2025-07-26_22-59-06_REVIEW.md).
|
|
118
|
+
* Can be set to false with `-wn` or `-w0`
|
|
119
|
+
* Can be set to a specific filename or path by passing a string:
|
|
120
|
+
* - Bare filenames (e.g. `"review.md"`) are placed in `.gsloth/` when it exists, otherwise project root
|
|
121
|
+
* - Paths with separators (e.g. `"./review.md"` or `"reviews/last.md"`) are always relative to project root
|
|
122
|
+
* Please note the string does not accept absolute path, but allows to exit project with `..` if necessary.
|
|
123
|
+
*/
|
|
124
|
+
writeOutputToFile: boolean | string;
|
|
125
|
+
/**
|
|
126
|
+
* Whether binary model outputs should be written to files instead of printed inline.
|
|
127
|
+
* When enabled, supported binary content blocks are materialized as `gth_*.<ext>` files.
|
|
128
|
+
*/
|
|
129
|
+
writeBinaryOutputsToFile: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Use colour in output
|
|
132
|
+
*/
|
|
133
|
+
useColour: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Stream session log instead of writing it when inference streaming is complete.
|
|
136
|
+
* (only works when {@link streamOutput} is true)
|
|
137
|
+
*/
|
|
138
|
+
streamSessionInferenceLog: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Allow inference to be interrupted with esc. Only has an effect in TTY mode.
|
|
141
|
+
*/
|
|
142
|
+
canInterruptInferenceWithEsc: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Log messages and events to gaunt-sloth.log,
|
|
145
|
+
* use llm.verbose or `gth --verbose` as more intrusive option, setting verbose to LangChain / LangGraph
|
|
146
|
+
*/
|
|
147
|
+
debugLog?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Console logging level. Only messages at or above this level will be displayed.
|
|
150
|
+
* Valid values: 'debug', 'info', 'display', 'success', 'warning', 'error', 'stream'
|
|
151
|
+
* Default: 'info' (not debug)
|
|
152
|
+
*/
|
|
153
|
+
consoleLevel?: StatusLevel;
|
|
154
|
+
customTools?: CustomToolsConfig;
|
|
155
|
+
requirementSourceConfig?: Record<string, unknown>;
|
|
156
|
+
contentSourceConfig?: Record<string, unknown>;
|
|
157
|
+
/** @deprecated Use requirementSourceConfig instead */
|
|
158
|
+
requirementsProviderConfig?: Record<string, unknown>;
|
|
159
|
+
/** @deprecated Use contentSourceConfig instead */
|
|
160
|
+
contentProviderConfig?: Record<string, unknown>;
|
|
161
|
+
/**
|
|
162
|
+
* MCP (Model Context Protocol) server connections.
|
|
163
|
+
* Allows connecting to external MCP servers including those requiring OAuth.
|
|
164
|
+
* @see {@link https://modelcontextprotocol.io/}
|
|
165
|
+
*/
|
|
166
|
+
mcpServers?: Record<string, unknown>;
|
|
167
|
+
/**
|
|
168
|
+
* A2A (Agent-to-Agent) protocol agents configuration.
|
|
169
|
+
* Enables delegation of tasks to external AI agents.
|
|
170
|
+
* Each agent becomes available as a tool named `a2a_agent_<agentId>`.
|
|
171
|
+
* @experimental This feature is experimental and may change.
|
|
172
|
+
* @see {@link https://a2a-protocol.org/}
|
|
173
|
+
*/
|
|
174
|
+
a2aAgents?: Record<string, unknown>;
|
|
175
|
+
builtInToolsConfig?: BuiltInToolsConfig;
|
|
176
|
+
aiignore?: {
|
|
177
|
+
enabled?: boolean;
|
|
178
|
+
patterns?: string[];
|
|
179
|
+
};
|
|
180
|
+
commands?: {
|
|
181
|
+
pr?: {
|
|
182
|
+
contentSource?: string;
|
|
183
|
+
requirementSource?: string;
|
|
184
|
+
/** @deprecated Use contentSource instead */
|
|
185
|
+
contentProvider?: string;
|
|
186
|
+
/** @deprecated Use requirementSource instead */
|
|
187
|
+
requirementsProvider?: string;
|
|
188
|
+
filesystem?: string[] | 'all' | 'read' | 'none';
|
|
189
|
+
builtInTools?: string[];
|
|
190
|
+
customTools?: CustomToolsConfig | false;
|
|
191
|
+
logWorkForReviewInSeconds?: number;
|
|
192
|
+
rating?: RatingConfig;
|
|
193
|
+
binaryFormats?: false | BinaryFormatConfig[];
|
|
194
|
+
};
|
|
195
|
+
review?: {
|
|
196
|
+
contentSource?: string;
|
|
197
|
+
requirementSource?: string;
|
|
198
|
+
/** @deprecated Use requirementSource instead */
|
|
199
|
+
requirementsProvider?: string;
|
|
200
|
+
/** @deprecated Use contentSource instead */
|
|
201
|
+
contentProvider?: string;
|
|
202
|
+
filesystem?: string[] | 'all' | 'read' | 'none';
|
|
203
|
+
builtInTools?: string[];
|
|
204
|
+
customTools?: CustomToolsConfig | false;
|
|
205
|
+
rating?: RatingConfig;
|
|
206
|
+
binaryFormats?: false | BinaryFormatConfig[];
|
|
207
|
+
};
|
|
208
|
+
ask?: {
|
|
209
|
+
filesystem?: string[] | 'all' | 'read' | 'none';
|
|
210
|
+
builtInTools?: string[];
|
|
211
|
+
customTools?: CustomToolsConfig | false;
|
|
212
|
+
binaryFormats?: false | BinaryFormatConfig[];
|
|
213
|
+
};
|
|
214
|
+
chat?: {
|
|
215
|
+
filesystem?: string[] | 'all' | 'read' | 'none';
|
|
216
|
+
builtInTools?: string[];
|
|
217
|
+
customTools?: CustomToolsConfig | false;
|
|
218
|
+
binaryFormats?: false | BinaryFormatConfig[];
|
|
219
|
+
};
|
|
220
|
+
code?: {
|
|
221
|
+
filesystem?: string[] | 'all' | 'read' | 'none';
|
|
222
|
+
builtInTools?: string[];
|
|
223
|
+
customTools?: CustomToolsConfig | false;
|
|
224
|
+
devTools?: GthDevToolsConfig;
|
|
225
|
+
binaryFormats?: false | BinaryFormatConfig[];
|
|
226
|
+
};
|
|
227
|
+
api?: {
|
|
228
|
+
filesystem?: string[] | 'all' | 'read' | 'none';
|
|
229
|
+
builtInTools?: string[];
|
|
230
|
+
port?: number;
|
|
231
|
+
cors?: {
|
|
232
|
+
allowOrigin?: string;
|
|
233
|
+
allowMethods?: string;
|
|
234
|
+
allowHeaders?: string;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
modelDisplayName?: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Server tools such as Anthropic Web Search.
|
|
242
|
+
* These tools are meant to be magic objects like
|
|
243
|
+
* `{"type": "web_search_20250305", "name": "web_search", "max_uses": 10}`,
|
|
244
|
+
* AI Provider does the rest of the magic on their side.
|
|
245
|
+
*/
|
|
246
|
+
export interface ServerTool extends Record<string, unknown> {
|
|
247
|
+
type: string;
|
|
248
|
+
name?: string;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Raw, unprocessed Gaunt Sloth config.
|
|
252
|
+
*/
|
|
253
|
+
export type ConsoleLevelInput = StatusLevel | keyof typeof StatusLevel | Lowercase<keyof typeof StatusLevel>;
|
|
254
|
+
export interface RawGthConfig extends Omit<GthConfig, 'llm' | 'consoleLevel'> {
|
|
255
|
+
llm: LLMConfig;
|
|
256
|
+
consoleLevel?: ConsoleLevelInput;
|
|
257
|
+
}
|
|
258
|
+
export type BinaryFormatType = 'image' | 'file' | 'audio' | 'video' | 'binary';
|
|
259
|
+
export interface BinaryFormatConfig {
|
|
260
|
+
/**
|
|
261
|
+
* The type/category of binary format.
|
|
262
|
+
*/
|
|
263
|
+
type: BinaryFormatType;
|
|
264
|
+
/**
|
|
265
|
+
* List of allowed extensions for this type (without leading dot).
|
|
266
|
+
*/
|
|
267
|
+
extensions: string[];
|
|
268
|
+
/**
|
|
269
|
+
* Maximum file size in bytes. Defaults to 10MB when omitted.
|
|
270
|
+
*/
|
|
271
|
+
maxSize?: number;
|
|
272
|
+
/**
|
|
273
|
+
* Optional MIME type overrides for extensions not in the default mapping.
|
|
274
|
+
*/
|
|
275
|
+
mimeTypes?: Record<string, string>;
|
|
276
|
+
}
|
|
277
|
+
export type CustomToolsConfig = Record<string, CustomCommandConfig>;
|
|
278
|
+
export type BuiltInToolsConfig = Record<string, unknown>;
|
|
279
|
+
/**
|
|
280
|
+
* Configuration for review rating feature.
|
|
281
|
+
* Allows configuring automated review scoring with pass/fail thresholds.
|
|
282
|
+
*/
|
|
283
|
+
export interface RatingConfig {
|
|
284
|
+
/**
|
|
285
|
+
* Enable or disable review rating.
|
|
286
|
+
* @default true
|
|
287
|
+
*/
|
|
288
|
+
enabled?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Minimum score (0-10) required to pass the review.
|
|
291
|
+
* @default 6
|
|
292
|
+
*/
|
|
293
|
+
passThreshold?: number;
|
|
294
|
+
/**
|
|
295
|
+
* Highest allowed value on the rating scale.
|
|
296
|
+
* @default 10
|
|
297
|
+
*/
|
|
298
|
+
maxRating?: number;
|
|
299
|
+
/**
|
|
300
|
+
* Lowest allowed value on the rating scale.
|
|
301
|
+
* @default 0
|
|
302
|
+
*/
|
|
303
|
+
minRating?: number;
|
|
304
|
+
/**
|
|
305
|
+
* Exit with error code 1 when review fails (below threshold).
|
|
306
|
+
* When false, exits normally (code 0) regardless of rating.
|
|
307
|
+
* @default true
|
|
308
|
+
*/
|
|
309
|
+
errorOnReviewFail?: boolean;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Validation checks that can be skipped for custom command parameters.
|
|
313
|
+
* Use with the `allow` property to bypass specific security checks.
|
|
314
|
+
*
|
|
315
|
+
* - `absolute-paths`: Allow absolute paths (e.g. `/dev/ttyUSB0`)
|
|
316
|
+
* - `directory-traversal`: Allow `..` in paths
|
|
317
|
+
* - `shell-injection`: Allow shell metacharacters (`|`, `&`, `;`, etc.)
|
|
318
|
+
* - `null-bytes`: Allow null bytes in values
|
|
319
|
+
*/
|
|
320
|
+
export type ValidationCheck = 'absolute-paths' | 'directory-traversal' | 'shell-injection' | 'null-bytes';
|
|
321
|
+
/**
|
|
322
|
+
* Configuration for a custom command parameter.
|
|
323
|
+
* Parameters allow the model to provide dynamic values to commands.
|
|
324
|
+
*/
|
|
325
|
+
export interface CustomCommandParameter {
|
|
326
|
+
/**
|
|
327
|
+
* Description of the parameter shown to the model.
|
|
328
|
+
*/
|
|
329
|
+
description: string;
|
|
330
|
+
/**
|
|
331
|
+
* Optional list of validation checks to skip for this parameter's value.
|
|
332
|
+
* Use when this parameter legitimately requires values that would normally be blocked.
|
|
333
|
+
* For example, `["absolute-paths"]` allows values like `/dev/ttyUSB0` for this parameter.
|
|
334
|
+
*
|
|
335
|
+
* Available checks: `absolute-paths`, `directory-traversal`, `shell-injection`, `null-bytes`
|
|
336
|
+
*/
|
|
337
|
+
allow?: ValidationCheck[];
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Configuration for a custom command.
|
|
341
|
+
* Custom commands can be executed with or without parameters.
|
|
342
|
+
*/
|
|
343
|
+
export interface CustomCommandConfig {
|
|
344
|
+
/**
|
|
345
|
+
* The shell command to execute.
|
|
346
|
+
* Can include placeholders like ${paramName} that will be replaced with parameter values.
|
|
347
|
+
* If no placeholder is present and parameters are provided, they are appended to the command.
|
|
348
|
+
*/
|
|
349
|
+
command: string;
|
|
350
|
+
/**
|
|
351
|
+
* Description of what this command does, shown to the model.
|
|
352
|
+
*/
|
|
353
|
+
description: string;
|
|
354
|
+
/**
|
|
355
|
+
* Optional parameters that the model can provide when calling this command.
|
|
356
|
+
* Each parameter has a name (the key) and a description.
|
|
357
|
+
* Parameters are validated for security (no shell injection, directory traversal, etc.).
|
|
358
|
+
*/
|
|
359
|
+
parameters?: Record<string, CustomCommandParameter>;
|
|
360
|
+
/**
|
|
361
|
+
* Optional timeout in seconds.
|
|
362
|
+
* When set, the command will be killed if it exceeds this duration.
|
|
363
|
+
* When omitted, no timeout is applied.
|
|
364
|
+
*/
|
|
365
|
+
timeout?: number;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Config for {@link GthDevToolkit}.
|
|
369
|
+
* Tools are not applied when config is not provided.
|
|
370
|
+
* Only available in `code` mode.
|
|
371
|
+
*/
|
|
372
|
+
export interface GthDevToolsConfig {
|
|
373
|
+
/**
|
|
374
|
+
* Optional shell command to run tests.
|
|
375
|
+
* Not applied when config is not provided.
|
|
376
|
+
*/
|
|
377
|
+
run_tests?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Optional shell command to run static analysis (lint).
|
|
380
|
+
* Not applied when config is not provided.
|
|
381
|
+
*/
|
|
382
|
+
run_lint?: string;
|
|
383
|
+
/**
|
|
384
|
+
* Optional shell command to run the build.
|
|
385
|
+
* Not applied when config is not provided.
|
|
386
|
+
*/
|
|
387
|
+
run_build?: string;
|
|
388
|
+
/**
|
|
389
|
+
* Optional shell command to run a single test file.
|
|
390
|
+
* Supports command interpolation with the `${testPath}` placeholder.
|
|
391
|
+
* Example: "npm test -- ${testPath}" or "jest ${testPath}"
|
|
392
|
+
* Example: "npm test" - the test will simply be appended
|
|
393
|
+
* Not applied when config is not provided.
|
|
394
|
+
*/
|
|
395
|
+
run_single_test?: string;
|
|
396
|
+
}
|
|
397
|
+
export interface LLMConfig extends Record<string, unknown> {
|
|
398
|
+
type: string;
|
|
399
|
+
model: string;
|
|
400
|
+
configuration: Record<string, unknown>;
|
|
401
|
+
apiKeyEnvironmentVariable?: string;
|
|
402
|
+
}
|
|
403
|
+
export declare const availableDefaultConfigs: readonly ["vertexai", "anthropic", "groq", "deepseek", "openai", "google-genai", "xai", "openrouter"];
|
|
404
|
+
export type ConfigType = (typeof availableDefaultConfigs)[number];
|
|
405
|
+
export interface CommandLineConfigOverrides {
|
|
406
|
+
/**
|
|
407
|
+
* Custom config path
|
|
408
|
+
*/
|
|
409
|
+
customConfigPath?: string;
|
|
410
|
+
/**
|
|
411
|
+
* Set LangChain/LangGraph to verbose mode,
|
|
412
|
+
* causing LangChain/LangGraph to log many details to the console.
|
|
413
|
+
* debugLog from config.ts may be a less intrusive option.
|
|
414
|
+
*/
|
|
415
|
+
verbose?: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Should the output be written to md file.
|
|
418
|
+
* (e.g. gth_2025-07-26_22-59-06_REVIEW.md).
|
|
419
|
+
* Can be set to false with `-wn` or `-w0`
|
|
420
|
+
* Can be set to a specific filename or path by passing a string:
|
|
421
|
+
* - Bare filenames (e.g. `"review.md"`) are placed in `.gsloth/` when it exists, otherwise project root
|
|
422
|
+
* - Paths with separators (e.g. `"./review.md"` or `"reviews/last.md"`) are always relative to project root
|
|
423
|
+
* Please note the string does not accept absolute path, but allows to exit project with `..` if necessary.
|
|
424
|
+
*/
|
|
425
|
+
writeOutputToFile?: boolean | string;
|
|
426
|
+
/**
|
|
427
|
+
* Separate identity profile.
|
|
428
|
+
* May include separate identity, guidelines and command protocol,
|
|
429
|
+
* making gsloth behave as an agent different from default profile behaviour.
|
|
430
|
+
* for example, `devops` profile to detect changes such as properties and environment variables.
|
|
431
|
+
* Custom config can still win over this one.
|
|
432
|
+
* This setting requires .gsloth/.gsloth-settings directory to exist.
|
|
433
|
+
* Important to note that the profile directory substitutes the entire config directory,
|
|
434
|
+
* in the case if some prompt files are missing - a file from the installation directory will be used.
|
|
435
|
+
*/
|
|
436
|
+
identityProfile?: string;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Default config
|
|
440
|
+
*/
|
|
441
|
+
export declare const DEFAULT_CONFIG: {
|
|
442
|
+
readonly contentSource: "file";
|
|
443
|
+
readonly requirementSource: "file";
|
|
444
|
+
readonly contentProvider: "file";
|
|
445
|
+
readonly requirementsProvider: "file";
|
|
446
|
+
/**
|
|
447
|
+
* Path to project-specific guidelines.
|
|
448
|
+
* The default is `.gsloth.guidelines.md`; this config may be used to point Gaunt Sloth to a different file,
|
|
449
|
+
* for example, to AGENTS.md
|
|
450
|
+
*/
|
|
451
|
+
readonly projectGuidelines: ".gsloth.guidelines.md";
|
|
452
|
+
/**
|
|
453
|
+
* Whether to include the current date in the project review instructions or not.
|
|
454
|
+
*/
|
|
455
|
+
readonly includeCurrentDateAfterGuidelines: false;
|
|
456
|
+
readonly projectReviewInstructions: ".gsloth.review.md";
|
|
457
|
+
readonly filesystem: "none";
|
|
458
|
+
readonly debugLog: false;
|
|
459
|
+
readonly consoleLevel: StatusLevel.INFO;
|
|
460
|
+
/**
|
|
461
|
+
* Default provider for both requirements and content is GitHub.
|
|
462
|
+
* It needs GitHub CLI (gh).
|
|
463
|
+
*
|
|
464
|
+
* `github` content provider uses `gh pr diff NN` internally. {@link src/providers/ghPrDiffProvider.ts!}
|
|
465
|
+
*
|
|
466
|
+
*
|
|
467
|
+
* `github` requirements provider `gh issue view NN` internally
|
|
468
|
+
*/
|
|
469
|
+
readonly commands: {
|
|
470
|
+
readonly pr: {
|
|
471
|
+
readonly contentSource: "github";
|
|
472
|
+
readonly requirementSource: "github";
|
|
473
|
+
readonly contentProvider: "github";
|
|
474
|
+
readonly requirementsProvider: "github";
|
|
475
|
+
readonly rating: {
|
|
476
|
+
readonly enabled: true;
|
|
477
|
+
readonly passThreshold: 6;
|
|
478
|
+
readonly minRating: 0;
|
|
479
|
+
readonly maxRating: 10;
|
|
480
|
+
readonly errorOnReviewFail: true;
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
readonly review: {
|
|
484
|
+
readonly rating: {
|
|
485
|
+
readonly enabled: true;
|
|
486
|
+
readonly passThreshold: 6;
|
|
487
|
+
readonly minRating: 0;
|
|
488
|
+
readonly maxRating: 10;
|
|
489
|
+
readonly errorOnReviewFail: true;
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
readonly ask: {
|
|
493
|
+
readonly filesystem: "read";
|
|
494
|
+
};
|
|
495
|
+
readonly chat: {
|
|
496
|
+
readonly filesystem: "read";
|
|
497
|
+
};
|
|
498
|
+
readonly code: {
|
|
499
|
+
readonly filesystem: "all";
|
|
500
|
+
};
|
|
501
|
+
readonly api: {
|
|
502
|
+
readonly filesystem: "read";
|
|
503
|
+
readonly port: 3000;
|
|
504
|
+
readonly cors: {
|
|
505
|
+
readonly allowOrigin: "http://localhost:3000";
|
|
506
|
+
readonly allowMethods: "POST, GET, OPTIONS";
|
|
507
|
+
readonly allowHeaders: "Content-Type, Accept";
|
|
508
|
+
};
|
|
509
|
+
};
|
|
510
|
+
};
|
|
511
|
+
readonly streamOutput: true;
|
|
512
|
+
readonly writeOutputToFile: true;
|
|
513
|
+
readonly writeBinaryOutputsToFile: true;
|
|
514
|
+
readonly useColour: true;
|
|
515
|
+
readonly streamSessionInferenceLog: true;
|
|
516
|
+
readonly canInterruptInferenceWithEsc: true;
|
|
517
|
+
readonly aiignore: {
|
|
518
|
+
readonly enabled: true;
|
|
519
|
+
readonly patterns: undefined;
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Initialize configuration by loading from available config files
|
|
524
|
+
* @returns The loaded GthConfig
|
|
525
|
+
*/
|
|
526
|
+
export declare function initConfig(commandLineConfigOverrides: CommandLineConfigOverrides): Promise<GthConfig>;
|
|
527
|
+
/**
|
|
528
|
+
* Process JSON LLM config by creating the appropriate LLM instance
|
|
529
|
+
* @param jsonConfig - The parsed JSON config
|
|
530
|
+
* @param commandLineConfigOverrides - command line config overrides
|
|
531
|
+
* @returns Promise<GthConfig>
|
|
532
|
+
*/
|
|
533
|
+
export declare function tryJsonConfig(jsonConfig: RawGthConfig, commandLineConfigOverrides: CommandLineConfigOverrides): Promise<GthConfig>;
|