genaicode 0.12.0 → 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-BbIYZZub.js → index-C2MB0Z2i.js} +290 -260
- 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
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { exec } from 'child_process';
|
|
2
|
-
import { promisify } from 'util';
|
|
3
1
|
import { putSystemMessage } from '../../../../main/common/content-bus.js';
|
|
4
|
-
import {
|
|
2
|
+
import { getProjectCommand } from '../../../../main/config.js';
|
|
5
3
|
import { registerActionHandler } from '../step-ask-question-handlers.js';
|
|
6
|
-
|
|
4
|
+
import { handleRunProjectCommand } from './handle-project-command.js';
|
|
7
5
|
registerActionHandler('lint', handleLint);
|
|
8
6
|
/**
|
|
9
7
|
* Handles the lint action by executing the lint command and processing its results.
|
|
10
|
-
*
|
|
8
|
+
* This is now a wrapper around the generic `runProjectCommand` handler.
|
|
11
9
|
*/
|
|
12
|
-
export async function handleLint(
|
|
13
|
-
|
|
10
|
+
export async function handleLint(props) {
|
|
11
|
+
const { askQuestionCall, prompt } = props;
|
|
12
|
+
const lintCommand = getProjectCommand('lint');
|
|
13
|
+
if (!lintCommand) {
|
|
14
14
|
putSystemMessage('Lint command not configured. Skipping lint check.');
|
|
15
15
|
prompt.push({
|
|
16
16
|
type: 'assistant',
|
|
@@ -32,67 +32,29 @@ export async function handleLint({ askQuestionCall, prompt }) {
|
|
|
32
32
|
items: [],
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
breakLoop: false,
|
|
60
|
-
lintResult,
|
|
61
|
-
items: [],
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
catch (error) {
|
|
65
|
-
const { stdout, stderr } = error;
|
|
66
|
-
putSystemMessage('Lint command failed.', {
|
|
67
|
-
stdout,
|
|
68
|
-
stderr,
|
|
69
|
-
});
|
|
70
|
-
lintResult = {
|
|
71
|
-
success: false,
|
|
72
|
-
stdout,
|
|
73
|
-
stderr,
|
|
74
|
-
};
|
|
75
|
-
// User confirmed to continue despite lint errors
|
|
76
|
-
prompt.push({
|
|
77
|
-
type: 'assistant',
|
|
78
|
-
text: askQuestionCall.args?.message ?? '',
|
|
79
|
-
functionCalls: [{ name: 'lint', id: askQuestionCall.id + '_lint' }],
|
|
80
|
-
}, {
|
|
81
|
-
type: 'user',
|
|
82
|
-
text: 'Lint command failed, please analyze the output.',
|
|
83
|
-
functionResponses: [
|
|
84
|
-
{
|
|
85
|
-
name: 'lint',
|
|
86
|
-
call_id: askQuestionCall.id + '_lint',
|
|
87
|
-
content: JSON.stringify(lintResult),
|
|
88
|
-
},
|
|
89
|
-
],
|
|
90
|
-
});
|
|
91
|
-
return {
|
|
92
|
-
breakLoop: false,
|
|
93
|
-
lintResult,
|
|
94
|
-
items: [],
|
|
95
|
-
};
|
|
96
|
-
}
|
|
35
|
+
// Synthesize the call to the generic project command handler
|
|
36
|
+
const syntheticAskQuestionCall = {
|
|
37
|
+
...askQuestionCall,
|
|
38
|
+
name: 'runProjectCommand',
|
|
39
|
+
args: {
|
|
40
|
+
name: 'lint',
|
|
41
|
+
// Pass original filePaths argument to the generic command runner
|
|
42
|
+
args: askQuestionCall.args?.filePaths,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
const result = await handleRunProjectCommand({ ...props, askQuestionCall: syntheticAskQuestionCall });
|
|
46
|
+
const projectCommandResult = result.projectCommandResult;
|
|
47
|
+
const lintResult = projectCommandResult
|
|
48
|
+
? {
|
|
49
|
+
success: projectCommandResult.success,
|
|
50
|
+
stdout: projectCommandResult.stdout,
|
|
51
|
+
stderr: projectCommandResult.stderr,
|
|
52
|
+
}
|
|
53
|
+
: undefined;
|
|
54
|
+
return {
|
|
55
|
+
breakLoop: false,
|
|
56
|
+
lintResult,
|
|
57
|
+
items: [], // The delegated handler already modified the prompt
|
|
58
|
+
};
|
|
97
59
|
}
|
|
98
60
|
//# sourceMappingURL=handle-lint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-lint.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"handle-lint.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,qBAAqB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAyB;IACxD,MAAM,EA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E,oBAAoB,CAAC,MAAM;YACnC,MAAM,EAAE,oBAAoB,CAAC,MAAM;SACpC;QACH,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,SAAS,EAAE,KAAK;QAChB,UAAU;QACV,KAAK,EAAE,EAAE,EAAE,oDAAoD;KAChE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { putSystemMessage, putUserMessage } from '../../../../main/common/content-bus.js';
|
|
4
|
+
import { rcConfig, getProjectCommand, getProjectCommands } 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 handleRunProjectCommand({ generateContentFn, askQuestionCall, prompt, options, }) {
|
|
11
|
+
const runProjectCommandRequest = [
|
|
12
|
+
[
|
|
13
|
+
...prompt,
|
|
14
|
+
{
|
|
15
|
+
type: 'assistant',
|
|
16
|
+
text: askQuestionCall.args?.message ?? '',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'user',
|
|
20
|
+
text: JSON.stringify(rcConfig.projectCommands),
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
{
|
|
24
|
+
functionDefs: getFunctionDefs(),
|
|
25
|
+
requiredFunctionName: 'runProjectCommand',
|
|
26
|
+
modelType: ModelType.CHEAP,
|
|
27
|
+
temperature: 0.7,
|
|
28
|
+
expectedResponseType: { text: false, functionCall: true, media: false },
|
|
29
|
+
},
|
|
30
|
+
options,
|
|
31
|
+
];
|
|
32
|
+
const runProjectCommandResult = await generateContentFn(...runProjectCommandRequest);
|
|
33
|
+
const RunProjectCommandCall = runProjectCommandResult
|
|
34
|
+
.filter((item) => item.type === 'functionCall')
|
|
35
|
+
.map((item) => item.functionCall)
|
|
36
|
+
.find((call) => call.name === 'runProjectCommand');
|
|
37
|
+
if (!RunProjectCommandCall?.args) {
|
|
38
|
+
putSystemMessage('No runProjectCommand call found in the assistant response.');
|
|
39
|
+
prompt.push({
|
|
40
|
+
type: 'assistant',
|
|
41
|
+
text: askQuestionCall.args.message,
|
|
42
|
+
}, {
|
|
43
|
+
type: 'user',
|
|
44
|
+
text: 'No runProjectCommand call found in the assistant response.',
|
|
45
|
+
});
|
|
46
|
+
return { breakLoop: true, items: [] };
|
|
47
|
+
}
|
|
48
|
+
const { name, args = [], env: envOverride, workingDirOverride, truncMode = 'summarize' } = RunProjectCommandCall.args;
|
|
49
|
+
const command = getProjectCommand(name);
|
|
50
|
+
if (!command) {
|
|
51
|
+
const errorMessage = `Project command "${name}" not found. Available commands are: ${[
|
|
52
|
+
...getProjectCommands().keys(),
|
|
53
|
+
].join(', ')}`;
|
|
54
|
+
putSystemMessage(errorMessage);
|
|
55
|
+
prompt.push({
|
|
56
|
+
type: 'assistant',
|
|
57
|
+
text: askQuestionCall.args.message,
|
|
58
|
+
functionCalls: [{ name: 'runProjectCommand', id: askQuestionCall.id + '_runProjectCommand', args: { name } }],
|
|
59
|
+
}, {
|
|
60
|
+
type: 'user',
|
|
61
|
+
functionResponses: [
|
|
62
|
+
{
|
|
63
|
+
name: 'runProjectCommand',
|
|
64
|
+
call_id: askQuestionCall.id + '_runProjectCommand',
|
|
65
|
+
content: JSON.stringify({ error: errorMessage }),
|
|
66
|
+
isError: true,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
});
|
|
70
|
+
return { breakLoop: false, items: [] };
|
|
71
|
+
}
|
|
72
|
+
// Auto-approval logic
|
|
73
|
+
let skipConfirmation = false;
|
|
74
|
+
try {
|
|
75
|
+
if (command.autoApprove === true) {
|
|
76
|
+
skipConfirmation = true;
|
|
77
|
+
putSystemMessage(`Auto-approving project command "${name}" (autoApprove: true).`);
|
|
78
|
+
}
|
|
79
|
+
else if (typeof command.autoApprove === 'string') {
|
|
80
|
+
const approved = await evaluateAutoApproveCondition(prompt, generateContentFn, options, command.autoApprove, name, args, command.description);
|
|
81
|
+
if (approved) {
|
|
82
|
+
skipConfirmation = true;
|
|
83
|
+
putSystemMessage(`Auto-approving project command "${name}" based on condition: ${command.autoApprove}`);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
putSystemMessage(`Auto-approval condition did not pass for command "${name}". Proceeding with user confirmation.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
putSystemMessage(`Failed to evaluate auto-approval condition for command "${name}". Falling back to user confirmation.`, { error: error.message });
|
|
92
|
+
}
|
|
93
|
+
if (!skipConfirmation) {
|
|
94
|
+
const confirmation = await askUserForConfirmationWithAnswer(`Do you want to run the project command "${name}"?`, 'Run command', 'Reject', true, options);
|
|
95
|
+
if (confirmation.answer) {
|
|
96
|
+
putUserMessage(confirmation.answer);
|
|
97
|
+
}
|
|
98
|
+
if (!confirmation.confirmed) {
|
|
99
|
+
putSystemMessage(`Project command "${name}" cancelled by user.`);
|
|
100
|
+
prompt.push({
|
|
101
|
+
type: 'assistant',
|
|
102
|
+
text: askQuestionCall.args.message,
|
|
103
|
+
functionCalls: [
|
|
104
|
+
{ name: 'runProjectCommand', id: askQuestionCall.id + '_runProjectCommand', args: { name, args } },
|
|
105
|
+
],
|
|
106
|
+
}, {
|
|
107
|
+
type: 'user',
|
|
108
|
+
text: `I reject running the project command "${name}".` + (confirmation.answer ? ` ${confirmation.answer}` : ''),
|
|
109
|
+
functionResponses: [
|
|
110
|
+
{
|
|
111
|
+
name: 'runProjectCommand',
|
|
112
|
+
call_id: askQuestionCall.id + '_runProjectCommand',
|
|
113
|
+
content: JSON.stringify({ error: 'User rejected command execution.' }),
|
|
114
|
+
isError: true,
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
});
|
|
118
|
+
return { breakLoop: true, items: [] };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Proceed with execution if confirmed/auto-approved
|
|
122
|
+
const finalArgs = [...(command.defaultArgs || []), ...args];
|
|
123
|
+
const fullCommand = [command.command, ...finalArgs].join(' ');
|
|
124
|
+
const cwd = workingDirOverride || command.workingDir || rcConfig.rootDir;
|
|
125
|
+
const env = { ...process.env, ...(command.env || {}), ...envOverride };
|
|
126
|
+
putSystemMessage(`Executing project command "${name}": ${fullCommand}`, {
|
|
127
|
+
cwd,
|
|
128
|
+
envOverride,
|
|
129
|
+
args: finalArgs,
|
|
130
|
+
truncMode,
|
|
131
|
+
workingDirOverride,
|
|
132
|
+
autoApproved: skipConfirmation,
|
|
133
|
+
});
|
|
134
|
+
let result;
|
|
135
|
+
try {
|
|
136
|
+
const { stdout, stderr } = await execPromise(fullCommand, { cwd, env });
|
|
137
|
+
result = { success: true, exitCode: 0, stdout, stderr };
|
|
138
|
+
putSystemMessage(`Project command "${name}" executed successfully.`, { stdout, stderr });
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
const { code, stdout, stderr } = error;
|
|
142
|
+
result = {
|
|
143
|
+
success: false,
|
|
144
|
+
exitCode: code ?? 1,
|
|
145
|
+
stdout,
|
|
146
|
+
stderr,
|
|
147
|
+
};
|
|
148
|
+
putSystemMessage(`Project command "${name}" failed with exit code ${result.exitCode}.`, {
|
|
149
|
+
stdout: result.stdout,
|
|
150
|
+
stderr: result.stderr,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
// Handle output truncation
|
|
154
|
+
if (truncMode === 'first') {
|
|
155
|
+
result.stdout = truncateOutput(result.stdout, 'first');
|
|
156
|
+
result.stderr = truncateOutput(result.stderr, 'first');
|
|
157
|
+
}
|
|
158
|
+
else if (truncMode === 'last') {
|
|
159
|
+
result.stdout = truncateOutput(result.stdout, 'last');
|
|
160
|
+
result.stderr = truncateOutput(result.stderr, 'last');
|
|
161
|
+
}
|
|
162
|
+
else if (truncMode === 'summarize') {
|
|
163
|
+
if (result.stdout.length > 0) {
|
|
164
|
+
result.stdout = await summarizeOutput(result.stdout, generateContentFn, options);
|
|
165
|
+
}
|
|
166
|
+
if (result.stderr.length > 0) {
|
|
167
|
+
result.stderr = await summarizeOutput(result.stderr, generateContentFn, options);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
putSystemMessage(`Command output sent to AI`, {
|
|
171
|
+
truncMode,
|
|
172
|
+
stdout: result.stdout,
|
|
173
|
+
stderr: result.stderr,
|
|
174
|
+
});
|
|
175
|
+
prompt.push({
|
|
176
|
+
type: 'assistant',
|
|
177
|
+
functionCalls: [
|
|
178
|
+
{ name: 'runProjectCommand', id: askQuestionCall.id + '_runProjectCommand', args: { name, args } },
|
|
179
|
+
],
|
|
180
|
+
}, {
|
|
181
|
+
type: 'user',
|
|
182
|
+
text: `Command "${name}" finished with exit code ${result.exitCode}. Please analyze the output.`,
|
|
183
|
+
functionResponses: [
|
|
184
|
+
{
|
|
185
|
+
name: 'runProjectCommand',
|
|
186
|
+
call_id: askQuestionCall.id + '_runProjectCommand',
|
|
187
|
+
content: JSON.stringify(result),
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
});
|
|
191
|
+
return {
|
|
192
|
+
breakLoop: false,
|
|
193
|
+
items: [],
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
async function evaluateAutoApproveCondition(prompt, generateContentFn, options, condition, name, args, description) {
|
|
197
|
+
const evalPromptText = `You are a strict decision engine. Evaluate the following natural-language condition against the provided project command context. Reply with ONLY YES or NO (uppercase), without any explanation.
|
|
198
|
+
|
|
199
|
+
Condition: ${condition}
|
|
200
|
+
|
|
201
|
+
Command:
|
|
202
|
+
- name: ${name}
|
|
203
|
+
- description: ${description ?? 'n/a'}
|
|
204
|
+
- args: ${JSON.stringify(args)}
|
|
205
|
+
`;
|
|
206
|
+
const evalPrompt = [...prompt, { type: 'user', text: evalPromptText }];
|
|
207
|
+
const evalRequest = [
|
|
208
|
+
evalPrompt,
|
|
209
|
+
{
|
|
210
|
+
modelType: ModelType.LITE,
|
|
211
|
+
temperature: 0,
|
|
212
|
+
expectedResponseType: { text: true, functionCall: false, media: false },
|
|
213
|
+
},
|
|
214
|
+
options,
|
|
215
|
+
];
|
|
216
|
+
try {
|
|
217
|
+
const evalResult = await generateContentFn(...evalRequest);
|
|
218
|
+
const text = evalResult
|
|
219
|
+
.find((p) => p.type === 'text')
|
|
220
|
+
?.text?.trim()
|
|
221
|
+
.toUpperCase();
|
|
222
|
+
if (text === 'YES')
|
|
223
|
+
return true;
|
|
224
|
+
if (text === 'NO')
|
|
225
|
+
return false;
|
|
226
|
+
// Any other unexpected output -> not approved
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
catch (e) {
|
|
230
|
+
// On error, do not auto-approve
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const MAX_OUTPUT_LENGTH = 2000;
|
|
235
|
+
const TRUNCATE_LINES = 200;
|
|
236
|
+
const TRUNCATE_CHARS = 1000;
|
|
237
|
+
function truncateOutput(output, mode) {
|
|
238
|
+
if (output.length <= MAX_OUTPUT_LENGTH) {
|
|
239
|
+
return output;
|
|
240
|
+
}
|
|
241
|
+
const lines = output.split('\n');
|
|
242
|
+
if (mode === 'first') {
|
|
243
|
+
const truncatedLines = lines.slice(0, TRUNCATE_LINES).join('\n');
|
|
244
|
+
return truncatedLines.length > TRUNCATE_CHARS ? truncatedLines.substring(0, TRUNCATE_CHARS) : truncatedLines;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
// mode === 'last'
|
|
248
|
+
const truncatedLines = lines.slice(-TRUNCATE_LINES).join('\n');
|
|
249
|
+
return truncatedLines.length > TRUNCATE_CHARS
|
|
250
|
+
? truncatedLines.substring(truncatedLines.length - TRUNCATE_CHARS)
|
|
251
|
+
: truncatedLines;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
async function summarizeOutput(output, generateContentFn, options) {
|
|
255
|
+
if (output.length <= MAX_OUTPUT_LENGTH) {
|
|
256
|
+
return output;
|
|
257
|
+
}
|
|
258
|
+
putSystemMessage('Summarizing command output...');
|
|
259
|
+
const summaryPrompt = [
|
|
260
|
+
{
|
|
261
|
+
type: 'user',
|
|
262
|
+
text: `Please summarize the following command output:\n\n---\n\n${output}`,
|
|
263
|
+
},
|
|
264
|
+
];
|
|
265
|
+
const summaryRequest = [
|
|
266
|
+
summaryPrompt,
|
|
267
|
+
{
|
|
268
|
+
modelType: ModelType.LITE,
|
|
269
|
+
expectedResponseType: { text: true, functionCall: false, media: false },
|
|
270
|
+
},
|
|
271
|
+
options,
|
|
272
|
+
];
|
|
273
|
+
const summaryResult = await generateContentFn(...summaryRequest);
|
|
274
|
+
const summaryText = summaryResult.find((part) => part.type === 'text')?.text;
|
|
275
|
+
if (!summaryText) {
|
|
276
|
+
putSystemMessage('Failed to summarize output, returning truncated version.');
|
|
277
|
+
return truncateOutput(output, 'first');
|
|
278
|
+
}
|
|
279
|
+
return summaryText;
|
|
280
|
+
}
|
|
281
|
+
registerActionHandler('runProjectCommand', handleRunProjectCommand);
|
|
282
|
+
//# sourceMappingURL=handle-project-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle-project-command.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-project-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,wCAAwC,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAO7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OA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,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,mBAAmB,EAAE,uBAAuB,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ActionHandler } from '../step-ask-question-types.js';
|
|
2
|
-
export declare const GIT_CONTEXT_INSTRUCTION_PROMPT = "\n You need to call the 'requestGitContext' function. Please determine the appropriate arguments based on the user's request.\n Parameters:\n - requestType (required): Choose one of 'commits', 'fileChanges', 'blame', or '
|
|
2
|
+
export declare const GIT_CONTEXT_INSTRUCTION_PROMPT = "\n You need to call the 'requestGitContext' function. Please determine the appropriate arguments based on the user's request.\n Parameters:\n - requestType (required): Choose one of 'commits', 'fileChanges', 'blame', 'fileDiff', 'workingChanges', or 'workingDiff'.\n - 'commits': Get recent commit history for the entire repository.\n - 'fileChanges': Get commit history specifically for the given 'filePath'.\n - 'blame': Get line-by-line authorship information (git blame) for the given 'filePath'.\n - 'fileDiff': Get the changes made to a specific 'filePath' in a given 'commitHash'.\n - 'workingChanges': List changed files in the current working copy (staged, unstaged, untracked).\n - 'workingDiff': Show the diff for a specific file in the working copy.\n - filePath (absolute, required for 'fileChanges', 'blame', 'fileDiff', and 'workingDiff'): The absolute path to the file within the project. IMPORTANT: Ensure the provided filePath is absolute and is inside of the project root and exists within the project directory structure.\n - commitHash (required for 'blame' and 'fileDiff'): A specific commit hash to focus the request.\n - count (required for 'commits' and 'fileChanges'): The maximum number of commits to retrieve.\n - includeUntracked (optional, for 'workingChanges'): Set to false to exclude untracked files. Defaults to true.\n - stagedOnly (optional, for 'workingChanges'): Set to true to only show staged changes. Mutually exclusive with unstagedOnly.\n - unstagedOnly (optional, for 'workingChanges'): Set to true to only show unstaged changes. Mutually exclusive with stagedOnly.\n - staged (optional, for 'workingDiff'): Set to true to show the diff for staged changes (--cached) instead of unstaged changes.\n\n Analyze the user's request and provide the arguments accurately.\n ";
|
|
3
3
|
export declare const handleRequestGitContext: ActionHandler;
|
|
@@ -18,20 +18,31 @@ function formatBlame(blame) {
|
|
|
18
18
|
}
|
|
19
19
|
// Helper function to format diff output
|
|
20
20
|
function formatDiff(diff) {
|
|
21
|
+
const DIFF_TRUNCATE_LENGTH = 2000;
|
|
22
|
+
if (diff.length > DIFF_TRUNCATE_LENGTH) {
|
|
23
|
+
const truncatedDiff = diff.substring(0, DIFF_TRUNCATE_LENGTH);
|
|
24
|
+
return `\nDiff Output (truncated):\n${truncatedDiff}\n\n[Truncated ${DIFF_TRUNCATE_LENGTH} of ${diff.length} chars. Ask for the full diff if needed.]`;
|
|
25
|
+
}
|
|
21
26
|
return `\nDiff Output:\n${diff}`;
|
|
22
27
|
}
|
|
23
28
|
// Define the detailed instruction prompt for the LLM
|
|
24
29
|
export const GIT_CONTEXT_INSTRUCTION_PROMPT = `
|
|
25
30
|
You need to call the 'requestGitContext' function. Please determine the appropriate arguments based on the user's request.
|
|
26
31
|
Parameters:
|
|
27
|
-
- requestType (required): Choose one of 'commits', 'fileChanges', 'blame', or '
|
|
32
|
+
- requestType (required): Choose one of 'commits', 'fileChanges', 'blame', 'fileDiff', 'workingChanges', or 'workingDiff'.
|
|
28
33
|
- 'commits': Get recent commit history for the entire repository.
|
|
29
34
|
- 'fileChanges': Get commit history specifically for the given 'filePath'.
|
|
30
35
|
- 'blame': Get line-by-line authorship information (git blame) for the given 'filePath'.
|
|
31
36
|
- 'fileDiff': Get the changes made to a specific 'filePath' in a given 'commitHash'.
|
|
32
|
-
|
|
37
|
+
- 'workingChanges': List changed files in the current working copy (staged, unstaged, untracked).
|
|
38
|
+
- 'workingDiff': Show the diff for a specific file in the working copy.
|
|
39
|
+
- filePath (absolute, required for 'fileChanges', 'blame', 'fileDiff', and 'workingDiff'): The absolute path to the file within the project. IMPORTANT: Ensure the provided filePath is absolute and is inside of the project root and exists within the project directory structure.
|
|
33
40
|
- commitHash (required for 'blame' and 'fileDiff'): A specific commit hash to focus the request.
|
|
34
|
-
- count (required for 'commits' and 'fileChanges'): The maximum number of commits to retrieve
|
|
41
|
+
- count (required for 'commits' and 'fileChanges'): The maximum number of commits to retrieve.
|
|
42
|
+
- includeUntracked (optional, for 'workingChanges'): Set to false to exclude untracked files. Defaults to true.
|
|
43
|
+
- stagedOnly (optional, for 'workingChanges'): Set to true to only show staged changes. Mutually exclusive with unstagedOnly.
|
|
44
|
+
- unstagedOnly (optional, for 'workingChanges'): Set to true to only show unstaged changes. Mutually exclusive with stagedOnly.
|
|
45
|
+
- staged (optional, for 'workingDiff'): Set to true to show the diff for staged changes (--cached) instead of unstaged changes.
|
|
35
46
|
|
|
36
47
|
Analyze the user's request and provide the arguments accurately.
|
|
37
48
|
`;
|
|
@@ -146,6 +157,62 @@ export const handleRequestGitContext = async ({ askQuestionCall, options, genera
|
|
|
146
157
|
responseContent = `Diff for ${args.filePath} at commit ${commitHash.substring(0, 7)}:\n${formatDiff(diff)}`;
|
|
147
158
|
break;
|
|
148
159
|
}
|
|
160
|
+
case 'workingChanges': {
|
|
161
|
+
if (args.stagedOnly && args.unstagedOnly) {
|
|
162
|
+
throw new Error('stagedOnly and unstagedOnly are mutually exclusive.');
|
|
163
|
+
}
|
|
164
|
+
const status = await git.status();
|
|
165
|
+
const getAbsPath = (p) => path.resolve(rcConfig.rootDir, p);
|
|
166
|
+
let stagedFiles = status.staged.map(getAbsPath);
|
|
167
|
+
let unstagedFiles = [
|
|
168
|
+
...status.modified.map((p) => `${getAbsPath(p)} (Modified)`),
|
|
169
|
+
...status.deleted.map((p) => `${getAbsPath(p)} (Deleted)`),
|
|
170
|
+
...status.created.map((p) => `${getAbsPath(p)} (Created)`),
|
|
171
|
+
...status.renamed.map((r) => `${getAbsPath(r.from)} -> ${getAbsPath(r.to)} (Renamed)`),
|
|
172
|
+
];
|
|
173
|
+
let untrackedFiles = args.includeUntracked !== false ? status.not_added.map(getAbsPath) : [];
|
|
174
|
+
if (args.stagedOnly) {
|
|
175
|
+
unstagedFiles = [];
|
|
176
|
+
untrackedFiles = [];
|
|
177
|
+
}
|
|
178
|
+
if (args.unstagedOnly) {
|
|
179
|
+
stagedFiles = [];
|
|
180
|
+
}
|
|
181
|
+
if (stagedFiles.length === 0 && unstagedFiles.length === 0 && untrackedFiles.length === 0) {
|
|
182
|
+
responseContent = 'Working tree is clean (according to the specified filters).';
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
let output = 'Working copy changes:';
|
|
186
|
+
if (stagedFiles.length > 0 && !args.unstagedOnly) {
|
|
187
|
+
output += `\n\nStaged:\n - ${stagedFiles.join('\n - ')}`;
|
|
188
|
+
}
|
|
189
|
+
if (unstagedFiles.length > 0 && !args.stagedOnly) {
|
|
190
|
+
output += `\n\nUnstaged:\n - ${unstagedFiles.join('\n - ')}`;
|
|
191
|
+
}
|
|
192
|
+
if (untrackedFiles.length > 0 && !args.stagedOnly && !args.unstagedOnly) {
|
|
193
|
+
output += `\n\nUntracked:\n - ${untrackedFiles.join('\n - ')}`;
|
|
194
|
+
}
|
|
195
|
+
responseContent = output.trim();
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case 'workingDiff': {
|
|
200
|
+
const absoluteFilePath = validateFilePath('workingDiff');
|
|
201
|
+
const status = await git.status();
|
|
202
|
+
const relativeFilePath = path.relative(rcConfig.rootDir, absoluteFilePath);
|
|
203
|
+
const isUntracked = status.not_added.includes(relativeFilePath);
|
|
204
|
+
const isStaged = status.staged.includes(relativeFilePath);
|
|
205
|
+
if (isUntracked && !isStaged && !args.staged) {
|
|
206
|
+
responseContent = `File '${args.filePath}' is untracked and not staged. 'git diff' will not show any output for unstaged changes. Stage the file to see its initial content diff.`;
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
const diffArgs = args.staged ? ['--cached', '--', absoluteFilePath] : ['--', absoluteFilePath];
|
|
210
|
+
const diff = await git.diff(diffArgs);
|
|
211
|
+
const diffContent = diff || 'No changes found.';
|
|
212
|
+
responseContent = `Diff for ${args.filePath}${args.staged ? ' (staged)' : ''}:${formatDiff(diffContent)}`;
|
|
213
|
+
}
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
149
216
|
default: {
|
|
150
217
|
// Should be caught by function call validation, but handle defensively
|
|
151
218
|
throw new Error(`Invalid requestType received: ${args.requestType}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-request-git-context.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-request-git-context.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"handle-request-git-context.js","sourceRoot":"","sources":["../../../../../src/prompt/steps/step-ask-question/handlers/handle-request-git-context.ts"],"names":[],"mappings":"AAAA,OAAO,SAAmE,MAAM,YAAY,CAAC;AAE7F,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAc,MAAM,wCAAwC,CAAC,CAAC,oBAAoB;AACpG,OAAO,EAAE,gBAAg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