gaunt-sloth-assistant 0.9.4 → 0.9.6
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/README.md +24 -22
- package/dist/config.d.ts +85 -41
- package/dist/config.js +34 -8
- package/dist/config.js.map +1 -1
- package/dist/consoleUtils.d.ts +4 -1
- package/dist/consoleUtils.js +50 -7
- package/dist/consoleUtils.js.map +1 -1
- package/dist/core/GthAgentRunner.d.ts +1 -1
- package/dist/core/GthAgentRunner.js +1 -1
- package/dist/core/GthLangChainAgent.d.ts +5 -5
- package/dist/core/GthLangChainAgent.js +29 -22
- package/dist/core/GthLangChainAgent.js.map +1 -1
- package/dist/mcp/OAuthClientProviderImpl.js +1 -1
- package/dist/mcp/OAuthClientProviderImpl.js.map +1 -1
- package/dist/modules/interactiveSessionModule.js +18 -11
- package/dist/modules/interactiveSessionModule.js.map +1 -1
- package/dist/systemUtils.d.ts +7 -0
- package/dist/systemUtils.js +82 -0
- package/dist/systemUtils.js.map +1 -1
- package/dist/tools/GthFileSystemToolkit.js +13 -13
- package/dist/tools/GthFileSystemToolkit.js.map +1 -1
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Gaunt Sloth Assistant
|
|
2
|
-
[](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/actions/workflows/unit-tests.yml) [](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/actions/workflows/integration-tests.yml)
|
|
3
3
|
|
|
4
4
|
Gaunt Sloth Assistant is a lightweight **command line AI assistant**
|
|
5
5
|
built with TypeScript (JavaScript) and distributed via NPM with minimum dependencies.
|
|
@@ -8,6 +8,8 @@ built with TypeScript (JavaScript) and distributed via NPM with minimum dependen
|
|
|
8
8
|
|
|
9
9
|
Based on [LangChain.js](https://github.com/langchain-ai/langchainjs)
|
|
10
10
|
|
|
11
|
+
[Documentation](https://gaunt-sloth-assistant.github.io/docs/) | [Official Site](https://gaunt-sloth-assistant.github.io/) | [NPM](https://www.npmjs.com/package/gaunt-sloth-assistant) | [GitHub](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant)
|
|
12
|
+
|
|
11
13
|
## Why?
|
|
12
14
|
|
|
13
15
|
There are many Open Source command line AI assistants available, such as Aider and Goose;
|
|
@@ -53,10 +55,10 @@ The promise of Gaunt Sloth:
|
|
|
53
55
|
- Google AI Studio and Google Vertex AI;
|
|
54
56
|
- Anthropic;
|
|
55
57
|
- OpenAI (and other providers using OpenAI format, such as Inception);
|
|
56
|
-
- Ollama with JS config (some of the models, see https://github.com/
|
|
58
|
+
- Ollama with JS config (some of the models, see https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/discussions/107)
|
|
57
59
|
- xAI;
|
|
58
60
|
|
|
59
|
-
`*` Any other provider supported by LangChain.JS should also work with [JS config](./docs/CONFIGURATION.md#
|
|
61
|
+
`*` Any other provider supported by LangChain.JS should also work with [JS config](./docs/CONFIGURATION.md#javascript-configuration).
|
|
60
62
|
|
|
61
63
|
## Commands Overview
|
|
62
64
|
|
|
@@ -76,37 +78,37 @@ For detailed information about all commands, see [docs/COMMANDS.md](./docs/COMMA
|
|
|
76
78
|
### Quick Examples:
|
|
77
79
|
|
|
78
80
|
**Initialize project:**
|
|
79
|
-
```
|
|
81
|
+
```bash
|
|
80
82
|
gsloth init anthropic
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|
**Review PR with requirements:**
|
|
84
|
-
```
|
|
86
|
+
```bash
|
|
85
87
|
gsloth pr 42 23 # Review PR #42 with GitHub issue #23
|
|
86
88
|
```
|
|
87
89
|
|
|
88
90
|
**Review local changes:**
|
|
89
|
-
```
|
|
91
|
+
```bash
|
|
90
92
|
git --no-pager diff | gsloth review
|
|
91
93
|
```
|
|
92
94
|
|
|
93
95
|
**Review changes between a specific tag and the HEAD:**
|
|
94
|
-
```
|
|
96
|
+
```bash
|
|
95
97
|
git --no-pager diff v0.8.3..HEAD | gth review
|
|
96
98
|
```
|
|
97
99
|
|
|
98
100
|
**Review diff between head and previous release and head using a specific requirements provider (GitHub issue 38), not the one which is configured by default:
|
|
99
|
-
```
|
|
101
|
+
```bash
|
|
100
102
|
git --no-pager diff v0.8.10 HEAD | npx gth review --requirements-provider github -r 38
|
|
101
103
|
```
|
|
102
104
|
|
|
103
105
|
**Ask questions:**
|
|
104
|
-
```
|
|
106
|
+
```bash
|
|
105
107
|
gsloth ask "What does this function do?" -f utils.js
|
|
106
108
|
```
|
|
107
109
|
|
|
108
110
|
**Write release notes:**
|
|
109
|
-
```
|
|
111
|
+
```bash
|
|
110
112
|
git --no-pager diff v0.8.3..HEAD | gth ask "inspect existing release notes in assets/release-notes/v0_8_2.md; inspect provided diff and write release notes to v0_8_4.md"
|
|
111
113
|
```
|
|
112
114
|
|
|
@@ -120,7 +122,7 @@ To write this to filesystem, you'd need to add filesystem access to the *ask* co
|
|
|
120
122
|
|
|
121
123
|
|
|
122
124
|
**Interactive sessions:**
|
|
123
|
-
```
|
|
125
|
+
```bash
|
|
124
126
|
gsloth chat # Start chat session
|
|
125
127
|
gsloth code # Start coding session
|
|
126
128
|
```
|
|
@@ -130,7 +132,7 @@ gsloth code # Start coding session
|
|
|
130
132
|
Tested with Node 22 LTS.
|
|
131
133
|
|
|
132
134
|
### NPM
|
|
133
|
-
```
|
|
135
|
+
```bash
|
|
134
136
|
npm install gaunt-sloth-assistant -g
|
|
135
137
|
```
|
|
136
138
|
|
|
@@ -149,7 +151,7 @@ More detailed information on configuration can be found in [CONFIGURATION.md](./
|
|
|
149
151
|
|
|
150
152
|
### Google GenAI (AI Studio)
|
|
151
153
|
|
|
152
|
-
```
|
|
154
|
+
```bash
|
|
153
155
|
cd ./your-project
|
|
154
156
|
gsloth init google-genai
|
|
155
157
|
```
|
|
@@ -158,7 +160,7 @@ It is recommended to obtain API key from Google AI Studio official website rathe
|
|
|
158
160
|
|
|
159
161
|
### Google Vertex AI
|
|
160
162
|
|
|
161
|
-
```
|
|
163
|
+
```bash
|
|
162
164
|
cd ./your-project
|
|
163
165
|
gsloth init vertexai
|
|
164
166
|
gcloud auth login
|
|
@@ -167,7 +169,7 @@ gcloud auth application-default login
|
|
|
167
169
|
|
|
168
170
|
### Open Router
|
|
169
171
|
|
|
170
|
-
```
|
|
172
|
+
```bash
|
|
171
173
|
cd ./your-project
|
|
172
174
|
gsloth init openrouter
|
|
173
175
|
```
|
|
@@ -176,7 +178,7 @@ Make sure you either define `OPEN_ROUTER_API_KEY` environment variable or edit y
|
|
|
176
178
|
|
|
177
179
|
### Anthropic
|
|
178
180
|
|
|
179
|
-
```
|
|
181
|
+
```bash
|
|
180
182
|
cd ./your-project
|
|
181
183
|
gsloth init anthropic
|
|
182
184
|
```
|
|
@@ -184,14 +186,14 @@ gsloth init anthropic
|
|
|
184
186
|
Make sure you either define `ANTHROPIC_API_KEY` environment variable or edit your configuration file and set up your key.
|
|
185
187
|
|
|
186
188
|
### Groq
|
|
187
|
-
```
|
|
189
|
+
```bash
|
|
188
190
|
cd ./your-project
|
|
189
191
|
gsloth init groq
|
|
190
192
|
```
|
|
191
193
|
Make sure you either define `GROQ_API_KEY` environment variable or edit your configuration file and set up your key.
|
|
192
194
|
|
|
193
195
|
### DeepSeek
|
|
194
|
-
```
|
|
196
|
+
```bash
|
|
195
197
|
cd ./your-project
|
|
196
198
|
gsloth init deepseek
|
|
197
199
|
```
|
|
@@ -199,7 +201,7 @@ Make sure you either define `DEEPSEEK_API_KEY` environment variable or edit your
|
|
|
199
201
|
It is recommended to obtain API key from DeepSeek official website rather than from a reseller.
|
|
200
202
|
|
|
201
203
|
### OpenAI
|
|
202
|
-
```
|
|
204
|
+
```bash
|
|
203
205
|
cd ./your-project
|
|
204
206
|
gsloth init openai
|
|
205
207
|
```
|
|
@@ -207,14 +209,14 @@ Make sure you either define `OPENAI_API_KEY` environment variable or edit your c
|
|
|
207
209
|
|
|
208
210
|
### OpenAI-compatible providers (Inception, etc.)
|
|
209
211
|
For providers using OpenAI-compatible APIs:
|
|
210
|
-
```
|
|
212
|
+
```bash
|
|
211
213
|
cd ./your-project
|
|
212
214
|
gsloth init openai
|
|
213
215
|
```
|
|
214
216
|
Then edit your configuration to add custom base URL and API key. See [CONFIGURATION.md](./docs/CONFIGURATION.md) for examples.
|
|
215
217
|
|
|
216
218
|
### xAI
|
|
217
|
-
```
|
|
219
|
+
```bash
|
|
218
220
|
cd ./your-project
|
|
219
221
|
gsloth init xai
|
|
220
222
|
```
|
|
@@ -222,7 +224,7 @@ Make sure you either define `XAI_API_KEY` environment variable or edit your conf
|
|
|
222
224
|
|
|
223
225
|
### Other AI providers
|
|
224
226
|
Any other AI provider supported by Langchain.js can be configured with js [Config](./docs/CONFIGURATION.md).
|
|
225
|
-
For example, Ollama can be set up with JS config (some of the models, see https://github.com/
|
|
227
|
+
For example, Ollama can be set up with JS config (some of the models, see https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/discussions/107)
|
|
226
228
|
|
|
227
229
|
## Integration with GitHub Workflows / Actions
|
|
228
230
|
|
package/dist/config.d.ts
CHANGED
|
@@ -9,15 +9,20 @@ import { RunnableConfig } from '@langchain/core/runnables';
|
|
|
9
9
|
import { StateDefinition, StateType } from '@langchain/langgraph';
|
|
10
10
|
/**
|
|
11
11
|
* This is a processed Gaunt Sloth config ready to be passed down into components.
|
|
12
|
+
*
|
|
13
|
+
* Default values can be found in {@link DEFAULT_CONFIG}
|
|
12
14
|
*/
|
|
13
|
-
export interface GthConfig
|
|
15
|
+
export interface GthConfig {
|
|
14
16
|
llm: BaseChatModel;
|
|
17
|
+
/**
|
|
18
|
+
* Content Provider. Provider used to fetch content (usually diff) for `review` or `pr` command.
|
|
19
|
+
*
|
|
20
|
+
* {@link DEFAULT_CONFIG#contentProvider}
|
|
21
|
+
*/
|
|
15
22
|
contentProvider: string;
|
|
16
23
|
requirementsProvider: string;
|
|
17
24
|
projectGuidelines: string;
|
|
18
25
|
projectReviewInstructions: string;
|
|
19
|
-
streamOutput: boolean;
|
|
20
|
-
useColour: boolean;
|
|
21
26
|
filesystem: string[] | 'all' | 'read' | 'none';
|
|
22
27
|
builtInTools?: string[];
|
|
23
28
|
tools?: StructuredToolInterface[] | BaseToolkit[] | ServerTool[];
|
|
@@ -44,49 +49,35 @@ export interface GthConfig extends BaseGthConfig {
|
|
|
44
49
|
*/
|
|
45
50
|
postModelHook?: LangChainHook;
|
|
46
51
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
* Do not export this one.
|
|
71
|
-
* This is a basic interface for Gaunt Sloth config.
|
|
72
|
-
*/
|
|
73
|
-
interface BaseGthConfig {
|
|
52
|
+
/**
|
|
53
|
+
* Stream output. Some models do not support streaming. Set value to `false` for them.
|
|
54
|
+
*
|
|
55
|
+
* {@link DEFAULT_CONFIG#streamOutput}
|
|
56
|
+
*/
|
|
57
|
+
streamOutput: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Use colour in ouptut
|
|
60
|
+
*/
|
|
61
|
+
useColour: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Stream session log instead of writing it when inference streaming is complete.
|
|
64
|
+
* (only works when {@link streamOutput} is true)
|
|
65
|
+
*/
|
|
66
|
+
streamSessionInferenceLog: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Allow inference to be interrupted with esc.
|
|
69
|
+
*/
|
|
70
|
+
canInterruptInferenceWithEsc: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Log messages and events to gaunt-sloth.log,
|
|
73
|
+
* use llm.verbose or `gth --verbose` as more intrusive option, setting verbose to LangChain / LangGraph
|
|
74
|
+
*/
|
|
74
75
|
debugLog?: boolean;
|
|
75
|
-
llm: unknown;
|
|
76
|
-
contentProvider?: string;
|
|
77
|
-
requirementsProvider?: string;
|
|
78
|
-
projectGuidelines?: string;
|
|
79
|
-
projectReviewInstructions?: string;
|
|
80
|
-
streamOutput?: boolean;
|
|
81
|
-
useColour?: boolean;
|
|
82
|
-
filesystem?: string[] | 'all' | 'read' | 'none';
|
|
83
76
|
customToolsConfig?: CustomToolsConfig;
|
|
84
77
|
requirementsProviderConfig?: Record<string, unknown>;
|
|
85
78
|
contentProviderConfig?: Record<string, unknown>;
|
|
86
79
|
mcpServers?: Record<string, Connection>;
|
|
87
|
-
builtInTools?: string[];
|
|
88
80
|
builtInToolsConfig?: BuiltInToolsConfig;
|
|
89
|
-
tools?: StructuredToolInterface[] | BaseToolkit[] | ServerTool[];
|
|
90
81
|
commands?: {
|
|
91
82
|
pr?: {
|
|
92
83
|
contentProvider?: string;
|
|
@@ -116,6 +107,27 @@ interface BaseGthConfig {
|
|
|
116
107
|
};
|
|
117
108
|
};
|
|
118
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Server tools such as Anthropic Web Search.
|
|
112
|
+
* These tools are meant to be magic objects like
|
|
113
|
+
* `{"type": "web_search_20250305", "name": "web_search", "max_uses": 10}`,
|
|
114
|
+
* AI Provider does the rest of the magic on their side.
|
|
115
|
+
*/
|
|
116
|
+
export interface ServerTool extends Record<string, unknown> {
|
|
117
|
+
type: string;
|
|
118
|
+
name?: string;
|
|
119
|
+
}
|
|
120
|
+
type LangChainHook = (state: StateType<StateDefinition>) => StateType<StateDefinition>;
|
|
121
|
+
type RunnerHook = (runner: GthAgentRunner) => Promise<void>;
|
|
122
|
+
type BeforeMessageHook = (runner: GthAgentRunner, message: Message[], runConfig: RunnableConfig) => Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Raw, unprocessed Gaunt Sloth config.
|
|
125
|
+
*/
|
|
126
|
+
export interface RawGthConfig extends Omit<GthConfig, 'llm'> {
|
|
127
|
+
llm: LLMConfig;
|
|
128
|
+
preModelHook?: LangChainHook | 'skip';
|
|
129
|
+
postModelHook?: LangChainHook | 'skip';
|
|
130
|
+
}
|
|
119
131
|
export type CustomToolsConfig = Record<string, object>;
|
|
120
132
|
export type BuiltInToolsConfig = {
|
|
121
133
|
jira: JiraConfig;
|
|
@@ -170,7 +182,39 @@ export interface CommandLineConfigOverrides {
|
|
|
170
182
|
*/
|
|
171
183
|
verbose?: boolean;
|
|
172
184
|
}
|
|
173
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Default config
|
|
187
|
+
*/
|
|
188
|
+
export declare const DEFAULT_CONFIG: {
|
|
189
|
+
readonly contentProvider: "file";
|
|
190
|
+
readonly requirementsProvider: "file";
|
|
191
|
+
readonly projectGuidelines: ".gsloth.guidelines.md";
|
|
192
|
+
readonly projectReviewInstructions: ".gsloth.review.md";
|
|
193
|
+
readonly filesystem: "read";
|
|
194
|
+
readonly debugLog: false;
|
|
195
|
+
/**
|
|
196
|
+
* Default provider for both requirements and content is GitHub.
|
|
197
|
+
* It needs GitHub CLI (gh).
|
|
198
|
+
*
|
|
199
|
+
* `github` content provider uses `gh pr diff NN` internally. {@link src/providers/ghPrDiffProvider.ts!}
|
|
200
|
+
*
|
|
201
|
+
*
|
|
202
|
+
* `github` requirements provider `gh issue view NN` internally
|
|
203
|
+
*/
|
|
204
|
+
readonly commands: {
|
|
205
|
+
readonly pr: {
|
|
206
|
+
readonly contentProvider: "github";
|
|
207
|
+
readonly requirementsProvider: "github";
|
|
208
|
+
};
|
|
209
|
+
readonly code: {
|
|
210
|
+
readonly filesystem: "all";
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
readonly streamOutput: true;
|
|
214
|
+
readonly useColour: true;
|
|
215
|
+
readonly streamSessionInferenceLog: true;
|
|
216
|
+
readonly canInterruptInferenceWithEsc: true;
|
|
217
|
+
};
|
|
174
218
|
/**
|
|
175
219
|
* Initialize configuration by loading from available config files
|
|
176
220
|
* @returns The loaded GthConfig
|
package/dist/config.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
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
|
+
*/
|
|
1
9
|
import { displayDebug, displayError, displayInfo, displayWarning } from '#src/consoleUtils.js';
|
|
2
10
|
import { importExternalFile, writeFileIfNotExistsWithMessages } from '#src/utils.js';
|
|
3
11
|
import { existsSync, readFileSync } from 'node:fs';
|
|
@@ -14,30 +22,45 @@ export const availableDefaultConfigs = [
|
|
|
14
22
|
'xai',
|
|
15
23
|
'openrouter',
|
|
16
24
|
];
|
|
25
|
+
/**
|
|
26
|
+
* Default config
|
|
27
|
+
*/
|
|
17
28
|
export const DEFAULT_CONFIG = {
|
|
18
|
-
llm: undefined,
|
|
19
29
|
contentProvider: 'file',
|
|
20
30
|
requirementsProvider: 'file',
|
|
21
31
|
projectGuidelines: PROJECT_GUIDELINES,
|
|
22
32
|
projectReviewInstructions: PROJECT_REVIEW_INSTRUCTIONS,
|
|
23
|
-
streamOutput: true,
|
|
24
|
-
useColour: true,
|
|
25
33
|
filesystem: 'read',
|
|
34
|
+
debugLog: false,
|
|
26
35
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
36
|
+
* Default provider for both requirements and content is GitHub.
|
|
37
|
+
* It needs GitHub CLI (gh).
|
|
38
|
+
*
|
|
39
|
+
* `github` content provider uses `gh pr diff NN` internally. {@link src/providers/ghPrDiffProvider.ts!}
|
|
40
|
+
*
|
|
41
|
+
*
|
|
42
|
+
* `github` requirements provider `gh issue view NN` internally
|
|
29
43
|
*/
|
|
30
|
-
debugLog: false,
|
|
31
44
|
commands: {
|
|
32
45
|
pr: {
|
|
33
|
-
contentProvider: 'github',
|
|
34
|
-
requirementsProvider: 'github',
|
|
46
|
+
contentProvider: 'github',
|
|
47
|
+
requirementsProvider: 'github',
|
|
35
48
|
},
|
|
36
49
|
code: {
|
|
37
50
|
filesystem: 'all',
|
|
38
51
|
},
|
|
39
52
|
},
|
|
53
|
+
streamOutput: true,
|
|
54
|
+
useColour: true,
|
|
55
|
+
streamSessionInferenceLog: true,
|
|
56
|
+
canInterruptInferenceWithEsc: true,
|
|
40
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* Needed DEFAULT_CONFIG to be plain const to be picked up by typedoc,
|
|
60
|
+
* this cast here is just for typecheck.
|
|
61
|
+
*/
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
63
|
+
DEFAULT_CONFIG;
|
|
41
64
|
/**
|
|
42
65
|
* Initialize configuration by loading from available config files
|
|
43
66
|
* @returns The loaded GthConfig
|
|
@@ -251,6 +274,9 @@ function mergeConfig(partialConfig, commandLineConfigOverrides) {
|
|
|
251
274
|
* Merge raw with default config
|
|
252
275
|
*/
|
|
253
276
|
function mergeRawConfig(config, llm, commandLineConfigOverrides) {
|
|
277
|
+
if (config.llm?.model) {
|
|
278
|
+
displayInfo(`Model: ${config.llm.model}`);
|
|
279
|
+
}
|
|
254
280
|
return mergeConfig({ ...config, llm }, commandLineConfigOverrides);
|
|
255
281
|
}
|
|
256
282
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,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sD;IAEtD,MAAM,MAAM,GAAG,aAA0B,CAAC;IAC1C,MAAM,YAAY,GAAG;QACnB,GAAG,cAAc;QACjB,GAAG,MAAM;QACT,QAAQ,EAAE,EAAE,GAAG,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,IAAI,EAAE,CAAC,EAAE;KACtE,CAAC;IAEF,IAAI,0BAA0B,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACrD,YAAY,CAAC,GAAG,CAAC,OAAO,GAAG,0BAA0B,CAAC,OAAO,CAAC;IAChE,CAAC;IAED,yCAAyC;IACzC,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAErC,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CACrB,MAAoB,EACpB,GAAkB,EAClB,0BAAsD;IAEtD,IAAI,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC;QACtB,WAAW,CAAC,UAAU,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,WAAW,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE,0BAA0B,CAAC,CAAC;AACrE,CAAC"}
|
package/dist/consoleUtils.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { StatusUpdateCallback } from '#src/core/GthLangChainAgent.js';
|
|
2
|
+
export declare const initSessionLogging: (logFileName: string, enableLogging: boolean) => void;
|
|
3
|
+
export declare const flushSessionLog: () => void;
|
|
4
|
+
export declare const stopSessionLogging: () => void;
|
|
2
5
|
export declare function displayError(message: string): void;
|
|
3
6
|
export declare function displayWarning(message: string): void;
|
|
4
7
|
export declare function displaySuccess(message: string): void;
|
|
@@ -6,4 +9,4 @@ export declare function displayInfo(message: string): void;
|
|
|
6
9
|
export declare function display(message: string): void;
|
|
7
10
|
export declare function formatInputPrompt(message: string): string;
|
|
8
11
|
export declare function displayDebug(message: string | Error | undefined): void;
|
|
9
|
-
export declare const
|
|
12
|
+
export declare const defaultStatusCallback: StatusUpdateCallback;
|
package/dist/consoleUtils.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import * as su from '#src/systemUtils.js';
|
|
2
|
+
import { closeLogStream, initLogStream, stream, writeToLogStream } from '#src/systemUtils.js';
|
|
3
|
+
const loggingState = {
|
|
4
|
+
sessionLogFile: undefined,
|
|
5
|
+
enableSessionLogging: false,
|
|
6
|
+
};
|
|
2
7
|
// ANSI color codes
|
|
3
8
|
const ANSI_COLORS = {
|
|
4
9
|
red: '\x1b[31m',
|
|
@@ -15,19 +20,53 @@ function colorText(text, color) {
|
|
|
15
20
|
}
|
|
16
21
|
return `${ANSI_COLORS[color]}${text}${ANSI_COLORS.reset}`;
|
|
17
22
|
}
|
|
23
|
+
// Stream-based logging function
|
|
24
|
+
const writeToSessionLog = (message) => {
|
|
25
|
+
if (loggingState.enableSessionLogging) {
|
|
26
|
+
// Strip ANSI color codes before logging to file
|
|
27
|
+
const cleanMessage = message.replace(/\x1b\[[0-9;]*m/g, '');
|
|
28
|
+
writeToLogStream(cleanMessage);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
// Public functions for session logging management
|
|
32
|
+
export const initSessionLogging = (logFileName, enableLogging) => {
|
|
33
|
+
loggingState.sessionLogFile = enableLogging ? logFileName : undefined;
|
|
34
|
+
loggingState.enableSessionLogging = enableLogging;
|
|
35
|
+
if (enableLogging && logFileName) {
|
|
36
|
+
initLogStream(logFileName);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const flushSessionLog = () => {
|
|
40
|
+
// Streams auto-flush, so this is now a no-op for API compatibility
|
|
41
|
+
// Could potentially force flush if needed in the future
|
|
42
|
+
};
|
|
43
|
+
export const stopSessionLogging = () => {
|
|
44
|
+
closeLogStream();
|
|
45
|
+
loggingState.sessionLogFile = undefined;
|
|
46
|
+
loggingState.enableSessionLogging = false;
|
|
47
|
+
};
|
|
18
48
|
export function displayError(message) {
|
|
19
|
-
|
|
49
|
+
const coloredMessage = colorText(message, 'red');
|
|
50
|
+
writeToSessionLog(message + '\n');
|
|
51
|
+
su.log(coloredMessage);
|
|
20
52
|
}
|
|
21
53
|
export function displayWarning(message) {
|
|
22
|
-
|
|
54
|
+
const coloredMessage = colorText(message, 'yellow');
|
|
55
|
+
writeToSessionLog(message + '\n');
|
|
56
|
+
su.warn(coloredMessage);
|
|
23
57
|
}
|
|
24
58
|
export function displaySuccess(message) {
|
|
25
|
-
|
|
59
|
+
const coloredMessage = colorText(message, 'green');
|
|
60
|
+
writeToSessionLog(message + '\n');
|
|
61
|
+
su.log(coloredMessage);
|
|
26
62
|
}
|
|
27
63
|
export function displayInfo(message) {
|
|
28
|
-
|
|
64
|
+
const coloredMessage = colorText(message, 'dim');
|
|
65
|
+
writeToSessionLog(message + '\n');
|
|
66
|
+
su.info(coloredMessage);
|
|
29
67
|
}
|
|
30
68
|
export function display(message) {
|
|
69
|
+
writeToSessionLog(message + '\n');
|
|
31
70
|
su.log(message);
|
|
32
71
|
}
|
|
33
72
|
export function formatInputPrompt(message) {
|
|
@@ -36,14 +75,17 @@ export function formatInputPrompt(message) {
|
|
|
36
75
|
export function displayDebug(message) {
|
|
37
76
|
// TODO make it controlled by config
|
|
38
77
|
if (message instanceof Error) {
|
|
39
|
-
|
|
78
|
+
const stackTrace = message.stack || '';
|
|
79
|
+
writeToSessionLog(stackTrace + '\n');
|
|
80
|
+
su.debug(stackTrace);
|
|
40
81
|
}
|
|
41
82
|
else if (message !== undefined) {
|
|
83
|
+
writeToSessionLog(message + '\n');
|
|
42
84
|
su.debug(message);
|
|
43
85
|
}
|
|
44
86
|
}
|
|
45
87
|
// Create status update callback
|
|
46
|
-
export const
|
|
88
|
+
export const defaultStatusCallback = (level, message) => {
|
|
47
89
|
switch (level) {
|
|
48
90
|
case 'info':
|
|
49
91
|
displayInfo(message);
|
|
@@ -64,7 +106,8 @@ export const defaultStatusCallbacks = (level, message) => {
|
|
|
64
106
|
display(message);
|
|
65
107
|
break;
|
|
66
108
|
case 'stream':
|
|
67
|
-
|
|
109
|
+
writeToSessionLog(message);
|
|
110
|
+
stream(message);
|
|
68
111
|
break;
|
|
69
112
|
}
|
|
70
113
|
};
|
package/dist/consoleUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consoleUtils.js","sourceRoot":"","sources":["../src/consoleUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"consoleUtils.js","sourceRoot":"","sources":["../src/consoleUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQ9F,MAAM,YAAY,GAAiB;IACjC,cAAc,EAAE,SAAS;IACzB,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,mBAAmB;AACnB,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,UAAU;IACf,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU;IACnB,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF,qCAAqC;AACrC,SAAS,SAAS,CAAC,IAAY,EAAE,KAA+B;IAC9D,IAAI,CAAC,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC;AAC5D,CAAC;AAED,gCAAgC;AAChC,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAQ,EAAE;IAClD,IAAI,YAAY,CAAC,oBAAoB,EAAE,CAAC;QACtC,gDAAgD;QAChD,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE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C,CAAC;YACxB,MAAM;QACR,KAAK,OAAO;YACV,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM;QACR,KAAK,SAAS;YACZ,cAAc,CAAC,OAAO,CAAC,CAAC;YACxB,MAAM;QACR,KAAK,OAAO;YACV,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM;QACR,KAAK,SAAS;YACZ,OAAO,CAAC,OAAO,CAAC,CAAC;YACjB,MAAM;QACR,KAAK,QAAQ;YACX,iBAAiB,CAAC,OAAO,CAAC,CAAC;YAC3B,MAAM,CAAC,OAAO,CAAC,CAAC;YAChB,MAAM;IACV,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { GthAgentInterface, GthCommand } from '#src/core/types.js';
|
|
|
5
5
|
import { StatusUpdateCallback } from '#src/core/GthLangChainAgent.js';
|
|
6
6
|
/**
|
|
7
7
|
* Agent simplifies interaction with LLM and reduces it to calling a few methods
|
|
8
|
-
* {@link #init} and {@link #processMessages}.
|
|
8
|
+
* {@link GthAgentRunner#init} and {@link GthAgentRunner#processMessages}.
|
|
9
9
|
*/
|
|
10
10
|
export declare class GthAgentRunner {
|
|
11
11
|
private statusUpdate;
|
|
@@ -4,7 +4,7 @@ import { getNewRunnableConfig } from '#src/llmUtils.js';
|
|
|
4
4
|
import { initDebugLogging, debugLog, debugLogError, debugLogObject } from '#src/debugUtils.js';
|
|
5
5
|
/**
|
|
6
6
|
* Agent simplifies interaction with LLM and reduces it to calling a few methods
|
|
7
|
-
* {@link #init} and {@link #processMessages}.
|
|
7
|
+
* {@link GthAgentRunner#init} and {@link GthAgentRunner#processMessages}.
|
|
8
8
|
*/
|
|
9
9
|
export class GthAgentRunner {
|
|
10
10
|
statusUpdate;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { GthConfig } from '#src/config.js';
|
|
2
|
-
import type { Connection } from '@langchain/mcp-adapters';
|
|
3
|
-
import { MultiServerMCPClient } from '@langchain/mcp-adapters';
|
|
4
|
-
import { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
5
2
|
import { GthAgentInterface, GthCommand, StatusLevel } from '#src/core/types.js';
|
|
6
|
-
import { IterableReadableStream } from '@langchain/core/utils/stream';
|
|
7
|
-
import { RunnableConfig } from '@langchain/core/runnables';
|
|
8
3
|
import type { Message } from '#src/modules/types.js';
|
|
4
|
+
import { RunnableConfig } from '@langchain/core/runnables';
|
|
5
|
+
import { IterableReadableStream } from '@langchain/core/utils/stream';
|
|
6
|
+
import { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
7
|
+
import type { Connection } from '@langchain/mcp-adapters';
|
|
8
|
+
import { MultiServerMCPClient } from '@langchain/mcp-adapters';
|
|
9
9
|
export type StatusUpdateCallback = (level: StatusLevel, message: string) => void;
|
|
10
10
|
export declare class GthLangChainAgent implements GthAgentInterface {
|
|
11
11
|
private statusUpdate;
|