genaicode 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ai-service/service-configurations-types.d.ts +15 -1
- package/dist/ai-service/service-configurations-types.js +4 -0
- package/dist/ai-service/service-configurations-types.js.map +1 -1
- package/dist/cli/cli-params.d.ts +1 -0
- package/dist/cli/cli-params.js +1 -0
- package/dist/cli/cli-params.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/main/codegen-types.d.ts +2 -1
- package/dist/main/codegen.js +1 -0
- package/dist/main/codegen.js.map +1 -1
- package/dist/main/common/user-actions.d.ts +5 -2
- package/dist/main/common/user-actions.js +2 -2
- package/dist/main/common/user-actions.js.map +1 -1
- package/dist/main/config-lib.d.ts +12 -3
- package/dist/main/config-lib.js +61 -44
- package/dist/main/config-lib.js.map +1 -1
- package/dist/main/config-schema.d.ts +2 -1
- package/dist/main/config-schema.js +153 -19
- package/dist/main/config-schema.js.map +1 -1
- package/dist/main/config-types.d.ts +43 -16
- package/dist/main/config-types.js +3 -1
- package/dist/main/config-types.js.map +1 -1
- package/dist/main/config.d.ts +8 -2
- package/dist/main/config.js +59 -11
- package/dist/main/config.js.map +1 -1
- package/dist/main/plugin-loader.d.ts +1 -0
- package/dist/main/plugin-loader.js +28 -6
- package/dist/main/plugin-loader.js.map +1 -1
- package/dist/main/ui/backend/api.js +2 -0
- package/dist/main/ui/backend/api.js.map +1 -1
- package/dist/main/ui/backend/endpoints/config-endpoint.js +12 -0
- package/dist/main/ui/backend/endpoints/config-endpoint.js.map +1 -1
- package/dist/main/ui/backend/endpoints/question-endpoint.js +5 -4
- package/dist/main/ui/backend/endpoints/question-endpoint.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +3 -1
- package/dist/main/ui/backend/service.js +4 -3
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/common/api-types.d.ts +1 -0
- package/dist/main/ui/common/api-types.js.map +1 -1
- package/dist/main/ui/frontend/assets/index-C2MB0Z2i.js +2665 -0
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/main/ui/user-action-handlers.js +3 -1
- package/dist/main/ui/user-action-handlers.js.map +1 -1
- package/dist/prompt/function-calling-validate.js +1 -0
- package/dist/prompt/function-calling-validate.js.map +1 -1
- package/dist/prompt/function-calling.js +7 -4
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/ask-question.d.ts +2 -2
- package/dist/prompt/function-defs/ask-question.js +60 -52
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/conversation-graph.d.ts +1 -1
- package/dist/prompt/function-defs/conversation-graph.js +4 -4
- package/dist/prompt/function-defs/conversation-graph.js.map +1 -1
- package/dist/prompt/function-defs/run-bash-command.d.ts +2 -0
- package/dist/prompt/function-defs/run-bash-command.js +29 -0
- package/dist/prompt/function-defs/run-bash-command.js.map +1 -0
- package/dist/prompt/function-defs/run-project-command.d.ts +2 -0
- package/dist/prompt/function-defs/run-project-command.js +37 -0
- package/dist/prompt/function-defs/run-project-command.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/container-task/commands/send-message.js +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/container-task/commands/send-message.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-lint.d.ts +2 -2
- package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js +31 -69
- package/dist/prompt/steps/step-ask-question/handlers/handle-lint.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-project-command.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-project-command.js +282 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-project-command.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-git-context.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-git-context.js +70 -3
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-git-context.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-run-bash-command.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-run-bash-command.js +185 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-run-bash-command.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js +2 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +31 -12
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +2 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +16 -2
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
- package/dist/prompt/systemprompt.js +2 -2
- package/package.json +4 -3
- package/dist/main/ui/frontend/assets/index-j9Oi9iiP.js +0 -2635
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { putSystemMessage, putUserMessage } from '../../../../main/common/content-bus.js';
|
|
4
|
+
import { rcConfig } from '../../../../main/config.js';
|
|
5
|
+
import { registerActionHandler } from '../step-ask-question-handlers.js';
|
|
6
|
+
import { ModelType } from '../../../../ai-service/common-types.js';
|
|
7
|
+
import { getFunctionDefs } from '../../../function-calling.js';
|
|
8
|
+
import { askUserForConfirmationWithAnswer } from '../../../../main/common/user-actions.js';
|
|
9
|
+
const execPromise = promisify(exec);
|
|
10
|
+
export async function handleRunBashCommand({ generateContentFn, askQuestionCall, prompt, options, }) {
|
|
11
|
+
const runBashCommandRequest = [
|
|
12
|
+
[
|
|
13
|
+
...prompt,
|
|
14
|
+
{
|
|
15
|
+
type: 'assistant',
|
|
16
|
+
text: askQuestionCall.args?.message ?? '',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
{
|
|
20
|
+
functionDefs: getFunctionDefs(),
|
|
21
|
+
requiredFunctionName: 'runBashCommand',
|
|
22
|
+
modelType: ModelType.CHEAP,
|
|
23
|
+
temperature: 0.7,
|
|
24
|
+
expectedResponseType: { text: false, functionCall: true, media: false },
|
|
25
|
+
},
|
|
26
|
+
options,
|
|
27
|
+
];
|
|
28
|
+
const runBashCommandResult = await generateContentFn(...runBashCommandRequest);
|
|
29
|
+
const runBashCommandCall = runBashCommandResult
|
|
30
|
+
.filter((item) => item.type === 'functionCall')
|
|
31
|
+
.map((item) => item.functionCall)
|
|
32
|
+
.find((call) => call.name === 'runBashCommand');
|
|
33
|
+
if (!runBashCommandCall?.args) {
|
|
34
|
+
putSystemMessage('No runBashCommand call found in the assistant response.');
|
|
35
|
+
prompt.push({
|
|
36
|
+
type: 'assistant',
|
|
37
|
+
text: askQuestionCall.args.message,
|
|
38
|
+
}, {
|
|
39
|
+
type: 'user',
|
|
40
|
+
text: 'No runBashCommand call found in the assistant response.',
|
|
41
|
+
});
|
|
42
|
+
return { breakLoop: true, items: [] };
|
|
43
|
+
}
|
|
44
|
+
const { command, env: envOverride, workingDirOverride, truncMode = 'summarize' } = runBashCommandCall.args;
|
|
45
|
+
const confirmation = await askUserForConfirmationWithAnswer(`Do you want to run the bash command "${command}"?`, 'Run command', 'Reject', true, options);
|
|
46
|
+
if (confirmation.answer) {
|
|
47
|
+
putUserMessage(confirmation.answer);
|
|
48
|
+
}
|
|
49
|
+
if (!confirmation.confirmed) {
|
|
50
|
+
putSystemMessage(`Bash command "${command}" cancelled by user.`);
|
|
51
|
+
prompt.push({
|
|
52
|
+
type: 'assistant',
|
|
53
|
+
text: askQuestionCall.args.message,
|
|
54
|
+
functionCalls: [{ name: 'runBashCommand', id: askQuestionCall.id + '_runBashCommand', args: { command } }],
|
|
55
|
+
}, {
|
|
56
|
+
type: 'user',
|
|
57
|
+
text: `I reject running the bash command "${command}".` + (confirmation.answer ? ` ${confirmation.answer}` : ''),
|
|
58
|
+
functionResponses: [
|
|
59
|
+
{
|
|
60
|
+
name: 'runBashCommand',
|
|
61
|
+
call_id: askQuestionCall.id + '_runBashCommand',
|
|
62
|
+
content: JSON.stringify({ error: 'User rejected command execution.' }),
|
|
63
|
+
isError: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
return { breakLoop: true, items: [] };
|
|
68
|
+
}
|
|
69
|
+
const cwd = workingDirOverride || rcConfig.rootDir;
|
|
70
|
+
const env = { ...process.env, ...envOverride };
|
|
71
|
+
putSystemMessage(`Executing bash command: ${command}`, {
|
|
72
|
+
cwd,
|
|
73
|
+
envOverride,
|
|
74
|
+
truncMode,
|
|
75
|
+
workingDirOverride,
|
|
76
|
+
});
|
|
77
|
+
let result;
|
|
78
|
+
try {
|
|
79
|
+
const { stdout, stderr } = await execPromise(command, { cwd, env });
|
|
80
|
+
result = { success: true, exitCode: 0, stdout, stderr };
|
|
81
|
+
putSystemMessage(`Bash command executed successfully.`, { stdout, stderr });
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
const { code, stdout, stderr } = error;
|
|
85
|
+
result = {
|
|
86
|
+
success: false,
|
|
87
|
+
exitCode: code ?? 1,
|
|
88
|
+
stdout,
|
|
89
|
+
stderr,
|
|
90
|
+
};
|
|
91
|
+
putSystemMessage(`Bash command failed with exit code ${result.exitCode}.`, {
|
|
92
|
+
stdout: result.stdout,
|
|
93
|
+
stderr: result.stderr,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// Handle output truncation
|
|
97
|
+
if (truncMode === 'first') {
|
|
98
|
+
result.stdout = truncateOutput(result.stdout, 'first');
|
|
99
|
+
result.stderr = truncateOutput(result.stderr, 'first');
|
|
100
|
+
}
|
|
101
|
+
else if (truncMode === 'last') {
|
|
102
|
+
result.stdout = truncateOutput(result.stdout, 'last');
|
|
103
|
+
result.stderr = truncateOutput(result.stderr, 'last');
|
|
104
|
+
}
|
|
105
|
+
else if (truncMode === 'summarize') {
|
|
106
|
+
if (result.stdout.length > 0) {
|
|
107
|
+
result.stdout = await summarizeOutput(result.stdout, generateContentFn, options);
|
|
108
|
+
}
|
|
109
|
+
if (result.stderr.length > 0) {
|
|
110
|
+
result.stderr = await summarizeOutput(result.stderr, generateContentFn, options);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
putSystemMessage(`Command output sent to AI`, {
|
|
114
|
+
truncMode,
|
|
115
|
+
stdout: result.stdout,
|
|
116
|
+
stderr: result.stderr,
|
|
117
|
+
});
|
|
118
|
+
prompt.push({
|
|
119
|
+
type: 'assistant',
|
|
120
|
+
functionCalls: [{ name: 'runBashCommand', id: askQuestionCall.id + '_runBashCommand', args: { command } }],
|
|
121
|
+
}, {
|
|
122
|
+
type: 'user',
|
|
123
|
+
text: `Command "${command}" finished with exit code ${result.exitCode}. Please analyze the output.`,
|
|
124
|
+
functionResponses: [
|
|
125
|
+
{
|
|
126
|
+
name: 'runBashCommand',
|
|
127
|
+
call_id: askQuestionCall.id + '_runBashCommand',
|
|
128
|
+
content: JSON.stringify(result),
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
breakLoop: false,
|
|
134
|
+
items: [],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const MAX_OUTPUT_LENGTH = 2000;
|
|
138
|
+
const TRUNCATE_LINES = 200;
|
|
139
|
+
const TRUNCATE_CHARS = 1000;
|
|
140
|
+
function truncateOutput(output, mode) {
|
|
141
|
+
if (output.length <= MAX_OUTPUT_LENGTH) {
|
|
142
|
+
return output;
|
|
143
|
+
}
|
|
144
|
+
const lines = output.split('\\n');
|
|
145
|
+
if (mode === 'first') {
|
|
146
|
+
const truncatedLines = lines.slice(0, TRUNCATE_LINES).join('\\n');
|
|
147
|
+
return truncatedLines.length > TRUNCATE_CHARS ? truncatedLines.substring(0, TRUNCATE_CHARS) : truncatedLines;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
// mode === 'last'
|
|
151
|
+
const truncatedLines = lines.slice(-TRUNCATE_LINES).join('\\n');
|
|
152
|
+
return truncatedLines.length > TRUNCATE_CHARS
|
|
153
|
+
? truncatedLines.substring(truncatedLines.length - TRUNCATE_CHARS)
|
|
154
|
+
: truncatedLines;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async function summarizeOutput(output, generateContentFn, options) {
|
|
158
|
+
if (output.length <= MAX_OUTPUT_LENGTH) {
|
|
159
|
+
return output;
|
|
160
|
+
}
|
|
161
|
+
putSystemMessage('Summarizing command output...');
|
|
162
|
+
const summaryPrompt = [
|
|
163
|
+
{
|
|
164
|
+
type: 'user',
|
|
165
|
+
text: `Please summarize the following command output:\\n\\n---\\n\\n${output}`,
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
const summaryRequest = [
|
|
169
|
+
summaryPrompt,
|
|
170
|
+
{
|
|
171
|
+
modelType: ModelType.LITE,
|
|
172
|
+
expectedResponseType: { text: true, functionCall: false, media: false },
|
|
173
|
+
},
|
|
174
|
+
options,
|
|
175
|
+
];
|
|
176
|
+
const summaryResult = await generateContentFn(...summaryRequest);
|
|
177
|
+
const summaryText = summaryResult.find((part) => part.type === 'text')?.text;
|
|
178
|
+
if (!summaryText) {
|
|
179
|
+
putSystemMessage('Failed to summarize output, returning truncated version.');
|
|
180
|
+
return truncateOutput(output, 'first');
|
|
181
|
+
}
|
|
182
|
+
return summaryText;
|
|
183
|
+
}
|
|
184
|
+
registerActionHandler('runBashCommand', handleRunBashCommand);
|
|
185
|
+
//# sourceMappingURL=handle-run-bash-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-run-bash-command.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-run-bash-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,wC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CAAC,cAAc,CAAC,MAAM,GAAG,cAAc,CAAC;YAClE,CAAC,CAAC,cAAc,CAAC;IACrB,CAAC;AACH,CAAC;AAED,KAAK,UAAU,eAAe,CAC5B,MAAc,EACd,iBAA0D,EAC1D,OAAsC;IAEtC,IAAI,MAAM,CAAC,MAAM,IAAI,iBAAiB,EAAE,CAAC;QACvC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,gBAAgB,CAAC,+BAA+B,CAAC,CAAC;IAClD,MAAM,aAAa,GAAiB;QAClC;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,gEAAgE,MAAM,EAAE;SAC/E;KACF,CAAC;IACF,MAAM,cAAc,GAAwB;QAC1C,aAAa;QACb;YACE,SAAS,EAAE,SAAS,CAAC,IAAI;YACzB,oBAAoB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;SACxE;QACD,OAAO;KACR,CAAC;IACF,MAAM,aAAa,GAAG,MAAM,iBAAiB,CAAC,GAAG,cAAc,CAAC,CAAC;IACjE,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,IAAI,CAAC;IAC7E,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,gBAAgB,CAAC,0DAA0D,CAAC,CAAC;QAC7E,OAAO,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,qBAAqB,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC"}
|
|
@@ -2,9 +2,10 @@ import { askUserForInput } from '../../../../main/common/user-actions.js';
|
|
|
2
2
|
import { registerActionHandler } from '../step-ask-question-handlers.js';
|
|
3
3
|
registerActionHandler('sendMessage', handleSendMessage);
|
|
4
4
|
export async function handleSendMessage({ askQuestionCall, options }) {
|
|
5
|
-
const response = await askUserForInput('Your answer', '', options);
|
|
5
|
+
const response = await askUserForInput('Your answer', '', options, true);
|
|
6
6
|
return {
|
|
7
7
|
breakLoop: false,
|
|
8
|
+
forceActionType: response.selectedActionType,
|
|
8
9
|
items: [
|
|
9
10
|
{
|
|
10
11
|
assistant: { type: 'assistant', text: askQuestionCall.args?.message ?? '' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-send-message.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-send-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,qBAAqB,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EAAE,eAAe,EAAE,OAAO,EAAsB;IACtF,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,aAAa,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"handle-send-message.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-send-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,qBAAqB,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EAAE,eAAe,EAAE,OAAO,EAAsB;IACtF,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,aAAa,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACzE,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,eAAe,EAAE,QAAQ,CAAC,kBAAkB;QAC5C,KAAK,EAAE;YACL;gBACE,SAAS,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE;gBAC3E,IAAI,EAAE;oBACJ,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,QAAQ,CAAC,MAAM;oBACrB,MAAM,EAAE,QAAQ,CAAC,MAAM;iBACxB;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,11 +5,12 @@ import { PromptItemImage } from '../../../ai-service/common-types.js';
|
|
|
5
5
|
import { FunctionCall } from '../../../ai-service/common-types.js';
|
|
6
6
|
import { CodegenOptions } from '../../../main/codegen-types.js';
|
|
7
7
|
import { PluginActionType } from '../../../ai-service/service-configurations-types.js';
|
|
8
|
-
export type ActionType = 'codeGeneration' | 'sendMessage' | 'generateImage' | 'requestPermissions' | 'readExternalFiles' | 'requestFilesContent' | 'removeFilesFromContext' | 'exploreExternalDirectories' | 'confirmCodeGeneration' | 'endConversation' | 'contextOptimization' | 'contextCompression' | 'searchCode' | '
|
|
9
|
-
type AskQuestionArgs = {
|
|
10
|
-
actionType
|
|
11
|
-
message
|
|
8
|
+
export type ActionType = 'codeGeneration' | 'sendMessage' | 'generateImage' | 'requestPermissions' | 'readExternalFiles' | 'requestFilesContent' | 'removeFilesFromContext' | 'exploreExternalDirectories' | 'confirmCodeGeneration' | 'endConversation' | 'contextOptimization' | 'contextCompression' | 'searchCode' | 'updateFile' | 'performAnalysis' | 'createFile' | 'pullAppContext' | 'genaicodeHelp' | 'pushAppContext' | 'reasoningInference' | 'requestFilesFragments' | 'requestGitContext' | 'conversationGraph' | 'runContainerTask' | 'compoundAction' | 'runProjectCommand' | 'runBashCommand' | 'webSearch' | PluginActionType;
|
|
9
|
+
export type AskQuestionArgs = {
|
|
10
|
+
actionType?: ActionType;
|
|
11
|
+
message?: string;
|
|
12
12
|
decisionMakingProcess?: string;
|
|
13
|
+
[key: string]: unknown;
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Arguments for sendMessage action
|
|
@@ -125,15 +126,14 @@ export type ReasoningInferenceResponseArgs = {
|
|
|
125
126
|
reasoning: string;
|
|
126
127
|
};
|
|
127
128
|
export type RequestGitContextArgs = {
|
|
128
|
-
requestType: 'commits' | 'fileChanges' | 'blame' | 'fileDiff';
|
|
129
|
+
requestType: 'commits' | 'fileChanges' | 'blame' | 'fileDiff' | 'workingChanges' | 'workingDiff';
|
|
129
130
|
filePath?: string;
|
|
130
131
|
commitHash?: string;
|
|
131
132
|
count?: number;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
stderr?: string;
|
|
133
|
+
includeUntracked?: boolean;
|
|
134
|
+
stagedOnly?: boolean;
|
|
135
|
+
unstagedOnly?: boolean;
|
|
136
|
+
staged?: boolean;
|
|
137
137
|
};
|
|
138
138
|
/**
|
|
139
139
|
* Represents a single action within a compound action batch.
|
|
@@ -153,6 +153,25 @@ export type CompoundActionListArgs = {
|
|
|
153
153
|
/** Summary of the actions to be performed. */
|
|
154
154
|
summary?: string;
|
|
155
155
|
};
|
|
156
|
+
export type RunProjectCommandArgs = {
|
|
157
|
+
name: string;
|
|
158
|
+
args?: string[];
|
|
159
|
+
env?: Record<string, string>;
|
|
160
|
+
workingDirOverride?: string;
|
|
161
|
+
truncMode?: 'first' | 'last' | 'summarize' | 'full';
|
|
162
|
+
};
|
|
163
|
+
export type RunBashCommandArgs = {
|
|
164
|
+
command: string;
|
|
165
|
+
env?: Record<string, string>;
|
|
166
|
+
workingDirOverride?: string;
|
|
167
|
+
truncMode?: 'first' | 'last' | 'summarize' | 'full';
|
|
168
|
+
};
|
|
169
|
+
export type ProjectCommandResult = {
|
|
170
|
+
success: boolean;
|
|
171
|
+
exitCode: number;
|
|
172
|
+
stdout: string;
|
|
173
|
+
stderr: string;
|
|
174
|
+
};
|
|
156
175
|
export type AskQuestionCall = FunctionCall<AskQuestionArgs>;
|
|
157
176
|
export type PerformAnalysisCall = FunctionCall<PerformAnalysisArgs>;
|
|
158
177
|
export type AnalysisResultCall = FunctionCall<AnalysisResultArgs>;
|
|
@@ -172,18 +191,19 @@ export interface UserItem {
|
|
|
172
191
|
name: string;
|
|
173
192
|
call_id: string | undefined;
|
|
174
193
|
content: string | undefined;
|
|
194
|
+
isError?: boolean;
|
|
175
195
|
}>;
|
|
176
196
|
images?: PromptItemImage[];
|
|
177
197
|
cache?: true;
|
|
178
198
|
}
|
|
179
199
|
export interface ActionResult {
|
|
180
200
|
breakLoop: boolean;
|
|
201
|
+
forceActionType?: ActionType;
|
|
181
202
|
stepResult?: FunctionCall[];
|
|
182
203
|
items: Array<{
|
|
183
204
|
assistant: AssistantItem;
|
|
184
205
|
user: UserItem;
|
|
185
206
|
}>;
|
|
186
|
-
lintResult?: LintResult;
|
|
187
207
|
}
|
|
188
208
|
export type ActionHandlerProps = {
|
|
189
209
|
askQuestionCall: AskQuestionCall;
|
|
@@ -194,4 +214,3 @@ export type ActionHandlerProps = {
|
|
|
194
214
|
waitIfPaused: () => Promise<void>;
|
|
195
215
|
};
|
|
196
216
|
export type ActionHandler = (props: ActionHandlerProps) => Promise<ActionResult>;
|
|
197
|
-
export {};
|
|
@@ -13,7 +13,6 @@ import './handlers/handle-create-file.js';
|
|
|
13
13
|
import './handlers/handle-end-conversation.js';
|
|
14
14
|
import './handlers/handle-genaicode-help.js';
|
|
15
15
|
import './handlers/handle-generate-image.js';
|
|
16
|
-
import './handlers/handle-lint.js';
|
|
17
16
|
import './handlers/handle-perform-analysis.js';
|
|
18
17
|
import './handlers/handle-pull-app-context.js';
|
|
19
18
|
import './handlers/handle-push-app-context.js';
|
|
@@ -31,4 +30,6 @@ import './handlers/handle-explore-external-directories.js';
|
|
|
31
30
|
import './handlers/handle-request-git-context.js';
|
|
32
31
|
import './handlers/handle-web-search.js';
|
|
33
32
|
import './handlers/handle-compound-action.js';
|
|
33
|
+
import './handlers/handle-project-command.js';
|
|
34
|
+
import './handlers/handle-run-bash-command.js';
|
|
34
35
|
export declare function executeStepAskQuestion(generateContentFn: GenerateContentFunction, generateImageFn: GenerateImageFunction, prompt: PromptItem[], functionDefs: FunctionDef[], waitIfPaused: () => Promise<void>, temperature: number, options: CodegenOptions): Promise<FunctionCall[]>;
|
|
@@ -13,7 +13,6 @@ import './handlers/handle-create-file.js';
|
|
|
13
13
|
import './handlers/handle-end-conversation.js';
|
|
14
14
|
import './handlers/handle-genaicode-help.js';
|
|
15
15
|
import './handlers/handle-generate-image.js';
|
|
16
|
-
import './handlers/handle-lint.js';
|
|
17
16
|
import './handlers/handle-perform-analysis.js';
|
|
18
17
|
import './handlers/handle-pull-app-context.js';
|
|
19
18
|
import './handlers/handle-push-app-context.js';
|
|
@@ -31,6 +30,8 @@ import './handlers/handle-explore-external-directories.js';
|
|
|
31
30
|
import './handlers/handle-request-git-context.js';
|
|
32
31
|
import './handlers/handle-web-search.js';
|
|
33
32
|
import './handlers/handle-compound-action.js';
|
|
33
|
+
import './handlers/handle-project-command.js';
|
|
34
|
+
import './handlers/handle-run-bash-command.js';
|
|
34
35
|
export async function executeStepAskQuestion(generateContentFn, generateImageFn, prompt, functionDefs, waitIfPaused, temperature, options) {
|
|
35
36
|
putSystemMessage('Allowing the assistant to ask a question...');
|
|
36
37
|
let filesState = getFilesState();
|
|
@@ -38,11 +39,23 @@ export async function executeStepAskQuestion(generateContentFn, generateImageFn,
|
|
|
38
39
|
abortController?.signal.addEventListener('abort', () => {
|
|
39
40
|
aborted = true;
|
|
40
41
|
});
|
|
42
|
+
let forcedActionType = options.initialActionType;
|
|
41
43
|
while (!aborted) {
|
|
42
44
|
try {
|
|
43
45
|
// Calculate context size using the total tokens per day (this is not a perfect metric, but it's a good approximation)
|
|
44
46
|
const lastTokenCount = getUsageMetrics().total.tpd;
|
|
45
|
-
|
|
47
|
+
if (forcedActionType) {
|
|
48
|
+
putSystemMessage(`Forcing action type: ${forcedActionType}`);
|
|
49
|
+
}
|
|
50
|
+
const askQuestionCall = forcedActionType
|
|
51
|
+
? {
|
|
52
|
+
name: 'askQuestion',
|
|
53
|
+
id: 'forced-action',
|
|
54
|
+
args: {
|
|
55
|
+
actionType: forcedActionType,
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
: await getAskQuestionCall(generateContentFn, prompt, functionDefs, temperature, options);
|
|
46
59
|
const totalTokens = getUsageMetrics().total.tpd - lastTokenCount;
|
|
47
60
|
if (!askQuestionCall) {
|
|
48
61
|
break;
|
|
@@ -61,6 +74,7 @@ export async function executeStepAskQuestion(generateContentFn, generateImageFn,
|
|
|
61
74
|
generateImageFn,
|
|
62
75
|
waitIfPaused,
|
|
63
76
|
});
|
|
77
|
+
forcedActionType = result.forceActionType;
|
|
64
78
|
if (aborted) {
|
|
65
79
|
putSystemMessage('Iteration aborted.');
|
|
66
80
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-ask-question.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAE/F,OAAO,sCAAsC,CAAC;AAC9C,OAAO,8CAA8C,CAAC;AACtD,OAAO,0CAA0C,CAAC;AAClD,OAAO,2CAA2C,CAAC;AACnD,OAAO,yCAAyC,CAAC;AACjD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"step-ask-question.js","sourceRoot":"","sources":["../../../../src/prompt/steps/step-ask-question/step-ask-question.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAE/F,OAAO,sCAAsC,CAAC;AAC9C,OAAO,8CAA8C,CAAC;AACtD,OAAO,0CAA0C,CAAC;AAClD,OAAO,2CAA2C,CAAC;AACnD,OAAO,yCAAyC,CAAC;AACjD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,uCAAuC,CAAC;AAC/C,OAAO,0CAA0C,CAAC;AAClD,OAAO,gDAAgD,CAAC;AACxD,OAAO,4CAA4C,CAAC;AACpD,OAAO,8CAA8C,CAAC;AACtD,OAAO,0CAA0C,CAAC;AAClD,OAAO,yCAAyC,CAAC;AACjD,OAAO,kCAAkC,CAAC;AAC1C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,0CAA0C,CAAC;AAClD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,0CAA0C,CAAC;AAClD,OAAO,iCAAiC,CAAC;AACzC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,sCAAsC,CAAC;AAC9C,OAAO,uCAAuC,CAAC;AAE/C,MAAM,CAAC,K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U,IAAI,EAAE,CAAC;gBACjC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,gBAAgB,CAAC,8BAA8B,CAAC,CAAC;gBACjD,MAAM;YACR,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gBAAgB,CAAC,sBAAsB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACjG,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,gBAAgB,CAAC,sEAAsE,CAAC,CAAC;IACzF,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,KAAK,UAAU,kBAAkB,CAC/B,iBAA0C,EAC1C,MAAoB,EACpB,YAA2B,EAC3B,WAAmB,EACnB,OAAuB;IAEvB,MAAM,kBAAkB,GAAwB;QAC9C,MAAM;QACN;YACE,YAAY;YACZ,oBAAoB,EAAE,aAAa;YACnC,WAAW;YACX,SAAS,EAAE,SAAS,CAAC,KAAK;YAC1B,oBAAoB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;SACxE;QACD,OAAO;KACR,CAAC;IACF,MAAM,iBAAiB,GAAG,CAAC,MAAM,iBAAiB,CAAC,GAAG,kBAAkB,CAAC,CAAC;SACvE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC;SAC9C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACpC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAgC,CAAC;AACtG,CAAC"}
|
|
@@ -58,7 +58,7 @@ To have conversation with me use the \`askQuestion\` function. This function all
|
|
|
58
58
|
- **Generate an image**: If you want to express your thoughts through an image, you can request image generation.
|
|
59
59
|
- **Perform Code Generation**: Once you have all the necessary information, you can propose code changes.
|
|
60
60
|
- **Update Files**: If you need to make small changes to a file, you can request to update it.
|
|
61
|
-
- **
|
|
61
|
+
- **Run project commands**: If you need to run a project command (like tests, build, or custom scripts), you can request to run it.
|
|
62
62
|
- **Use Context Compression**: Autonomously initiate context compression when the conversation history becomes large or complex, or the topic of conversation changes. Always inform the user before compressing and explain the benefits.
|
|
63
63
|
- **Handle Conversation Summaries**: When you encounter a message starting with "This is summary of our conversation:", treat it as a compressed context representing key points and decisions from previous conversation. Use this summary as a foundation for understanding the conversation's history, technical decisions made, and current implementation status. The summary maintains the most important aspects of the conversation while reducing token usage.
|
|
64
64
|
|
|
@@ -88,7 +88,7 @@ Example use cases of action types:
|
|
|
88
88
|
- Need to reorganize the context of the conversation, or reduce its size -> **contextOptimization**
|
|
89
89
|
- Generate an image -> **generateImage**
|
|
90
90
|
- Search for a keyword/phrase over the codebase of the project -> **searchCode**
|
|
91
|
-
-
|
|
91
|
+
- Run project commands (lint, test, build, or custom) with parameters -> **runProjectCommand**
|
|
92
92
|
- End the conversation -> **endConversation**
|
|
93
93
|
- The user needs help with GenAIcode itself, encountered a problem, or needs guidance -> **genaicodeHelp**
|
|
94
94
|
- Perform inference on a AI model with reasoning capabilities -> **reasoningInference**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genaicode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"author": "Grzegorz Tańczyk",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"styled-components": "^6.1.13",
|
|
91
91
|
"ts-node": "^10.9.2",
|
|
92
92
|
"typescript": "^5.0.0",
|
|
93
|
-
"vite": "^6.3.
|
|
93
|
+
"vite": "^6.3.6",
|
|
94
94
|
"vite-plugin-checker": "^0.8.0",
|
|
95
95
|
"vitest": "^3.0.7"
|
|
96
96
|
},
|
|
@@ -107,7 +107,8 @@
|
|
|
107
107
|
"@types/mime-types": "^2.1.4",
|
|
108
108
|
"@types/node": "^18.0.0",
|
|
109
109
|
"@types/styled-components": "^5.1.34",
|
|
110
|
-
"axios": "^1.
|
|
110
|
+
"axios": "^1.12.0",
|
|
111
|
+
"c12": "^1.11.1",
|
|
111
112
|
"cors": "^2.8.5",
|
|
112
113
|
"diff": "^5.2.0",
|
|
113
114
|
"dockerode": "^4.0.7",
|