erosolar-cli 1.7.116 → 1.7.118
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/shell/enhancedInteractiveShell.d.ts +36 -22
- package/dist/shell/enhancedInteractiveShell.d.ts.map +1 -1
- package/dist/shell/enhancedInteractiveShell.js +76 -105
- package/dist/shell/enhancedInteractiveShell.js.map +1 -1
- package/dist/shell/enhancedShellApp.d.ts +6 -3
- package/dist/shell/enhancedShellApp.d.ts.map +1 -1
- package/dist/shell/enhancedShellApp.js +66 -53
- package/dist/shell/enhancedShellApp.js.map +1 -1
- package/dist/ui/enhancedPinnedChatBox.d.ts +143 -65
- package/dist/ui/enhancedPinnedChatBox.d.ts.map +1 -1
- package/dist/ui/enhancedPinnedChatBox.js +301 -303
- package/dist/ui/enhancedPinnedChatBox.js.map +1 -1
- package/dist/ui/persistentChatBox.d.ts +117 -83
- package/dist/ui/persistentChatBox.d.ts.map +1 -1
- package/dist/ui/persistentChatBox.js +239 -331
- package/dist/ui/persistentChatBox.js.map +1 -1
- package/dist/ui/persistentPrompt.d.ts +7 -2
- package/dist/ui/persistentPrompt.d.ts.map +1 -1
- package/dist/ui/persistentPrompt.js +51 -16
- package/dist/ui/persistentPrompt.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,42 +1,56 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Enhanced Interactive Shell with Persistent Chat Box
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
4
|
+
* Extends the base InteractiveShell with enhanced persistent chat box features:
|
|
5
|
+
* - Always visible chat input during AI streaming
|
|
6
|
+
* - Graceful paste handling with summaries
|
|
7
|
+
* - Input history navigation
|
|
8
|
+
* - Visual feedback during streaming
|
|
8
9
|
*/
|
|
9
|
-
import { InteractiveShell
|
|
10
|
+
import { InteractiveShell } from './interactiveShell.js';
|
|
11
|
+
import type { ShellConfig } from './shellApp.js';
|
|
10
12
|
export declare class EnhancedInteractiveShell extends InteractiveShell {
|
|
11
|
-
private
|
|
13
|
+
private enhancedChatBox;
|
|
12
14
|
constructor(config: ShellConfig);
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* Enhanced start method that activates the persistent chat box
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
start(initialPrompt?: string): Promise<void>;
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* Set streaming state for the chat box
|
|
19
21
|
*/
|
|
20
|
-
|
|
22
|
+
setStreaming(isStreaming: boolean): void;
|
|
21
23
|
/**
|
|
22
|
-
*
|
|
24
|
+
* Set processing state for the chat box
|
|
23
25
|
*/
|
|
24
|
-
|
|
26
|
+
setProcessing(isProcessing: boolean): void;
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
28
|
+
* Handle enhanced input from the chat box
|
|
27
29
|
*/
|
|
28
|
-
|
|
30
|
+
handleEnhancedInput(input: string): void;
|
|
29
31
|
/**
|
|
30
|
-
*
|
|
32
|
+
* Submit current input
|
|
31
33
|
*/
|
|
32
|
-
|
|
34
|
+
submitInput(): void;
|
|
33
35
|
/**
|
|
34
|
-
*
|
|
36
|
+
* Cancel current input
|
|
35
37
|
*/
|
|
36
|
-
|
|
38
|
+
cancelInput(): void;
|
|
37
39
|
/**
|
|
38
|
-
*
|
|
40
|
+
* Navigate input history up
|
|
39
41
|
*/
|
|
40
|
-
|
|
42
|
+
navigateHistoryUp(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Navigate input history down
|
|
45
|
+
*/
|
|
46
|
+
navigateHistoryDown(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Get user prompt format
|
|
49
|
+
*/
|
|
50
|
+
private formatUserPrompt;
|
|
51
|
+
/**
|
|
52
|
+
* Override dispose to clean up enhanced chat box
|
|
53
|
+
*/
|
|
54
|
+
dispose(): void;
|
|
41
55
|
}
|
|
42
|
-
//# sourceMappingURL=
|
|
56
|
+
//# sourceMappingURL=EnhancedInteractiveShell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"EnhancedInteractiveShell.d.ts","sourceRoot":"","sources":["../../src/shell/EnhancedInteractiveShell.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,qBAAa,wBAAyB,SAAQ,gBAAgB;IAC5D,OAAO,CAAC,eAAe,CAAwB;gBAEnC,MAAM,EAAE,WAAW;IA+B/B;;OAEG;IACG,KAAK,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBlD;;OAEG;IACH,YAAY,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI;IAIxC;;OAEG;IACH,aAAa,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI;IAI1C;;OAEG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAIzB;;OAEG;IACH,mBAAmB,IAAI,IAAI;IAI3B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;OAEG;IACH,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -1,139 +1,110 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Enhanced Interactive Shell with Persistent Chat Box
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
4
|
+
* Extends the base InteractiveShell with enhanced persistent chat box features:
|
|
5
|
+
* - Always visible chat input during AI streaming
|
|
6
|
+
* - Graceful paste handling with summaries
|
|
7
|
+
* - Input history navigation
|
|
8
|
+
* - Visual feedback during streaming
|
|
8
9
|
*/
|
|
9
|
-
import { stdout as output } from 'node:process';
|
|
10
10
|
import { InteractiveShell } from './interactiveShell.js';
|
|
11
|
+
import { EnhancedPinnedChatBox } from '../ui/EnhancedPinnedChatBox.js';
|
|
11
12
|
import { display } from '../ui/display.js';
|
|
12
|
-
import { PersistentChatBox } from '../ui/persistentChatBox.js';
|
|
13
13
|
export class EnhancedInteractiveShell extends InteractiveShell {
|
|
14
|
-
|
|
14
|
+
enhancedChatBox;
|
|
15
15
|
constructor(config) {
|
|
16
16
|
super(config);
|
|
17
|
-
//
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
// Replace the standard pinned chat box with enhanced version
|
|
18
|
+
this.enhancedChatBox = new EnhancedPinnedChatBox(process.stdout, (input) => {
|
|
19
|
+
// Process the input through the normal flow
|
|
20
|
+
this.processInputBlock(input).catch((err) => {
|
|
21
|
+
display.showError(err instanceof Error ? err.message : String(err), err);
|
|
22
|
+
});
|
|
23
|
+
}, () => {
|
|
24
|
+
// Cancel callback
|
|
25
|
+
display.showInfo('Input cancelled');
|
|
26
|
+
}, {
|
|
27
|
+
enabled: true,
|
|
28
|
+
position: 1,
|
|
29
|
+
maxLines: 3,
|
|
30
|
+
showPasteSummaries: true,
|
|
31
|
+
autoScroll: true,
|
|
32
|
+
maxInputLength: 10000,
|
|
33
|
+
maxHistorySize: 100,
|
|
33
34
|
});
|
|
34
|
-
//
|
|
35
|
-
this.
|
|
35
|
+
// Override the original pinnedChatBox reference
|
|
36
|
+
this.pinnedChatBox = this.enhancedChatBox;
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
+
* Enhanced start method that activates the persistent chat box
|
|
39
40
|
*/
|
|
40
|
-
async
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// Set streaming state on persistent chat box
|
|
46
|
-
this.persistentChatBox.setStreaming(true);
|
|
47
|
-
this.persistentChatBox.setProcessing(true);
|
|
48
|
-
// Enable scroll region so streaming output scrolls while input stays at bottom
|
|
49
|
-
this.persistentChatBox.enableScrollRegion();
|
|
50
|
-
// Suppress readline echo so typed characters only appear in persistent input box
|
|
51
|
-
this.suppressReadlineOutput();
|
|
52
|
-
const agent = this.getAgent();
|
|
53
|
-
// Enable streaming for real-time text output (Claude Code style)
|
|
54
|
-
await agent.send(request, true);
|
|
55
|
-
await this.awaitPendingCleanup();
|
|
56
|
-
this.captureHistorySnapshot();
|
|
57
|
-
this.autosaveIfEnabled();
|
|
58
|
-
// Track metrics with Alpha Zero 2
|
|
59
|
-
const elapsedMs = Date.now() - requestStartTime;
|
|
60
|
-
this.alphaZeroMetrics.recordMessage(elapsedMs);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
const handled = this.handleProviderError(error, () => this.processRequest(request));
|
|
64
|
-
if (!handled) {
|
|
65
|
-
// Pass full error object for enhanced formatting with stack trace
|
|
66
|
-
display.showError(error instanceof Error ? error.message : String(error), error);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
finally {
|
|
70
|
-
// Restore readline echo before other cleanup
|
|
71
|
-
this.restoreReadlineOutput();
|
|
72
|
-
// Disable scroll region before any other output to restore normal terminal behavior
|
|
73
|
-
this.persistentChatBox.disableScrollRegion();
|
|
74
|
-
display.stopThinking(false);
|
|
75
|
-
this.isProcessing = false;
|
|
76
|
-
this.uiAdapter.endProcessing('Ready for prompts');
|
|
77
|
-
this.setIdleStatus();
|
|
41
|
+
async start(initialPrompt) {
|
|
42
|
+
// Always render the enhanced chat box at startup so it's visible from the beginning
|
|
43
|
+
this.enhancedChatBox.activate();
|
|
44
|
+
this.enhancedChatBox.forceRender();
|
|
45
|
+
if (initialPrompt) {
|
|
78
46
|
display.newLine();
|
|
79
|
-
|
|
80
|
-
this.
|
|
81
|
-
|
|
82
|
-
this.persistentChatBox.setStatusMessage(null);
|
|
83
|
-
this.persistentChatBox.forceRender();
|
|
84
|
-
// CRITICAL: Ensure readline prompt is active for user input
|
|
85
|
-
// Call ensureReadlineReady to resume stdin if paused and re-enable keypress
|
|
86
|
-
this.ensureReadlineReady();
|
|
87
|
-
this.rl.prompt();
|
|
47
|
+
console.log(`${this.formatUserPrompt()}${initialPrompt}`);
|
|
48
|
+
await this.processInputBlock(initialPrompt);
|
|
49
|
+
return;
|
|
88
50
|
}
|
|
51
|
+
// Start the normal readline prompt
|
|
52
|
+
this.rl.prompt();
|
|
89
53
|
}
|
|
90
54
|
/**
|
|
91
|
-
*
|
|
55
|
+
* Set streaming state for the chat box
|
|
92
56
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this.persistentChatBox.handlePaste(content);
|
|
57
|
+
setStreaming(isStreaming) {
|
|
58
|
+
this.enhancedChatBox.setStreaming(isStreaming);
|
|
96
59
|
}
|
|
97
60
|
/**
|
|
98
|
-
*
|
|
61
|
+
* Set processing state for the chat box
|
|
99
62
|
*/
|
|
100
|
-
|
|
101
|
-
this.
|
|
63
|
+
setProcessing(isProcessing) {
|
|
64
|
+
this.enhancedChatBox.setProcessing(isProcessing);
|
|
102
65
|
}
|
|
103
66
|
/**
|
|
104
|
-
*
|
|
67
|
+
* Handle enhanced input from the chat box
|
|
105
68
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (input) {
|
|
109
|
-
// Input was submitted and processed
|
|
110
|
-
this.rl.prompt();
|
|
111
|
-
}
|
|
69
|
+
handleEnhancedInput(input) {
|
|
70
|
+
this.enhancedChatBox.setInput(input);
|
|
112
71
|
}
|
|
113
72
|
/**
|
|
114
|
-
*
|
|
73
|
+
* Submit current input
|
|
115
74
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (detail) {
|
|
119
|
-
this.persistentChatBox.setStatusMessage(detail);
|
|
120
|
-
}
|
|
75
|
+
submitInput() {
|
|
76
|
+
this.enhancedChatBox.submit();
|
|
121
77
|
}
|
|
122
78
|
/**
|
|
123
|
-
*
|
|
79
|
+
* Cancel current input
|
|
124
80
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
81
|
+
cancelInput() {
|
|
82
|
+
this.enhancedChatBox.cancel();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Navigate input history up
|
|
86
|
+
*/
|
|
87
|
+
navigateHistoryUp() {
|
|
88
|
+
this.enhancedChatBox.navigateHistoryUp();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Navigate input history down
|
|
92
|
+
*/
|
|
93
|
+
navigateHistoryDown() {
|
|
94
|
+
this.enhancedChatBox.navigateHistoryDown();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get user prompt format
|
|
98
|
+
*/
|
|
99
|
+
formatUserPrompt() {
|
|
100
|
+
return `> `;
|
|
130
101
|
}
|
|
131
102
|
/**
|
|
132
|
-
* Override to
|
|
103
|
+
* Override dispose to clean up enhanced chat box
|
|
133
104
|
*/
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
105
|
+
dispose() {
|
|
106
|
+
this.enhancedChatBox.dispose();
|
|
107
|
+
super.dispose();
|
|
137
108
|
}
|
|
138
109
|
}
|
|
139
|
-
//# sourceMappingURL=
|
|
110
|
+
//# sourceMappingURL=EnhancedInteractiveShell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"EnhancedInteractiveShell.js","sourceRoot":"","sources":["../../src/shell/EnhancedInteractiveShell.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,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IAAI,CAAC,gBAAgB,EAAE,GAAG,aAAa,EAAE,CAAC,CAAC;YAC1D,MAAM,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;YAC5C,OAAO;QACT,CAAC;QAED,mCAAmC;QAClC,IAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,WAAoB;QAC/B,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,YAAqB;QACjC,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,KAAa;QAC/B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED;;OAEG;IACH,WAAW;QACT,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,WAAW;QACT,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,IAAI,CAAC,eAAe,CAAC,iBAAiB,EAAE,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,IAAI,CAAC,eAAe,CAAC,mBAAmB,EAAE,CAAC;IAC7C,CAAC;IAED;;OAEG;IACK,gBAAgB;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAC/B,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Enhanced Shell App with Persistent Chat Box
|
|
3
|
+
*
|
|
4
|
+
* Extends the base shell app with enhanced persistent chat box features
|
|
3
5
|
*/
|
|
4
6
|
import '../config.js';
|
|
5
7
|
import type { ProfileName } from '../config.js';
|
|
6
8
|
export interface LaunchEnhancedShellOptions {
|
|
7
9
|
enableProfileSelection?: boolean;
|
|
10
|
+
enablePersistentChat?: boolean;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* Plugin flags for enabling optional features.
|
|
@@ -18,5 +21,5 @@ export interface PluginFlags {
|
|
|
18
21
|
/**
|
|
19
22
|
* Launch the enhanced interactive shell with persistent chat box
|
|
20
23
|
*/
|
|
21
|
-
export declare function launchEnhancedShell(profile: ProfileName, options?: LaunchEnhancedShellOptions): Promise<void>;
|
|
22
|
-
//# sourceMappingURL=
|
|
24
|
+
export declare function launchEnhancedShell(profile: ProfileName, options?: LaunchEnhancedShellOptions, pluginFlags?: PluginFlags, promptArgs?: string[]): Promise<void>;
|
|
25
|
+
//# sourceMappingURL=EnhancedShellApp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"EnhancedShellApp.d.ts","sourceRoot":"","sources":["../../src/shell/EnhancedShellApp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA6BhD,MAAM,WAAW,0BAA0B;IACzC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,0BAA+B,EACxC,WAAW,GAAE,WAAgB,EAC7B,UAAU,GAAE,MAAM,EAAO,GACxB,OAAO,CAAC,IAAI,CAAC,CAiIf"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Enhanced Shell App with Persistent Chat Box
|
|
3
|
+
*
|
|
4
|
+
* Extends the base shell app with enhanced persistent chat box features
|
|
3
5
|
*/
|
|
4
6
|
import { exit } from 'node:process';
|
|
5
7
|
import '../config.js';
|
|
6
8
|
import { buildWorkspaceContext, resolveWorkspaceCaptureOptions } from '../workspace.js';
|
|
7
|
-
import { EnhancedInteractiveShell } from './
|
|
9
|
+
import { EnhancedInteractiveShell } from './EnhancedInteractiveShell.js';
|
|
8
10
|
import { display } from '../ui/display.js';
|
|
9
11
|
import { loadModelPreference, loadToolSettings, } from '../core/preferences.js';
|
|
10
12
|
import { createNodeRuntime } from '../runtime/node.js';
|
|
@@ -15,29 +17,30 @@ import { LiveStatusTracker } from './liveStatus.js';
|
|
|
15
17
|
import { buildInteractiveSystemPrompt } from './systemPrompt.js';
|
|
16
18
|
import { ShellUIAdapter } from '../ui/ShellUIAdapter.js';
|
|
17
19
|
import { stdout } from 'node:process';
|
|
20
|
+
import { setPlainOutputMode } from '../ui/outputMode.js';
|
|
18
21
|
import { getPluginIdsFromFlags, loadPlugin } from '../plugins/index.js';
|
|
19
22
|
import { quickCheckProviders } from '../core/modelDiscovery.js';
|
|
20
23
|
import { loadAllSecrets } from '../core/secretStore.js';
|
|
21
24
|
/**
|
|
22
25
|
* Launch the enhanced interactive shell with persistent chat box
|
|
23
26
|
*/
|
|
24
|
-
export async function launchEnhancedShell(profile, options = {}) {
|
|
25
|
-
const { enableProfileSelection = false } = options;
|
|
27
|
+
export async function launchEnhancedShell(profile, options = {}, pluginFlags = {}, promptArgs = []) {
|
|
26
28
|
try {
|
|
27
|
-
// Check for
|
|
28
|
-
|
|
29
|
+
// Check for plain output mode
|
|
30
|
+
if (process.env['EROSOLAR_PLAIN_OUTPUT'] === '1') {
|
|
31
|
+
setPlainOutputMode(true);
|
|
32
|
+
}
|
|
33
|
+
// Check for CLI update
|
|
34
|
+
await maybeOfferCliUpdate();
|
|
29
35
|
// Quick check for available providers
|
|
30
|
-
await quickCheckProviders();
|
|
31
|
-
|
|
36
|
+
const providerStatus = await quickCheckProviders();
|
|
37
|
+
if (providerStatus.length === 0) {
|
|
38
|
+
display.showError('No AI providers configured. Set at least one API key:\n' +
|
|
39
|
+
' ANTHROPIC_API_KEY, OPENAI_API_KEY, DEEPSEEK_API_KEY, or GEMINI_API_KEY');
|
|
40
|
+
exit(1);
|
|
41
|
+
}
|
|
42
|
+
// Load secrets early
|
|
32
43
|
await loadAllSecrets();
|
|
33
|
-
// Parse CLI arguments for prompt
|
|
34
|
-
const argv = process.argv.slice(2);
|
|
35
|
-
const promptArgs = argv.filter(arg => !arg.startsWith('--'));
|
|
36
|
-
// Handle profile selection if enabled
|
|
37
|
-
const allowProfileSelection = enableProfileSelection;
|
|
38
|
-
const profileConfig = await selectProfile(profile, {
|
|
39
|
-
allowSavedProfile: allowProfileSelection,
|
|
40
|
-
});
|
|
41
44
|
const workingDir = process.cwd();
|
|
42
45
|
const workspaceOptions = resolveWorkspaceCaptureOptions(process.env);
|
|
43
46
|
const workspaceContext = buildWorkspaceContext(workingDir, workspaceOptions);
|
|
@@ -73,31 +76,38 @@ export async function launchEnhancedShell(profile, options = {}) {
|
|
|
73
76
|
? null
|
|
74
77
|
: loadModelPreference(profile);
|
|
75
78
|
let initialModel = persistedSelection ?? {
|
|
76
|
-
provider: profileConfig.
|
|
77
|
-
model: profileConfig.
|
|
79
|
+
provider: profileConfig.provider,
|
|
80
|
+
model: profileConfig.model,
|
|
81
|
+
temperature: profileConfig.temperature,
|
|
82
|
+
maxTokens: profileConfig.maxTokens,
|
|
78
83
|
};
|
|
79
|
-
//
|
|
84
|
+
// Apply reasoning effort if configured
|
|
85
|
+
if (profileConfig.reasoningEffort) {
|
|
86
|
+
initialModel.reasoningEffort = profileConfig.reasoningEffort;
|
|
87
|
+
}
|
|
88
|
+
// Build enhanced system prompt
|
|
80
89
|
const enhancedSystemPrompt = buildInteractiveSystemPrompt({
|
|
81
|
-
profile
|
|
90
|
+
profile,
|
|
91
|
+
profileConfig,
|
|
82
92
|
workspaceContext,
|
|
83
|
-
|
|
93
|
+
initialModel,
|
|
84
94
|
toolSelection,
|
|
85
|
-
|
|
86
|
-
});
|
|
87
|
-
// Load enabled plugins
|
|
88
|
-
const enabledPluginIds = getPluginIdsFromFlags({
|
|
89
|
-
alphaZero: false,
|
|
90
|
-
coding: false,
|
|
91
|
-
security: false,
|
|
92
|
-
allPlugins: false,
|
|
95
|
+
providerTools,
|
|
93
96
|
});
|
|
94
|
-
//
|
|
97
|
+
// Handle agent selection menu
|
|
98
|
+
const agentSelection = options.enableProfileSelection
|
|
99
|
+
? await buildAgentSelectionMenu()
|
|
100
|
+
: null;
|
|
101
|
+
// Handle session restore
|
|
102
|
+
const sessionRestore = {
|
|
103
|
+
mode: 'none',
|
|
104
|
+
};
|
|
105
|
+
// Load plugins
|
|
106
|
+
const enabledPluginIds = getPluginIdsFromFlags(pluginFlags);
|
|
95
107
|
for (const pluginId of enabledPluginIds) {
|
|
96
108
|
await loadPlugin(pluginId);
|
|
97
109
|
}
|
|
98
|
-
//
|
|
99
|
-
reportSkippedTools(permissionSummary.warnings);
|
|
100
|
-
// Create enhanced interactive shell with persistent chat box
|
|
110
|
+
// Create enhanced shell with persistent chat box
|
|
101
111
|
const shell = new EnhancedInteractiveShell({
|
|
102
112
|
profile,
|
|
103
113
|
profileLabel: profileConfig.label,
|
|
@@ -105,11 +115,11 @@ export async function launchEnhancedShell(profile, options = {}) {
|
|
|
105
115
|
session,
|
|
106
116
|
baseSystemPrompt: enhancedSystemPrompt,
|
|
107
117
|
initialModel,
|
|
108
|
-
agentSelection
|
|
118
|
+
agentSelection,
|
|
109
119
|
statusTracker,
|
|
110
120
|
uiAdapter,
|
|
111
121
|
workspaceOptions,
|
|
112
|
-
sessionRestore
|
|
122
|
+
sessionRestore,
|
|
113
123
|
enabledPlugins: enabledPluginIds,
|
|
114
124
|
});
|
|
115
125
|
const initialPrompt = promptArgs.join(' ').trim();
|
|
@@ -122,27 +132,30 @@ export async function launchEnhancedShell(profile, options = {}) {
|
|
|
122
132
|
}
|
|
123
133
|
}
|
|
124
134
|
/**
|
|
125
|
-
*
|
|
135
|
+
* Build agent selection menu
|
|
126
136
|
*/
|
|
127
|
-
async function
|
|
128
|
-
// Simplified profile selection - in practice this would be more complex
|
|
137
|
+
async function buildAgentSelectionMenu() {
|
|
129
138
|
const availableProfiles = listAgentProfiles();
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
139
|
+
return {
|
|
140
|
+
profiles: availableProfiles.map((profile) => ({
|
|
141
|
+
name: profile.name,
|
|
142
|
+
label: profile.label || profile.name,
|
|
143
|
+
})),
|
|
144
|
+
onSelect: async (profile) => {
|
|
145
|
+
await saveActiveProfilePreference(profile);
|
|
146
|
+
display.showInfo(`Default agent profile set to: ${profile}`);
|
|
147
|
+
},
|
|
148
|
+
};
|
|
135
149
|
}
|
|
136
150
|
/**
|
|
137
|
-
*
|
|
151
|
+
* Parse launch arguments
|
|
138
152
|
*/
|
|
139
|
-
function
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
153
|
+
function parseLaunchArguments(args) {
|
|
154
|
+
const profileOverride = args.find((arg) => !arg.startsWith('-')) || null;
|
|
155
|
+
const promptArgs = args.filter((arg) => arg !== profileOverride);
|
|
156
|
+
return {
|
|
157
|
+
profileOverride,
|
|
158
|
+
promptArgs,
|
|
159
|
+
};
|
|
147
160
|
}
|
|
148
|
-
//# sourceMappingURL=
|
|
161
|
+
//# sourceMappingURL=EnhancedShellApp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"EnhancedShellApp.js","sourceRoot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