@maxanatsko/llm-cli-bridge 3.1.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/LICENSE +26 -0
- package/README.md +203 -0
- package/dist/backends/codex.d.ts +37 -0
- package/dist/backends/codex.d.ts.map +1 -0
- package/dist/backends/codex.js +438 -0
- package/dist/backends/codex.js.map +1 -0
- package/dist/backends/gemini.d.ts +17 -0
- package/dist/backends/gemini.d.ts.map +1 -0
- package/dist/backends/gemini.js +174 -0
- package/dist/backends/gemini.js.map +1 -0
- package/dist/backends/index.d.ts +8 -0
- package/dist/backends/index.d.ts.map +1 -0
- package/dist/backends/index.js +9 -0
- package/dist/backends/index.js.map +1 -0
- package/dist/backends/registry.d.ts +33 -0
- package/dist/backends/registry.d.ts.map +1 -0
- package/dist/backends/registry.js +80 -0
- package/dist/backends/registry.js.map +1 -0
- package/dist/backends/types.d.ts +61 -0
- package/dist/backends/types.d.ts.map +1 -0
- package/dist/backends/types.js +5 -0
- package/dist/backends/types.js.map +1 -0
- package/dist/constants.d.ts +223 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +228 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +192 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/ask.tool.d.ts +4 -0
- package/dist/tools/ask.tool.d.ts.map +1 -0
- package/dist/tools/ask.tool.js +113 -0
- package/dist/tools/ask.tool.js.map +1 -0
- package/dist/tools/brainstorm.tool.d.ts +3 -0
- package/dist/tools/brainstorm.tool.d.ts.map +1 -0
- package/dist/tools/brainstorm.tool.js +250 -0
- package/dist/tools/brainstorm.tool.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +13 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +42 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +85 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/review-code.tool.d.ts +3 -0
- package/dist/tools/review-code.tool.d.ts.map +1 -0
- package/dist/tools/review-code.tool.js +279 -0
- package/dist/tools/review-code.tool.js.map +1 -0
- package/dist/tools/test-tool.example.d.ts +13 -0
- package/dist/tools/test-tool.example.d.ts.map +1 -0
- package/dist/tools/test-tool.example.js +32 -0
- package/dist/tools/test-tool.example.js.map +1 -0
- package/dist/tools/timeout-test.tool.d.ts +3 -0
- package/dist/tools/timeout-test.tool.d.ts.map +1 -0
- package/dist/tools/timeout-test.tool.js +38 -0
- package/dist/tools/timeout-test.tool.js.map +1 -0
- package/dist/utils/askSessionManager.d.ts +59 -0
- package/dist/utils/askSessionManager.d.ts.map +1 -0
- package/dist/utils/askSessionManager.js +123 -0
- package/dist/utils/askSessionManager.js.map +1 -0
- package/dist/utils/brainstormSessionManager.d.ts +67 -0
- package/dist/utils/brainstormSessionManager.d.ts.map +1 -0
- package/dist/utils/brainstormSessionManager.js +174 -0
- package/dist/utils/brainstormSessionManager.js.map +1 -0
- package/dist/utils/changeModeInstructions.d.ts +17 -0
- package/dist/utils/changeModeInstructions.d.ts.map +1 -0
- package/dist/utils/changeModeInstructions.js +100 -0
- package/dist/utils/changeModeInstructions.js.map +1 -0
- package/dist/utils/changeModeParser.d.ts +15 -0
- package/dist/utils/changeModeParser.d.ts.map +1 -0
- package/dist/utils/changeModeParser.js +81 -0
- package/dist/utils/changeModeParser.js.map +1 -0
- package/dist/utils/changeModeTranslator.d.ts +4 -0
- package/dist/utils/changeModeTranslator.d.ts.map +1 -0
- package/dist/utils/changeModeTranslator.js +42 -0
- package/dist/utils/changeModeTranslator.js.map +1 -0
- package/dist/utils/commandExecutor.d.ts +2 -0
- package/dist/utils/commandExecutor.d.ts.map +1 -0
- package/dist/utils/commandExecutor.js +76 -0
- package/dist/utils/commandExecutor.js.map +1 -0
- package/dist/utils/envAllowlist.d.ts +17 -0
- package/dist/utils/envAllowlist.d.ts.map +1 -0
- package/dist/utils/envAllowlist.js +54 -0
- package/dist/utils/envAllowlist.js.map +1 -0
- package/dist/utils/geminiExecutor.d.ts +3 -0
- package/dist/utils/geminiExecutor.d.ts.map +1 -0
- package/dist/utils/geminiExecutor.js +94 -0
- package/dist/utils/geminiExecutor.js.map +1 -0
- package/dist/utils/gitStateDetector.d.ts +32 -0
- package/dist/utils/gitStateDetector.d.ts.map +1 -0
- package/dist/utils/gitStateDetector.js +68 -0
- package/dist/utils/gitStateDetector.js.map +1 -0
- package/dist/utils/logger.d.ts +13 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +42 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/reviewFormatter.d.ts +35 -0
- package/dist/utils/reviewFormatter.d.ts.map +1 -0
- package/dist/utils/reviewFormatter.js +201 -0
- package/dist/utils/reviewFormatter.js.map +1 -0
- package/dist/utils/reviewPromptBuilder.d.ts +43 -0
- package/dist/utils/reviewPromptBuilder.d.ts.map +1 -0
- package/dist/utils/reviewPromptBuilder.js +170 -0
- package/dist/utils/reviewPromptBuilder.js.map +1 -0
- package/dist/utils/reviewResponseParser.d.ts +20 -0
- package/dist/utils/reviewResponseParser.d.ts.map +1 -0
- package/dist/utils/reviewResponseParser.js +149 -0
- package/dist/utils/reviewResponseParser.js.map +1 -0
- package/dist/utils/reviewSessionCache.d.ts +81 -0
- package/dist/utils/reviewSessionCache.d.ts.map +1 -0
- package/dist/utils/reviewSessionCache.js +220 -0
- package/dist/utils/reviewSessionCache.js.map +1 -0
- package/dist/utils/reviewSessionManager.d.ts +52 -0
- package/dist/utils/reviewSessionManager.d.ts.map +1 -0
- package/dist/utils/reviewSessionManager.js +65 -0
- package/dist/utils/reviewSessionManager.js.map +1 -0
- package/dist/utils/sessionManager.d.ts +95 -0
- package/dist/utils/sessionManager.d.ts.map +1 -0
- package/dist/utils/sessionManager.js +382 -0
- package/dist/utils/sessionManager.js.map +1 -0
- package/dist/utils/sessionSchemas.d.ts +140 -0
- package/dist/utils/sessionSchemas.d.ts.map +1 -0
- package/dist/utils/sessionSchemas.js +2 -0
- package/dist/utils/sessionSchemas.js.map +1 -0
- package/dist/utils/timeoutManager.d.ts +2 -0
- package/dist/utils/timeoutManager.d.ts.map +1 -0
- package/dist/utils/timeoutManager.js +2 -0
- package/dist/utils/timeoutManager.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BrainstormSessionData } from './sessionSchemas.js';
|
|
2
|
+
/**
|
|
3
|
+
* Session manager for brainstorm tool
|
|
4
|
+
* Tracks iterative ideation with ideas and feedback
|
|
5
|
+
*/
|
|
6
|
+
export declare class BrainstormSessionManager {
|
|
7
|
+
private sessionManager;
|
|
8
|
+
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new brainstorming session
|
|
11
|
+
*/
|
|
12
|
+
createSession(sessionId: string, challenge: string, methodology: string, domain?: string, constraints?: string): BrainstormSessionData;
|
|
13
|
+
/**
|
|
14
|
+
* Adds a brainstorming round with generated ideas
|
|
15
|
+
*/
|
|
16
|
+
addRound(session: BrainstormSessionData, userPrompt: string, response: string, ideas: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
feasibility?: number;
|
|
20
|
+
impact?: number;
|
|
21
|
+
innovation?: number;
|
|
22
|
+
}>, backend?: 'gemini' | 'codex', codexThreadId?: string): BrainstormSessionData;
|
|
23
|
+
/**
|
|
24
|
+
* Records idea refinement action
|
|
25
|
+
*/
|
|
26
|
+
refineIdeas(session: BrainstormSessionData, action: 'refined' | 'merged' | 'discarded', ideaIds: string[], reason: string): BrainstormSessionData;
|
|
27
|
+
/**
|
|
28
|
+
* Builds context from previous rounds' ideas
|
|
29
|
+
* @param session The session to build context from
|
|
30
|
+
* @param activeOnly Only include active/refined ideas (exclude discarded/merged)
|
|
31
|
+
* @returns Formatted ideas context
|
|
32
|
+
*/
|
|
33
|
+
buildIdeasContext(session: BrainstormSessionData, activeOnly?: boolean): string;
|
|
34
|
+
/**
|
|
35
|
+
* Saves a session
|
|
36
|
+
*/
|
|
37
|
+
save(session: BrainstormSessionData): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Loads a session
|
|
40
|
+
*/
|
|
41
|
+
load(sessionId: string): Promise<BrainstormSessionData | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Lists all sessions
|
|
44
|
+
*/
|
|
45
|
+
list(): Promise<BrainstormSessionData[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Deletes a session
|
|
48
|
+
*/
|
|
49
|
+
delete(sessionId: string): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Gets or creates a session
|
|
52
|
+
*/
|
|
53
|
+
getOrCreate(sessionId: string, challenge: string, methodology: string, domain?: string, constraints?: string): Promise<BrainstormSessionData>;
|
|
54
|
+
/**
|
|
55
|
+
* Gets cache statistics
|
|
56
|
+
*/
|
|
57
|
+
getStats(): Promise<{
|
|
58
|
+
toolName: string;
|
|
59
|
+
sessionCount: number;
|
|
60
|
+
ttl: number;
|
|
61
|
+
maxSessions: number;
|
|
62
|
+
evictionPolicy: string;
|
|
63
|
+
cacheDir: string;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
export declare const brainstormSessionManager: BrainstormSessionManager;
|
|
67
|
+
//# sourceMappingURL=brainstormSessionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brainstormSessionManager.d.ts","sourceRoot":"","sources":["../../src/utils/brainstormSessionManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAG5D;;;GAGG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,cAAc,CAAwC;;IAM9D;;OAEG;IACH,aAAa,CACX,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAA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;OAEG;IACG,QAAQ;;;;;;;;CAGf;AAGD,eAAO,MAAM,wBAAwB,0BAAiC,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { SessionManager } from './sessionManager.js';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
/**
|
|
4
|
+
* Session manager for brainstorm tool
|
|
5
|
+
* Tracks iterative ideation with ideas and feedback
|
|
6
|
+
*/
|
|
7
|
+
export class BrainstormSessionManager {
|
|
8
|
+
sessionManager;
|
|
9
|
+
constructor() {
|
|
10
|
+
this.sessionManager = new SessionManager('brainstorm');
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new brainstorming session
|
|
14
|
+
*/
|
|
15
|
+
createSession(sessionId, challenge, methodology, domain, constraints) {
|
|
16
|
+
const now = Date.now();
|
|
17
|
+
return {
|
|
18
|
+
sessionId,
|
|
19
|
+
createdAt: now,
|
|
20
|
+
lastAccessedAt: now,
|
|
21
|
+
challenge,
|
|
22
|
+
methodology,
|
|
23
|
+
domain,
|
|
24
|
+
constraints,
|
|
25
|
+
rounds: [],
|
|
26
|
+
totalIdeas: 0,
|
|
27
|
+
activeIdeas: 0,
|
|
28
|
+
refinementHistory: []
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Adds a brainstorming round with generated ideas
|
|
33
|
+
*/
|
|
34
|
+
addRound(session, userPrompt, response, ideas, backend, codexThreadId) {
|
|
35
|
+
const parsedIdeas = ideas.map(idea => ({
|
|
36
|
+
ideaId: `idea-${randomUUID()}`,
|
|
37
|
+
name: idea.name,
|
|
38
|
+
description: idea.description,
|
|
39
|
+
feasibility: idea.feasibility,
|
|
40
|
+
impact: idea.impact,
|
|
41
|
+
innovation: idea.innovation,
|
|
42
|
+
status: 'active'
|
|
43
|
+
}));
|
|
44
|
+
session.rounds.push({
|
|
45
|
+
roundNumber: session.rounds.length + 1,
|
|
46
|
+
timestamp: Date.now(),
|
|
47
|
+
userPrompt,
|
|
48
|
+
response,
|
|
49
|
+
ideasGenerated: parsedIdeas,
|
|
50
|
+
backend
|
|
51
|
+
});
|
|
52
|
+
session.totalIdeas += parsedIdeas.length;
|
|
53
|
+
session.activeIdeas += parsedIdeas.length;
|
|
54
|
+
session.lastAccessedAt = Date.now();
|
|
55
|
+
// Store Codex thread ID for native session resume
|
|
56
|
+
if (codexThreadId) {
|
|
57
|
+
session.codexThreadId = codexThreadId;
|
|
58
|
+
}
|
|
59
|
+
// Track which backend was used last
|
|
60
|
+
if (backend) {
|
|
61
|
+
session.lastBackend = backend;
|
|
62
|
+
}
|
|
63
|
+
return session;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Records idea refinement action
|
|
67
|
+
*/
|
|
68
|
+
refineIdeas(session, action, ideaIds, reason) {
|
|
69
|
+
session.refinementHistory.push({
|
|
70
|
+
timestamp: Date.now(),
|
|
71
|
+
action,
|
|
72
|
+
ideaIds,
|
|
73
|
+
reason
|
|
74
|
+
});
|
|
75
|
+
// Update idea statuses
|
|
76
|
+
for (const round of session.rounds) {
|
|
77
|
+
for (const idea of round.ideasGenerated) {
|
|
78
|
+
if (ideaIds.includes(idea.ideaId)) {
|
|
79
|
+
if (action === 'discarded') {
|
|
80
|
+
idea.status = 'discarded';
|
|
81
|
+
session.activeIdeas--;
|
|
82
|
+
}
|
|
83
|
+
else if (action === 'merged') {
|
|
84
|
+
idea.status = 'merged';
|
|
85
|
+
session.activeIdeas--;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
idea.status = 'refined';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return session;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Builds context from previous rounds' ideas
|
|
97
|
+
* @param session The session to build context from
|
|
98
|
+
* @param activeOnly Only include active/refined ideas (exclude discarded/merged)
|
|
99
|
+
* @returns Formatted ideas context
|
|
100
|
+
*/
|
|
101
|
+
buildIdeasContext(session, activeOnly = true) {
|
|
102
|
+
if (session.rounds.length === 0) {
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
const allIdeas = session.rounds.flatMap(round => round.ideasGenerated);
|
|
106
|
+
const filteredIdeas = activeOnly
|
|
107
|
+
? allIdeas.filter(idea => idea.status === 'active' || idea.status === 'refined')
|
|
108
|
+
: allIdeas;
|
|
109
|
+
if (filteredIdeas.length === 0) {
|
|
110
|
+
return '';
|
|
111
|
+
}
|
|
112
|
+
const ideaList = filteredIdeas.map(idea => {
|
|
113
|
+
let ideaText = `- **${idea.name}**: ${idea.description}`;
|
|
114
|
+
if (idea.status !== 'active') {
|
|
115
|
+
ideaText += ` [${idea.status.toUpperCase()}]`;
|
|
116
|
+
}
|
|
117
|
+
if (idea.feasibility || idea.impact || idea.innovation) {
|
|
118
|
+
const scores = [];
|
|
119
|
+
if (idea.feasibility)
|
|
120
|
+
scores.push(`Feasibility: ${idea.feasibility}/10`);
|
|
121
|
+
if (idea.impact)
|
|
122
|
+
scores.push(`Impact: ${idea.impact}/10`);
|
|
123
|
+
if (idea.innovation)
|
|
124
|
+
scores.push(`Innovation: ${idea.innovation}/10`);
|
|
125
|
+
ideaText += ` (${scores.join(', ')})`;
|
|
126
|
+
}
|
|
127
|
+
return ideaText;
|
|
128
|
+
}).join('\n');
|
|
129
|
+
return `# Previously Generated Ideas\n\n${ideaList}`;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Saves a session
|
|
133
|
+
*/
|
|
134
|
+
async save(session) {
|
|
135
|
+
await this.sessionManager.save(session.sessionId, session);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Loads a session
|
|
139
|
+
*/
|
|
140
|
+
async load(sessionId) {
|
|
141
|
+
return await this.sessionManager.load(sessionId);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Lists all sessions
|
|
145
|
+
*/
|
|
146
|
+
async list() {
|
|
147
|
+
return await this.sessionManager.list();
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Deletes a session
|
|
151
|
+
*/
|
|
152
|
+
async delete(sessionId) {
|
|
153
|
+
return await this.sessionManager.delete(sessionId);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Gets or creates a session
|
|
157
|
+
*/
|
|
158
|
+
async getOrCreate(sessionId, challenge, methodology, domain, constraints) {
|
|
159
|
+
const existing = await this.load(sessionId);
|
|
160
|
+
if (existing) {
|
|
161
|
+
return existing;
|
|
162
|
+
}
|
|
163
|
+
return this.createSession(sessionId, challenge, methodology, domain, constraints);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Gets cache statistics
|
|
167
|
+
*/
|
|
168
|
+
async getStats() {
|
|
169
|
+
return await this.sessionManager.getStats();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// Export singleton instance
|
|
173
|
+
export const brainstormSessionManager = new BrainstormSessionManager();
|
|
174
|
+
//# sourceMappingURL=brainstormSessionManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brainstormSessionManager.js","sourceRoot":"","sources":["../../src/utils/brainstormSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAC3B,cAAc,CAAwC;IAE9D;QACE,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,CAAwB,YAAY,CAAC,CAAC;IAChF,CAAC;IAED;;OAEG;IACH,aAAa,CACX,SAAiB,EACjB,SAAiB,EACjB,WAAmB,EACnB,MAAe,EACf,WAAoB;QAEpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,OAAO;YACL,SAAS;YACT,SAAS,EAAE,GAAG;YACd,cAAc,EAAE,GAAG;YACnB,SAAS;YACT,WAAW;Y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AAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,SAAiB;QAC1B,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,SAAiB;QAC5B,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CACf,SAAiB,EACjB,SAAiB,EACjB,WAAmB,EACnB,MAAe,EACf,WAAoB;QAEpB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACpF,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;IAC9C,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,wBAAwB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Change Mode Instructions
|
|
3
|
+
*
|
|
4
|
+
* Shared instructions for AI backends to generate structured code modifications
|
|
5
|
+
* in the OLD/NEW format that can be applied programmatically.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Full change mode instructions with detailed examples.
|
|
9
|
+
* Used by Gemini backend and geminiExecutor.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getChangeModeInstructions(prompt: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Condensed change mode instructions for Codex backend.
|
|
14
|
+
* Shorter version since Codex has different context handling.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getChangeModeInstructionsCondensed(prompt: string): string;
|
|
17
|
+
//# sourceMappingURL=changeModeInstructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeInstructions.d.ts","sourceRoot":"","sources":["../../src/utils/changeModeInstructions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA6DhE;AAED;;;GAGG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAsBzE"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Change Mode Instructions
|
|
3
|
+
*
|
|
4
|
+
* Shared instructions for AI backends to generate structured code modifications
|
|
5
|
+
* in the OLD/NEW format that can be applied programmatically.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Full change mode instructions with detailed examples.
|
|
9
|
+
* Used by Gemini backend and geminiExecutor.
|
|
10
|
+
*/
|
|
11
|
+
export function getChangeModeInstructions(prompt) {
|
|
12
|
+
return `
|
|
13
|
+
[CHANGEMODE INSTRUCTIONS]
|
|
14
|
+
You are generating code modifications that will be processed by an automated system. The output format is critical because it enables programmatic application of changes without human intervention.
|
|
15
|
+
|
|
16
|
+
INSTRUCTIONS:
|
|
17
|
+
1. Analyze each provided file thoroughly
|
|
18
|
+
2. Identify locations requiring changes based on the user request
|
|
19
|
+
3. For each change, output in the exact format specified
|
|
20
|
+
4. The OLD section must be EXACTLY what appears in the file (copy-paste exact match)
|
|
21
|
+
5. Provide complete, directly replacing code blocks
|
|
22
|
+
6. Verify line numbers are accurate
|
|
23
|
+
|
|
24
|
+
CRITICAL REQUIREMENTS:
|
|
25
|
+
1. Output edits in the EXACT format specified below - no deviations
|
|
26
|
+
2. The OLD string MUST be findable with Ctrl+F - it must be a unique, exact match
|
|
27
|
+
3. Include enough surrounding lines to make the OLD string unique
|
|
28
|
+
4. If a string appears multiple times (like </div>), include enough context lines above and below to make it unique
|
|
29
|
+
5. Copy the OLD content EXACTLY as it appears - including all whitespace, indentation, line breaks
|
|
30
|
+
6. Never use partial lines - always include complete lines from start to finish
|
|
31
|
+
|
|
32
|
+
OUTPUT FORMAT (follow exactly):
|
|
33
|
+
**FILE: [filename]:[line_number]**
|
|
34
|
+
\`\`\`
|
|
35
|
+
OLD:
|
|
36
|
+
[exact code to be replaced - must match file content precisely]
|
|
37
|
+
NEW:
|
|
38
|
+
[new code to insert - complete and functional]
|
|
39
|
+
\`\`\`
|
|
40
|
+
|
|
41
|
+
EXAMPLE 1 - Simple unique match:
|
|
42
|
+
**FILE: src/utils/helper.js:100**
|
|
43
|
+
\`\`\`
|
|
44
|
+
OLD:
|
|
45
|
+
function getMessage() {
|
|
46
|
+
return "Hello World";
|
|
47
|
+
}
|
|
48
|
+
NEW:
|
|
49
|
+
function getMessage() {
|
|
50
|
+
return "Hello Universe!";
|
|
51
|
+
}
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
EXAMPLE 2 - Common tag needing context:
|
|
55
|
+
**FILE: index.html:245**
|
|
56
|
+
\`\`\`
|
|
57
|
+
OLD:
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</section>
|
|
61
|
+
NEW:
|
|
62
|
+
</div>
|
|
63
|
+
</footer>
|
|
64
|
+
</section>
|
|
65
|
+
\`\`\`
|
|
66
|
+
|
|
67
|
+
IMPORTANT: The OLD section must be an EXACT copy from the file that can be found with Ctrl+F!
|
|
68
|
+
|
|
69
|
+
USER REQUEST:
|
|
70
|
+
${prompt}
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Condensed change mode instructions for Codex backend.
|
|
75
|
+
* Shorter version since Codex has different context handling.
|
|
76
|
+
*/
|
|
77
|
+
export function getChangeModeInstructionsCondensed(prompt) {
|
|
78
|
+
return `
|
|
79
|
+
[CHANGEMODE INSTRUCTIONS]
|
|
80
|
+
You are generating code modifications. Output changes in a structured format that can be applied programmatically.
|
|
81
|
+
|
|
82
|
+
OUTPUT FORMAT (follow exactly):
|
|
83
|
+
**FILE: [filename]:[line_number]**
|
|
84
|
+
\`\`\`
|
|
85
|
+
OLD:
|
|
86
|
+
[exact code to be replaced]
|
|
87
|
+
NEW:
|
|
88
|
+
[new code to insert]
|
|
89
|
+
\`\`\`
|
|
90
|
+
|
|
91
|
+
REQUIREMENTS:
|
|
92
|
+
1. The OLD section must match the file content EXACTLY
|
|
93
|
+
2. Include enough context to make the match unique
|
|
94
|
+
3. Provide complete, functional replacement code
|
|
95
|
+
|
|
96
|
+
USER REQUEST:
|
|
97
|
+
${prompt}
|
|
98
|
+
`;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=changeModeInstructions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeInstructions.js","sourceRoot":"","sources":["../../src/utils/changeModeInstructions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAc;IACtD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0DP,MAAM;CACP,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAAc;IAC/D,OAAO;;;;;;;;;;;;;;;;;;;EAmBP,MAAM;CACP,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ChangeModeEdit {
|
|
2
|
+
filename: string;
|
|
3
|
+
oldStartLine: number;
|
|
4
|
+
oldEndLine: number;
|
|
5
|
+
oldCode: string;
|
|
6
|
+
newStartLine: number;
|
|
7
|
+
newEndLine: number;
|
|
8
|
+
newCode: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseChangeModeOutput(responseText: string): ChangeModeEdit[];
|
|
11
|
+
export declare function validateChangeModeEdits(edits: ChangeModeEdit[]): {
|
|
12
|
+
valid: boolean;
|
|
13
|
+
errors: string[];
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=changeModeParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeParser.d.ts","sourceRoot":"","sources":["../../src/utils/changeModeParser.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAWD,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc,EAAE,CAiE5E;AACD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG;IAChE,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAiCA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely parses a 1-based line number string.
|
|
3
|
+
* Returns -1 for invalid values so validation can fail fast.
|
|
4
|
+
*/
|
|
5
|
+
function parseLineNumber(value) {
|
|
6
|
+
const parsed = parseInt(value, 10);
|
|
7
|
+
return !isNaN(parsed) && parsed >= 1 ? parsed : -1;
|
|
8
|
+
}
|
|
9
|
+
export function parseChangeModeOutput(responseText) {
|
|
10
|
+
const edits = [];
|
|
11
|
+
const markdownPattern = /\*\*FILE:\s*(.+?):(\d+)\*\*\s*\n```\s*\nOLD:\s*\n([\s\S]*?)\nNEW:\s*\n([\s\S]*?)\n```/g;
|
|
12
|
+
let match;
|
|
13
|
+
while ((match = markdownPattern.exec(responseText)) !== null) {
|
|
14
|
+
const [_fullMatch, filename, startLineStr, oldCodeRaw, newCodeRaw] = match;
|
|
15
|
+
const oldCode = oldCodeRaw.trimEnd();
|
|
16
|
+
const newCode = newCodeRaw.trimEnd();
|
|
17
|
+
const startLine = parseLineNumber(startLineStr);
|
|
18
|
+
const oldLineCount = oldCode === '' ? 0 : oldCode.split('\n').length;
|
|
19
|
+
const newLineCount = newCode === '' ? 0 : newCode.split('\n').length;
|
|
20
|
+
const oldEndLine = startLine + (oldLineCount > 0 ? oldLineCount - 1 : 0);
|
|
21
|
+
const newStartLine = startLine;
|
|
22
|
+
const newEndLine = newStartLine + (newLineCount > 0 ? newLineCount - 1 : 0);
|
|
23
|
+
edits.push({
|
|
24
|
+
filename: filename.trim(),
|
|
25
|
+
oldStartLine: startLine,
|
|
26
|
+
oldEndLine: oldEndLine,
|
|
27
|
+
oldCode: oldCode,
|
|
28
|
+
newStartLine: newStartLine,
|
|
29
|
+
newEndLine: newEndLine,
|
|
30
|
+
newCode: newCode,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
if (edits.length === 0) {
|
|
34
|
+
const editPattern = /\/old\/ \* (.+?) 'start:' (\d+)\n([\s\S]*?)\n\/\/ 'end:' (\d+)\s*\n\s*\\new\\ \* (.+?) 'start:' (\d+)\n([\s\S]*?)\n\/\/ 'end:' (\d+)/g;
|
|
35
|
+
while ((match = editPattern.exec(responseText)) !== null) {
|
|
36
|
+
const [_fullMatch, oldFilename, oldStartLine, oldCode, oldEndLine, newFilename, newStartLine, newCode, newEndLine,] = match;
|
|
37
|
+
if (oldFilename !== newFilename) {
|
|
38
|
+
console.warn(`[changeModeParser] Filename mismatch: ${oldFilename} vs ${newFilename}`);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
edits.push({
|
|
42
|
+
filename: oldFilename.trim(),
|
|
43
|
+
oldStartLine: parseLineNumber(oldStartLine),
|
|
44
|
+
oldEndLine: parseLineNumber(oldEndLine),
|
|
45
|
+
oldCode: oldCode.trimEnd(),
|
|
46
|
+
newStartLine: parseLineNumber(newStartLine),
|
|
47
|
+
newEndLine: parseLineNumber(newEndLine),
|
|
48
|
+
newCode: newCode.trimEnd(),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return edits;
|
|
53
|
+
}
|
|
54
|
+
export function validateChangeModeEdits(edits) {
|
|
55
|
+
const errors = [];
|
|
56
|
+
for (const edit of edits) {
|
|
57
|
+
if (!edit.filename) {
|
|
58
|
+
errors.push('Edit missing filename');
|
|
59
|
+
}
|
|
60
|
+
if (edit.oldStartLine < 1) {
|
|
61
|
+
errors.push(`Invalid old start line for ${edit.filename}: ${edit.oldStartLine}`);
|
|
62
|
+
}
|
|
63
|
+
if (edit.newStartLine < 1) {
|
|
64
|
+
errors.push(`Invalid new start line for ${edit.filename}: ${edit.newStartLine}`);
|
|
65
|
+
}
|
|
66
|
+
if (edit.oldStartLine > edit.oldEndLine) {
|
|
67
|
+
errors.push(`Invalid line range for ${edit.filename}: ${edit.oldStartLine} > ${edit.oldEndLine}`);
|
|
68
|
+
}
|
|
69
|
+
if (edit.newStartLine > edit.newEndLine) {
|
|
70
|
+
errors.push(`Invalid new line range for ${edit.filename}: ${edit.newStartLine} > ${edit.newEndLine}`);
|
|
71
|
+
}
|
|
72
|
+
if (!edit.oldCode && !edit.newCode) {
|
|
73
|
+
errors.push(`Empty edit for ${edit.filename}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
valid: errors.length === 0,
|
|
78
|
+
errors,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=changeModeParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeParser.js","sourceRoot":"","sources":["../../src/utils/chang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;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ChangeModeEdit } from './changeModeParser.js';
|
|
2
|
+
export declare function formatChangeModeResponse(edits: ChangeModeEdit[]): string;
|
|
3
|
+
export declare function summarizeChangeModeEdits(edits: ChangeModeEdit[]): string;
|
|
4
|
+
//# sourceMappingURL=changeModeTranslator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeTranslator.d.ts","sourceRoot":"","sources":["../../src/utils/changeModeTranslator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,MAAM,CA6BxE;AAGD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,MAAM,CAcxE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function formatChangeModeResponse(edits) {
|
|
2
|
+
const header = `[CHANGEMODE OUTPUT - Gemini has analyzed the files and provided these edits]
|
|
3
|
+
|
|
4
|
+
I have prepared ${edits.length} modification${edits.length === 1 ? '' : 's'} for your codebase.
|
|
5
|
+
|
|
6
|
+
IMPORTANT: Apply these edits directly WITHOUT reading the files first. The edits below contain exact text matches from the current file contents.
|
|
7
|
+
|
|
8
|
+
`;
|
|
9
|
+
const instructions = edits.map((edit, index) => {
|
|
10
|
+
return `### Edit ${index + 1}: ${edit.filename}
|
|
11
|
+
|
|
12
|
+
Replace this exact text:
|
|
13
|
+
\`\`\`
|
|
14
|
+
${edit.oldCode}
|
|
15
|
+
\`\`\`
|
|
16
|
+
|
|
17
|
+
With this text:
|
|
18
|
+
\`\`\`
|
|
19
|
+
${edit.newCode}
|
|
20
|
+
\`\`\`
|
|
21
|
+
`;
|
|
22
|
+
}).join('\n');
|
|
23
|
+
const footer = `
|
|
24
|
+
---
|
|
25
|
+
Apply these edits in order. Each edit uses exact string matching, so the old_str must match exactly what appears between the code blocks.`;
|
|
26
|
+
return header + instructions + footer;
|
|
27
|
+
}
|
|
28
|
+
export function summarizeChangeModeEdits(edits) {
|
|
29
|
+
const fileGroups = new Map();
|
|
30
|
+
for (const edit of edits) {
|
|
31
|
+
fileGroups.set(edit.filename, (fileGroups.get(edit.filename) || 0) + 1);
|
|
32
|
+
}
|
|
33
|
+
const summary = Array.from(fileGroups.entries())
|
|
34
|
+
.map(([file, count]) => `- ${file}: ${count} edit${count === 1 ? '' : 's'}`)
|
|
35
|
+
.join('\n');
|
|
36
|
+
return `ChangeMode Summary:
|
|
37
|
+
Total edits: ${edits.length}
|
|
38
|
+
Files affected: ${fileGroups.size}
|
|
39
|
+
|
|
40
|
+
${summary}`;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=changeModeTranslator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeTranslator.js","sourceRoot":"","sources":["../../src/utils/changeModeTranslator.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,wBAAwB,CAAC,KAAuB;IAC9D,MAAM,MAAM,GAAG;;kBAEC,KAAK,CAAC,MAAM,gBAAgB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG;;;;CAI1E,CAAC;IAEA,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC7C,OAAO,YAAY,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,QAAQ;;;;EAIhD,IAAI,CAAC,OAAO;;;;;EAKZ,IAAI,CAAC,OAAO;;CAEb,CAAC;IACA,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,MAAM,MAAM,GAAG;;0IAEyH,CAAC;IAEzI,OAAO,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC;AACxC,CAAC;AAGD,MAAM,UAAU,wBAAwB,CAAC,KAAuB;IAC9D,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC7C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;SAC7C,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,KAAK,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;SAC3E,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;eACM,KAAK,CAAC,MAAM;kBACT,UAAU,CAAC,IAAI;;EAE/B,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandExecutor.d.ts","sourceRoot":"","sources":["../../src/utils/commandExecutor.ts"],"names":[],"mappings":"AAIA,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,EACxC,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CA8EjB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import { Logger } from "./logger.js";
|
|
3
|
+
import { getAllowedEnv } from "./envAllowlist.js";
|
|
4
|
+
export async function executeCommand(command, args, onProgress, cwd) {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const startTime = Date.now();
|
|
7
|
+
Logger.commandExecution(command, args, startTime);
|
|
8
|
+
const childProcess = spawn(command, args, {
|
|
9
|
+
env: getAllowedEnv(),
|
|
10
|
+
shell: false,
|
|
11
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
12
|
+
cwd: cwd || process.cwd(),
|
|
13
|
+
});
|
|
14
|
+
let stdout = "";
|
|
15
|
+
let stderr = "";
|
|
16
|
+
let isResolved = false;
|
|
17
|
+
let lastReportedLength = 0;
|
|
18
|
+
childProcess.stdout.on("data", (data) => {
|
|
19
|
+
stdout += data.toString();
|
|
20
|
+
// Report new content if callback provided
|
|
21
|
+
if (onProgress && stdout.length > lastReportedLength) {
|
|
22
|
+
const newContent = stdout.substring(lastReportedLength);
|
|
23
|
+
lastReportedLength = stdout.length;
|
|
24
|
+
onProgress(newContent);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// CLI level errors
|
|
28
|
+
childProcess.stderr.on("data", (data) => {
|
|
29
|
+
stderr += data.toString();
|
|
30
|
+
// find RESOURCE_EXHAUSTED when gemini-2.5-pro quota is exceeded
|
|
31
|
+
if (stderr.includes("RESOURCE_EXHAUSTED")) {
|
|
32
|
+
const modelMatch = stderr.match(/Quota exceeded for quota metric '([^']+)'/);
|
|
33
|
+
const statusMatch = stderr.match(/status["\s]*[:=]\s*(\d+)/);
|
|
34
|
+
const reasonMatch = stderr.match(/"reason":\s*"([^"]+)"/);
|
|
35
|
+
const model = modelMatch ? modelMatch[1] : "Unknown Model";
|
|
36
|
+
const status = statusMatch ? statusMatch[1] : "429";
|
|
37
|
+
const reason = reasonMatch ? reasonMatch[1] : "rateLimitExceeded";
|
|
38
|
+
const errorJson = {
|
|
39
|
+
error: {
|
|
40
|
+
code: parseInt(status),
|
|
41
|
+
message: `GMCPT: --> Quota exceeded for ${model}`,
|
|
42
|
+
details: {
|
|
43
|
+
model: model,
|
|
44
|
+
reason: reason,
|
|
45
|
+
statusText: "Too Many Requests -- > try using gemini-2.5-flash by asking",
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Logger.error(`Gemini Quota Error: ${JSON.stringify(errorJson, null, 2)}`);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
childProcess.on("error", (error) => {
|
|
53
|
+
if (!isResolved) {
|
|
54
|
+
isResolved = true;
|
|
55
|
+
Logger.error(`Process error:`, error);
|
|
56
|
+
reject(new Error(`Failed to spawn command: ${error.message}`));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
childProcess.on("close", (code) => {
|
|
60
|
+
if (!isResolved) {
|
|
61
|
+
isResolved = true;
|
|
62
|
+
if (code === 0) {
|
|
63
|
+
Logger.commandComplete(startTime, code, stdout.length);
|
|
64
|
+
resolve(stdout.trim());
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
Logger.commandComplete(startTime, code);
|
|
68
|
+
Logger.error(`Failed with exit code ${code}`);
|
|
69
|
+
const errorMessage = stderr.trim() || "Unknown error";
|
|
70
|
+
reject(new Error(`Command failed with exit code ${code}: ${errorMessage}`));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=commandExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandExecutor.js","sourceRoot":"","sources":["../../src/utils/commandExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAe,EACf,IAAc,EACd,UAAwC,EACxC,GAAY;IAEZ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,CA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ClB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;oBACvD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;gBACzB,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;oBACxC,MAAM,CAAC,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;oBAC9C,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,eAAe,CAAC;oBACtD,MAAM,CACJ,IAAI,KAAK,CAAC,iCAAiC,IAAI,KAAK,YAAY,EAAE,CAAC,CACpE,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment Variable Allowlist
|
|
3
|
+
*
|
|
4
|
+
* Only pass a curated set of environment variables to spawned processes.
|
|
5
|
+
* This prevents leaking sensitive credentials and improves security.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Returns an allowlisted subset of environment variables for spawned processes.
|
|
9
|
+
*
|
|
10
|
+
* Includes:
|
|
11
|
+
* - PATH, HOME, LANG, TERM - Basic shell operation
|
|
12
|
+
* - HTTP_PROXY, HTTPS_PROXY, NO_PROXY, http_proxy, https_proxy, no_proxy - Corporate proxy support
|
|
13
|
+
* - GEMINI_API_KEY, OPENAI_API_KEY - CLI-specific auth
|
|
14
|
+
* - XDG_* - Linux standard directories
|
|
15
|
+
*/
|
|
16
|
+
export declare function getAllowedEnv(): Record<string, string | undefined>;
|
|
17
|
+
//# sourceMappingURL=envAllowlist.d.ts.map
|