gaunt-sloth-assistant 0.7.0 → 0.7.2
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.config_.json +7 -0
- package/.gsloth.config_.mjs +15 -0
- package/README.md +162 -153
- package/assets/release-notes/v0_7_2.md +14 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +3 -3
- package/dist/config.js.map +1 -1
- package/dist/core/Invocation.d.ts +3 -2
- package/dist/core/Invocation.js +36 -31
- package/dist/core/Invocation.js.map +1 -1
- package/dist/core/types.d.ts +1 -0
- package/dist/{configs → presets}/anthropic.js +2 -1
- package/dist/{configs → presets}/anthropic.js.map +1 -1
- package/dist/presets/deepseek.d.ts +4 -0
- package/dist/presets/deepseek.js +33 -0
- package/dist/presets/deepseek.js.map +1 -0
- package/dist/{configs → presets}/fake.js.map +1 -1
- package/dist/{configs → presets}/groq.js +4 -5
- package/dist/presets/groq.js.map +1 -0
- package/dist/{configs → presets}/vertexai.js +2 -3
- package/dist/presets/vertexai.js.map +1 -0
- package/dist/tools/GthFileSystemToolkit.js +1 -1
- package/dist/tools/GthFileSystemToolkit.js.map +1 -1
- package/docs/CONFIGURATION.md +468 -437
- package/it.js +15 -0
- package/package.json +13 -14
- package/src/config.ts +3 -3
- package/src/core/Invocation.ts +43 -38
- package/src/core/types.ts +1 -0
- package/src/{configs → presets}/anthropic.ts +4 -1
- package/src/presets/deepseek.ts +46 -0
- package/src/{configs → presets}/groq.ts +5 -6
- package/src/{configs → presets}/vertexai.ts +2 -3
- package/src/tools/GthFileSystemToolkit.ts +1 -1
- package/vitest-it.config.ts +1 -1
- package/dist/configs/groq.js.map +0 -1
- package/dist/configs/vertexai.js.map +0 -1
- /package/dist/{configs → presets}/anthropic.d.ts +0 -0
- /package/dist/{configs → presets}/fake.d.ts +0 -0
- /package/dist/{configs → presets}/fake.js +0 -0
- /package/dist/{configs → presets}/groq.d.ts +0 -0
- /package/dist/{configs → presets}/vertexai.d.ts +0 -0
- /package/src/{configs → presets}/fake.ts +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { statusUpdate } from './dist/tools/statusUpdate.js';
|
|
2
|
+
import GthFileSystemToolkit from './dist/tools/GthFileSystemToolkit.js';
|
|
3
|
+
|
|
4
|
+
export async function configure() {
|
|
5
|
+
const deepseek = await import('@langchain/deepseek');
|
|
6
|
+
return {
|
|
7
|
+
llm: new deepseek.ChatDeepSeek({
|
|
8
|
+
model: 'deepseek-reasoner',
|
|
9
|
+
}),
|
|
10
|
+
tools: [
|
|
11
|
+
statusUpdate,
|
|
12
|
+
new GthFileSystemToolkit()
|
|
13
|
+
]
|
|
14
|
+
};
|
|
15
|
+
}
|
package/README.md
CHANGED
|
@@ -1,153 +1,162 @@
|
|
|
1
|
-
# Gaunt Sloth Assistant
|
|
2
|
-
[](https://github.com/andruhon/gaunt-sloth-assistant/actions/workflows/ci.yml)
|
|
3
|
-
|
|
4
|
-
Gaunt GSloth Assistant is a lightweight **command line AI assistant**
|
|
5
|
-
built with TypeScript (JavaScript) and distributed via NPM with minimum dependencies.
|
|
6
|
-
|
|
7
|
-

|
|
8
|
-
|
|
9
|
-
Based on [LangChain.js](https://github.com/langchain-ai/langchainjs)
|
|
10
|
-
|
|
11
|
-
## Why?
|
|
12
|
-
|
|
13
|
-
There are many Open Source command line AI assistants available, such as Aider and Goose;
|
|
14
|
-
there are great non-open source options such as Claude Code.
|
|
15
|
-
|
|
16
|
-
Gaunt Sloth does not intend to be your "Daily Driver" and is not aiming to replace your Cursor.
|
|
17
|
-
What it promises is that it is small, extendable, cross-platform and can itself be a dependency in your project.
|
|
18
|
-
|
|
19
|
-
The GSloth was initially built as a code review tool, fetching PR contents and Jira contents before feeding them to
|
|
20
|
-
the LLM, but we ourselves found many more use cases which we initially did not anticipate; for example,
|
|
21
|
-
we may have it as a dependency in an MCP project, allowing us to quickly spin it up to simulate or test some use cases.
|
|
22
|
-
|
|
23
|
-
The promise of Gaunt Sloth:
|
|
24
|
-
|
|
25
|
-
- **Minimum dependencies**. Ideally, we aim to only have CommanderJS and some packages from LangChainJS and LangGraphJS.
|
|
26
|
-
- **Extensibility**. Feel free to write some JS and create your Tool, Provider or connect to the MCP server of your choice.
|
|
27
|
-
- **No vendor lock-in**. Just BYO API keys.
|
|
28
|
-
- **Easy installation via NPM**.
|
|
29
|
-
- **All prompts are editable** via markdown files.
|
|
30
|
-
- **No UI**. Command Line only, with intent to be used as a dependency, potentially in your build pipeline.
|
|
31
|
-
Of course, you can use Gaunt Sloth as a dependency and hook your own UI.
|
|
32
|
-
|
|
33
|
-
## What GSloth does:
|
|
34
|
-
|
|
35
|
-
- Reviews code;
|
|
36
|
-
- Suggests bug fixes;
|
|
37
|
-
- Explains provided code
|
|
38
|
-
- Reviews Diffs provided with pipe (|);
|
|
39
|
-
- You can ask GSloth to review your own code before committing (`git --no-pager diff | gsloth review`).
|
|
40
|
-
- Reviews Pull Requests (PRs) (`gsloth pr 42`);
|
|
41
|
-
- Fetches descriptions (requirements) from Github issue or Jira (`gsloth pr 42 12`);;
|
|
42
|
-
- Answers questions about provided code;
|
|
43
|
-
- Writes code;
|
|
44
|
-
- Connects to MCP server;
|
|
45
|
-
- Saves all responses in .md file in the project directory;
|
|
46
|
-
- Anything else you need, when combined with other command line tools.
|
|
47
|
-
|
|
48
|
-
### To make GSloth work, you need an **API key** from some AI provider, such as:
|
|
49
|
-
|
|
50
|
-
- Google Vertex AI;
|
|
51
|
-
- Anthropic;
|
|
52
|
-
- Groq
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- **`
|
|
66
|
-
- **`
|
|
67
|
-
- **`
|
|
68
|
-
- **`
|
|
69
|
-
- **`
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
gsloth
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
gcloud auth
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
1
|
+
# Gaunt Sloth Assistant
|
|
2
|
+
[](https://github.com/andruhon/gaunt-sloth-assistant/actions/workflows/ci.yml)
|
|
3
|
+
|
|
4
|
+
Gaunt GSloth Assistant is a lightweight **command line AI assistant**
|
|
5
|
+
built with TypeScript (JavaScript) and distributed via NPM with minimum dependencies.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
Based on [LangChain.js](https://github.com/langchain-ai/langchainjs)
|
|
10
|
+
|
|
11
|
+
## Why?
|
|
12
|
+
|
|
13
|
+
There are many Open Source command line AI assistants available, such as Aider and Goose;
|
|
14
|
+
there are great non-open source options such as Claude Code.
|
|
15
|
+
|
|
16
|
+
Gaunt Sloth does not intend to be your "Daily Driver" and is not aiming to replace your Cursor.
|
|
17
|
+
What it promises is that it is small, extendable, cross-platform and can itself be a dependency in your project.
|
|
18
|
+
|
|
19
|
+
The GSloth was initially built as a code review tool, fetching PR contents and Jira contents before feeding them to
|
|
20
|
+
the LLM, but we ourselves found many more use cases which we initially did not anticipate; for example,
|
|
21
|
+
we may have it as a dependency in an MCP project, allowing us to quickly spin it up to simulate or test some use cases.
|
|
22
|
+
|
|
23
|
+
The promise of Gaunt Sloth:
|
|
24
|
+
|
|
25
|
+
- **Minimum dependencies**. Ideally, we aim to only have CommanderJS and some packages from LangChainJS and LangGraphJS.
|
|
26
|
+
- **Extensibility**. Feel free to write some JS and create your Tool, Provider or connect to the MCP server of your choice.
|
|
27
|
+
- **No vendor lock-in**. Just BYO API keys.
|
|
28
|
+
- **Easy installation via NPM**.
|
|
29
|
+
- **All prompts are editable** via markdown files.
|
|
30
|
+
- **No UI**. Command Line only, with intent to be used as a dependency, potentially in your build pipeline.
|
|
31
|
+
Of course, you can use Gaunt Sloth as a dependency and hook your own UI.
|
|
32
|
+
|
|
33
|
+
## What GSloth does:
|
|
34
|
+
|
|
35
|
+
- Reviews code;
|
|
36
|
+
- Suggests bug fixes;
|
|
37
|
+
- Explains provided code
|
|
38
|
+
- Reviews Diffs provided with pipe (|);
|
|
39
|
+
- You can ask GSloth to review your own code before committing (`git --no-pager diff | gsloth review`).
|
|
40
|
+
- Reviews Pull Requests (PRs) (`gsloth pr 42`);
|
|
41
|
+
- Fetches descriptions (requirements) from Github issue or Jira (`gsloth pr 42 12`);;
|
|
42
|
+
- Answers questions about provided code;
|
|
43
|
+
- Writes code;
|
|
44
|
+
- Connects to MCP server;
|
|
45
|
+
- Saves all responses in .md file in the project directory;
|
|
46
|
+
- Anything else you need, when combined with other command line tools.
|
|
47
|
+
|
|
48
|
+
### To make GSloth work, you need an **API key** from some AI provider, such as:
|
|
49
|
+
|
|
50
|
+
- Google Vertex AI;
|
|
51
|
+
- Anthropic;
|
|
52
|
+
- Groq;
|
|
53
|
+
- DeepSeek.
|
|
54
|
+
|
|
55
|
+
`*` Any other provider supported by LangChain.JS should also work with [JS config](./docs/CONFIGURATION.md#JavaScript-Configuration).
|
|
56
|
+
|
|
57
|
+
## Commands Overview
|
|
58
|
+
|
|
59
|
+
`gth` and `gsloth` commands are used interchangeably, both `gsloth pr 42` and `gth pr 42` do the same thing.
|
|
60
|
+
|
|
61
|
+
For detailed information about all commands, see [docs/COMMANDS.md](./docs/COMMANDS.md).
|
|
62
|
+
|
|
63
|
+
### Available Commands:
|
|
64
|
+
|
|
65
|
+
- **`init`** - Initialize Gaunt Sloth in your project with a specific AI provider
|
|
66
|
+
- **`pr`** - ⚠️ This feature requires GitHub CLI to be installed. Review pull requests with optional requirement integration (GitHub issues or Jira).
|
|
67
|
+
- **`review`** - Review any diff or content from various sources
|
|
68
|
+
- **`ask`** - Ask questions about code or programming topics
|
|
69
|
+
- **`chat`** - Start an interactive chat session
|
|
70
|
+
- **`code`** - Write code interactively with full project context
|
|
71
|
+
|
|
72
|
+
### Quick Examples:
|
|
73
|
+
|
|
74
|
+
**Initialize project:**
|
|
75
|
+
```shell
|
|
76
|
+
gsloth init anthropic
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Review PR with requirements:**
|
|
80
|
+
```shell
|
|
81
|
+
gsloth pr 42 23 # Review PR #42 with GitHub issue #23
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Review local changes:**
|
|
85
|
+
```shell
|
|
86
|
+
git --no-pager diff | gsloth review
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Ask questions:**
|
|
90
|
+
```shell
|
|
91
|
+
gsloth ask "What does this function do?" -f utils.js
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Interactive sessions:**
|
|
95
|
+
```shell
|
|
96
|
+
gsloth chat # Start chat session
|
|
97
|
+
gsloth code # Start coding session
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Installation
|
|
101
|
+
|
|
102
|
+
Tested with Node 22 LTS.
|
|
103
|
+
|
|
104
|
+
### NPM
|
|
105
|
+
```shell
|
|
106
|
+
npm install gaunt-sloth-assistant -g
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
> Gaunt Sloth currently only functions from the directory which has a configuration file (`.gsloth.config.js`, `.gsloth.config.json`, or `.gsloth.config.mjs`) and `.gsloth.guidelines.md`.
|
|
112
|
+
> Global configuration to invoke gsloth anywhere is in [ROADMAP](ROADMAP.md).
|
|
113
|
+
|
|
114
|
+
Configuration can be created with `gsloth init [vendor]` command.
|
|
115
|
+
Currently, vertexai, anthropic, groq and deepseek can be configured with `gsloth init [vendor]`.
|
|
116
|
+
|
|
117
|
+
More detailed information on configuration can be found in [CONFIGURATION.md](./docs/CONFIGURATION.md)
|
|
118
|
+
|
|
119
|
+
### Google Vertex AI
|
|
120
|
+
```shell
|
|
121
|
+
cd ./your-project
|
|
122
|
+
gsloth init vertexai
|
|
123
|
+
gcloud auth login
|
|
124
|
+
gcloud auth application-default login
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Anthropic
|
|
128
|
+
|
|
129
|
+
```shell
|
|
130
|
+
cd ./your-project
|
|
131
|
+
gsloth init anthropic
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Make sure you either define `ANTHROPIC_API_KEY` environment variable or edit your configuration file and set up your key.
|
|
135
|
+
|
|
136
|
+
### Groq
|
|
137
|
+
```shell
|
|
138
|
+
cd ./your-project
|
|
139
|
+
gsloth init groq
|
|
140
|
+
```
|
|
141
|
+
Make sure you either define `GROQ_API_KEY` environment variable or edit your configuration file and set up your key.
|
|
142
|
+
|
|
143
|
+
### DeepSeek
|
|
144
|
+
```shell
|
|
145
|
+
cd ./your-project
|
|
146
|
+
gsloth init deepseek
|
|
147
|
+
```
|
|
148
|
+
Make sure you either define `DEEPSEEK_API_KEY` environment variable or edit your configuration file and set up your key.
|
|
149
|
+
It is recommended to obtain API key from DeepSeek official website rather than from a reseller.
|
|
150
|
+
|
|
151
|
+
### Other AI providers
|
|
152
|
+
Any other AI provider supported by Langchain.js can be configured with js [Config](./docs/CONFIGURATION.md).
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
Contributors are needed! Feel free to create a PR.
|
|
156
|
+
If you are not sure where to start, look for issues with a "good first issue" label.
|
|
157
|
+
|
|
158
|
+
## Building from repo
|
|
159
|
+
See [DEVELOPMENT.md](./docs/DEVELOPMENT.md)
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
License is [MIT](https://opensource.org/license/mit). See [LICENSE](LICENSE)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# v0.7.2 DeepSeek Preset
|
|
2
|
+
|
|
3
|
+
## New Features
|
|
4
|
+
|
|
5
|
+
### DeepSeek Support
|
|
6
|
+
- Added DeepSeek model preset and necessary dependencies
|
|
7
|
+
|
|
8
|
+
## Dependency Updates
|
|
9
|
+
- Updated LangChain, LangGraph and other dependencies
|
|
10
|
+
|
|
11
|
+
## Other Changes
|
|
12
|
+
- Updated documentation to include DeepSeek preset
|
|
13
|
+
|
|
14
|
+
> *Note: This release note was generated by DeepSeek Reasoner. For more details, see the [discussion thread](https://github.com/andruhon/gaunt-sloth-assistant/discussions/80).*
|
package/dist/config.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface LLMConfig extends Record<string, unknown> {
|
|
|
57
57
|
type: string;
|
|
58
58
|
model: string;
|
|
59
59
|
}
|
|
60
|
-
export declare const availableDefaultConfigs: readonly ["vertexai", "anthropic", "groq"];
|
|
60
|
+
export declare const availableDefaultConfigs: readonly ["vertexai", "anthropic", "groq", "deepseek"];
|
|
61
61
|
export type ConfigType = (typeof availableDefaultConfigs)[number];
|
|
62
62
|
export declare const DEFAULT_CONFIG: Partial<SlothConfig>;
|
|
63
63
|
/**
|
package/dist/config.js
CHANGED
|
@@ -6,7 +6,7 @@ import { getGslothConfigReadPath, getGslothConfigWritePath } from '#src/filePath
|
|
|
6
6
|
import { PROJECT_GUIDELINES, PROJECT_REVIEW_INSTRUCTIONS, USER_PROJECT_CONFIG_JS, USER_PROJECT_CONFIG_JSON, USER_PROJECT_CONFIG_MJS, } from '#src/constants.js';
|
|
7
7
|
import { getCurrentDir } from '#src/systemUtils.js';
|
|
8
8
|
import GthFileSystemToolkit from '#src/tools/GthFileSystemToolkit.js';
|
|
9
|
-
export const availableDefaultConfigs = ['vertexai', 'anthropic', 'groq'];
|
|
9
|
+
export const availableDefaultConfigs = ['vertexai', 'anthropic', 'groq', 'deepseek'];
|
|
10
10
|
export const DEFAULT_CONFIG = {
|
|
11
11
|
llm: undefined,
|
|
12
12
|
contentProvider: 'file',
|
|
@@ -124,7 +124,7 @@ export async function tryJsonConfig(jsonConfig) {
|
|
|
124
124
|
// Get the configuration for the specific LLM type
|
|
125
125
|
const llmConfig = jsonConfig.llm;
|
|
126
126
|
// Import the appropriate config module
|
|
127
|
-
const configModule = await import(`./
|
|
127
|
+
const configModule = await import(`./presets/${llmType}.js`);
|
|
128
128
|
if (configModule.processJsonConfig) {
|
|
129
129
|
const llm = (await configModule.processJsonConfig(llmConfig));
|
|
130
130
|
return mergeRawConfig(jsonConfig, llm);
|
|
@@ -161,7 +161,7 @@ export async function createProjectConfig(configType) {
|
|
|
161
161
|
writeProjectReviewPreamble();
|
|
162
162
|
displayWarning(`Make sure you add as much detail as possible to your ${PROJECT_GUIDELINES}.\n`);
|
|
163
163
|
displayInfo(`Creating project config for ${configType}`);
|
|
164
|
-
const vendorConfig = await import(`./
|
|
164
|
+
const vendorConfig = await import(`./presets/${configType}.js`);
|
|
165
165
|
vendorConfig.init(getGslothConfigWritePath(USER_PROJECT_CONFIG_JSON));
|
|
166
166
|
}
|
|
167
167
|
export function writeProjectReviewPreamble() {
|
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,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAG1F,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,oBAAoB,MAAM,oCAAoC,CAAC;AA8DtE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,MAAM,CAAU,CAAC;
|
|
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,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAG1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CAAC,CAAC;IAEH,0BAA0B;IAC1B,MAAM,eAAe,GAAG,CAAC,GAAG,YAAY,EAAE,GAAG,kBAAkB,CAAC,CAAC;IACjE,OAAO,eAAe,CAAC,MAAM,CAC3B,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAC3E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,mBAAuD,MAAM;IAE7D,OAAO,CAAC,GAAG,qBAAqB,CAAC,IAAI,oBAAoB,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -4,7 +4,7 @@ import type { Connection } from '@langchain/mcp-adapters';
|
|
|
4
4
|
import { MultiServerMCPClient } from '@langchain/mcp-adapters';
|
|
5
5
|
import { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
6
6
|
import { type RunnableConfig } from '@langchain/core/runnables';
|
|
7
|
-
import { StatusLevel } from '#src/core/types.js';
|
|
7
|
+
import { GthCommand, StatusLevel } from '#src/core/types.js';
|
|
8
8
|
export type StatusUpdateCallback = (level: StatusLevel, message: string) => void;
|
|
9
9
|
export declare class Invocation {
|
|
10
10
|
private statusUpdate;
|
|
@@ -14,7 +14,8 @@ export declare class Invocation {
|
|
|
14
14
|
private config;
|
|
15
15
|
constructor(statusUpdate: StatusUpdateCallback);
|
|
16
16
|
setVerbose(verbose: boolean): void;
|
|
17
|
-
init(command:
|
|
17
|
+
init(command: GthCommand | undefined, config: SlothConfig, checkpointSaver?: BaseCheckpointSaver | undefined): Promise<void>;
|
|
18
|
+
getEffectiveConfig(config: SlothConfig, command: GthCommand | undefined): SlothConfig;
|
|
18
19
|
invoke(messages: Message[], runConfig?: RunnableConfig): Promise<string>;
|
|
19
20
|
cleanup(): Promise<void>;
|
|
20
21
|
/**
|
package/dist/core/Invocation.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { isAIMessage } from '@langchain/core/messages';
|
|
2
|
+
import { getDefaultTools } from '#src/config.js';
|
|
2
3
|
import { MultiServerMCPClient } from '@langchain/mcp-adapters';
|
|
3
4
|
import { createReactAgent } from '@langchain/langgraph/prebuilt';
|
|
4
|
-
import { ProgressIndicator } from '#src/utils.js';
|
|
5
|
-
import { formatToolCalls } from '#src/utils.js';
|
|
6
|
-
import { getDefaultTools } from '#src/config.js';
|
|
5
|
+
import { formatToolCalls, ProgressIndicator } from '#src/utils.js';
|
|
7
6
|
export class Invocation {
|
|
8
7
|
statusUpdate;
|
|
9
8
|
verbose = false;
|
|
@@ -22,20 +21,12 @@ export class Invocation {
|
|
|
22
21
|
config.llm.verbose = true;
|
|
23
22
|
}
|
|
24
23
|
// Merge command-specific filesystem config if provided
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
effectiveConfig = {
|
|
28
|
-
...config,
|
|
29
|
-
filesystem: config.commands[command].filesystem,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
this.config = effectiveConfig;
|
|
33
|
-
this.mcpClient = this.getMcpClient(effectiveConfig);
|
|
24
|
+
this.config = this.getEffectiveConfig(config, command);
|
|
25
|
+
this.mcpClient = this.getMcpClient(this.config);
|
|
34
26
|
// Get default filesystem tools (filtered based on config)
|
|
35
|
-
const defaultTools = getDefaultTools(
|
|
27
|
+
const defaultTools = getDefaultTools(this.config.filesystem || 'none');
|
|
36
28
|
// Get user config tools
|
|
37
|
-
const
|
|
38
|
-
const flattenedConfigTools = this.extractAndFlattenTools(configTools);
|
|
29
|
+
const flattenedConfigTools = this.extractAndFlattenTools(this.config.tools || []);
|
|
39
30
|
// Get MCP tools
|
|
40
31
|
const mcpTools = (await this.mcpClient?.getTools()) ?? [];
|
|
41
32
|
// Combine all tools
|
|
@@ -49,11 +40,23 @@ export class Invocation {
|
|
|
49
40
|
}
|
|
50
41
|
// Create the React agent
|
|
51
42
|
this.agent = createReactAgent({
|
|
52
|
-
llm: config.llm,
|
|
43
|
+
llm: this.config.llm,
|
|
53
44
|
tools,
|
|
54
45
|
checkpointSaver,
|
|
55
46
|
});
|
|
56
47
|
}
|
|
48
|
+
getEffectiveConfig(config, command) {
|
|
49
|
+
const supportsTools = !!config.llm.bindTools;
|
|
50
|
+
if (!supportsTools) {
|
|
51
|
+
this.statusUpdate('warning', 'Model does not seem to support tools.');
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
...config,
|
|
55
|
+
filesystem: command && config.commands?.[command]?.filesystem !== undefined
|
|
56
|
+
? config.commands[command].filesystem
|
|
57
|
+
: config.filesystem,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
57
60
|
async invoke(messages, runConfig) {
|
|
58
61
|
if (!this.agent || !this.config) {
|
|
59
62
|
throw new Error('Invocation not initialized. Call init() first.');
|
|
@@ -61,7 +64,23 @@ export class Invocation {
|
|
|
61
64
|
// Run the agent
|
|
62
65
|
try {
|
|
63
66
|
const output = { aiMessage: '' };
|
|
64
|
-
if (
|
|
67
|
+
if (this.config.streamOutput) {
|
|
68
|
+
// Streaming output
|
|
69
|
+
this.statusUpdate('info', '\nThinking...\n');
|
|
70
|
+
const stream = await this.agent.stream({ messages }, { ...runConfig, streamMode: 'messages' });
|
|
71
|
+
for await (const [chunk, _metadata] of stream) {
|
|
72
|
+
if (isAIMessage(chunk)) {
|
|
73
|
+
this.statusUpdate('stream', chunk.text);
|
|
74
|
+
output.aiMessage += chunk.text;
|
|
75
|
+
const toolCalls = chunk.tool_calls?.filter((tc) => tc.name);
|
|
76
|
+
if (toolCalls && toolCalls.length > 0) {
|
|
77
|
+
this.statusUpdate('info', `\nUsed tools: ${formatToolCalls(toolCalls)}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// Not streaming output
|
|
65
84
|
const progress = new ProgressIndicator('Thinking.');
|
|
66
85
|
try {
|
|
67
86
|
const response = await this.agent.invoke({ messages }, runConfig);
|
|
@@ -82,20 +101,6 @@ export class Invocation {
|
|
|
82
101
|
}
|
|
83
102
|
this.statusUpdate('display', output.aiMessage);
|
|
84
103
|
}
|
|
85
|
-
else {
|
|
86
|
-
this.statusUpdate('info', '\nThinking...\n');
|
|
87
|
-
const stream = await this.agent.stream({ messages }, { ...runConfig, streamMode: 'messages' });
|
|
88
|
-
for await (const [chunk, _metadata] of stream) {
|
|
89
|
-
if (isAIMessage(chunk)) {
|
|
90
|
-
this.statusUpdate('stream', chunk.text);
|
|
91
|
-
output.aiMessage += chunk.text;
|
|
92
|
-
const toolCalls = chunk.tool_calls?.filter((tc) => tc.name);
|
|
93
|
-
if (toolCalls && toolCalls.length > 0) {
|
|
94
|
-
this.statusUpdate('info', `Used tools: ${formatToolCalls(toolCalls)}`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
104
|
return output.aiMessage;
|
|
100
105
|
}
|
|
101
106
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Invocation.js","sourceRoot":"","sources":["../../src/core/Invocation.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,WAAW,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"Invocation.js","sourceRoot":"","sources":["../../src/core/Invocation.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAe,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAQnE,MAAM,OAAO,UAAU;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F"}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export function init(configFileName) {
|
|
|
27
27
|
throw new Error('Only JSON config is supported.');
|
|
28
28
|
}
|
|
29
29
|
writeFileIfNotExistsWithMessages(configFileName, jsonContent);
|
|
30
|
-
displayWarning(`You need to update your ${configFileName} to add your Anthropic API key
|
|
30
|
+
displayWarning(`You need to update your ${configFileName} to add your Anthropic API key, ` +
|
|
31
|
+
'or define ANTHROPIC_API_KEY environment variable.');
|
|
31
32
|
}
|
|
32
33
|
//# sourceMappingURL=anthropic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/presets/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAOjE,oEAAoE;AACpE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAA+C;IAE/C,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;IACvD,wEAAwE;IACxE,MAAM,eAAe,GAAG,GAAG,CAAC,iBAAiB,IAAI,SAAS,CAAC,MAAM,CAAC;IAClE,OAAO,IAAI,SAAS,CAAC,aAAa,CAAC;QACjC,GAAG,SAAS;QACZ,MAAM,EAAE,eAAe;QACvB,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,0BAA0B;KACrD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,WAAW,GAAG;;;;;EAKlB,CAAC;AAEH,MAAM,UAAU,IAAI,CAAC,cAAsB;IACzC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAEtC,yDAAyD;IACzD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,gCAAgC,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAC9D,cAAc,CACZ,2BAA2B,cAAc,kCAAkC;QACzE,mDAAmD,CACtD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseChatModel, BaseChatModelParams } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import { ChatDeepSeekInput } from '@langchain/deepseek';
|
|
3
|
+
export declare function processJsonConfig(llmConfig: ChatDeepSeekInput & BaseChatModelParams): Promise<BaseChatModel>;
|
|
4
|
+
export declare function init(configFileName: string): void;
|