@staticpayload/zai-code 1.4.1 → 1.4.3
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/dist/context/context_builder.d.ts +5 -18
- package/dist/context/context_builder.d.ts.map +1 -1
- package/dist/context/context_builder.js +108 -202
- package/dist/context/context_builder.js.map +1 -1
- package/dist/context/project_memory.d.ts +3 -12
- package/dist/context/project_memory.d.ts.map +1 -1
- package/dist/context/project_memory.js +46 -89
- package/dist/context/project_memory.js.map +1 -1
- package/dist/orchestrator.d.ts +1 -1
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +247 -41
- package/dist/orchestrator.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +12 -1
- package/dist/session.js.map +1 -1
- package/dist/settings.d.ts +4 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +17 -0
- package/dist/settings.js.map +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +128 -115
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
package/dist/session.js
CHANGED
|
@@ -48,6 +48,17 @@ exports.PLAN_SCHEMA = {
|
|
|
48
48
|
error: { type: 'string' },
|
|
49
49
|
},
|
|
50
50
|
};
|
|
51
|
+
// Get default mode from settings (lazy load to avoid circular dependency)
|
|
52
|
+
function getDefaultModeFromSettings() {
|
|
53
|
+
try {
|
|
54
|
+
// Dynamic import to avoid circular dependency
|
|
55
|
+
const { getDefaultMode } = require('./settings');
|
|
56
|
+
return getDefaultMode();
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return 'edit';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
51
62
|
// Create a new session state
|
|
52
63
|
function createSession(workingDirectory) {
|
|
53
64
|
return {
|
|
@@ -55,7 +66,7 @@ function createSession(workingDirectory) {
|
|
|
55
66
|
lastPlan: null,
|
|
56
67
|
lastDiff: null,
|
|
57
68
|
pendingActions: null,
|
|
58
|
-
mode:
|
|
69
|
+
mode: getDefaultModeFromSettings(),
|
|
59
70
|
dryRun: false,
|
|
60
71
|
workingDirectory: workingDirectory || process.cwd(),
|
|
61
72
|
currentIntent: null,
|
package/dist/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":";;;AAkGA,sCAeC;AAMD,gCAKC;AAGD,kCAGC;AAGD,oCAGC;AAGD,kCAKC;AAED,wCAGC;AAED,wCAEC;AAED,kCAEC;AAED,kCAEC;AAED,8CAEC;AAED,0BAEC;AAED,8BAEC;AAED,0BAEC;AAED,4BAEC;AAED,8BAEC;AAED,8BAEC;AAED,kCAEC;AAED,sCAEC;AAED,sCAEC;AAED,8CAEC;AAED,8CAEC;AAGD,oCAIC;AAED,oCAEC;AAED,wCAKC;AAED,kCAIC;AAED,4CAMC;AAED,0CAQC;AA/OY,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE;QACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE;QACtD,IAAI,EAAE;YACJ,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC;gBAC/B,UAAU,EAAE;oBACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACtB,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBAC/B,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;iBACpD;aACF;SACF;QACD,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MAA0B;IACzE,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;IAC1D,IAAI,IAAI,EAAE,CAAC;QACT,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;AACH,CAAC;AAED,SAAgB,eAAe;IAC7B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC;IACzG,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,gBAAgB,GAAG,CAAC;QACrC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM;QAC/B,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/dist/settings.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface Settings {
|
|
|
8
8
|
promptStyle: 'compact' | 'verbose';
|
|
9
9
|
};
|
|
10
10
|
execution: {
|
|
11
|
+
defaultMode: 'edit' | 'auto' | 'ask' | 'debug' | 'review' | 'explain';
|
|
11
12
|
confirmationMode: 'strict' | 'normal';
|
|
12
13
|
maxPlanIterations: number;
|
|
13
14
|
allowShellExec: boolean;
|
|
@@ -40,6 +41,9 @@ export declare function markFirstRunComplete(): void;
|
|
|
40
41
|
export declare function isFirstRun(): boolean;
|
|
41
42
|
export declare function shouldShowColor(): boolean;
|
|
42
43
|
export declare function shouldShowLogo(): boolean;
|
|
44
|
+
export declare function getDefaultMode(): 'edit' | 'auto' | 'ask' | 'debug' | 'review' | 'explain';
|
|
45
|
+
export declare function setDefaultMode(mode: 'edit' | 'auto' | 'ask' | 'debug' | 'review' | 'explain'): void;
|
|
46
|
+
export declare function setAsciiLogo(enabled: boolean): void;
|
|
43
47
|
export declare function setNestedSetting(path: string, value: string): boolean;
|
|
44
48
|
export declare function loadProjectSettings(projectPath?: string): Partial<Settings> | null;
|
|
45
49
|
export declare function getEffectiveSettings(projectPath?: string): Settings;
|
package/dist/settings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,EAAE,EAAE;QACF,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;QACxB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;QAC7B,WAAW,EAAE,SAAS,GAAG,SAAS,CAAC;KACpC,CAAC;IACF,SAAS,EAAE;QACT,gBAAgB,EAAE,QAAQ,GAAG,QAAQ,CAAC;QACtC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;QACnC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,KAAK,EAAE;QACL,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;QAC9B,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,QAAQ,EAAE,OAAO,CAAC;CACnB;AAGD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,EAAE,eAAe,EAGvC,CAAC;
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,QAAQ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AI,MAAM,CAYjC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAS5C;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAI3C;AAED,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED,wBAAgB,eAAe,IAAI,OAAO,CAKzC;AAED,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,wBAAgB,cAAc,IAAI,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAEzF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAInG;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAInD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAwBrE;AAGD,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAclF;AAGD,wBAAgB,oBAAoB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,CASnE;AAGD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAU3F;AAGD,wBAAgB,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAIhE"}
|
package/dist/settings.js
CHANGED
|
@@ -44,6 +44,9 @@ exports.markFirstRunComplete = markFirstRunComplete;
|
|
|
44
44
|
exports.isFirstRun = isFirstRun;
|
|
45
45
|
exports.shouldShowColor = shouldShowColor;
|
|
46
46
|
exports.shouldShowLogo = shouldShowLogo;
|
|
47
|
+
exports.getDefaultMode = getDefaultMode;
|
|
48
|
+
exports.setDefaultMode = setDefaultMode;
|
|
49
|
+
exports.setAsciiLogo = setAsciiLogo;
|
|
47
50
|
exports.setNestedSetting = setNestedSetting;
|
|
48
51
|
exports.loadProjectSettings = loadProjectSettings;
|
|
49
52
|
exports.getEffectiveSettings = getEffectiveSettings;
|
|
@@ -68,6 +71,7 @@ const DEFAULT_SETTINGS = {
|
|
|
68
71
|
promptStyle: 'compact',
|
|
69
72
|
},
|
|
70
73
|
execution: {
|
|
74
|
+
defaultMode: 'edit',
|
|
71
75
|
confirmationMode: 'strict',
|
|
72
76
|
maxPlanIterations: 5,
|
|
73
77
|
allowShellExec: false,
|
|
@@ -172,6 +176,19 @@ function shouldShowColor() {
|
|
|
172
176
|
function shouldShowLogo() {
|
|
173
177
|
return loadSettings().ui.asciiLogo === 'on';
|
|
174
178
|
}
|
|
179
|
+
function getDefaultMode() {
|
|
180
|
+
return loadSettings().execution.defaultMode || 'edit';
|
|
181
|
+
}
|
|
182
|
+
function setDefaultMode(mode) {
|
|
183
|
+
const settings = loadSettings();
|
|
184
|
+
settings.execution.defaultMode = mode;
|
|
185
|
+
saveSettings(settings);
|
|
186
|
+
}
|
|
187
|
+
function setAsciiLogo(enabled) {
|
|
188
|
+
const settings = loadSettings();
|
|
189
|
+
settings.ui.asciiLogo = enabled ? 'on' : 'off';
|
|
190
|
+
saveSettings(settings);
|
|
191
|
+
}
|
|
175
192
|
function setNestedSetting(path, value) {
|
|
176
193
|
const settings = loadSettings();
|
|
177
194
|
const parts = path.split('.');
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,oCAiBC;AAGD,gDAEC;AAcD,oCAOC;AAED,gCAEC;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AAO,CAAC,CAAC;AAC7E,CAAC;AAED,kCAAkC;AAClC,SAAgB,kBAAkB,CAAC,WAAoB;IACrD,MAAM,GAAG,GAAG,WAAW,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;IAClE,OAAO,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAC5C,CAAC"}
|
package/dist/tui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,UAAU;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,UAAU;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAsKD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA+lCjE"}
|
package/dist/tui.js
CHANGED
|
@@ -136,6 +136,15 @@ function getPlaceholder() {
|
|
|
136
136
|
// Recent commands history
|
|
137
137
|
const commandHistory = [];
|
|
138
138
|
let historyIndex = -1;
|
|
139
|
+
// Big ASCII Logo
|
|
140
|
+
const ASCII_LOGO = `{bold}{cyan-fg}
|
|
141
|
+
███████╗ █████╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗
|
|
142
|
+
╚══███╔╝██╔══██╗██║ ██╔════╝██╔═══██╗██╔══██╗██╔════╝
|
|
143
|
+
███╔╝ ███████║██║ ██║ ██║ ██║██║ ██║█████╗
|
|
144
|
+
███╔╝ ██╔══██║██║ ██║ ██║ ██║██║ ██║██╔══╝
|
|
145
|
+
███████╗██║ ██║██║ ╚██████╗╚██████╔╝██████╔╝███████╗
|
|
146
|
+
╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝{/cyan-fg}{/bold}
|
|
147
|
+
{gray-fg}AI-native code editor v1.4.3{/gray-fg}`;
|
|
139
148
|
// Animated Robot Mascot Frames
|
|
140
149
|
const MASCOT_FRAMES = [
|
|
141
150
|
// Frame 1 - looking right
|
|
@@ -168,7 +177,7 @@ const MASCOT_FRAMES = [
|
|
|
168
177
|
{cyan-fg} ╰┬───┬╯ {/cyan-fg}`,
|
|
169
178
|
];
|
|
170
179
|
// Compact header with mascot
|
|
171
|
-
const HEADER_WITH_MASCOT = `{bold}{cyan-fg}zai{/cyan-fg}{blue-fg}·{/blue-fg}{cyan-fg}code{/cyan-fg}{/bold} {gray-fg}v1.4.
|
|
180
|
+
const HEADER_WITH_MASCOT = `{bold}{cyan-fg}zai{/cyan-fg}{blue-fg}·{/blue-fg}{cyan-fg}code{/cyan-fg}{/bold} {gray-fg}v1.4.3{/gray-fg}`;
|
|
172
181
|
const MINIMAL_LOGO = '{bold}{cyan-fg}⚡ zai·code{/cyan-fg}{/bold} {gray-fg}AI-native editor{/gray-fg}';
|
|
173
182
|
// Welcome tips - rotate through these
|
|
174
183
|
const WELCOME_TIPS = [
|
|
@@ -216,71 +225,39 @@ async function startTUI(options) {
|
|
|
216
225
|
let spinnerFrame = 0;
|
|
217
226
|
let isProcessing = false;
|
|
218
227
|
let currentTip = Math.floor(Math.random() * WELCOME_TIPS.length);
|
|
219
|
-
|
|
220
|
-
let mascotInterval = null;
|
|
221
|
-
// Header with animated mascot
|
|
228
|
+
// Header with ASCII logo
|
|
222
229
|
const header = blessed.box({
|
|
223
230
|
top: 0,
|
|
224
231
|
left: 0,
|
|
225
232
|
width: '100%',
|
|
226
|
-
height: (0, settings_1.shouldShowLogo)() ?
|
|
233
|
+
height: (0, settings_1.shouldShowLogo)() ? 9 : 2,
|
|
227
234
|
tags: true,
|
|
228
235
|
style: {
|
|
229
236
|
fg: theme.fg,
|
|
230
237
|
bg: theme.bg,
|
|
231
238
|
},
|
|
232
239
|
});
|
|
233
|
-
// Update header with
|
|
240
|
+
// Update header with logo
|
|
234
241
|
function updateHeader() {
|
|
235
242
|
if ((0, settings_1.shouldShowLogo)()) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const subtitle = '{gray-fg}AI-native code editor{/gray-fg}';
|
|
239
|
-
// Combine mascot with title
|
|
240
|
-
const mascotLines = mascot.split('\n');
|
|
241
|
-
const content = mascotLines.map((line, i) => {
|
|
242
|
-
if (i === 1)
|
|
243
|
-
return line + ' ' + title;
|
|
244
|
-
if (i === 2)
|
|
245
|
-
return line + ' ' + subtitle;
|
|
246
|
-
return line;
|
|
247
|
-
}).join('\n');
|
|
248
|
-
header.setContent(content);
|
|
243
|
+
header.setContent(ASCII_LOGO);
|
|
244
|
+
header.height = 9;
|
|
249
245
|
}
|
|
250
246
|
else {
|
|
251
247
|
header.setContent(MINIMAL_LOGO);
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
// Start mascot animation
|
|
255
|
-
function startMascotAnimation() {
|
|
256
|
-
if (mascotInterval)
|
|
257
|
-
return;
|
|
258
|
-
mascotInterval = setInterval(() => {
|
|
259
|
-
mascotFrame = (mascotFrame + 1) % MASCOT_FRAMES.length;
|
|
260
|
-
updateHeader();
|
|
261
|
-
screen.render();
|
|
262
|
-
}, 2000); // Change every 2 seconds
|
|
263
|
-
}
|
|
264
|
-
// Stop mascot animation
|
|
265
|
-
function stopMascotAnimation() {
|
|
266
|
-
if (mascotInterval) {
|
|
267
|
-
clearInterval(mascotInterval);
|
|
268
|
-
mascotInterval = null;
|
|
248
|
+
header.height = 2;
|
|
269
249
|
}
|
|
270
250
|
}
|
|
271
251
|
// Initialize header
|
|
272
252
|
updateHeader();
|
|
273
|
-
if ((0, settings_1.shouldShowLogo)()) {
|
|
274
|
-
startMascotAnimation();
|
|
275
|
-
}
|
|
276
253
|
// Quick actions bar - keyboard shortcuts
|
|
277
254
|
const quickActions = blessed.box({
|
|
278
|
-
top: (0, settings_1.shouldShowLogo)() ?
|
|
255
|
+
top: (0, settings_1.shouldShowLogo)() ? 9 : 2,
|
|
279
256
|
left: 0,
|
|
280
257
|
width: '100%',
|
|
281
258
|
height: 1,
|
|
282
259
|
tags: true,
|
|
283
|
-
content: '{gray-fg}↑↓{/gray-fg} navigate {gray-fg}Tab{/gray-fg} complete {gray-fg}Enter{/gray-fg} select {gray-fg}Esc{/gray-fg} close',
|
|
260
|
+
content: '{gray-fg}↑↓{/gray-fg} navigate {gray-fg}Tab{/gray-fg} complete {gray-fg}Enter{/gray-fg} select {gray-fg}Esc{/gray-fg} close {gray-fg}Shift+Tab{/gray-fg} mode',
|
|
284
261
|
style: {
|
|
285
262
|
fg: theme.fg,
|
|
286
263
|
bg: theme.bg,
|
|
@@ -288,7 +265,7 @@ async function startTUI(options) {
|
|
|
288
265
|
padding: { left: 1 },
|
|
289
266
|
});
|
|
290
267
|
// Context/status line
|
|
291
|
-
const contextTop = (0, settings_1.shouldShowLogo)() ?
|
|
268
|
+
const contextTop = (0, settings_1.shouldShowLogo)() ? 10 : 3;
|
|
292
269
|
const contextLine = blessed.box({
|
|
293
270
|
top: contextTop,
|
|
294
271
|
left: 0,
|
|
@@ -384,7 +361,7 @@ async function startTUI(options) {
|
|
|
384
361
|
warning.setContent('{yellow-fg}⚠{/yellow-fg} Not a git repository. Changes cannot be tracked.');
|
|
385
362
|
warning.show();
|
|
386
363
|
}
|
|
387
|
-
// Main output area
|
|
364
|
+
// Main output area - SCROLLABLE with mouse and keyboard
|
|
388
365
|
const outputTop = warning.hidden ? warningTop : warningTop + 3;
|
|
389
366
|
const output = blessed.log({
|
|
390
367
|
top: outputTop,
|
|
@@ -394,8 +371,14 @@ async function startTUI(options) {
|
|
|
394
371
|
tags: true,
|
|
395
372
|
scrollable: true,
|
|
396
373
|
alwaysScroll: true,
|
|
374
|
+
mouse: true,
|
|
375
|
+
keys: true,
|
|
376
|
+
vi: true,
|
|
397
377
|
scrollbar: {
|
|
398
|
-
ch: '
|
|
378
|
+
ch: '█',
|
|
379
|
+
track: {
|
|
380
|
+
bg: theme.bg,
|
|
381
|
+
},
|
|
399
382
|
style: {
|
|
400
383
|
fg: theme.highlight,
|
|
401
384
|
bg: theme.bg
|
|
@@ -650,14 +633,15 @@ async function startTUI(options) {
|
|
|
650
633
|
let autocompleteFiles = [];
|
|
651
634
|
function updatePalette(filter) {
|
|
652
635
|
const query = filter.replace(/^\//, '').toLowerCase();
|
|
653
|
-
|
|
654
|
-
const items =
|
|
636
|
+
filteredCommandsCache = COMMANDS.filter(c => c.name.startsWith(query) || c.description.toLowerCase().includes(query)).slice(0, 10);
|
|
637
|
+
const items = filteredCommandsCache.map(c => {
|
|
655
638
|
const shortcut = c.shortcut ? ` {gray-fg}${c.shortcut}{/gray-fg}` : '';
|
|
656
639
|
return `{bold}{cyan-fg}/${c.name}{/cyan-fg}{/bold} ${c.description}${shortcut}`;
|
|
657
640
|
});
|
|
658
641
|
palette.setItems(items);
|
|
659
|
-
if (
|
|
642
|
+
if (filteredCommandsCache.length > 0) {
|
|
660
643
|
palette.select(0);
|
|
644
|
+
paletteSelectedIndex = 0;
|
|
661
645
|
}
|
|
662
646
|
}
|
|
663
647
|
function updateFileAutocomplete(query) {
|
|
@@ -792,15 +776,16 @@ async function startTUI(options) {
|
|
|
792
776
|
// Track palette selection index manually
|
|
793
777
|
let paletteSelectedIndex = 0;
|
|
794
778
|
let fileSelectedIndex = 0;
|
|
779
|
+
let filteredCommandsCache = [];
|
|
795
780
|
// Screen-level key handling for arrow keys (works better than input keypress)
|
|
796
781
|
screen.key(['up'], () => {
|
|
797
|
-
if (showPalette) {
|
|
782
|
+
if (showPalette && filteredCommandsCache.length > 0) {
|
|
798
783
|
paletteSelectedIndex = Math.max(0, paletteSelectedIndex - 1);
|
|
799
784
|
palette.select(paletteSelectedIndex);
|
|
800
785
|
screen.render();
|
|
801
786
|
return;
|
|
802
787
|
}
|
|
803
|
-
if (showFileAutocomplete) {
|
|
788
|
+
if (showFileAutocomplete && autocompleteFiles.length > 0) {
|
|
804
789
|
fileSelectedIndex = Math.max(0, fileSelectedIndex - 1);
|
|
805
790
|
fileAutocomplete.select(fileSelectedIndex);
|
|
806
791
|
screen.render();
|
|
@@ -815,15 +800,15 @@ async function startTUI(options) {
|
|
|
815
800
|
}
|
|
816
801
|
});
|
|
817
802
|
screen.key(['down'], () => {
|
|
818
|
-
if (showPalette) {
|
|
819
|
-
const maxIndex =
|
|
803
|
+
if (showPalette && filteredCommandsCache.length > 0) {
|
|
804
|
+
const maxIndex = filteredCommandsCache.length - 1;
|
|
820
805
|
paletteSelectedIndex = Math.min(maxIndex, paletteSelectedIndex + 1);
|
|
821
806
|
palette.select(paletteSelectedIndex);
|
|
822
807
|
screen.render();
|
|
823
808
|
return;
|
|
824
809
|
}
|
|
825
|
-
if (showFileAutocomplete) {
|
|
826
|
-
const maxIndex =
|
|
810
|
+
if (showFileAutocomplete && autocompleteFiles.length > 0) {
|
|
811
|
+
const maxIndex = autocompleteFiles.length - 1;
|
|
827
812
|
fileSelectedIndex = Math.min(maxIndex, fileSelectedIndex + 1);
|
|
828
813
|
fileAutocomplete.select(fileSelectedIndex);
|
|
829
814
|
screen.render();
|
|
@@ -845,11 +830,9 @@ async function startTUI(options) {
|
|
|
845
830
|
});
|
|
846
831
|
// Tab completion
|
|
847
832
|
screen.key(['tab'], () => {
|
|
848
|
-
if (showPalette) {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
if (filtered[paletteSelectedIndex]) {
|
|
852
|
-
const cmd = filtered[paletteSelectedIndex];
|
|
833
|
+
if (showPalette && filteredCommandsCache.length > 0) {
|
|
834
|
+
if (filteredCommandsCache[paletteSelectedIndex]) {
|
|
835
|
+
const cmd = filteredCommandsCache[paletteSelectedIndex];
|
|
853
836
|
input.setValue('/' + cmd.name + ' ');
|
|
854
837
|
togglePalette(false);
|
|
855
838
|
paletteSelectedIndex = 0;
|
|
@@ -933,11 +916,9 @@ async function startTUI(options) {
|
|
|
933
916
|
// Submit handler
|
|
934
917
|
input.on('submit', async (value) => {
|
|
935
918
|
const inputValue = value || input.getValue() || '';
|
|
936
|
-
if (showPalette && inputValue.startsWith('/')) {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
if (filteredCommands[paletteSelectedIndex]) {
|
|
940
|
-
const cmd = filteredCommands[paletteSelectedIndex];
|
|
919
|
+
if (showPalette && inputValue.startsWith('/') && filteredCommandsCache.length > 0) {
|
|
920
|
+
if (filteredCommandsCache[paletteSelectedIndex]) {
|
|
921
|
+
const cmd = filteredCommandsCache[paletteSelectedIndex];
|
|
941
922
|
const needsArgs = ['mode', 'model', 'open', 'read', 'cat', 'close', 'do', 'run', 'ask', 'fix', 'exec', 'search'].includes(cmd.name);
|
|
942
923
|
if (needsArgs && !inputValue.includes(' ')) {
|
|
943
924
|
input.setValue('/' + cmd.name + ' ');
|
|
@@ -991,34 +972,37 @@ async function startTUI(options) {
|
|
|
991
972
|
updatePlaceholder();
|
|
992
973
|
screen.render();
|
|
993
974
|
});
|
|
994
|
-
// SETTINGS MODAL
|
|
975
|
+
// SETTINGS MODAL - Completely rewritten for proper keyboard handling
|
|
995
976
|
function showSettingsMenu() {
|
|
996
|
-
|
|
977
|
+
// Disable main input while settings is open
|
|
978
|
+
input.hide();
|
|
997
979
|
let currentSettings = (0, settings_1.loadSettings)();
|
|
998
980
|
const models = settings_1.AVAILABLE_MODELS;
|
|
981
|
+
const modes = ['edit', 'auto', 'ask', 'debug', 'review', 'explain'];
|
|
999
982
|
let selectedIndex = 0;
|
|
1000
983
|
const getListItems = () => [
|
|
1001
|
-
`Model:
|
|
1002
|
-
`
|
|
1003
|
-
`
|
|
1004
|
-
`
|
|
1005
|
-
`
|
|
1006
|
-
`
|
|
984
|
+
`{cyan-fg}Model:{/cyan-fg} ${currentSettings.model.current}`,
|
|
985
|
+
`{cyan-fg}Default Mode:{/cyan-fg} ${currentSettings.execution.defaultMode || 'edit'}`,
|
|
986
|
+
`{cyan-fg}ASCII Logo:{/cyan-fg} ${currentSettings.ui.asciiLogo}`,
|
|
987
|
+
`{cyan-fg}Color:{/cyan-fg} ${currentSettings.ui.color}`,
|
|
988
|
+
`{cyan-fg}Prompt Style:{/cyan-fg} ${currentSettings.ui.promptStyle}`,
|
|
989
|
+
`{cyan-fg}Confirm Mode:{/cyan-fg} ${currentSettings.execution.confirmationMode}`,
|
|
990
|
+
`{cyan-fg}Shell Exec:{/cyan-fg} ${currentSettings.execution.allowShellExec}`,
|
|
991
|
+
`{cyan-fg}Debug Log:{/cyan-fg} ${currentSettings.debug.logging}`
|
|
1007
992
|
];
|
|
1008
993
|
const modal = blessed.box({
|
|
1009
994
|
parent: screen,
|
|
1010
995
|
top: 'center',
|
|
1011
996
|
left: 'center',
|
|
1012
|
-
width:
|
|
1013
|
-
height:
|
|
997
|
+
width: 50,
|
|
998
|
+
height: 16,
|
|
1014
999
|
border: { type: 'line' },
|
|
1015
|
-
label: ' Settings ',
|
|
1000
|
+
label: ' ⚙ Settings ',
|
|
1016
1001
|
tags: true,
|
|
1017
1002
|
style: {
|
|
1018
1003
|
bg: 'black',
|
|
1019
1004
|
fg: 'white',
|
|
1020
1005
|
border: { fg: 'cyan' },
|
|
1021
|
-
label: { fg: 'cyan', bold: true }
|
|
1022
1006
|
},
|
|
1023
1007
|
});
|
|
1024
1008
|
const list = blessed.list({
|
|
@@ -1027,8 +1011,10 @@ async function startTUI(options) {
|
|
|
1027
1011
|
left: 1,
|
|
1028
1012
|
right: 1,
|
|
1029
1013
|
bottom: 3,
|
|
1030
|
-
|
|
1031
|
-
mouse:
|
|
1014
|
+
tags: true,
|
|
1015
|
+
mouse: true,
|
|
1016
|
+
keys: true,
|
|
1017
|
+
vi: true,
|
|
1032
1018
|
style: {
|
|
1033
1019
|
selected: { bg: 'blue', fg: 'white', bold: true },
|
|
1034
1020
|
item: { fg: 'white', bg: 'black' }
|
|
@@ -1039,10 +1025,12 @@ async function startTUI(options) {
|
|
|
1039
1025
|
parent: modal,
|
|
1040
1026
|
bottom: 1,
|
|
1041
1027
|
left: 1,
|
|
1042
|
-
|
|
1028
|
+
tags: true,
|
|
1029
|
+
content: '{gray-fg}↑↓{/gray-fg} navigate {gray-fg}Enter{/gray-fg} toggle {gray-fg}Esc{/gray-fg} save & exit',
|
|
1043
1030
|
style: { fg: 'gray', bg: 'black' }
|
|
1044
1031
|
});
|
|
1045
1032
|
list.select(0);
|
|
1033
|
+
list.focus();
|
|
1046
1034
|
screen.render();
|
|
1047
1035
|
function cycleValue() {
|
|
1048
1036
|
if (selectedIndex === 0) { // Model
|
|
@@ -1050,21 +1038,30 @@ async function startTUI(options) {
|
|
|
1050
1038
|
const nextIdx = (currIdx + 1) % models.length;
|
|
1051
1039
|
currentSettings.model.current = models[nextIdx];
|
|
1052
1040
|
}
|
|
1053
|
-
else if (selectedIndex === 1) { //
|
|
1041
|
+
else if (selectedIndex === 1) { // Default Mode
|
|
1042
|
+
const currMode = currentSettings.execution.defaultMode || 'edit';
|
|
1043
|
+
const currIdx = modes.indexOf(currMode);
|
|
1044
|
+
const nextIdx = (currIdx + 1) % modes.length;
|
|
1045
|
+
currentSettings.execution.defaultMode = modes[nextIdx];
|
|
1046
|
+
}
|
|
1047
|
+
else if (selectedIndex === 2) { // ASCII Logo
|
|
1048
|
+
currentSettings.ui.asciiLogo = currentSettings.ui.asciiLogo === 'on' ? 'off' : 'on';
|
|
1049
|
+
}
|
|
1050
|
+
else if (selectedIndex === 3) { // Color
|
|
1054
1051
|
const vals = ['auto', 'on', 'off'];
|
|
1055
1052
|
const n = (vals.indexOf(currentSettings.ui.color) + 1) % 3;
|
|
1056
1053
|
currentSettings.ui.color = vals[n];
|
|
1057
1054
|
}
|
|
1058
|
-
else if (selectedIndex ===
|
|
1055
|
+
else if (selectedIndex === 4) { // Prompt Style
|
|
1059
1056
|
currentSettings.ui.promptStyle = currentSettings.ui.promptStyle === 'compact' ? 'verbose' : 'compact';
|
|
1060
1057
|
}
|
|
1061
|
-
else if (selectedIndex ===
|
|
1058
|
+
else if (selectedIndex === 5) { // Confirm Mode
|
|
1062
1059
|
currentSettings.execution.confirmationMode = currentSettings.execution.confirmationMode === 'strict' ? 'normal' : 'strict';
|
|
1063
1060
|
}
|
|
1064
|
-
else if (selectedIndex ===
|
|
1061
|
+
else if (selectedIndex === 6) { // Shell Exec
|
|
1065
1062
|
currentSettings.execution.allowShellExec = !currentSettings.execution.allowShellExec;
|
|
1066
1063
|
}
|
|
1067
|
-
else if (selectedIndex ===
|
|
1064
|
+
else if (selectedIndex === 7) { // Debug Log
|
|
1068
1065
|
currentSettings.debug.logging = !currentSettings.debug.logging;
|
|
1069
1066
|
}
|
|
1070
1067
|
list.setItems(getListItems());
|
|
@@ -1072,46 +1069,63 @@ async function startTUI(options) {
|
|
|
1072
1069
|
screen.render();
|
|
1073
1070
|
}
|
|
1074
1071
|
function closeSettings() {
|
|
1075
|
-
if (!settingsActive)
|
|
1076
|
-
return;
|
|
1077
|
-
settingsActive = false;
|
|
1078
1072
|
(0, settings_1.saveSettings)(currentSettings);
|
|
1073
|
+
// Update header if logo setting changed
|
|
1074
|
+
updateHeader();
|
|
1079
1075
|
updateStatusBar();
|
|
1076
|
+
updateModeIndicator();
|
|
1080
1077
|
screen.remove(modal);
|
|
1078
|
+
input.show();
|
|
1081
1079
|
input.focus();
|
|
1082
1080
|
screen.render();
|
|
1083
|
-
output.log('{green-fg}Settings saved
|
|
1081
|
+
output.log('{green-fg}✓ Settings saved{/green-fg}');
|
|
1084
1082
|
}
|
|
1085
|
-
//
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
selectedIndex = Math.min(getListItems().length - 1, selectedIndex + 1);
|
|
1099
|
-
list.select(selectedIndex);
|
|
1100
|
-
screen.render();
|
|
1101
|
-
}
|
|
1102
|
-
else if (key.name === 'enter' || key.name === 'return') {
|
|
1103
|
-
cycleValue();
|
|
1104
|
-
}
|
|
1105
|
-
};
|
|
1106
|
-
screen.on('keypress', settingsKeyHandler);
|
|
1107
|
-
// Cleanup when modal is destroyed
|
|
1108
|
-
modal.on('destroy', () => {
|
|
1109
|
-
screen.removeListener('keypress', settingsKeyHandler);
|
|
1083
|
+
// List key handlers
|
|
1084
|
+
list.key(['up', 'k'], () => {
|
|
1085
|
+
selectedIndex = Math.max(0, selectedIndex - 1);
|
|
1086
|
+
list.select(selectedIndex);
|
|
1087
|
+
screen.render();
|
|
1088
|
+
});
|
|
1089
|
+
list.key(['down', 'j'], () => {
|
|
1090
|
+
selectedIndex = Math.min(getListItems().length - 1, selectedIndex + 1);
|
|
1091
|
+
list.select(selectedIndex);
|
|
1092
|
+
screen.render();
|
|
1093
|
+
});
|
|
1094
|
+
list.key(['enter', 'space'], () => {
|
|
1095
|
+
cycleValue();
|
|
1110
1096
|
});
|
|
1097
|
+
list.key(['escape', 'q'], () => {
|
|
1098
|
+
closeSettings();
|
|
1099
|
+
});
|
|
1100
|
+
// Mouse selection
|
|
1101
|
+
list.on('select', (item, index) => {
|
|
1102
|
+
selectedIndex = index;
|
|
1103
|
+
cycleValue();
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
// Mode cycling with Shift+Tab
|
|
1107
|
+
const MODES = ['edit', 'auto', 'ask', 'debug', 'review', 'explain'];
|
|
1108
|
+
let currentModeIndex = MODES.indexOf(session.mode) || 0;
|
|
1109
|
+
function cycleMode(direction = 1) {
|
|
1110
|
+
currentModeIndex = (currentModeIndex + direction + MODES.length) % MODES.length;
|
|
1111
|
+
const newMode = MODES[currentModeIndex];
|
|
1112
|
+
session.mode = newMode;
|
|
1113
|
+
const modeIcons = {
|
|
1114
|
+
'edit': '✏️', 'auto': '⚡', 'ask': '❓', 'debug': '🔧', 'review': '👁', 'explain': '📖'
|
|
1115
|
+
};
|
|
1116
|
+
output.log(`{cyan-fg}${modeIcons[newMode]} Mode: ${newMode}{/cyan-fg}`);
|
|
1117
|
+
updateContextLine();
|
|
1118
|
+
updateStatusBar();
|
|
1119
|
+
updateModeIndicator();
|
|
1120
|
+
updatePlaceholder();
|
|
1121
|
+
screen.render();
|
|
1111
1122
|
}
|
|
1123
|
+
// Shift+Tab to cycle modes
|
|
1124
|
+
screen.key(['S-tab'], () => {
|
|
1125
|
+
cycleMode(1);
|
|
1126
|
+
});
|
|
1112
1127
|
// Global Key Bindings
|
|
1113
1128
|
screen.key(['C-c'], () => {
|
|
1114
|
-
stopMascotAnimation();
|
|
1115
1129
|
onExit?.();
|
|
1116
1130
|
return process.exit(0);
|
|
1117
1131
|
});
|
|
@@ -1186,7 +1200,6 @@ async function startTUI(options) {
|
|
|
1186
1200
|
screen.key(['q'], () => {
|
|
1187
1201
|
// Only quit if not focused on input
|
|
1188
1202
|
if (screen.focused !== input) {
|
|
1189
|
-
stopMascotAnimation();
|
|
1190
1203
|
onExit?.();
|
|
1191
1204
|
return process.exit(0);
|
|
1192
1205
|
}
|
|
@@ -1201,7 +1214,7 @@ async function startTUI(options) {
|
|
|
1201
1214
|
});
|
|
1202
1215
|
// Cleanup on exit
|
|
1203
1216
|
process.on('exit', () => {
|
|
1204
|
-
|
|
1217
|
+
// Cleanup if needed
|
|
1205
1218
|
});
|
|
1206
1219
|
screen.render();
|
|
1207
1220
|
}
|