@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
package/dist/config.js
ADDED
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Gaunt Sloth Configuration.
|
|
4
|
+
*
|
|
5
|
+
* Refer to {@link GthConfig} to find all possible configuration properties.
|
|
6
|
+
*
|
|
7
|
+
* Refer to {@link DEFAULT_CONFIG} for default configuration.
|
|
8
|
+
*
|
|
9
|
+
* Some config params can be overriden from command line, see {@link CommandLineConfigOverrides}
|
|
10
|
+
*/
|
|
11
|
+
import { PROJECT_GUIDELINES, PROJECT_REVIEW_INSTRUCTIONS, USER_PROJECT_CONFIG_JS, USER_PROJECT_CONFIG_JSON, USER_PROJECT_CONFIG_MJS, } from '#src/constants.js';
|
|
12
|
+
import { StatusLevel } from '#src/core/types.js';
|
|
13
|
+
import { displayDebug, displayError, displayInfo, displayWarning, setConsoleLevel, } from '#src/utils/consoleUtils.js';
|
|
14
|
+
import { getGslothConfigReadPath, importExternalFile } from '#src/utils/fileUtils.js';
|
|
15
|
+
import { error, exit, isTTY, setUseColour } from '#src/utils/systemUtils.js';
|
|
16
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
17
|
+
export const availableDefaultConfigs = [
|
|
18
|
+
'vertexai',
|
|
19
|
+
'anthropic',
|
|
20
|
+
'groq',
|
|
21
|
+
'deepseek',
|
|
22
|
+
'openai',
|
|
23
|
+
'google-genai',
|
|
24
|
+
'xai',
|
|
25
|
+
'openrouter',
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Default config
|
|
29
|
+
*/
|
|
30
|
+
export const DEFAULT_CONFIG = {
|
|
31
|
+
contentSource: 'file',
|
|
32
|
+
requirementSource: 'file',
|
|
33
|
+
contentProvider: 'file',
|
|
34
|
+
requirementsProvider: 'file',
|
|
35
|
+
/**
|
|
36
|
+
* Path to project-specific guidelines.
|
|
37
|
+
* The default is `.gsloth.guidelines.md`; this config may be used to point Gaunt Sloth to a different file,
|
|
38
|
+
* for example, to AGENTS.md
|
|
39
|
+
*/
|
|
40
|
+
projectGuidelines: PROJECT_GUIDELINES,
|
|
41
|
+
/**
|
|
42
|
+
* Whether to include the current date in the project review instructions or not.
|
|
43
|
+
*/
|
|
44
|
+
includeCurrentDateAfterGuidelines: false,
|
|
45
|
+
projectReviewInstructions: PROJECT_REVIEW_INSTRUCTIONS,
|
|
46
|
+
filesystem: 'none',
|
|
47
|
+
debugLog: false,
|
|
48
|
+
consoleLevel: StatusLevel.INFO, // Default to INFO level, not debug
|
|
49
|
+
/**
|
|
50
|
+
* Default provider for both requirements and content is GitHub.
|
|
51
|
+
* It needs GitHub CLI (gh).
|
|
52
|
+
*
|
|
53
|
+
* `github` content provider uses `gh pr diff NN` internally. {@link src/providers/ghPrDiffProvider.ts!}
|
|
54
|
+
*
|
|
55
|
+
*
|
|
56
|
+
* `github` requirements provider `gh issue view NN` internally
|
|
57
|
+
*/
|
|
58
|
+
commands: {
|
|
59
|
+
pr: {
|
|
60
|
+
contentSource: 'github',
|
|
61
|
+
requirementSource: 'github',
|
|
62
|
+
contentProvider: 'github',
|
|
63
|
+
requirementsProvider: 'github',
|
|
64
|
+
rating: {
|
|
65
|
+
enabled: true,
|
|
66
|
+
passThreshold: 6,
|
|
67
|
+
minRating: 0,
|
|
68
|
+
maxRating: 10,
|
|
69
|
+
errorOnReviewFail: true,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
review: {
|
|
73
|
+
rating: {
|
|
74
|
+
enabled: true,
|
|
75
|
+
passThreshold: 6,
|
|
76
|
+
minRating: 0,
|
|
77
|
+
maxRating: 10,
|
|
78
|
+
errorOnReviewFail: true,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
ask: {
|
|
82
|
+
filesystem: 'read',
|
|
83
|
+
},
|
|
84
|
+
chat: {
|
|
85
|
+
filesystem: 'read',
|
|
86
|
+
},
|
|
87
|
+
code: {
|
|
88
|
+
filesystem: 'all',
|
|
89
|
+
},
|
|
90
|
+
api: {
|
|
91
|
+
filesystem: 'read',
|
|
92
|
+
port: 3000,
|
|
93
|
+
cors: {
|
|
94
|
+
allowOrigin: 'http://localhost:3000',
|
|
95
|
+
allowMethods: 'POST, GET, OPTIONS',
|
|
96
|
+
allowHeaders: 'Content-Type, Accept',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
streamOutput: true,
|
|
101
|
+
writeOutputToFile: true,
|
|
102
|
+
writeBinaryOutputsToFile: true,
|
|
103
|
+
useColour: true,
|
|
104
|
+
streamSessionInferenceLog: true,
|
|
105
|
+
canInterruptInferenceWithEsc: true,
|
|
106
|
+
aiignore: {
|
|
107
|
+
enabled: true,
|
|
108
|
+
patterns: undefined,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Needed DEFAULT_CONFIG to be plain const to be picked up by typedoc,
|
|
113
|
+
* this cast here is just for typecheck.
|
|
114
|
+
*/
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
116
|
+
DEFAULT_CONFIG;
|
|
117
|
+
/**
|
|
118
|
+
* Initialize configuration by loading from available config files
|
|
119
|
+
* @returns The loaded GthConfig
|
|
120
|
+
*/
|
|
121
|
+
export async function initConfig(commandLineConfigOverrides) {
|
|
122
|
+
if (commandLineConfigOverrides.customConfigPath &&
|
|
123
|
+
!existsSync(commandLineConfigOverrides.customConfigPath)) {
|
|
124
|
+
throw new Error(`Provided manual config "${commandLineConfigOverrides.customConfigPath}" does not exist`);
|
|
125
|
+
}
|
|
126
|
+
const jsonConfigPath = commandLineConfigOverrides.customConfigPath ??
|
|
127
|
+
getGslothConfigReadPath(USER_PROJECT_CONFIG_JSON, commandLineConfigOverrides.identityProfile);
|
|
128
|
+
// Try loading the JSON config file first
|
|
129
|
+
if (jsonConfigPath.endsWith('.json') && existsSync(jsonConfigPath)) {
|
|
130
|
+
try {
|
|
131
|
+
// TODO makes sense to employ ZOD to validate config
|
|
132
|
+
const jsonConfig = JSON.parse(readFileSync(jsonConfigPath, 'utf8'));
|
|
133
|
+
// If the config has an LLM with a type, create the appropriate LLM instance
|
|
134
|
+
if (jsonConfig.llm && typeof jsonConfig.llm === 'object' && 'type' in jsonConfig.llm) {
|
|
135
|
+
return await tryJsonConfig(jsonConfig, commandLineConfigOverrides);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
error(`${jsonConfigPath} is not in valid format. Should at least define llm.type`);
|
|
139
|
+
exit(1);
|
|
140
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
141
|
+
// This throw is unreachable due to exit(1) above, but satisfies TS type analysis and prevents tests from exiting
|
|
142
|
+
// noinspection ExceptionCaughtLocallyJS
|
|
143
|
+
throw new Error('Unexpected error occurred.');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (e) {
|
|
147
|
+
displayDebug(e instanceof Error ? e : String(e));
|
|
148
|
+
displayError(`Failed to read config from ${USER_PROJECT_CONFIG_JSON}, will try other formats.`);
|
|
149
|
+
// Continue to try other formats
|
|
150
|
+
return await tryJsConfig(commandLineConfigOverrides);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// JSON config not found, try JS
|
|
155
|
+
return tryJsConfig(commandLineConfigOverrides);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Helper function to try loading JS config
|
|
159
|
+
async function tryJsConfig(commandLineConfigOverrides) {
|
|
160
|
+
const jsConfigPath = commandLineConfigOverrides.customConfigPath ??
|
|
161
|
+
getGslothConfigReadPath(USER_PROJECT_CONFIG_JS, commandLineConfigOverrides.identityProfile);
|
|
162
|
+
if (jsConfigPath.endsWith('.js') && existsSync(jsConfigPath)) {
|
|
163
|
+
try {
|
|
164
|
+
const i = await importExternalFile(jsConfigPath);
|
|
165
|
+
const customConfig = await i.configure();
|
|
166
|
+
return await mergeConfig(customConfig, commandLineConfigOverrides);
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
displayDebug(e instanceof Error ? e : String(e));
|
|
170
|
+
displayError(`Failed to read config from ${USER_PROJECT_CONFIG_JS}, will try other formats.`);
|
|
171
|
+
// Continue to try other formats
|
|
172
|
+
return await tryMjsConfig(commandLineConfigOverrides);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
// JS config not found, try MJS
|
|
177
|
+
return await tryMjsConfig(commandLineConfigOverrides);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
// Helper function to try loading MJS config
|
|
181
|
+
async function tryMjsConfig(commandLineConfigOverrides) {
|
|
182
|
+
const mjsConfigPath = commandLineConfigOverrides.customConfigPath ??
|
|
183
|
+
getGslothConfigReadPath(USER_PROJECT_CONFIG_MJS, commandLineConfigOverrides.identityProfile);
|
|
184
|
+
if (mjsConfigPath.endsWith('.mjs') && existsSync(mjsConfigPath)) {
|
|
185
|
+
try {
|
|
186
|
+
const i = await importExternalFile(mjsConfigPath);
|
|
187
|
+
const customConfig = await i.configure();
|
|
188
|
+
return await mergeConfig(customConfig, commandLineConfigOverrides);
|
|
189
|
+
}
|
|
190
|
+
catch (e) {
|
|
191
|
+
displayDebug(e instanceof Error ? e : String(e));
|
|
192
|
+
displayError(`Failed to read config from ${USER_PROJECT_CONFIG_MJS}.`);
|
|
193
|
+
displayError(`No valid configuration found. Please create a valid configuration file.`);
|
|
194
|
+
exit(1);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
// No config files found
|
|
199
|
+
displayError('No configuration file found. Please create one of: ' +
|
|
200
|
+
`${USER_PROJECT_CONFIG_JSON}, ${USER_PROJECT_CONFIG_JS}, or ${USER_PROJECT_CONFIG_MJS} ` +
|
|
201
|
+
'in your project directory.');
|
|
202
|
+
exit(1);
|
|
203
|
+
}
|
|
204
|
+
// This throw is unreachable due to exit(1) above, but satisfies TS type analysis and prevents tests from exiting
|
|
205
|
+
throw new Error('Unexpected error occurred.');
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Process JSON LLM config by creating the appropriate LLM instance
|
|
209
|
+
* @param jsonConfig - The parsed JSON config
|
|
210
|
+
* @param commandLineConfigOverrides - command line config overrides
|
|
211
|
+
* @returns Promise<GthConfig>
|
|
212
|
+
*/
|
|
213
|
+
export async function tryJsonConfig(jsonConfig, commandLineConfigOverrides) {
|
|
214
|
+
try {
|
|
215
|
+
if (jsonConfig.llm && typeof jsonConfig.llm === 'object') {
|
|
216
|
+
// Get the type of LLM (e.g. 'vertexai', 'anthropic') - this should exist
|
|
217
|
+
const llmType = jsonConfig.llm.type;
|
|
218
|
+
if (!llmType) {
|
|
219
|
+
displayError('LLM type not specified in config.');
|
|
220
|
+
exit(1);
|
|
221
|
+
}
|
|
222
|
+
// Get the configuration for the specific LLM type
|
|
223
|
+
const llmConfig = jsonConfig.llm;
|
|
224
|
+
if (commandLineConfigOverrides.verbose) {
|
|
225
|
+
// Necessary to avoid https://github.com/langchain-ai/langchainjs/issues/8705
|
|
226
|
+
llmConfig.verbose = commandLineConfigOverrides.verbose;
|
|
227
|
+
}
|
|
228
|
+
// Import the appropriate config module
|
|
229
|
+
const configModule = await import(`#src/providers/${llmType}.js`);
|
|
230
|
+
if (configModule.processJsonConfig) {
|
|
231
|
+
const llm = (await configModule.processJsonConfig(llmConfig));
|
|
232
|
+
const mergedConfig = mergeRawConfig(jsonConfig, llm, commandLineConfigOverrides);
|
|
233
|
+
if (configModule.postProcessJsonConfig) {
|
|
234
|
+
return await configModule.postProcessJsonConfig(mergedConfig);
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
return await mergedConfig;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
displayWarning(`Config module for ${llmType} does not have processJsonConfig function.`);
|
|
242
|
+
exit(1);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
displayError('No LLM configuration found in config.');
|
|
247
|
+
exit(1);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch (e) {
|
|
251
|
+
if (e instanceof Error && e.message.includes('Cannot find module')) {
|
|
252
|
+
displayError(`LLM type '${jsonConfig.llm.type}' not supported.`);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
displayError(`Error processing LLM config: ${e instanceof Error ? e.message : String(e)}`);
|
|
256
|
+
}
|
|
257
|
+
exit(1);
|
|
258
|
+
}
|
|
259
|
+
// This throw is unreachable due to exit(1) above, but satisfies TS type analysis and prevents tests from exiting
|
|
260
|
+
throw new Error('Unexpected error occurred.');
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Deep merge two objects, with source overriding target properties
|
|
264
|
+
* @param target - The target object with default values
|
|
265
|
+
* @param source - The source object with user overrides
|
|
266
|
+
* @param maxDepth - Maximum recursion depth to prevent stack overflow (default: 4)
|
|
267
|
+
*/
|
|
268
|
+
function deepMerge(target, source, maxDepth = 4) {
|
|
269
|
+
if (!source)
|
|
270
|
+
return target;
|
|
271
|
+
if (!target)
|
|
272
|
+
return source;
|
|
273
|
+
const result = { ...target };
|
|
274
|
+
// Return result without merging if depth is exceeded
|
|
275
|
+
if (maxDepth === 0)
|
|
276
|
+
return result;
|
|
277
|
+
for (const key in source) {
|
|
278
|
+
const sourceValue = source[key];
|
|
279
|
+
const targetValue = target[key];
|
|
280
|
+
if (sourceValue &&
|
|
281
|
+
typeof sourceValue === 'object' &&
|
|
282
|
+
!Array.isArray(sourceValue) &&
|
|
283
|
+
targetValue &&
|
|
284
|
+
typeof targetValue === 'object' &&
|
|
285
|
+
!Array.isArray(targetValue)) {
|
|
286
|
+
// Recursively merge nested objects
|
|
287
|
+
result[key] = deepMerge(targetValue, sourceValue, maxDepth - 1);
|
|
288
|
+
}
|
|
289
|
+
else if (sourceValue !== undefined) {
|
|
290
|
+
// Override with source value if it exists
|
|
291
|
+
result[key] = sourceValue;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Merge config with default config
|
|
298
|
+
*/
|
|
299
|
+
async function mergeConfig(partialConfig, commandLineConfigOverrides) {
|
|
300
|
+
const config = partialConfig;
|
|
301
|
+
// Migrate deprecated property names
|
|
302
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
303
|
+
const raw = config;
|
|
304
|
+
if (raw.contentProvider && !raw.contentSource) {
|
|
305
|
+
displayWarning('Config property "contentProvider" is deprecated. Use "contentSource" instead.');
|
|
306
|
+
config.contentSource = raw.contentProvider;
|
|
307
|
+
}
|
|
308
|
+
if (raw.requirementsProvider && !raw.requirementSource) {
|
|
309
|
+
displayWarning('Config property "requirementsProvider" is deprecated. Use "requirementSource" instead.');
|
|
310
|
+
config.requirementSource = raw.requirementsProvider;
|
|
311
|
+
}
|
|
312
|
+
// Keep both old and new in sync
|
|
313
|
+
if (config.contentSource)
|
|
314
|
+
config.contentProvider = config.contentSource;
|
|
315
|
+
if (config.requirementSource)
|
|
316
|
+
config.requirementsProvider = config.requirementSource;
|
|
317
|
+
// Migrate command-level deprecated properties
|
|
318
|
+
if (config.commands) {
|
|
319
|
+
for (const cmdName of ['pr', 'review']) {
|
|
320
|
+
const cmd = config.commands[cmdName];
|
|
321
|
+
if (cmd) {
|
|
322
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
323
|
+
const cmdRaw = cmd;
|
|
324
|
+
if (cmdRaw.contentProvider && !cmdRaw.contentSource) {
|
|
325
|
+
cmd.contentSource = cmdRaw.contentProvider;
|
|
326
|
+
}
|
|
327
|
+
if (cmdRaw.requirementsProvider && !cmdRaw.requirementSource) {
|
|
328
|
+
cmd.requirementSource = cmdRaw.requirementsProvider;
|
|
329
|
+
}
|
|
330
|
+
if (cmd.contentSource)
|
|
331
|
+
cmd.contentProvider = cmd.contentSource;
|
|
332
|
+
if (cmd.requirementSource)
|
|
333
|
+
cmd.requirementsProvider = cmd.requirementSource;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
// Deep merge command configs while preserving defaults
|
|
338
|
+
// Type complexity from DEFAULT_CONFIG.commands 'as const' requires any cast for deep merge result
|
|
339
|
+
const mergedCommands = {
|
|
340
|
+
pr: deepMerge(DEFAULT_CONFIG.commands.pr, config?.commands?.pr), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
341
|
+
review: deepMerge(DEFAULT_CONFIG.commands.review, config?.commands?.review), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
342
|
+
code: deepMerge(DEFAULT_CONFIG.commands.code, config?.commands?.code), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
343
|
+
ask: deepMerge(DEFAULT_CONFIG.commands.ask, config?.commands?.ask), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
344
|
+
chat: deepMerge(DEFAULT_CONFIG.commands.chat, config?.commands?.chat), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
345
|
+
api: deepMerge(DEFAULT_CONFIG.commands.api, config?.commands?.api), // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
346
|
+
};
|
|
347
|
+
const mergedConfig = {
|
|
348
|
+
...DEFAULT_CONFIG,
|
|
349
|
+
...config,
|
|
350
|
+
commands: mergedCommands,
|
|
351
|
+
};
|
|
352
|
+
if (commandLineConfigOverrides.identityProfile !== undefined) {
|
|
353
|
+
displayInfo(`Activating profile: ${commandLineConfigOverrides.identityProfile}`);
|
|
354
|
+
mergedConfig.identityProfile = commandLineConfigOverrides.identityProfile.trim();
|
|
355
|
+
}
|
|
356
|
+
if (commandLineConfigOverrides.verbose !== undefined) {
|
|
357
|
+
mergedConfig.llm.verbose = commandLineConfigOverrides.verbose;
|
|
358
|
+
}
|
|
359
|
+
if (commandLineConfigOverrides.writeOutputToFile !== undefined) {
|
|
360
|
+
mergedConfig.writeOutputToFile = commandLineConfigOverrides.writeOutputToFile;
|
|
361
|
+
}
|
|
362
|
+
// Set the useColour value in systemUtils
|
|
363
|
+
setUseColour(mergedConfig.useColour);
|
|
364
|
+
// Set console logging level
|
|
365
|
+
if (mergedConfig.consoleLevel !== undefined) {
|
|
366
|
+
const resolvedConsoleLevel = resolveConsoleLevel(mergedConfig.consoleLevel);
|
|
367
|
+
if (resolvedConsoleLevel !== undefined) {
|
|
368
|
+
mergedConfig.consoleLevel = resolvedConsoleLevel;
|
|
369
|
+
setConsoleLevel(resolvedConsoleLevel);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
displayWarning(`Invalid consoleLevel "${String(mergedConfig.consoleLevel)}", using default ${StatusLevel.INFO}.`);
|
|
373
|
+
mergedConfig.consoleLevel = StatusLevel.INFO;
|
|
374
|
+
setConsoleLevel(StatusLevel.INFO);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
mergedConfig.canInterruptInferenceWithEsc = mergedConfig.canInterruptInferenceWithEsc && isTTY();
|
|
378
|
+
return mergedConfig;
|
|
379
|
+
}
|
|
380
|
+
const CONSOLE_LEVELS_BY_NAME = {
|
|
381
|
+
debug: StatusLevel.DEBUG,
|
|
382
|
+
info: StatusLevel.INFO,
|
|
383
|
+
display: StatusLevel.DISPLAY,
|
|
384
|
+
success: StatusLevel.SUCCESS,
|
|
385
|
+
warning: StatusLevel.WARNING,
|
|
386
|
+
error: StatusLevel.ERROR,
|
|
387
|
+
stream: StatusLevel.STREAM,
|
|
388
|
+
};
|
|
389
|
+
function resolveConsoleLevel(level) {
|
|
390
|
+
if (typeof level === 'number') {
|
|
391
|
+
return StatusLevel[level] !== undefined ? level : undefined;
|
|
392
|
+
}
|
|
393
|
+
if (typeof level === 'string') {
|
|
394
|
+
const normalized = level.trim().toLowerCase();
|
|
395
|
+
if (normalized in CONSOLE_LEVELS_BY_NAME) {
|
|
396
|
+
return CONSOLE_LEVELS_BY_NAME[normalized];
|
|
397
|
+
}
|
|
398
|
+
const enumValue = StatusLevel[level];
|
|
399
|
+
if (typeof enumValue === 'number') {
|
|
400
|
+
return enumValue;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return undefined;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Merge raw with default config
|
|
407
|
+
*/
|
|
408
|
+
async function mergeRawConfig(config, llm, commandLineConfigOverrides) {
|
|
409
|
+
const modelDisplayName = config.llm?.model;
|
|
410
|
+
return await mergeConfig({ ...config, llm, modelDisplayName }, commandLineConfigOverrides);
|
|
411
|
+
}
|
|
412
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG7E,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAqanD,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,UAAU;IACV,WAAW;IACX,MAAM;IACN,UAAU;IACV,QAAQ;IACR,cAAc;IACd,KAAK;IACL,YAAY;CACJ,CAAC;AAqCX;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,aAAa,EAAE,MAAM;IACrB,iBAAiB,EAAE,MAAM;IACzB,eAAe,EAAE,MAAM;IACvB,oBAAoB,EAAE,MAAM;IAC5B;;;;OAIG;IACH,iBAAiB,EAAE,kBAAkB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O;IAC5B,OAAO,EAAE,WAAW,CAAC,OAAO;IAC5B,KAAK,EAAE,WAAW,CAAC,KAAK;IACxB,MAAM,EAAE,WAAW,CAAC,MAAM;CAC3B,CAAC;AAEF,SAAS,mBAAmB,CAAC,KAAsC;IACjE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,WAAW,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9D,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC9C,IAAI,UAAU,IAAI,sBAAsB,EAAE,CAAC;YACzC,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC;QAC5C,CAAC;QACD,MAAM,SAAS,GAAG,WAAW,CAAC,KAAiC,CAAC,CAAC;QACjE,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,cAAc,CAC3B,MAAoB,EACpB,GAAkB,EAClB,0BAAsD;IAEtD,MAAM,gBAAgB,GAAuB,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC;IAC/D,OAAO,MAAM,WAAW,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,EAAE,0BAA0B,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const GSLOTH_DIR = ".gsloth";
|
|
2
|
+
export declare const GSLOTH_SETTINGS_DIR = ".gsloth-settings";
|
|
3
|
+
export declare const GSLOTH_AUTH = ".gsloth-auth";
|
|
4
|
+
export declare const USER_PROJECT_CONFIG_JS = ".gsloth.config.js";
|
|
5
|
+
export declare const USER_PROJECT_CONFIG_JSON = ".gsloth.config.json";
|
|
6
|
+
export declare const USER_PROJECT_CONFIG_MJS = ".gsloth.config.mjs";
|
|
7
|
+
export declare const GSLOTH_BACKSTORY = ".gsloth.backstory.md";
|
|
8
|
+
export declare const PROJECT_GUIDELINES = ".gsloth.guidelines.md";
|
|
9
|
+
export declare const PROJECT_REVIEW_INSTRUCTIONS = ".gsloth.review.md";
|
|
10
|
+
export declare const GSLOTH_SYSTEM_PROMPT = ".gsloth.system.md";
|
|
11
|
+
export declare const GSLOTH_CHAT_PROMPT = ".gsloth.chat.md";
|
|
12
|
+
export declare const GSLOTH_CODE_PROMPT = ".gsloth.code.md";
|
|
13
|
+
export declare const AIIGNORE_FILE = ".aiignore";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const GSLOTH_DIR = '.gsloth';
|
|
2
|
+
export const GSLOTH_SETTINGS_DIR = '.gsloth-settings';
|
|
3
|
+
export const GSLOTH_AUTH = '.gsloth-auth';
|
|
4
|
+
export const USER_PROJECT_CONFIG_JS = '.gsloth.config.js';
|
|
5
|
+
export const USER_PROJECT_CONFIG_JSON = '.gsloth.config.json';
|
|
6
|
+
export const USER_PROJECT_CONFIG_MJS = '.gsloth.config.mjs';
|
|
7
|
+
export const GSLOTH_BACKSTORY = '.gsloth.backstory.md';
|
|
8
|
+
export const PROJECT_GUIDELINES = '.gsloth.guidelines.md';
|
|
9
|
+
export const PROJECT_REVIEW_INSTRUCTIONS = '.gsloth.review.md';
|
|
10
|
+
export const GSLOTH_SYSTEM_PROMPT = '.gsloth.system.md';
|
|
11
|
+
export const GSLOTH_CHAT_PROMPT = '.gsloth.chat.md';
|
|
12
|
+
export const GSLOTH_CODE_PROMPT = '.gsloth.code.md';
|
|
13
|
+
export const AIIGNORE_FILE = '.aiignore';
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AACtD,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAC1D,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GthConfig } from '#src/config.js';
|
|
2
|
+
import { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
3
|
+
import { AgentResolvers, GthAgentInterface, GthCommand, Message, StatusUpdateCallback } from '#src/core/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Agent simplifies interaction with LLM and reduces it to calling a few methods
|
|
6
|
+
* {@link GthAgentRunner#init} and {@link GthAgentRunner#processMessages}.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GthAgentRunner {
|
|
9
|
+
private statusUpdate;
|
|
10
|
+
private resolvers;
|
|
11
|
+
private agent;
|
|
12
|
+
private config;
|
|
13
|
+
private runConfig;
|
|
14
|
+
constructor(statusUpdate: StatusUpdateCallback, resolvers?: AgentResolvers);
|
|
15
|
+
/**
|
|
16
|
+
* Init is split into a separate method. This may create a number of connections,
|
|
17
|
+
* and we'd better have an instance by that moment, for the case things will go wrong,
|
|
18
|
+
* so we can wrap init into try-catch and then call {@link #cleanup} within finally.
|
|
19
|
+
*/
|
|
20
|
+
init(command: GthCommand | undefined, configIn: GthConfig, checkpointSaver?: BaseCheckpointSaver | undefined): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* processMessages deals with both streaming and non-streaming approaches.
|
|
23
|
+
*/
|
|
24
|
+
processMessages(messages: Message[]): Promise<string>;
|
|
25
|
+
getAgent(): GthAgentInterface | null;
|
|
26
|
+
cleanup(): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { GthLangChainAgent } from '#src/core/GthLangChainAgent.js';
|
|
2
|
+
import { enhanceVertexUnauthorizedMessage } from '#src/utils/vertexaiUtils.js';
|
|
3
|
+
import { getNewRunnableConfig } from '#src/utils/llmUtils.js';
|
|
4
|
+
import { initDebugLogging, debugLog, debugLogError, debugLogObject, } from '#src/utils/debugUtils.js';
|
|
5
|
+
/**
|
|
6
|
+
* Agent simplifies interaction with LLM and reduces it to calling a few methods
|
|
7
|
+
* {@link GthAgentRunner#init} and {@link GthAgentRunner#processMessages}.
|
|
8
|
+
*/
|
|
9
|
+
export class GthAgentRunner {
|
|
10
|
+
statusUpdate;
|
|
11
|
+
resolvers;
|
|
12
|
+
agent = null;
|
|
13
|
+
config = null;
|
|
14
|
+
runConfig = null;
|
|
15
|
+
constructor(statusUpdate, resolvers) {
|
|
16
|
+
this.statusUpdate = statusUpdate;
|
|
17
|
+
this.resolvers = resolvers;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Init is split into a separate method. This may create a number of connections,
|
|
21
|
+
* and we'd better have an instance by that moment, for the case things will go wrong,
|
|
22
|
+
* so we can wrap init into try-catch and then call {@link #cleanup} within finally.
|
|
23
|
+
*/
|
|
24
|
+
async init(command, configIn, checkpointSaver) {
|
|
25
|
+
this.config = configIn;
|
|
26
|
+
// Initialize debug logging
|
|
27
|
+
initDebugLogging(configIn.debugLog ?? false);
|
|
28
|
+
debugLog(`Initializing GthAgentRunner with command: ${command || 'default'}`);
|
|
29
|
+
this.runConfig = getNewRunnableConfig();
|
|
30
|
+
debugLogObject('Runnable Config', this.runConfig);
|
|
31
|
+
this.agent = new GthLangChainAgent(this.statusUpdate, this.resolvers);
|
|
32
|
+
// Initialize the agent
|
|
33
|
+
debugLog('Initializing agent...');
|
|
34
|
+
await this.agent.init(command, configIn, checkpointSaver);
|
|
35
|
+
debugLog('Agent initialization complete');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* processMessages deals with both streaming and non-streaming approaches.
|
|
39
|
+
*/
|
|
40
|
+
async processMessages(messages) {
|
|
41
|
+
if (!this.agent || !this.config || !this.runConfig) {
|
|
42
|
+
throw new Error('AgentRunner not initialized. Call init() first.');
|
|
43
|
+
}
|
|
44
|
+
debugLog('Processing messages...');
|
|
45
|
+
debugLogObject('Input Messages', messages);
|
|
46
|
+
try {
|
|
47
|
+
// Decision: Use streaming or non-streaming based on config
|
|
48
|
+
if (this.config.streamOutput) {
|
|
49
|
+
// Use streaming
|
|
50
|
+
debugLog('Using streaming mode');
|
|
51
|
+
const stream = await this.agent.stream(messages, this.runConfig);
|
|
52
|
+
let result = '';
|
|
53
|
+
try {
|
|
54
|
+
for await (const chunk of stream) {
|
|
55
|
+
debugLogObject('Stream chunk', chunk);
|
|
56
|
+
result += chunk;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (streamError) {
|
|
60
|
+
// Handle streaming-specific errors
|
|
61
|
+
debugLogError('Stream processing', streamError);
|
|
62
|
+
throw new Error(`Stream processing failed: ${streamError instanceof Error ? streamError.message : String(streamError)}`);
|
|
63
|
+
}
|
|
64
|
+
debugLog(`Stream completed. Total response length: ${result.length}`);
|
|
65
|
+
if (result.trim().length === 0) {
|
|
66
|
+
debugLog('Stream produced empty response, retrying once with non-streaming invoke.');
|
|
67
|
+
const fallback = await this.agent.invoke(messages, this.runConfig);
|
|
68
|
+
debugLog(`Fallback non-stream response length: ${fallback.length}`);
|
|
69
|
+
if (fallback.trim().length === 0) {
|
|
70
|
+
throw new Error('Model returned an empty response after tool execution. Try again or switch to a more stable model.');
|
|
71
|
+
}
|
|
72
|
+
return fallback;
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// Use non-streaming
|
|
78
|
+
debugLog('Using non-streaming mode');
|
|
79
|
+
const result = await this.agent.invoke(messages, this.runConfig);
|
|
80
|
+
debugLog(`Non-stream response length: ${result.length}`);
|
|
81
|
+
if (result.trim().length === 0) {
|
|
82
|
+
throw new Error('Model returned an empty response. Try again or switch to a more stable model.');
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
// Handle agent invocation errors
|
|
89
|
+
debugLogError('Agent processing', error);
|
|
90
|
+
const originalMessage = error instanceof Error ? error.message : String(error);
|
|
91
|
+
const enhancedMessage = enhanceVertexUnauthorizedMessage(originalMessage, this.config?.llm);
|
|
92
|
+
throw new Error(`Agent processing failed: ${enhancedMessage}`, error instanceof Error ? { cause: error } : undefined);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// noinspection JSUnusedGlobalSymbols
|
|
96
|
+
getAgent() {
|
|
97
|
+
return this.agent;
|
|
98
|
+
}
|
|
99
|
+
async cleanup() {
|
|
100
|
+
debugLog('Cleaning up GthAgentRunner...');
|
|
101
|
+
if (this.agent && 'cleanup' in this.agent && typeof this.agent.cleanup === 'function') {
|
|
102
|
+
await this.agent.cleanup();
|
|
103
|
+
}
|
|
104
|
+
this.agent = null;
|
|
105
|
+
this.config = null;
|
|
106
|
+
debugLog('GthAgentRunner cleanup complete');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=GthAgentRunner.js.map
|
|
@@ -0,0 +1 @@
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