gaunt-sloth-assistant 0.8.4 → 0.8.5
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 +0 -0
- package/.gsloth.chat.md +0 -0
- package/.gsloth.code.md +0 -0
- package/.gsloth.config_.json +0 -0
- package/.gsloth.config_.mjs +0 -0
- package/.gsloth.config_claude.mjs +0 -0
- package/.gsloth.config_vertex.json +0 -0
- package/.gsloth.guidelines.md +0 -0
- package/.gsloth.review.md +0 -0
- package/.gsloth.system.md +0 -0
- package/.prettierrc.json +0 -0
- package/LICENSE +0 -0
- package/README.md +19 -0
- package/assets/gaunt-sloth-logo.png +0 -0
- package/assets/release-notes/RELEASE-NOTES-HOWTO.md +12 -0
- package/assets/release-notes/v0_4_0.md +0 -0
- package/assets/release-notes/v0_5_0.md +0 -0
- package/assets/release-notes/v0_5_1.md +0 -0
- package/assets/release-notes/v0_5_2.md +0 -0
- package/assets/release-notes/v0_5_3.md +0 -0
- package/assets/release-notes/v0_6_0.md +0 -0
- package/assets/release-notes/v0_6_2.md +0 -0
- package/assets/release-notes/v0_6_4.md +0 -0
- package/assets/release-notes/v0_6_5.md +0 -0
- package/assets/release-notes/v0_7_0.md +0 -0
- package/assets/release-notes/v0_7_2.md +0 -0
- package/assets/release-notes/v0_7_3.md +0 -0
- package/assets/release-notes/v0_8_0.md +0 -0
- package/assets/release-notes/v0_8_2.md +0 -0
- package/assets/release-notes/v0_8_5.md +12 -0
- package/dist/builtInToolsConfig.d.ts +0 -0
- package/dist/builtInToolsConfig.js +0 -0
- package/dist/builtInToolsConfig.js.map +0 -0
- package/dist/commands/askCommand.d.ts +0 -0
- package/dist/commands/askCommand.js +0 -0
- package/dist/commands/askCommand.js.map +0 -0
- package/dist/commands/chatCommand.d.ts +0 -0
- package/dist/commands/chatCommand.js +0 -0
- package/dist/commands/chatCommand.js.map +0 -0
- package/dist/commands/codeCommand.d.ts +0 -0
- package/dist/commands/codeCommand.js +0 -0
- package/dist/commands/codeCommand.js.map +0 -0
- package/dist/commands/commandUtils.d.ts +0 -0
- package/dist/commands/commandUtils.js +0 -0
- package/dist/commands/commandUtils.js.map +0 -0
- package/dist/commands/initCommand.d.ts +0 -0
- package/dist/commands/initCommand.js +0 -0
- package/dist/commands/initCommand.js.map +0 -0
- package/dist/commands/prCommand.d.ts +0 -0
- package/dist/commands/prCommand.js +0 -0
- package/dist/commands/prCommand.js.map +0 -0
- package/dist/commands/reviewCommand.d.ts +0 -0
- package/dist/commands/reviewCommand.js +0 -0
- package/dist/commands/reviewCommand.js.map +0 -0
- package/dist/config.d.ts +0 -0
- package/dist/config.js +0 -0
- package/dist/config.js.map +0 -0
- package/dist/consoleUtils.d.ts +1 -1
- package/dist/consoleUtils.js +0 -0
- package/dist/consoleUtils.js.map +0 -0
- package/dist/constants.d.ts +0 -0
- package/dist/constants.js +0 -0
- package/dist/constants.js.map +0 -0
- package/dist/core/GthAgentRunner.d.ts +17 -0
- package/dist/core/GthAgentRunner.js +68 -0
- package/dist/core/GthAgentRunner.js.map +1 -0
- package/dist/core/{Invocation.d.ts → GthLangChainAgent.d.ts} +17 -6
- package/dist/core/{Invocation.js → GthLangChainAgent.js} +95 -55
- package/dist/core/GthLangChainAgent.js.map +1 -0
- package/dist/core/types.d.ts +10 -0
- package/dist/core/types.js +0 -0
- package/dist/core/types.js.map +0 -0
- package/dist/filePathUtils.d.ts +0 -0
- package/dist/filePathUtils.js +0 -0
- package/dist/filePathUtils.js.map +0 -0
- package/dist/globalConfigUtils.d.ts +0 -0
- package/dist/globalConfigUtils.js +0 -0
- package/dist/globalConfigUtils.js.map +0 -0
- package/dist/helpers/jira/jiraClient.d.ts +0 -0
- package/dist/helpers/jira/jiraClient.js +0 -0
- package/dist/helpers/jira/jiraClient.js.map +0 -0
- package/dist/helpers/jira/jiraLogWork.d.ts +0 -0
- package/dist/helpers/jira/jiraLogWork.js +0 -0
- package/dist/helpers/jira/jiraLogWork.js.map +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js.map +0 -0
- package/dist/llmUtils.d.ts +12 -3
- package/dist/llmUtils.js +24 -7
- package/dist/llmUtils.js.map +1 -1
- package/dist/mcp/OAuthClientProviderImpl.d.ts +0 -0
- package/dist/mcp/OAuthClientProviderImpl.js +0 -0
- package/dist/mcp/OAuthClientProviderImpl.js.map +0 -0
- package/dist/modules/interactiveSessionModule.d.ts +0 -0
- package/dist/modules/interactiveSessionModule.js +14 -18
- package/dist/modules/interactiveSessionModule.js.map +1 -1
- package/dist/modules/questionAnsweringModule.d.ts +0 -0
- package/dist/modules/questionAnsweringModule.js +0 -0
- package/dist/modules/questionAnsweringModule.js.map +0 -0
- package/dist/modules/reviewModule.d.ts +0 -0
- package/dist/modules/reviewModule.js +0 -0
- package/dist/modules/reviewModule.js.map +0 -0
- package/dist/modules/types.d.ts +0 -0
- package/dist/modules/types.js +0 -0
- package/dist/modules/types.js.map +0 -0
- package/dist/presets/anthropic.d.ts +0 -0
- package/dist/presets/anthropic.js +0 -0
- package/dist/presets/anthropic.js.map +0 -0
- package/dist/presets/deepseek.d.ts +0 -0
- package/dist/presets/deepseek.js +0 -0
- package/dist/presets/deepseek.js.map +0 -0
- package/dist/presets/fake.d.ts +0 -0
- package/dist/presets/fake.js +0 -0
- package/dist/presets/fake.js.map +0 -0
- package/dist/presets/groq.d.ts +0 -0
- package/dist/presets/groq.js +0 -0
- package/dist/presets/groq.js.map +0 -0
- package/dist/presets/openai.d.ts +0 -0
- package/dist/presets/openai.js +2 -0
- package/dist/presets/openai.js.map +1 -1
- package/dist/presets/vertexai.d.ts +0 -0
- package/dist/presets/vertexai.js +0 -0
- package/dist/presets/vertexai.js.map +0 -0
- package/dist/prompt.d.ts +0 -0
- package/dist/prompt.js +0 -0
- package/dist/prompt.js.map +0 -0
- package/dist/providers/file.d.ts +0 -0
- package/dist/providers/file.js +0 -0
- package/dist/providers/file.js.map +0 -0
- package/dist/providers/ghIssueProvider.d.ts +0 -0
- package/dist/providers/ghIssueProvider.js +0 -0
- package/dist/providers/ghIssueProvider.js.map +0 -0
- package/dist/providers/ghPrDiffProvider.d.ts +0 -0
- package/dist/providers/ghPrDiffProvider.js +0 -0
- package/dist/providers/ghPrDiffProvider.js.map +0 -0
- package/dist/providers/jiraIssueLegacyProvider.d.ts +0 -0
- package/dist/providers/jiraIssueLegacyProvider.js +0 -0
- package/dist/providers/jiraIssueLegacyProvider.js.map +0 -0
- package/dist/providers/jiraIssueProvider.d.ts +0 -0
- package/dist/providers/jiraIssueProvider.js +0 -0
- package/dist/providers/jiraIssueProvider.js.map +0 -0
- package/dist/providers/text.d.ts +0 -0
- package/dist/providers/text.js +0 -0
- package/dist/providers/text.js.map +0 -0
- package/dist/providers/types.d.ts +0 -0
- package/dist/providers/types.js +0 -0
- package/dist/providers/types.js.map +0 -0
- package/dist/systemUtils.d.ts +1 -1
- package/dist/systemUtils.js +1 -1
- package/dist/systemUtils.js.map +1 -1
- package/dist/tools/GthFileSystemToolkit.d.ts +0 -0
- package/dist/tools/GthFileSystemToolkit.js +0 -0
- package/dist/tools/GthFileSystemToolkit.js.map +0 -0
- package/dist/tools/gthJiraLogWorkTool.d.ts +0 -0
- package/dist/tools/gthJiraLogWorkTool.js +0 -0
- package/dist/tools/gthJiraLogWorkTool.js.map +0 -0
- package/dist/tools/gthStatusUpdateTool.d.ts +0 -0
- package/dist/tools/gthStatusUpdateTool.js +0 -0
- package/dist/tools/gthStatusUpdateTool.js.map +0 -0
- package/dist/utils.d.ts +0 -0
- package/dist/utils.js +0 -0
- package/dist/utils.js.map +0 -0
- package/docs/COMMANDS.md +0 -0
- package/docs/CONFIGURATION.md +0 -0
- package/docs/DEVELOPMENT.md +0 -0
- package/docs/RELEASE-HOWTO.md +0 -0
- package/eslint.config.js +0 -0
- package/it.js +2 -1
- package/maintenance/doc-maintenance.md +0 -0
- package/package.json +1 -1
- package/src/builtInToolsConfig.ts +0 -0
- package/src/commands/askCommand.ts +0 -0
- package/src/commands/chatCommand.ts +0 -0
- package/src/commands/codeCommand.ts +0 -0
- package/src/commands/commandUtils.ts +0 -0
- package/src/commands/initCommand.ts +0 -0
- package/src/commands/prCommand.ts +0 -0
- package/src/commands/reviewCommand.ts +0 -0
- package/src/config.ts +0 -0
- package/src/consoleUtils.ts +1 -1
- package/src/constants.ts +0 -0
- package/src/core/GthAgentRunner.ts +88 -0
- package/src/core/{Invocation.ts → GthLangChainAgent.ts} +105 -63
- package/src/core/types.ts +19 -0
- package/src/filePathUtils.ts +0 -0
- package/src/globalConfigUtils.ts +0 -0
- package/src/helpers/jira/jiraClient.ts +0 -0
- package/src/helpers/jira/jiraLogWork.ts +0 -0
- package/src/index.ts +0 -0
- package/src/llmUtils.ts +26 -11
- package/src/mcp/OAuthClientProviderImpl.ts +0 -0
- package/src/modules/interactiveSessionModule.ts +15 -19
- package/src/modules/questionAnsweringModule.ts +0 -0
- package/src/modules/reviewModule.ts +0 -0
- package/src/modules/types.ts +0 -0
- package/src/presets/anthropic.ts +0 -0
- package/src/presets/deepseek.ts +0 -0
- package/src/presets/fake.ts +0 -0
- package/src/presets/groq.ts +0 -0
- package/src/presets/openai.ts +2 -0
- package/src/presets/vertexai.ts +0 -0
- package/src/prompt.ts +0 -0
- package/src/providers/file.ts +0 -0
- package/src/providers/ghIssueProvider.ts +0 -0
- package/src/providers/ghPrDiffProvider.ts +0 -0
- package/src/providers/jiraIssueLegacyProvider.ts +0 -0
- package/src/providers/jiraIssueProvider.ts +0 -0
- package/src/providers/text.ts +0 -0
- package/src/providers/types.ts +0 -0
- package/src/systemUtils.ts +1 -1
- package/src/tools/GthFileSystemToolkit.ts +0 -0
- package/src/tools/gthJiraLogWorkTool.ts +0 -0
- package/src/tools/gthStatusUpdateTool.ts +0 -0
- package/src/utils.ts +0 -0
- package/tsconfig.json +0 -0
- package/vitest-it.config.ts +0 -0
- package/vitest.config.ts +0 -0
- package/dist/core/Invocation.js.map +0 -1
package/.gsloth.backstory.md
CHANGED
|
File without changes
|
package/.gsloth.chat.md
CHANGED
|
File without changes
|
package/.gsloth.code.md
CHANGED
|
File without changes
|
package/.gsloth.config_.json
CHANGED
|
File without changes
|
package/.gsloth.config_.mjs
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/.gsloth.guidelines.md
CHANGED
|
File without changes
|
package/.gsloth.review.md
CHANGED
|
File without changes
|
package/.gsloth.system.md
CHANGED
|
File without changes
|
package/.prettierrc.json
CHANGED
|
File without changes
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -87,11 +87,30 @@ gsloth pr 42 23 # Review PR #42 with GitHub issue #23
|
|
|
87
87
|
git --no-pager diff | gsloth review
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
**Review changes between a specific tag and the HEAD:**
|
|
91
|
+
```shell
|
|
92
|
+
git --no-pager diff v0.8.3..HEAD | gth review
|
|
93
|
+
```
|
|
94
|
+
|
|
90
95
|
**Ask questions:**
|
|
91
96
|
```shell
|
|
92
97
|
gsloth ask "What does this function do?" -f utils.js
|
|
93
98
|
```
|
|
94
99
|
|
|
100
|
+
**Write release notes:**
|
|
101
|
+
```shell
|
|
102
|
+
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"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
To write this to filesystem, you'd need to add filesystem access to the *ask* command in `.gsloth.config.json`.
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{"llm": {"type": "vertexai", "model": "gemini-2.5-pro"}, "commands": {"ask": {"filesystem": "all"}}}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
*You can improve this significantly by modifying project guidelines in `.gsloth.guidelines.md` or maybe with keeping instructions in file and feeding it in with `-f`.
|
|
112
|
+
|
|
113
|
+
|
|
95
114
|
**Interactive sessions:**
|
|
96
115
|
```shell
|
|
97
116
|
gsloth chat # Start chat session
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Release notes howto
|
|
2
|
+
|
|
3
|
+
Maintain dry technical language similar to assets/release-notes/v0_8_0.md.
|
|
4
|
+
|
|
5
|
+
## Process
|
|
6
|
+
- Review changes from the latest tag to HEAD.
|
|
7
|
+
- List assets/release-notes/ and review a few recent release notes.
|
|
8
|
+
- Create a new release notes file for the next patch version if the user didn't specify to write release notes for minor.
|
|
9
|
+
- Don't include information about unit tests, integration tests and other development specific nuances
|
|
10
|
+
- Present release notes to user and ask for confirmation
|
|
11
|
+
- call `git commit -m"release notes for {new_version_number}"`
|
|
12
|
+
- call `npm version patch` for a patch or `npm version minor` appropriately.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# v0.8.5 Async Readline Interface
|
|
2
|
+
|
|
3
|
+
## Improvements
|
|
4
|
+
|
|
5
|
+
### Async Readline Interface Migration
|
|
6
|
+
Interactive sessions now use Node.js's promise-based non-blocking readline interface.
|
|
7
|
+
|
|
8
|
+
### Other minor improvements
|
|
9
|
+
The core agent functionality has been restructured with improved separation of concerns:
|
|
10
|
+
- Renamed `Invocation` class to `GthAgentRunner` for better clarity
|
|
11
|
+
- Extracted React agent logic into a dedicated module
|
|
12
|
+
- Improved initialization flow and dependency management
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/config.d.ts
CHANGED
|
File without changes
|
package/dist/config.js
CHANGED
|
File without changes
|
package/dist/config.js.map
CHANGED
|
File without changes
|
package/dist/consoleUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StatusUpdateCallback } from '#src/core/
|
|
1
|
+
import { StatusUpdateCallback } from '#src/core/GthLangChainAgent.js';
|
|
2
2
|
export declare function displayError(message: string): void;
|
|
3
3
|
export declare function displayWarning(message: string): void;
|
|
4
4
|
export declare function displaySuccess(message: string): void;
|
package/dist/consoleUtils.js
CHANGED
|
File without changes
|
package/dist/consoleUtils.js.map
CHANGED
|
File without changes
|
package/dist/constants.d.ts
CHANGED
|
File without changes
|
package/dist/constants.js
CHANGED
|
File without changes
|
package/dist/constants.js.map
CHANGED
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Message } from '#src/modules/types.js';
|
|
2
|
+
import { SlothConfig } from '#src/config.js';
|
|
3
|
+
import { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
4
|
+
import { GthAgentInterface, GthCommand } from '#src/core/types.js';
|
|
5
|
+
import { StatusUpdateCallback } from '#src/core/GthLangChainAgent.js';
|
|
6
|
+
import { RunnableConfig } from '@langchain/core/runnables';
|
|
7
|
+
export declare class GthAgentRunner {
|
|
8
|
+
private statusUpdate;
|
|
9
|
+
private verbose;
|
|
10
|
+
private agent;
|
|
11
|
+
private config;
|
|
12
|
+
constructor(statusUpdate: StatusUpdateCallback, agent?: GthAgentInterface);
|
|
13
|
+
setVerbose(verbose: boolean): void;
|
|
14
|
+
init(command: GthCommand | undefined, configIn: SlothConfig, checkpointSaver?: BaseCheckpointSaver | undefined): Promise<void>;
|
|
15
|
+
processMessages(messages: Message[], runConfig: RunnableConfig): Promise<string>;
|
|
16
|
+
cleanup(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { GthLangChainAgent } from '#src/core/GthLangChainAgent.js';
|
|
2
|
+
export class GthAgentRunner {
|
|
3
|
+
statusUpdate;
|
|
4
|
+
verbose = false;
|
|
5
|
+
agent = null;
|
|
6
|
+
config = null;
|
|
7
|
+
constructor(statusUpdate, agent) {
|
|
8
|
+
this.statusUpdate = statusUpdate;
|
|
9
|
+
this.agent = agent || null;
|
|
10
|
+
}
|
|
11
|
+
setVerbose(verbose) {
|
|
12
|
+
this.verbose = verbose;
|
|
13
|
+
}
|
|
14
|
+
async init(command, configIn, checkpointSaver) {
|
|
15
|
+
this.config = configIn;
|
|
16
|
+
// Create default agent if none provided
|
|
17
|
+
if (!this.agent) {
|
|
18
|
+
this.agent = new GthLangChainAgent(this.statusUpdate);
|
|
19
|
+
}
|
|
20
|
+
// Initialize the agent if it has an init method
|
|
21
|
+
await this.agent.init(command, configIn, checkpointSaver);
|
|
22
|
+
// Set verbose mode
|
|
23
|
+
if (this.verbose) {
|
|
24
|
+
this.agent.setVerbose(this.verbose);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async processMessages(messages, runConfig) {
|
|
28
|
+
if (!this.agent || !this.config) {
|
|
29
|
+
throw new Error('AgentRunner not initialized. Call init() first.');
|
|
30
|
+
}
|
|
31
|
+
// Convert Message[] to a single string for the agent interface
|
|
32
|
+
const message = messages.map((msg) => msg.content).join('\n');
|
|
33
|
+
try {
|
|
34
|
+
// Decision: Use streaming or non-streaming based on config
|
|
35
|
+
if (this.config.streamOutput) {
|
|
36
|
+
// Use streaming
|
|
37
|
+
const stream = await this.agent.stream(message, runConfig);
|
|
38
|
+
let result = '';
|
|
39
|
+
try {
|
|
40
|
+
for await (const chunk of stream) {
|
|
41
|
+
result += chunk;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (streamError) {
|
|
45
|
+
// Handle streaming-specific errors
|
|
46
|
+
throw new Error(`Stream processing failed: ${streamError instanceof Error ? streamError.message : String(streamError)}`);
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// Use non-streaming
|
|
52
|
+
return await this.agent.invoke(message, runConfig);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
// Handle agent invocation errors
|
|
57
|
+
throw new Error(`Agent processing failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async cleanup() {
|
|
61
|
+
if (this.agent && 'cleanup' in this.agent && typeof this.agent.cleanup === 'function') {
|
|
62
|
+
await this.agent.cleanup();
|
|
63
|
+
}
|
|
64
|
+
this.agent = null;
|
|
65
|
+
this.config = null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=GthAgentRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GthAgentRunner.js","sourceRoot":"","sources":["../../src/core/GthAgentRunner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gCAAgC,CAAC;AAGzF,MAAM,OAAO,cAAc;IACjB,YAAY,CAAuB;IACnC,OAAO,GAAY,KAAK,CAAC;IACzB,KAAK,GAA6B,IAAI,CAAC;IACvC,MAAM,GAAuB,IAAI,CAAC;IAE1C,YAAY,YAAkC,EAAE,KAAyB;QACvE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,IAAI,CAAC;IAC7B,CAAC;IAED,UAAU,CAAC,OAAgB;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,KAAK,CAAC,IAAI,CACR,OAA+B,EAC/B,QAAqB,EACrB,eAAiD;QAEjD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QAEvB,wCAAwC;QACxC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACxD,CAAC;QAED,gDAAgD;QAChD,MAAM,IAAI,CAAC,KA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M,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iCAAiC;YACjC,MAAM,IAAI,KAAK,CACb,4BAA4B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACrF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO;QACX,IAAI,IAAI,CAAC,KAAK,IAAI,SAAS,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YACtF,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Message } from '#src/modules/types.js';
|
|
2
1
|
import { SlothConfig } from '#src/config.js';
|
|
3
2
|
import type { Connection } from '@langchain/mcp-adapters';
|
|
4
3
|
import { MultiServerMCPClient } from '@langchain/mcp-adapters';
|
|
5
4
|
import { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
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
8
|
export type StatusUpdateCallback = (level: StatusLevel, message: string) => void;
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class GthLangChainAgent implements GthAgentInterface {
|
|
10
10
|
private statusUpdate;
|
|
11
11
|
private verbose;
|
|
12
12
|
private mcpClient;
|
|
@@ -15,9 +15,20 @@ export declare class Invocation {
|
|
|
15
15
|
constructor(statusUpdate: StatusUpdateCallback);
|
|
16
16
|
setVerbose(verbose: boolean): void;
|
|
17
17
|
init(command: GthCommand | undefined, configIn: SlothConfig, checkpointSaver?: BaseCheckpointSaver | undefined): Promise<void>;
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Invoke LLM with a message and runnable config.
|
|
20
|
+
* For streaming use {@link #stream} method, streaming is preferred if model API supports it.
|
|
21
|
+
* Please note that this when tools are involved, this method will anyway do multiple LLM
|
|
22
|
+
* calls within LangChain dependency.
|
|
23
|
+
*/
|
|
24
|
+
invoke(message: string, runConfig: RunnableConfig): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Induce LLM to stream AI messages with a user message and runnable config.
|
|
27
|
+
* When stream is not appropriate use {@link invoke}.
|
|
28
|
+
*/
|
|
29
|
+
stream(message: string, runConfig: RunnableConfig): Promise<IterableReadableStream<string>>;
|
|
20
30
|
cleanup(): Promise<void>;
|
|
31
|
+
getEffectiveConfig(config: SlothConfig, command: GthCommand | undefined): SlothConfig;
|
|
21
32
|
/**
|
|
22
33
|
* Extract and flatten tools from toolkits
|
|
23
34
|
*/
|
|
@@ -5,7 +5,8 @@ import { formatToolCalls, ProgressIndicator } from '#src/utils.js';
|
|
|
5
5
|
import { getDefaultTools } from '#src/builtInToolsConfig.js';
|
|
6
6
|
import { createAuthProviderAndAuthenticate } from '#src/mcp/OAuthClientProviderImpl.js';
|
|
7
7
|
import { displayInfo } from '#src/consoleUtils.js';
|
|
8
|
-
|
|
8
|
+
import { IterableReadableStream } from '@langchain/core/utils/stream';
|
|
9
|
+
export class GthLangChainAgent {
|
|
9
10
|
statusUpdate;
|
|
10
11
|
verbose = false;
|
|
11
12
|
mcpClient = null;
|
|
@@ -47,76 +48,100 @@ export class Invocation {
|
|
|
47
48
|
checkpointSaver,
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
filesystem: command && config.commands?.[command]?.filesystem !== undefined
|
|
58
|
-
? config.commands[command].filesystem
|
|
59
|
-
: config.filesystem,
|
|
60
|
-
builtInTools: command && config.commands?.[command]?.builtInTools !== undefined
|
|
61
|
-
? config.commands[command].builtInTools
|
|
62
|
-
: config.builtInTools,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
async invoke(messages, runConfig) {
|
|
51
|
+
/**
|
|
52
|
+
* Invoke LLM with a message and runnable config.
|
|
53
|
+
* For streaming use {@link #stream} method, streaming is preferred if model API supports it.
|
|
54
|
+
* Please note that this when tools are involved, this method will anyway do multiple LLM
|
|
55
|
+
* calls within LangChain dependency.
|
|
56
|
+
*/
|
|
57
|
+
async invoke(message, runConfig) {
|
|
66
58
|
if (!this.agent || !this.config) {
|
|
67
|
-
throw new Error('
|
|
59
|
+
throw new Error('Agent not initialized. Call init() first.');
|
|
68
60
|
}
|
|
69
|
-
//
|
|
61
|
+
// Convert string to Message format expected by the agent
|
|
62
|
+
const messages = [{ role: 'user', content: message }];
|
|
70
63
|
try {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (toolCalls && toolCalls.length > 0) {
|
|
82
|
-
this.statusUpdate('info', `\nUsed tools: ${formatToolCalls(toolCalls)}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
64
|
+
const progress = new ProgressIndicator('Thinking.');
|
|
65
|
+
try {
|
|
66
|
+
const response = await this.agent.invoke({ messages }, runConfig);
|
|
67
|
+
const aiMessage = response.messages[response.messages.length - 1].content;
|
|
68
|
+
const toolCalls = response.messages
|
|
69
|
+
.filter((msg) => msg.tool_calls && msg.tool_calls.length > 0)
|
|
70
|
+
.flatMap((msg) => msg.tool_calls ?? [])
|
|
71
|
+
.filter((tc) => tc.name);
|
|
72
|
+
if (toolCalls.length > 0) {
|
|
73
|
+
this.statusUpdate('info', `\nUsed tools: ${formatToolCalls(toolCalls)}`);
|
|
85
74
|
}
|
|
75
|
+
this.statusUpdate('display', aiMessage);
|
|
76
|
+
return aiMessage;
|
|
86
77
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
try {
|
|
91
|
-
const response = await this.agent.invoke({ messages }, runConfig);
|
|
92
|
-
output.aiMessage = response.messages[response.messages.length - 1].content;
|
|
93
|
-
const toolCalls = response.messages
|
|
94
|
-
.filter((msg) => msg.tool_calls && msg.tool_calls.length > 0)
|
|
95
|
-
.flatMap((msg) => msg.tool_calls ?? [])
|
|
96
|
-
.filter((tc) => tc.name);
|
|
97
|
-
if (toolCalls.length > 0) {
|
|
98
|
-
this.statusUpdate('info', `\nUsed tools: ${formatToolCalls(toolCalls)}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
this.statusUpdate('warning', `Something went wrong ${e.message}`);
|
|
103
|
-
}
|
|
104
|
-
finally {
|
|
105
|
-
progress.stop();
|
|
78
|
+
catch (e) {
|
|
79
|
+
if (e instanceof Error && e?.name === 'ToolException') {
|
|
80
|
+
throw e; // Re-throw ToolException to be handled by outer catch
|
|
106
81
|
}
|
|
107
|
-
this.statusUpdate('
|
|
82
|
+
this.statusUpdate('warning', `Something went wrong ${e.message}`);
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
progress.stop();
|
|
108
87
|
}
|
|
109
|
-
return output.aiMessage;
|
|
110
88
|
}
|
|
111
89
|
catch (error) {
|
|
112
90
|
if (error instanceof Error) {
|
|
113
91
|
if (error?.name === 'ToolException') {
|
|
114
92
|
this.statusUpdate('error', `Tool execution failed: ${error?.message}`);
|
|
93
|
+
return `Tool execution failed: ${error?.message}`;
|
|
115
94
|
}
|
|
116
95
|
}
|
|
117
96
|
throw error;
|
|
118
97
|
}
|
|
119
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Induce LLM to stream AI messages with a user message and runnable config.
|
|
101
|
+
* When stream is not appropriate use {@link invoke}.
|
|
102
|
+
*/
|
|
103
|
+
async stream(message, runConfig) {
|
|
104
|
+
if (!this.agent || !this.config) {
|
|
105
|
+
throw new Error('Agent not initialized. Call init() first.');
|
|
106
|
+
}
|
|
107
|
+
// Convert string to Message format expected by the agent
|
|
108
|
+
const messages = [{ role: 'user', content: message }];
|
|
109
|
+
this.statusUpdate('info', '\nThinking...\n');
|
|
110
|
+
const stream = await this.agent.stream({ messages }, { ...runConfig, streamMode: 'messages' });
|
|
111
|
+
const statusUpdate = this.statusUpdate;
|
|
112
|
+
return new IterableReadableStream({
|
|
113
|
+
async start(controller) {
|
|
114
|
+
try {
|
|
115
|
+
for await (const [chunk, _metadata] of stream) {
|
|
116
|
+
if (isAIMessage(chunk)) {
|
|
117
|
+
const text = chunk.text;
|
|
118
|
+
statusUpdate('stream', text);
|
|
119
|
+
controller.enqueue(text);
|
|
120
|
+
const toolCalls = chunk.tool_calls?.filter((tc) => tc.name);
|
|
121
|
+
if (toolCalls && toolCalls.length > 0) {
|
|
122
|
+
statusUpdate('info', `\nUsed tools: ${formatToolCalls(toolCalls)}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
controller.close();
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (error instanceof Error) {
|
|
130
|
+
if (error?.name === 'ToolException') {
|
|
131
|
+
statusUpdate('error', `Tool execution failed: ${error?.message}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
controller.error(error);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
async cancel() {
|
|
138
|
+
// Clean up the underlying stream if it has a cancel method
|
|
139
|
+
if (stream && typeof stream.cancel === 'function') {
|
|
140
|
+
await stream.cancel();
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}
|
|
120
145
|
async cleanup() {
|
|
121
146
|
if (this.mcpClient) {
|
|
122
147
|
await this.mcpClient.close();
|
|
@@ -125,6 +150,21 @@ export class Invocation {
|
|
|
125
150
|
this.agent = null;
|
|
126
151
|
this.config = null;
|
|
127
152
|
}
|
|
153
|
+
getEffectiveConfig(config, command) {
|
|
154
|
+
const supportsTools = !!config.llm.bindTools;
|
|
155
|
+
if (!supportsTools) {
|
|
156
|
+
this.statusUpdate('warning', 'Model does not seem to support tools.');
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
...config,
|
|
160
|
+
filesystem: command && config.commands?.[command]?.filesystem !== undefined
|
|
161
|
+
? config.commands[command].filesystem
|
|
162
|
+
: config.filesystem,
|
|
163
|
+
builtInTools: command && config.commands?.[command]?.builtInTools !== undefined
|
|
164
|
+
? config.commands[command].builtInTools
|
|
165
|
+
: config.builtInTools,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
128
168
|
/**
|
|
129
169
|
* Extract and flatten tools from toolkits
|
|
130
170
|
*/
|
|
@@ -180,4 +220,4 @@ export class Invocation {
|
|
|
180
220
|
}
|
|
181
221
|
}
|
|
182
222
|
}
|
|
183
|
-
//# sourceMappingURL=
|
|
223
|
+
//# sourceMappingURL=GthLangChainAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GthLangChainAgent.js","sourceRoot":"","sources":["../../src/core/GthLangChainAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,oBAAoB,EAA4B,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAInE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,qC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GAAG,IAAI,MAAM,IAAK,MAAM,CAAC,YAAoB,KAAK,OAAO,EAAE,CAAC;gBACrE,WAAW,CAAC,0BAA0B,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;gBACpD,MAAM,YAAY,GAAG,MAAM,iCAAiC,CAAC,MAAM,CAAC,CAAC;gBACrE,UAAU,CAAC,UAAU,CAAC,GAAG;oBACvB,GAAG,MAAM;oBACT,YAAY;iBACb,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,8BAA8B;gBAC9B,UAAU,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;YAClC,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvC,OAAO,IAAI,oBAAoB,CAAC;gBAC9B,gBAAgB,EAAE,IAAI;gBACtB,4BAA4B,EAAE,IAAI;gBAClC,wBAAwB,EAAE,KAAK;gBAC/B,UAAU,EAAE,UAAU;aACvB,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
+
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
|
+
import { IterableReadableStream } from '@langchain/core/utils/stream';
|
|
3
|
+
import { SlothConfig } from '#src/config.js';
|
|
4
|
+
import { BaseCheckpointSaver } from '@langchain/langgraph';
|
|
1
5
|
export type StatusLevel = 'info' | 'warning' | 'error' | 'success' | 'debug' | 'display' | 'stream';
|
|
2
6
|
export type GthCommand = 'ask' | 'pr' | 'review' | 'chat' | 'code';
|
|
7
|
+
export interface GthAgentInterface {
|
|
8
|
+
init(command: GthCommand | undefined, configIn: SlothConfig, checkpointSaver?: BaseCheckpointSaver | undefined): Promise<void>;
|
|
9
|
+
invoke(message: string, runConfig: RunnableConfig): Promise<string>;
|
|
10
|
+
stream(message: string, runConfig: RunnableConfig): Promise<IterableReadableStream<string>>;
|
|
11
|
+
setVerbose(verbose: boolean): void;
|
|
12
|
+
}
|
package/dist/core/types.js
CHANGED
|
File without changes
|
package/dist/core/types.js.map
CHANGED
|
File without changes
|
package/dist/filePathUtils.d.ts
CHANGED
|
File without changes
|
package/dist/filePathUtils.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js.map
CHANGED
|
File without changes
|