gaunt-sloth-assistant 1.0.3 → 1.0.4
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.code.md +0 -5
- package/dist/builtInToolsConfig.d.ts +0 -4
- package/dist/builtInToolsConfig.js +1 -6
- package/dist/builtInToolsConfig.js.map +1 -1
- package/dist/middleware/registry.js +1 -3
- package/dist/middleware/registry.js.map +1 -1
- package/dist/middleware/types.d.ts +13 -5
- package/package.json +15 -15
- package/dist/tools/gthSequentialThinkingTool.d.ts +0 -33
- package/dist/tools/gthSequentialThinkingTool.js +0 -130
- package/dist/tools/gthSequentialThinkingTool.js.map +0 -1
package/.gsloth.code.md
CHANGED
|
@@ -25,8 +25,3 @@ Focus on writing clean, maintainable code that follows the project's established
|
|
|
25
25
|
- Run full tests suite as a penultimate step, when everything is fixed, but before running the lint;
|
|
26
26
|
- Run lint only as a final step when everything else is fixed;
|
|
27
27
|
- If nothing seems to work, ask for user's assistance;
|
|
28
|
-
|
|
29
|
-
## Sequential thinking
|
|
30
|
-
|
|
31
|
-
Use gth_sequential_thinking tool if the problem has multiple steps, or it turns to be complicated,
|
|
32
|
-
but make sure to continue with your task after finishing with the sequential thinking tool.
|
|
@@ -16,10 +16,6 @@ export declare const AVAILABLE_BUILT_IN_TOOLS: {
|
|
|
16
16
|
* Needs JIRA_CLOUD_ID, JIRA_USERNAME and JIRA_API_PAT_TOKEN environment variables
|
|
17
17
|
*/
|
|
18
18
|
readonly gth_jira_log_work: "#src/tools/gthJiraLogWorkTool.js";
|
|
19
|
-
/**
|
|
20
|
-
* Sequential thinking. LLM can use this as a scratchpad for thinking.
|
|
21
|
-
*/
|
|
22
|
-
readonly gth_sequential_thinking: "#src/tools/gthSequentialThinkingTool.js";
|
|
23
19
|
/**
|
|
24
20
|
* Web fetch tool.
|
|
25
21
|
*/
|
|
@@ -21,10 +21,6 @@ export const AVAILABLE_BUILT_IN_TOOLS = {
|
|
|
21
21
|
* Needs JIRA_CLOUD_ID, JIRA_USERNAME and JIRA_API_PAT_TOKEN environment variables
|
|
22
22
|
*/
|
|
23
23
|
gth_jira_log_work: '#src/tools/gthJiraLogWorkTool.js',
|
|
24
|
-
/**
|
|
25
|
-
* Sequential thinking. LLM can use this as a scratchpad for thinking.
|
|
26
|
-
*/
|
|
27
|
-
gth_sequential_thinking: '#src/tools/gthSequentialThinkingTool.js',
|
|
28
24
|
/**
|
|
29
25
|
* Web fetch tool.
|
|
30
26
|
*/
|
|
@@ -43,9 +39,8 @@ async function filterDevTools(command, devToolConfig) {
|
|
|
43
39
|
if (command != 'code' || !devToolConfig) {
|
|
44
40
|
return [];
|
|
45
41
|
}
|
|
46
|
-
const thinking = await import(AVAILABLE_BUILT_IN_TOOLS.gth_sequential_thinking);
|
|
47
42
|
const toolkit = new GthDevToolkit(devToolConfig);
|
|
48
|
-
return [
|
|
43
|
+
return [...toolkit.getTools()];
|
|
49
44
|
}
|
|
50
45
|
/**
|
|
51
46
|
* Filter filesystem tools based on configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtInToolsConfig.js","sourceRoot":"","sources":["../src/builtInToolsConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,oBAAoB,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC;;OAEG;IACH,iBAAiB,EAAE,mCAAmC;IACtD;;;OAGG;IACH,iBAAiB,EAAE,kCAAkC;IACrD;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"builtInToolsConfig.js","sourceRoot":"","sources":["../src/builtInToolsConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,oBAAoB,MAAM,oCAA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E,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,KAAK,UAAU,eAAe,CAAC,MAAiB;IAC9C,MAAM,KAAK,GAA8B,EAAE,CAAC;IAE5C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC3C,IAAI,QAAQ,IAAI,wBAAwB,EAAE,CAAC;YACzC,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,MAAM,CACvB,wBAAwB,CAAC,QAAiD,CAAC,CAC5E,CAAC;gBACF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,cAAc,CAAC,iCAAiC,QAAQ,MAAM,KAAK,EAAE,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,cAAc,CAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -57,9 +57,7 @@ export async function createSummarizationMiddleware(config, gthConfig) {
|
|
|
57
57
|
debugLog('Creating summarization middleware');
|
|
58
58
|
return Promise.resolve(summarizationMiddleware({
|
|
59
59
|
model: config.model || gthConfig.llm,
|
|
60
|
-
|
|
61
|
-
messagesToKeep: config.messagesToKeep,
|
|
62
|
-
summaryPrompt: config.summaryPrompt,
|
|
60
|
+
...config,
|
|
63
61
|
}));
|
|
64
62
|
}
|
|
65
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/middleware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AAG,QAAQ,EAAE,GAAG,MAAM,CAAC;gBACrC,UAAU,CAAC,IAAI,CAAC,MAAM,0BAA0B,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;YAC/E,CAAC;YACD,mDAAmD;iBAC9C,CAAC;gBACJ,QAAQ,CAAC,0BAA0B,CAAC,CAAC;gBACrC,UAAU,CAAC,IAAI,CAAC,MAAyB,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,cAAc,CACZ,gCAAgC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACzF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,0BAA0B,CACvC,IAAY,EACZ,QAAiC,EACjC,SAAoB;IAEpB,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,OAAO,GAAG,6BAA6B,CAAC,IAAI,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -33,14 +33,22 @@ export interface SummarizationConfig {
|
|
|
33
33
|
model?: BaseChatModel;
|
|
34
34
|
/**
|
|
35
35
|
* Maximum tokens before triggering summarization.
|
|
36
|
-
*
|
|
37
|
-
* Gaunt Sloth default value is 10000.
|
|
36
|
+
* Set one of:
|
|
38
37
|
*/
|
|
39
|
-
|
|
38
|
+
trigger?: {
|
|
39
|
+
fraction?: number;
|
|
40
|
+
tokens?: number;
|
|
41
|
+
messages?: number;
|
|
42
|
+
};
|
|
40
43
|
/**
|
|
41
|
-
*
|
|
44
|
+
* How many tokens, messages, or a fraction of context to keep.
|
|
45
|
+
* Set one of:
|
|
42
46
|
*/
|
|
43
|
-
|
|
47
|
+
keep?: {
|
|
48
|
+
fraction?: number;
|
|
49
|
+
tokens?: number;
|
|
50
|
+
messages?: number;
|
|
51
|
+
};
|
|
44
52
|
/**
|
|
45
53
|
* Custom prompt template for summarization.
|
|
46
54
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gaunt-sloth-assistant",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Andrew Kondratev",
|
|
@@ -41,37 +41,37 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@a2a-js/sdk": "^0.3.5",
|
|
44
|
-
"@langchain/anthropic": "^1.
|
|
44
|
+
"@langchain/anthropic": "^1.2.3",
|
|
45
45
|
"@langchain/core": "^1.1.0",
|
|
46
46
|
"@langchain/deepseek": "^1.0.2",
|
|
47
|
-
"@langchain/google-genai": "^2.0.
|
|
48
|
-
"@langchain/google-vertexai": "^
|
|
47
|
+
"@langchain/google-genai": "^2.0.4",
|
|
48
|
+
"@langchain/google-vertexai": "^2.0.4",
|
|
49
49
|
"@langchain/groq": "^1.0.2",
|
|
50
|
-
"@langchain/langgraph": "^1.0.
|
|
51
|
-
"@langchain/mcp-adapters": "^1.0.
|
|
50
|
+
"@langchain/langgraph": "^1.0.4",
|
|
51
|
+
"@langchain/mcp-adapters": "^1.0.3",
|
|
52
52
|
"@langchain/openai": "^1.1.2",
|
|
53
53
|
"@langchain/xai": "^1.0.2",
|
|
54
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
54
|
+
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
55
55
|
"commander": "^14.0.2",
|
|
56
56
|
"diff": "^8.0.2",
|
|
57
|
-
"express": "^5.1
|
|
58
|
-
"langchain": "^1.1.
|
|
57
|
+
"express": "^5.2.1",
|
|
58
|
+
"langchain": "^1.1.5",
|
|
59
59
|
"minimatch": "^10.1.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@eslint/js": "^9.34.0",
|
|
63
|
-
"@types/express": "^5.0.
|
|
63
|
+
"@types/express": "^5.0.6",
|
|
64
64
|
"@types/node": "^24.10.1",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^8.48.
|
|
66
|
-
"@typescript-eslint/parser": "^8.48.
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
66
|
+
"@typescript-eslint/parser": "^8.48.1",
|
|
67
67
|
"eslint": "^9.39.1",
|
|
68
68
|
"eslint-config-prettier": "^10.1.8",
|
|
69
69
|
"eslint-plugin-prettier": "^5.5.4",
|
|
70
70
|
"globals": "^16.5.0",
|
|
71
|
-
"prettier": "^3.
|
|
72
|
-
"typedoc": "^0.28.
|
|
71
|
+
"prettier": "^3.7.4",
|
|
72
|
+
"typedoc": "^0.28.15",
|
|
73
73
|
"typescript": "^5.9.3",
|
|
74
|
-
"vitest": "^4.0.
|
|
74
|
+
"vitest": "^4.0.15"
|
|
75
75
|
},
|
|
76
76
|
"overrides": {
|
|
77
77
|
"rimraf": "^6.1.0"
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { GthConfig } from '#src/config.js';
|
|
3
|
-
export declare function get(_: GthConfig): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
|
|
4
|
-
thought: z.ZodString;
|
|
5
|
-
nextThoughtNeeded: z.ZodBoolean;
|
|
6
|
-
thoughtNumber: z.ZodNumber;
|
|
7
|
-
totalThoughts: z.ZodNumber;
|
|
8
|
-
isRevision: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
-
revisesThought: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
branchFromThought: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
branchId: z.ZodOptional<z.ZodString>;
|
|
12
|
-
needsMoreThoughts: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
-
}, z.core.$strip>, {
|
|
14
|
-
thought: string;
|
|
15
|
-
nextThoughtNeeded: boolean;
|
|
16
|
-
thoughtNumber: number;
|
|
17
|
-
totalThoughts: number;
|
|
18
|
-
isRevision?: boolean | undefined;
|
|
19
|
-
revisesThought?: number | undefined;
|
|
20
|
-
branchFromThought?: number | undefined;
|
|
21
|
-
branchId?: string | undefined;
|
|
22
|
-
needsMoreThoughts?: boolean | undefined;
|
|
23
|
-
}, {
|
|
24
|
-
thought: string;
|
|
25
|
-
nextThoughtNeeded: boolean;
|
|
26
|
-
thoughtNumber: number;
|
|
27
|
-
totalThoughts: number;
|
|
28
|
-
isRevision?: boolean | undefined;
|
|
29
|
-
revisesThought?: number | undefined;
|
|
30
|
-
branchFromThought?: number | undefined;
|
|
31
|
-
branchId?: string | undefined;
|
|
32
|
-
needsMoreThoughts?: boolean | undefined;
|
|
33
|
-
}, string>;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { tool } from '@langchain/core/tools';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { displayInfo } from '#src/utils/consoleUtils.js';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
/**
|
|
6
|
-
* Sequential thinking tool
|
|
7
|
-
* Inspired by https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking
|
|
8
|
-
*/
|
|
9
|
-
const gthSequentialThinkingSchema = z.object({
|
|
10
|
-
thought: z.string().describe('Your current thinking step'),
|
|
11
|
-
nextThoughtNeeded: z.boolean().describe('Whether another thought step is needed'),
|
|
12
|
-
thoughtNumber: z.number().int().min(1).describe('Current thought number'),
|
|
13
|
-
totalThoughts: z.number().int().min(1).describe('Estimated total thoughts needed'),
|
|
14
|
-
isRevision: z.boolean().optional().describe('Whether this revises previous thinking'),
|
|
15
|
-
revisesThought: z
|
|
16
|
-
.number()
|
|
17
|
-
.int()
|
|
18
|
-
.min(1)
|
|
19
|
-
.optional()
|
|
20
|
-
.describe('Which thought is being reconsidered'),
|
|
21
|
-
branchFromThought: z.number().int().min(1).optional().describe('Branching point thought number'),
|
|
22
|
-
branchId: z.string().optional().describe('Branch identifier'),
|
|
23
|
-
needsMoreThoughts: z.boolean().optional().describe('If more thoughts are needed'),
|
|
24
|
-
});
|
|
25
|
-
class SequentialThinkingProcessor {
|
|
26
|
-
thoughtHistory = [];
|
|
27
|
-
branches = {};
|
|
28
|
-
disableThoughtLogging;
|
|
29
|
-
constructor() {
|
|
30
|
-
this.disableThoughtLogging =
|
|
31
|
-
(process.env.DISABLE_THOUGHT_LOGGING || '').toLowerCase() === 'true';
|
|
32
|
-
}
|
|
33
|
-
formatThought(thoughtData) {
|
|
34
|
-
const { thoughtNumber, totalThoughts, thought, isRevision, revisesThought, branchFromThought, branchId, } = thoughtData;
|
|
35
|
-
let prefix = '';
|
|
36
|
-
let context = '';
|
|
37
|
-
if (isRevision) {
|
|
38
|
-
prefix = chalk.yellow('🔄 Revision');
|
|
39
|
-
context = ` (revising thought ${revisesThought})`;
|
|
40
|
-
}
|
|
41
|
-
else if (branchFromThought) {
|
|
42
|
-
prefix = chalk.green('🌿 Branch');
|
|
43
|
-
context = ` (from thought ${branchFromThought}, ID: ${branchId})`;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
prefix = chalk.blue('💭 Thought');
|
|
47
|
-
context = '';
|
|
48
|
-
}
|
|
49
|
-
const header = `${prefix} ${thoughtNumber}/${totalThoughts}${context}`;
|
|
50
|
-
return `
|
|
51
|
-
=== ${header} ===
|
|
52
|
-
${thought}
|
|
53
|
-
`;
|
|
54
|
-
}
|
|
55
|
-
processThought(input) {
|
|
56
|
-
const validatedInput = {
|
|
57
|
-
...input,
|
|
58
|
-
nextThoughtNeeded: input.nextThoughtNeeded,
|
|
59
|
-
};
|
|
60
|
-
if (validatedInput.thoughtNumber > validatedInput.totalThoughts) {
|
|
61
|
-
validatedInput.totalThoughts = validatedInput.thoughtNumber;
|
|
62
|
-
}
|
|
63
|
-
this.thoughtHistory.push(validatedInput);
|
|
64
|
-
if (validatedInput.branchFromThought && validatedInput.branchId) {
|
|
65
|
-
if (!this.branches[validatedInput.branchId]) {
|
|
66
|
-
this.branches[validatedInput.branchId] = [];
|
|
67
|
-
}
|
|
68
|
-
this.branches[validatedInput.branchId].push(validatedInput);
|
|
69
|
-
}
|
|
70
|
-
if (!this.disableThoughtLogging) {
|
|
71
|
-
const formattedThought = this.formatThought(validatedInput);
|
|
72
|
-
displayInfo(formattedThought);
|
|
73
|
-
}
|
|
74
|
-
return JSON.stringify({
|
|
75
|
-
thoughtNumber: validatedInput.thoughtNumber,
|
|
76
|
-
totalThoughts: validatedInput.totalThoughts,
|
|
77
|
-
nextThoughtNeeded: validatedInput.nextThoughtNeeded,
|
|
78
|
-
branches: Object.keys(this.branches),
|
|
79
|
-
thoughtHistoryLength: this.thoughtHistory.length,
|
|
80
|
-
}, null, 2);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
const toolDefinition = {
|
|
84
|
-
name: 'gth_sequential_thinking',
|
|
85
|
-
description: `Gaunt Sloth Sequential Thinking Tool. A detailed tool for dynamic and reflective problem-solving through thoughts.
|
|
86
|
-
This tool helps analyze problems through a flexible thinking process that can adapt and evolve.
|
|
87
|
-
Each thought can build on, question, or revise previous insights as understanding deepens.
|
|
88
|
-
|
|
89
|
-
When to use this tool:
|
|
90
|
-
- Breaking down complex problems into steps
|
|
91
|
-
- Planning and design with room for revision
|
|
92
|
-
- Analysis that might need course correction
|
|
93
|
-
- Problems where the full scope might not be clear initially
|
|
94
|
-
- Problems that require a multi-step solution
|
|
95
|
-
- Tasks that need to maintain context over multiple steps
|
|
96
|
-
- Situations where irrelevant information needs to be filtered out
|
|
97
|
-
|
|
98
|
-
Key features:
|
|
99
|
-
- You can adjust total_thoughts up or down as you progress
|
|
100
|
-
- You can question or revise previous thoughts
|
|
101
|
-
- You can add more thoughts even after reaching what seemed like the end
|
|
102
|
-
- You can express uncertainty and explore alternative approaches
|
|
103
|
-
- Not every thought needs to build linearly - you can branch or backtrack
|
|
104
|
-
- Generates a solution hypothesis
|
|
105
|
-
- Verifies the hypothesis based on the Chain of Thought steps
|
|
106
|
-
- Repeats the process until satisfied
|
|
107
|
-
- Provides a correct answer
|
|
108
|
-
|
|
109
|
-
Parameters explained:
|
|
110
|
-
- thought: Your current thinking step, which can include regular analytical steps, revisions, questions, realizations, changes in approach, hypothesis generation, or verification
|
|
111
|
-
- nextThoughtNeeded: True if you need more thinking, even if at what seemed like the end
|
|
112
|
-
- thoughtNumber: Current number in sequence (can go beyond initial total if needed)
|
|
113
|
-
- totalThoughts: Current estimate of thoughts needed (can be adjusted up/down)
|
|
114
|
-
- isRevision: A boolean indicating if this thought revises previous thinking
|
|
115
|
-
- revisesThought: If isRevision is true, which thought number is being reconsidered
|
|
116
|
-
- branchFromThought: If branching, which thought number is the branching point
|
|
117
|
-
- branchId: Identifier for the current branch (if any)
|
|
118
|
-
- needsMoreThoughts: If reaching end but realizing more thoughts needed
|
|
119
|
-
|
|
120
|
-
Example: gth_sequential_thinking({ thought: "Let me analyze this problem step by step", nextThoughtNeeded: true, thoughtNumber: 1, totalThoughts: 7 })`,
|
|
121
|
-
schema: gthSequentialThinkingSchema,
|
|
122
|
-
};
|
|
123
|
-
export function get(_) {
|
|
124
|
-
const processor = new SequentialThinkingProcessor();
|
|
125
|
-
const toolImpl = (input) => {
|
|
126
|
-
return processor.processThought(input);
|
|
127
|
-
};
|
|
128
|
-
return tool(toolImpl, toolDefinition);
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=gthSequentialThinkingTool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gthSequentialThinkingTool.js","sourceRoot":"","sources":["../../src/tools/gthSequentialThinkingTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C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