@gaunt-sloth/core 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gsloth.backstory.md +17 -0
- package/.gsloth.chat.md +11 -0
- package/.gsloth.code.md +27 -0
- package/.gsloth.guidelines.md +1 -0
- package/.gsloth.review.md +15 -0
- package/.gsloth.system.md +10 -0
- package/README.md +27 -0
- package/dist/config.d.ts +533 -0
- package/dist/config.js +412 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/GthAgentRunner.d.ts +27 -0
- package/dist/core/GthAgentRunner.js +109 -0
- package/dist/core/GthAgentRunner.js.map +1 -0
- package/dist/core/GthLangChainAgent.d.ts +56 -0
- package/dist/core/GthLangChainAgent.js +355 -0
- package/dist/core/GthLangChainAgent.js.map +1 -0
- package/dist/core/types.d.ts +39 -0
- package/dist/core/types.js +16 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/anthropic.d.ts +7 -0
- package/dist/providers/anthropic.js +34 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/deepseek.d.ts +4 -0
- package/dist/providers/deepseek.js +30 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/fake.d.ts +3 -0
- package/dist/providers/fake.js +12 -0
- package/dist/providers/fake.js.map +1 -0
- package/dist/providers/google-genai.d.ts +7 -0
- package/dist/providers/google-genai.js +34 -0
- package/dist/providers/google-genai.js.map +1 -0
- package/dist/providers/groq.d.ts +4 -0
- package/dist/providers/groq.js +30 -0
- package/dist/providers/groq.js.map +1 -0
- package/dist/providers/openai.d.ts +5 -0
- package/dist/providers/openai.js +46 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/openrouter.d.ts +5 -0
- package/dist/providers/openrouter.js +57 -0
- package/dist/providers/openrouter.js.map +1 -0
- package/dist/providers/vertexai.d.ts +7 -0
- package/dist/providers/vertexai.js +41 -0
- package/dist/providers/vertexai.js.map +1 -0
- package/dist/providers/xai.d.ts +4 -0
- package/dist/providers/xai.js +30 -0
- package/dist/providers/xai.js.map +1 -0
- package/dist/state/artifactStore.d.ts +21 -0
- package/dist/state/artifactStore.js +30 -0
- package/dist/state/artifactStore.js.map +1 -0
- package/dist/utils/ProgressIndicator.d.ts +7 -0
- package/dist/utils/ProgressIndicator.js +26 -0
- package/dist/utils/ProgressIndicator.js.map +1 -0
- package/dist/utils/aiignoreUtils.d.ts +29 -0
- package/dist/utils/aiignoreUtils.js +82 -0
- package/dist/utils/aiignoreUtils.js.map +1 -0
- package/dist/utils/binaryOutputUtils.d.ts +13 -0
- package/dist/utils/binaryOutputUtils.js +138 -0
- package/dist/utils/binaryOutputUtils.js.map +1 -0
- package/dist/utils/consoleUtils.d.ts +76 -0
- package/dist/utils/consoleUtils.js +230 -0
- package/dist/utils/consoleUtils.js.map +1 -0
- package/dist/utils/debugUtils.d.ts +20 -0
- package/dist/utils/debugUtils.js +89 -0
- package/dist/utils/debugUtils.js.map +1 -0
- package/dist/utils/fileUtils.d.ts +68 -0
- package/dist/utils/fileUtils.js +216 -0
- package/dist/utils/fileUtils.js.map +1 -0
- package/dist/utils/globalConfigUtils.d.ts +28 -0
- package/dist/utils/globalConfigUtils.js +61 -0
- package/dist/utils/globalConfigUtils.js.map +1 -0
- package/dist/utils/llmUtils.d.ts +39 -0
- package/dist/utils/llmUtils.js +153 -0
- package/dist/utils/llmUtils.js.map +1 -0
- package/dist/utils/stringUtils.d.ts +4 -0
- package/dist/utils/stringUtils.js +10 -0
- package/dist/utils/stringUtils.js.map +1 -0
- package/dist/utils/systemUtils.d.ts +70 -0
- package/dist/utils/systemUtils.js +207 -0
- package/dist/utils/systemUtils.js.map +1 -0
- package/dist/utils/vertexaiUtils.d.ts +2 -0
- package/dist/utils/vertexaiUtils.js +18 -0
- package/dist/utils/vertexaiUtils.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { displayWarning } from '#src/utils/consoleUtils.js';
|
|
2
|
+
import { env } from '#src/utils/systemUtils.js';
|
|
3
|
+
import { writeFileIfNotExistsWithMessages } from '#src/utils/fileUtils.js';
|
|
4
|
+
// Function to process JSON config and create Google GenAI LLM instance
|
|
5
|
+
export async function processJsonConfig(llmConfig) {
|
|
6
|
+
const { ChatGoogle } = await import('@langchain/google/node');
|
|
7
|
+
// Use config value if available, otherwise use the environment variable
|
|
8
|
+
const googleApiKey = llmConfig.apiKey || env.GOOGLE_API_KEY;
|
|
9
|
+
const configFields = {
|
|
10
|
+
...llmConfig,
|
|
11
|
+
apiKey: googleApiKey,
|
|
12
|
+
model: llmConfig.model || 'gemini-2.5-pro',
|
|
13
|
+
platformType: 'gai',
|
|
14
|
+
};
|
|
15
|
+
delete configFields.type;
|
|
16
|
+
delete configFields.apiKeyEnvironmentVariable;
|
|
17
|
+
return new ChatGoogle(configFields);
|
|
18
|
+
}
|
|
19
|
+
const jsonContent = `{
|
|
20
|
+
"llm": {
|
|
21
|
+
"type": "google-genai",
|
|
22
|
+
"model": "gemini-2.5-pro"
|
|
23
|
+
}
|
|
24
|
+
}`;
|
|
25
|
+
export function init(configFileName) {
|
|
26
|
+
// Determine which content to use based on file extension
|
|
27
|
+
if (!configFileName.endsWith('.json')) {
|
|
28
|
+
throw new Error('Only JSON config is supported.');
|
|
29
|
+
}
|
|
30
|
+
writeFileIfNotExistsWithMessages(configFileName, jsonContent);
|
|
31
|
+
displayWarning(`You need to update your ${configFileName} to add your Google GenAI API key, ` +
|
|
32
|
+
'or define GOOGLE_API_KEY environment variable.');
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=google-genai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-genai.js","sourceRoot":"","sources":["../../src/providers/google-genai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAIhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE3E,uEAAuE;AACvE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAAmF;IAEnF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC9D,wEAAwE;IACxE,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,cAAc,CAAC;IAC5D,MAAM,YAAY,GAAG;QACnB,GAAG,SAAS;QACZ,MAAM,EAAE,YAAY;QACpB,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,gBAAgB;QAC1C,YAAY,EAAE,KAAc;KAC7B,CAAC;IACF,OAAO,YAAY,CAAC,IAAI,CAAC;IACzB,OAAO,YAAY,CAAC,yBAAyB,CAAC;IAC9C,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,WAAW,GAAG;;;;;EAKlB,CAAC;AAEH,MAAM,UAAU,IAAI,CAAC,cAAsB;IACzC,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,qCAAqC;QAC5E,gDAAgD,CACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import { ChatGroqInput } from '@langchain/groq';
|
|
3
|
+
export declare function processJsonConfig(llmConfig: ChatGroqInput): Promise<BaseChatModel>;
|
|
4
|
+
export declare function init(configFileName: string): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { displayWarning } from '#src/utils/consoleUtils.js';
|
|
2
|
+
import { env } from '#src/utils/systemUtils.js';
|
|
3
|
+
import { writeFileIfNotExistsWithMessages } from '#src/utils/fileUtils.js';
|
|
4
|
+
// Function to process JSON config and create Groq LLM instance
|
|
5
|
+
export async function processJsonConfig(llmConfig) {
|
|
6
|
+
const groq = await import('@langchain/groq');
|
|
7
|
+
// Use config value if available, otherwise use the environment variable
|
|
8
|
+
const groqApiKey = llmConfig.apiKey || env.GROQ_API_KEY;
|
|
9
|
+
return new groq.ChatGroq({
|
|
10
|
+
...llmConfig,
|
|
11
|
+
apiKey: groqApiKey,
|
|
12
|
+
model: llmConfig.model || 'openai/gpt-oss-120b',
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const jsonContent = `{
|
|
16
|
+
"llm": {
|
|
17
|
+
"type": "groq",
|
|
18
|
+
"model": "openai/gpt-oss-120b"
|
|
19
|
+
}
|
|
20
|
+
}`;
|
|
21
|
+
export function init(configFileName) {
|
|
22
|
+
// Determine which content to use based on file extension
|
|
23
|
+
if (!configFileName.endsWith('.json')) {
|
|
24
|
+
throw new Error('Only JSON config is supported.');
|
|
25
|
+
}
|
|
26
|
+
writeFileIfNotExistsWithMessages(configFileName, jsonContent);
|
|
27
|
+
displayWarning(`You need to edit your ${configFileName} to configure model, ` +
|
|
28
|
+
'or define GROQ_API_KEY environment variable.');
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=groq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groq.js","sourceRoot":"","sources":["../../src/providers/groq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAIhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE3E,+DAA+D;AAC/D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,SAAwB;IAC9D,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC7C,wEAAwE;IACxE,MAAM,UAAU,GAAG,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,YAAY,CAAC;IACxD,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC;QACvB,GAAG,SAAS;QACZ,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,qBAAqB;KAChD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,WAAW,GAAG;;;;;EAKlB,CAAC;AAEH,MAAM,UAAU,IAAI,CAAC,cAAsB;IACzC,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,yBAAyB,cAAc,uBAAuB;QAC5D,8CAA8C,CACjD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BaseChatModel, type BaseChatModelParams } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import { OpenAIChatInput } from '@langchain/openai';
|
|
3
|
+
import { ChatOpenAIFields } from '@langchain/openai';
|
|
4
|
+
export declare function processJsonConfig(llmConfig: OpenAIChatInput & ChatOpenAIFields & BaseChatModelParams): Promise<BaseChatModel>;
|
|
5
|
+
export declare function init(configFileName: string): void;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { displayWarning } from '#src/utils/consoleUtils.js';
|
|
2
|
+
import { env } from '#src/utils/systemUtils.js';
|
|
3
|
+
import { writeFileIfNotExistsWithMessages } from '#src/utils/fileUtils.js';
|
|
4
|
+
// Function to process JSON config and create OpenAI LLM instance
|
|
5
|
+
// noinspection JSUnusedGlobalSymbols
|
|
6
|
+
export async function processJsonConfig(llmConfig) {
|
|
7
|
+
const { ChatOpenAI } = await import('@langchain/openai');
|
|
8
|
+
// Use environment variable if available, otherwise use the config value
|
|
9
|
+
const openaiApiKey = getApiKey(llmConfig);
|
|
10
|
+
const configFields = {
|
|
11
|
+
...llmConfig,
|
|
12
|
+
apiKey: openaiApiKey,
|
|
13
|
+
model: llmConfig.model || 'gpt-4o',
|
|
14
|
+
};
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
delete configFields.type;
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
delete configFields.apiKeyEnvironmentVariable;
|
|
19
|
+
return new ChatOpenAI(configFields);
|
|
20
|
+
}
|
|
21
|
+
function getApiKey(llmConfig) {
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
const conf = llmConfig;
|
|
24
|
+
if (conf.apiKeyEnvironmentVariable && env[conf.apiKeyEnvironmentVariable]) {
|
|
25
|
+
return env[conf.apiKeyEnvironmentVariable];
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return llmConfig.apiKey || env.OPENAI_API_KEY;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const jsonContent = `{
|
|
32
|
+
"llm": {
|
|
33
|
+
"type": "openai",
|
|
34
|
+
"model": "gpt-4o"
|
|
35
|
+
}
|
|
36
|
+
}`;
|
|
37
|
+
export function init(configFileName) {
|
|
38
|
+
// Determine which content to use based on file extension
|
|
39
|
+
if (!configFileName.endsWith('.json')) {
|
|
40
|
+
throw new Error('Only JSON config is supported.');
|
|
41
|
+
}
|
|
42
|
+
writeFileIfNotExistsWithMessages(configFileName, jsonContent);
|
|
43
|
+
displayWarning(`You need to edit your ${configFileName} to configure model, ` +
|
|
44
|
+
'or define OPENAI_API_KEY environment variable.');
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@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,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,yBAAyB,cAAc,uBAAuB;QAC5D,gDAAgD,CACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BaseChatModel, type BaseChatModelParams } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import { OpenAIChatInput } from '@langchain/openai';
|
|
3
|
+
import { ChatOpenAIFields } from '@langchain/openai';
|
|
4
|
+
export declare function processJsonConfig(llmConfig: OpenAIChatInput & ChatOpenAIFields & BaseChatModelParams): Promise<BaseChatModel>;
|
|
5
|
+
export declare function init(configFileName: string): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { displayWarning } from '#src/utils/consoleUtils.js';
|
|
2
|
+
import { env } from '#src/utils/systemUtils.js';
|
|
3
|
+
import { writeFileIfNotExistsWithMessages } from '#src/utils/fileUtils.js';
|
|
4
|
+
// Function to process JSON config and create OpenRouter LLM instance
|
|
5
|
+
// noinspection JSUnusedGlobalSymbols
|
|
6
|
+
export async function processJsonConfig(llmConfig) {
|
|
7
|
+
const { ChatOpenAI } = await import('@langchain/openai');
|
|
8
|
+
// Use environment variable if available, otherwise use the config value
|
|
9
|
+
const openRouterApiKey = getApiKey(llmConfig);
|
|
10
|
+
if (!openRouterApiKey) {
|
|
11
|
+
throw new Error('You need to define OPEN_ROUTER_API_KEY environment variable, or set apiKey in your config file.');
|
|
12
|
+
}
|
|
13
|
+
const configFields = {
|
|
14
|
+
...llmConfig,
|
|
15
|
+
apiKey: openRouterApiKey,
|
|
16
|
+
model: llmConfig.model || 'qwen/qwen3-coder',
|
|
17
|
+
configuration: {
|
|
18
|
+
baseURL: 'https://openrouter.ai/api/v1',
|
|
19
|
+
...(llmConfig.configuration || {}),
|
|
20
|
+
defaultHeaders: {
|
|
21
|
+
'HTTP-Referer': 'https://gaunt-sloth-assistant.github.io/',
|
|
22
|
+
'X-Title': 'Gaunt Sloth Assistant',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
delete configFields.type;
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
delete configFields.apiKeyEnvironmentVariable;
|
|
30
|
+
return new ChatOpenAI(configFields);
|
|
31
|
+
}
|
|
32
|
+
function getApiKey(llmConfig) {
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
const conf = llmConfig;
|
|
35
|
+
if (conf.apiKeyEnvironmentVariable && env[conf.apiKeyEnvironmentVariable]) {
|
|
36
|
+
return env[conf.apiKeyEnvironmentVariable];
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return llmConfig.apiKey || env.OPEN_ROUTER_API_KEY || env.OPENROUTER_API_KEY;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const jsonContent = `{
|
|
43
|
+
"llm": {
|
|
44
|
+
"type": "openrouter",
|
|
45
|
+
"model": "qwen/qwen3-coder"
|
|
46
|
+
}
|
|
47
|
+
}`;
|
|
48
|
+
export function init(configFileName) {
|
|
49
|
+
// Determine which content to use based on file extension
|
|
50
|
+
if (!configFileName.endsWith('.json')) {
|
|
51
|
+
throw new Error('Only JSON config is supported.');
|
|
52
|
+
}
|
|
53
|
+
writeFileIfNotExistsWithMessages(configFileName, jsonContent);
|
|
54
|
+
displayWarning(`You need to edit your ${configFileName} to configure model, ` +
|
|
55
|
+
'or define OPEN_ROUTER_API_KEY environment variable.');
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=openrouter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openrouter.js","sourceRoot":"","sources":["../../src/providers/openrouter.ts"],"names":[],"mappings":"AAAA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S,CAAC,MAAM,IAAI,GAAG,CAAC,mBAAmB,IAAI,GAAG,CAAC,kBAAkB,CAAC;IAC/E,CAAC;AACH,CAAC;AAED,MAAM,WAAW,GAAG;;;;;EAKlB,CAAC;AAEH,MAAM,UAAU,IAAI,CAAC,cAAsB;IACzC,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,yBAAyB,cAAc,uBAAuB;QAC5D,qDAAqD,CACxD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { ChatGoogleParams } from '@langchain/google/node';
|
|
3
|
+
export declare function init(configFileName: string): void;
|
|
4
|
+
export declare function processJsonConfig(llmConfig: ChatGoogleParams & {
|
|
5
|
+
type?: string;
|
|
6
|
+
apiKeyEnvironmentVariable?: string;
|
|
7
|
+
}): Promise<BaseChatModel>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* Google VertexAI preset.
|
|
4
|
+
* This preset requires `gcloud auth login` and `gcloud auth application-default login`.
|
|
5
|
+
* <p>
|
|
6
|
+
* Caveats:
|
|
7
|
+
* This preset does not support discriminatedUnion, anyOf, oneOf in tool signatures,
|
|
8
|
+
* Gaunt Sloth converts those tools to flat calls, and generally they work fine,
|
|
9
|
+
* but sometimes this may lead to some quirks.
|
|
10
|
+
* <p>
|
|
11
|
+
* Hopefully this issue will go away when LangChain switches to the new GenAI dependency.
|
|
12
|
+
*/
|
|
13
|
+
import { displayWarning } from '#src/utils/consoleUtils.js';
|
|
14
|
+
import { writeFileIfNotExistsWithMessages } from '#src/utils/fileUtils.js';
|
|
15
|
+
const jsonContent = `{
|
|
16
|
+
"llm": {
|
|
17
|
+
"type": "vertexai",
|
|
18
|
+
"model": "gemini-2.5-pro"
|
|
19
|
+
}
|
|
20
|
+
}`;
|
|
21
|
+
export function init(configFileName) {
|
|
22
|
+
// Determine which content to use based on file extension
|
|
23
|
+
if (!configFileName.endsWith('.json')) {
|
|
24
|
+
throw new Error('Only JSON config is supported.');
|
|
25
|
+
}
|
|
26
|
+
writeFileIfNotExistsWithMessages(configFileName, jsonContent);
|
|
27
|
+
displayWarning('For Google VertexAI you likely to need to do `gcloud auth login` and `gcloud auth application-default login`.');
|
|
28
|
+
}
|
|
29
|
+
// Function to process JSON config and create VertexAI LLM instance
|
|
30
|
+
export async function processJsonConfig(llmConfig) {
|
|
31
|
+
const { ChatGoogle } = await import('@langchain/google/node');
|
|
32
|
+
const configFields = {
|
|
33
|
+
...llmConfig,
|
|
34
|
+
model: llmConfig.model || 'gemini-2.5-pro',
|
|
35
|
+
vertexai: true,
|
|
36
|
+
};
|
|
37
|
+
delete configFields.type;
|
|
38
|
+
delete configFields.apiKeyEnvironmentVariable;
|
|
39
|
+
return new ChatGoogle(configFields);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=vertexai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertexai.js","sourceRoot":"","sources":["../../src/providers/vertexai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAI5D,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE3E,MAAM,WAAW,GAAG;;;;;EAKlB,CAAC;AAEH,MAAM,UAAU,IAAI,CAAC,cAAsB;IACzC,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,+GAA+G,CAChH,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAAmF;IAEnF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG;QACnB,GAAG,SAAS;QACZ,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,gBAAgB;QAC1C,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,OAAO,YAAY,CAAC,IAAI,CAAC;IACzB,OAAO,YAAY,CAAC,yBAAyB,CAAC;IAC9C,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BaseChatModel, BaseChatModelParams } from '@langchain/core/language_models/chat_models';
|
|
2
|
+
import type { ChatXAIInput } from '@langchain/xai';
|
|
3
|
+
export declare function processJsonConfig(llmConfig: ChatXAIInput & BaseChatModelParams): Promise<BaseChatModel>;
|
|
4
|
+
export declare function init(configFileName: string): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { displayWarning } from '#src/utils/consoleUtils.js';
|
|
2
|
+
import { env } from '#src/utils/systemUtils.js';
|
|
3
|
+
import { writeFileIfNotExistsWithMessages } from '#src/utils/fileUtils.js';
|
|
4
|
+
// Function to process JSON config and create XAI LLM instance
|
|
5
|
+
export async function processJsonConfig(llmConfig) {
|
|
6
|
+
const { ChatXAI } = await import('@langchain/xai');
|
|
7
|
+
// Use config value if available, otherwise use the environment variable
|
|
8
|
+
const apiKey = llmConfig.apiKey || env.XAI_API_KEY;
|
|
9
|
+
return new ChatXAI({
|
|
10
|
+
...llmConfig,
|
|
11
|
+
apiKey,
|
|
12
|
+
model: llmConfig.model || 'grok-4-1-fast',
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const jsonContent = `{
|
|
16
|
+
"llm": {
|
|
17
|
+
"type": "xai",
|
|
18
|
+
"model": "grok-4-1-fast"
|
|
19
|
+
}
|
|
20
|
+
}`;
|
|
21
|
+
export function init(configFileName) {
|
|
22
|
+
// Determine which content to use based on file extension
|
|
23
|
+
if (!configFileName.endsWith('.json')) {
|
|
24
|
+
throw new Error('Only JSON config is supported.');
|
|
25
|
+
}
|
|
26
|
+
writeFileIfNotExistsWithMessages(configFileName, jsonContent);
|
|
27
|
+
displayWarning(`You need to update your ${configFileName} to add your xAI API key, ` +
|
|
28
|
+
'or define XAI_API_KEY environment variable.');
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=xai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xai.js","sourceRoot":"","sources":["../../src/providers/xai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAOhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE3E,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAA6C;IAE7C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACnD,wEAAwE;IACxE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,WAAW,CAAC;IACnD,OAAO,IAAI,OAAO,CAAC;QACjB,GAAG,SAAS;QACZ,MAAM;QACN,KAAK,EAAE,SAAS,CAAC,KAAK,IAAI,eAAe;KAC1C,CAAC,CAAC;AACL,CAAC;AAED,MAAM,WAAW,GAAG;;;;;EAKlB,CAAC;AAEH,MAAM,UAAU,IAAI,CAAC,cAAsB;IACzC,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,4BAA4B;QACnE,6CAA6C,CAChD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple in-memory artifact store shared across commands.
|
|
3
|
+
* Allows middleware and modules to exchange structured data.
|
|
4
|
+
*/
|
|
5
|
+
export type ArtifactValue<T = unknown> = T;
|
|
6
|
+
/**
|
|
7
|
+
* Store an artifact value by key.
|
|
8
|
+
*/
|
|
9
|
+
export declare function setArtifact<T>(key: string, value: ArtifactValue<T>): void;
|
|
10
|
+
/**
|
|
11
|
+
* Retrieve an artifact value by key.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getArtifact<T>(key: string): ArtifactValue<T> | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Remove an artifact by key.
|
|
16
|
+
*/
|
|
17
|
+
export declare function deleteArtifact(key: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Clear all stored artifacts.
|
|
20
|
+
*/
|
|
21
|
+
export declare function clearArtifacts(): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple in-memory artifact store shared across commands.
|
|
3
|
+
* Allows middleware and modules to exchange structured data.
|
|
4
|
+
*/
|
|
5
|
+
const artifacts = new Map();
|
|
6
|
+
/**
|
|
7
|
+
* Store an artifact value by key.
|
|
8
|
+
*/
|
|
9
|
+
export function setArtifact(key, value) {
|
|
10
|
+
artifacts.set(key, value);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Retrieve an artifact value by key.
|
|
14
|
+
*/
|
|
15
|
+
export function getArtifact(key) {
|
|
16
|
+
return artifacts.get(key);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Remove an artifact by key.
|
|
20
|
+
*/
|
|
21
|
+
export function deleteArtifact(key) {
|
|
22
|
+
artifacts.delete(key);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Clear all stored artifacts.
|
|
26
|
+
*/
|
|
27
|
+
export function clearArtifacts() {
|
|
28
|
+
artifacts.clear();
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=artifactStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifactStore.js","sourceRoot":"","sources":["../../src/state/artifactStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;AAI7C;;GAEG;AACH,MAAM,UAAU,WAAW,CAAI,GAAW,EAAE,KAAuB;IACjE,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAI,GAAW;IACxC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAiC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,SAAS,CAAC,KAAK,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { stdout } from '#src/utils/systemUtils.js';
|
|
2
|
+
export class ProgressIndicator {
|
|
3
|
+
interval = undefined;
|
|
4
|
+
constructor(initialMessage, manual) {
|
|
5
|
+
stdout.write(initialMessage);
|
|
6
|
+
if (!manual) {
|
|
7
|
+
this.interval = setInterval(this.indicateInner, 1000);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
indicateInner() {
|
|
11
|
+
stdout.write('.');
|
|
12
|
+
}
|
|
13
|
+
indicate() {
|
|
14
|
+
if (this.interval) {
|
|
15
|
+
throw new Error('ProgressIndicator.indicate only to be called in manual mode');
|
|
16
|
+
}
|
|
17
|
+
this.indicateInner();
|
|
18
|
+
}
|
|
19
|
+
stop() {
|
|
20
|
+
if (this.interval) {
|
|
21
|
+
clearInterval(this.interval);
|
|
22
|
+
}
|
|
23
|
+
stdout.write('\n');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=ProgressIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressIndicator.js","sourceRoot":"","sources":["../../src/utils/ProgressIndicator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,MAAM,OAAO,iBAAiB;IACpB,QAAQ,GAAuB,SAAS,CAAC;IAEjD,YAAY,cAAsB,EAAE,MAAgB;QAClD,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAsB,CAAC;QAC7E,CAAC;IACH,CAAC;IAEO,aAAa;QACnB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAED,IAAI;QACF,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* AI Ignore utility functions for handling .aiignore files.
|
|
4
|
+
* Provides functionality similar to .gitignore for filtering files.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Load .aiignore patterns from file
|
|
8
|
+
* @param rootDir - The root directory to look for .aiignore file
|
|
9
|
+
* @returns Array of ignore patterns
|
|
10
|
+
*/
|
|
11
|
+
export declare function loadAiignorePatterns(rootDir: string): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Check if a file path should be ignored based on aiignore patterns
|
|
14
|
+
* @param filePath - The file path to check
|
|
15
|
+
* @param rootDir - The root directory for relative pattern matching
|
|
16
|
+
* @param customPatterns - Optional custom patterns to use instead of loading from file
|
|
17
|
+
* @param enabled - Whether aiignore is enabled
|
|
18
|
+
* @returns True if the file should be ignored, false otherwise
|
|
19
|
+
*/
|
|
20
|
+
export declare function shouldIgnoreFile(filePath: string, rootDir: string, customPatterns?: string[] | undefined, enabled?: boolean): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Filter an array of file paths based on aiignore patterns
|
|
23
|
+
* @param filePaths - Array of file paths to filter
|
|
24
|
+
* @param rootDir - The root directory for relative pattern matching
|
|
25
|
+
* @param customPatterns - Optional custom patterns to use instead of loading from file
|
|
26
|
+
* @param enabled - Whether aiignore is enabled
|
|
27
|
+
* @returns Filtered array of file paths that should not be ignored
|
|
28
|
+
*/
|
|
29
|
+
export declare function filterIgnoredFiles(filePaths: string[], rootDir: string, customPatterns?: string[] | undefined, enabled?: boolean): string[];
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* AI Ignore utility functions for handling .aiignore files.
|
|
4
|
+
* Provides functionality similar to .gitignore for filtering files.
|
|
5
|
+
*/
|
|
6
|
+
import { AIIGNORE_FILE } from '#src/constants.js';
|
|
7
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { debugLog } from '#src/utils/debugUtils.js';
|
|
10
|
+
/**
|
|
11
|
+
* Load .aiignore patterns from file
|
|
12
|
+
* @param rootDir - The root directory to look for .aiignore file
|
|
13
|
+
* @returns Array of ignore patterns
|
|
14
|
+
*/
|
|
15
|
+
export function loadAiignorePatterns(rootDir) {
|
|
16
|
+
const aiignorePath = path.join(rootDir, AIIGNORE_FILE);
|
|
17
|
+
if (!existsSync(aiignorePath)) {
|
|
18
|
+
debugLog(`No ${AIIGNORE_FILE} file found at ${aiignorePath}`);
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const content = readFileSync(aiignorePath, 'utf-8');
|
|
23
|
+
const patterns = content
|
|
24
|
+
.split('\n')
|
|
25
|
+
.map((line) => line.trim())
|
|
26
|
+
.filter((line) => line.length > 0 && !line.startsWith('#'));
|
|
27
|
+
debugLog(`Loaded ${patterns.length} patterns from ${AIIGNORE_FILE}`);
|
|
28
|
+
return patterns;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
debugLog(`Error reading ${AIIGNORE_FILE}: ${error instanceof Error ? error.message : String(error)}`);
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Check if a file path should be ignored based on aiignore patterns
|
|
37
|
+
* @param filePath - The file path to check
|
|
38
|
+
* @param rootDir - The root directory for relative pattern matching
|
|
39
|
+
* @param customPatterns - Optional custom patterns to use instead of loading from file
|
|
40
|
+
* @param enabled - Whether aiignore is enabled
|
|
41
|
+
* @returns True if the file should be ignored, false otherwise
|
|
42
|
+
*/
|
|
43
|
+
export function shouldIgnoreFile(filePath, rootDir, customPatterns = undefined, enabled = true) {
|
|
44
|
+
if (!enabled) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
// Get patterns from custom config or load from file
|
|
48
|
+
const patterns = customPatterns ?? loadAiignorePatterns(rootDir);
|
|
49
|
+
if (patterns.length === 0) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
// Convert file path to relative path for pattern matching
|
|
53
|
+
const relativePath = path.relative(rootDir, filePath);
|
|
54
|
+
// Check if any pattern matches
|
|
55
|
+
for (const pattern of patterns) {
|
|
56
|
+
try {
|
|
57
|
+
if (path.matchesGlob(relativePath, pattern)) {
|
|
58
|
+
debugLog(`File ignored by pattern '${pattern}': ${relativePath}`);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
debugLog(`Error matching pattern '${pattern}': ${error instanceof Error ? error.message : String(error)}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Filter an array of file paths based on aiignore patterns
|
|
70
|
+
* @param filePaths - Array of file paths to filter
|
|
71
|
+
* @param rootDir - The root directory for relative pattern matching
|
|
72
|
+
* @param customPatterns - Optional custom patterns to use instead of loading from file
|
|
73
|
+
* @param enabled - Whether aiignore is enabled
|
|
74
|
+
* @returns Filtered array of file paths that should not be ignored
|
|
75
|
+
*/
|
|
76
|
+
export function filterIgnoredFiles(filePaths, rootDir, customPatterns = undefined, enabled = true) {
|
|
77
|
+
if (!enabled) {
|
|
78
|
+
return filePaths;
|
|
79
|
+
}
|
|
80
|
+
return filePaths.filter((filePath) => !shouldIgnoreFile(filePath, rootDir, customPatterns, enabled));
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=aiignoreUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiignoreUtils.js","sourceRoot":"","sources":["../../src/utils/aiignoreUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAA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AAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0DAA0D;IAC1D,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAEtD,+BAA+B;IAC/B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC5C,QAAQ,CAAC,4BAA4B,OAAO,MAAM,YAAY,EAAE,CAAC,CAAC;gBAClE,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,QAAQ,CACN,2BAA2B,OAAO,MAAM,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACjG,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAAmB,EACnB,OAAe,EACf,iBAAuC,SAAS,EAChD,UAAmB,IAAI;IAEvB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,SAAS,CAAC,MAAM,CACrB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,CAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GthCommand } from '#src/core/types.js';
|
|
2
|
+
interface InlineBinaryBlock {
|
|
3
|
+
index: number;
|
|
4
|
+
mimeType: string;
|
|
5
|
+
data: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function extractInlineBinaryBlocks(content: unknown): InlineBinaryBlock[];
|
|
8
|
+
export declare function renderAssistantContent(content: unknown, binaryPlaceholders?: Map<number, string>): string;
|
|
9
|
+
export declare function materializeBinaryOutputs(content: unknown, command: GthCommand | undefined): {
|
|
10
|
+
renderedContent: string;
|
|
11
|
+
successMessages: string[];
|
|
12
|
+
};
|
|
13
|
+
export {};
|