@vybestack/llxprt-code 0.1.15 → 0.1.16-nightly.250805.82080ee4

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.
Files changed (163) hide show
  1. package/README.md +37 -2
  2. package/dist/package.json +3 -3
  3. package/dist/src/config/config.d.ts +4 -1
  4. package/dist/src/config/config.js +151 -54
  5. package/dist/src/config/config.js.map +1 -1
  6. package/dist/src/config/settings.d.ts +11 -2
  7. package/dist/src/config/settings.js +84 -23
  8. package/dist/src/config/settings.js.map +1 -1
  9. package/dist/src/gemini.d.ts +2 -0
  10. package/dist/src/gemini.js +177 -21
  11. package/dist/src/gemini.js.map +1 -1
  12. package/dist/src/generated/git-commit.d.ts +1 -1
  13. package/dist/src/generated/git-commit.js +1 -1
  14. package/dist/src/generated/git-commit.js.map +1 -1
  15. package/dist/src/integration-tests/GITHUB_ACTIONS_README.md +41 -0
  16. package/dist/src/integration-tests/test-utils.d.ts +68 -0
  17. package/dist/src/integration-tests/test-utils.js +167 -0
  18. package/dist/src/integration-tests/test-utils.js.map +1 -0
  19. package/dist/src/nonInteractiveCli.js +24 -66
  20. package/dist/src/nonInteractiveCli.js.map +1 -1
  21. package/dist/src/providers/IFileSystem.d.ts +42 -0
  22. package/dist/src/providers/IFileSystem.js +46 -0
  23. package/dist/src/providers/IFileSystem.js.map +1 -0
  24. package/dist/src/providers/providerConfigUtils.d.ts +0 -4
  25. package/dist/src/providers/providerConfigUtils.js +21 -52
  26. package/dist/src/providers/providerConfigUtils.js.map +1 -1
  27. package/dist/src/providers/providerManagerInstance.d.ts +6 -1
  28. package/dist/src/providers/providerManagerInstance.js +117 -82
  29. package/dist/src/providers/providerManagerInstance.js.map +1 -1
  30. package/dist/src/services/BuiltinCommandLoader.js +11 -0
  31. package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
  32. package/dist/src/ui/App.js +61 -48
  33. package/dist/src/ui/App.js.map +1 -1
  34. package/dist/src/ui/commands/aboutCommand.js +2 -5
  35. package/dist/src/ui/commands/aboutCommand.js.map +1 -1
  36. package/dist/src/ui/commands/baseurlCommand.js +54 -9
  37. package/dist/src/ui/commands/baseurlCommand.js.map +1 -1
  38. package/dist/src/ui/commands/diagnosticsCommand.d.ts +10 -0
  39. package/dist/src/ui/commands/diagnosticsCommand.js +122 -0
  40. package/dist/src/ui/commands/diagnosticsCommand.js.map +1 -0
  41. package/dist/src/ui/commands/directoryCommand.d.ts +8 -0
  42. package/dist/src/ui/commands/directoryCommand.js +116 -0
  43. package/dist/src/ui/commands/directoryCommand.js.map +1 -0
  44. package/dist/src/ui/commands/ideCommand.js +101 -105
  45. package/dist/src/ui/commands/ideCommand.js.map +1 -1
  46. package/dist/src/ui/commands/initCommand.js +63 -31
  47. package/dist/src/ui/commands/initCommand.js.map +1 -1
  48. package/dist/src/ui/commands/keyCommand.js +75 -11
  49. package/dist/src/ui/commands/keyCommand.js.map +1 -1
  50. package/dist/src/ui/commands/keyfileCommand.js +54 -13
  51. package/dist/src/ui/commands/keyfileCommand.js.map +1 -1
  52. package/dist/src/ui/commands/memoryCommand.js +2 -1
  53. package/dist/src/ui/commands/memoryCommand.js.map +1 -1
  54. package/dist/src/ui/commands/modelCommand.js +2 -5
  55. package/dist/src/ui/commands/modelCommand.js.map +1 -1
  56. package/dist/src/ui/commands/profileCommand.d.ts +10 -0
  57. package/dist/src/ui/commands/profileCommand.js +592 -0
  58. package/dist/src/ui/commands/profileCommand.js.map +1 -0
  59. package/dist/src/ui/commands/providerCommand.js +46 -3
  60. package/dist/src/ui/commands/providerCommand.js.map +1 -1
  61. package/dist/src/ui/commands/setCommand.d.ts +7 -0
  62. package/dist/src/ui/commands/setCommand.js +431 -0
  63. package/dist/src/ui/commands/setCommand.js.map +1 -0
  64. package/dist/src/ui/commands/setupGithubCommand.d.ts +7 -0
  65. package/dist/src/ui/commands/setupGithubCommand.js +49 -0
  66. package/dist/src/ui/commands/setupGithubCommand.js.map +1 -0
  67. package/dist/src/ui/commands/types.d.ts +1 -1
  68. package/dist/src/ui/commands/types.js.map +1 -1
  69. package/dist/src/ui/components/DebugProfiler.d.ts +6 -0
  70. package/dist/src/ui/components/DebugProfiler.js +26 -0
  71. package/dist/src/ui/components/DebugProfiler.js.map +1 -0
  72. package/dist/src/ui/components/Footer.d.ts +1 -0
  73. package/dist/src/ui/components/Footer.js +5 -4
  74. package/dist/src/ui/components/Footer.js.map +1 -1
  75. package/dist/src/ui/components/IDEContextDetailDisplay.d.ts +2 -1
  76. package/dist/src/ui/components/IDEContextDetailDisplay.js +3 -3
  77. package/dist/src/ui/components/IDEContextDetailDisplay.js.map +1 -1
  78. package/dist/src/ui/components/InputPrompt.js +123 -12
  79. package/dist/src/ui/components/InputPrompt.js.map +1 -1
  80. package/dist/src/ui/components/LoadProfileDialog.d.ts +13 -0
  81. package/dist/src/ui/components/LoadProfileDialog.js +57 -0
  82. package/dist/src/ui/components/LoadProfileDialog.js.map +1 -0
  83. package/dist/src/ui/components/PrepareLabel.d.ts +15 -0
  84. package/dist/src/ui/components/PrepareLabel.js +16 -0
  85. package/dist/src/ui/components/PrepareLabel.js.map +1 -0
  86. package/dist/src/ui/components/ProviderModelDialog.js +75 -28
  87. package/dist/src/ui/components/ProviderModelDialog.js.map +1 -1
  88. package/dist/src/ui/components/SecureKeyInput.d.ts +15 -0
  89. package/dist/src/ui/components/SecureKeyInput.js +58 -0
  90. package/dist/src/ui/components/SecureKeyInput.js.map +1 -0
  91. package/dist/src/ui/components/SuggestionsDisplay.d.ts +1 -0
  92. package/dist/src/ui/components/SuggestionsDisplay.js +3 -3
  93. package/dist/src/ui/components/SuggestionsDisplay.js.map +1 -1
  94. package/dist/src/ui/components/messages/ToolConfirmationMessage.js +15 -4
  95. package/dist/src/ui/components/messages/ToolConfirmationMessage.js.map +1 -1
  96. package/dist/src/ui/components/messages/UserMessage.js +4 -1
  97. package/dist/src/ui/components/messages/UserMessage.js.map +1 -1
  98. package/dist/src/ui/components/shared/text-buffer.js +9 -14
  99. package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
  100. package/dist/src/ui/containers/SessionController.js +14 -15
  101. package/dist/src/ui/containers/SessionController.js.map +1 -1
  102. package/dist/src/ui/editors/editorSettingsManager.js +2 -0
  103. package/dist/src/ui/editors/editorSettingsManager.js.map +1 -1
  104. package/dist/src/ui/hooks/atCommandProcessor.js +56 -48
  105. package/dist/src/ui/hooks/atCommandProcessor.js.map +1 -1
  106. package/dist/src/ui/hooks/slashCommandProcessor.d.ts +1 -1
  107. package/dist/src/ui/hooks/slashCommandProcessor.js +13 -3
  108. package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
  109. package/dist/src/ui/hooks/useAuthCommand.js +9 -0
  110. package/dist/src/ui/hooks/useAuthCommand.js.map +1 -1
  111. package/dist/src/ui/hooks/useCompletion.d.ts +5 -5
  112. package/dist/src/ui/hooks/useCompletion.js +7 -407
  113. package/dist/src/ui/hooks/useCompletion.js.map +1 -1
  114. package/dist/src/ui/hooks/useGeminiStream.js +61 -10
  115. package/dist/src/ui/hooks/useGeminiStream.js.map +1 -1
  116. package/dist/src/ui/hooks/useLoadProfileDialog.d.ts +27 -0
  117. package/dist/src/ui/hooks/useLoadProfileDialog.js +138 -0
  118. package/dist/src/ui/hooks/useLoadProfileDialog.js.map +1 -0
  119. package/dist/src/ui/hooks/useReverseSearchCompletion.d.ts +19 -0
  120. package/dist/src/ui/hooks/useReverseSearchCompletion.js +54 -0
  121. package/dist/src/ui/hooks/useReverseSearchCompletion.js.map +1 -0
  122. package/dist/src/ui/hooks/useShellHistory.d.ts +1 -0
  123. package/dist/src/ui/hooks/useShellHistory.js +30 -7
  124. package/dist/src/ui/hooks/useShellHistory.js.map +1 -1
  125. package/dist/src/ui/hooks/useSlashCompletion.d.ts +24 -0
  126. package/dist/src/ui/hooks/useSlashCompletion.js +451 -0
  127. package/dist/src/ui/hooks/useSlashCompletion.js.map +1 -0
  128. package/dist/src/ui/reducers/appReducer.d.ts +3 -2
  129. package/dist/src/ui/reducers/appReducer.js +1 -0
  130. package/dist/src/ui/reducers/appReducer.js.map +1 -1
  131. package/dist/src/ui/utils/renderLoopDetector.js +3 -3
  132. package/dist/src/ui/utils/renderLoopDetector.js.map +1 -1
  133. package/dist/src/ui/utils/secureInputHandler.d.ts +46 -0
  134. package/dist/src/ui/utils/secureInputHandler.js +128 -0
  135. package/dist/src/ui/utils/secureInputHandler.js.map +1 -0
  136. package/dist/src/ui/utils/updateCheck.js +57 -12
  137. package/dist/src/ui/utils/updateCheck.js.map +1 -1
  138. package/dist/src/utils/gitUtils.d.ts +10 -0
  139. package/dist/src/utils/gitUtils.js +24 -0
  140. package/dist/src/utils/gitUtils.js.map +1 -0
  141. package/dist/src/utils/handleAutoUpdate.d.ts +2 -1
  142. package/dist/src/utils/handleAutoUpdate.js +8 -4
  143. package/dist/src/utils/handleAutoUpdate.js.map +1 -1
  144. package/dist/src/utils/sandbox-macos-permissive-closed.sb +6 -0
  145. package/dist/src/utils/sandbox-macos-permissive-open.sb +6 -0
  146. package/dist/src/utils/sandbox-macos-permissive-proxied.sb +6 -0
  147. package/dist/src/utils/sandbox-macos-restrictive-closed.sb +6 -0
  148. package/dist/src/utils/sandbox-macos-restrictive-open.sb +6 -0
  149. package/dist/src/utils/sandbox-macos-restrictive-proxied.sb +6 -0
  150. package/dist/src/utils/sandbox.d.ts +2 -2
  151. package/dist/src/utils/sandbox.js +35 -11
  152. package/dist/src/utils/sandbox.js.map +1 -1
  153. package/dist/src/utils/spawnWrapper.d.ts +7 -0
  154. package/dist/src/utils/spawnWrapper.js +8 -0
  155. package/dist/src/utils/spawnWrapper.js.map +1 -0
  156. package/dist/src/validateNonInterActiveAuth.d.ts +2 -1
  157. package/dist/src/validateNonInterActiveAuth.js +31 -5
  158. package/dist/src/validateNonInterActiveAuth.js.map +1 -1
  159. package/dist/tsconfig.tsbuildinfo +1 -1
  160. package/package.json +3 -3
  161. package/dist/src/providers/enhanceConfigWithProviders.d.ts +0 -12
  162. package/dist/src/providers/enhanceConfigWithProviders.js +0 -16
  163. package/dist/src/providers/enhanceConfigWithProviders.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ # Running Integration Tests in GitHub Actions
2
+
3
+ The CLI integration tests spawn actual CLI processes to test real behavior. To prevent browser windows from opening during authentication in CI environments, the following environment variables are set:
4
+
5
+ ## Environment Variables for CI
6
+
7
+ ```yaml
8
+ env:
9
+ CI: 'true'
10
+ LLXPRT_NO_BROWSER_AUTH: 'true'
11
+ GITHUB_ACTIONS: 'true'
12
+ DISPLAY: '' # No display available
13
+ ```
14
+
15
+ ## Test Configuration
16
+
17
+ 1. **Timeouts**: Tests use a 5-second timeout to prevent hanging
18
+ 2. **Authentication**: Tests provide API keys via keyfiles to avoid triggering OAuth flows
19
+ 3. **Home Directory**: Tests use temporary directories to isolate profile loading
20
+
21
+ ## Key Points
22
+
23
+ - The `CI` and `LLXPRT_NO_BROWSER_AUTH` environment variables should prevent browser-based authentication
24
+ - All tests that spawn CLI processes should provide authentication (via `--key` or `--keyfile`) to avoid auth prompts
25
+ - Tests should complete quickly (within 5 seconds) or they'll be killed with exitCode -1
26
+
27
+ ## Running Tests Locally
28
+
29
+ To run integration tests locally without opening browser windows:
30
+
31
+ ```bash
32
+ CI=true LLXPRT_NO_BROWSER_AUTH=true npm test
33
+ ```
34
+
35
+ ## Troubleshooting
36
+
37
+ If browser windows still open:
38
+
39
+ 1. Check that the CLI respects the `LLXPRT_NO_BROWSER_AUTH` environment variable
40
+ 2. Ensure all test cases provide proper authentication
41
+ 3. Consider mocking the authentication flow in test environments
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import * as http from 'http';
7
+ import { Profile } from '@vybestack/llxprt-code-core';
8
+ /**
9
+ * Creates a temporary directory for tests
10
+ * @returns Path to the created temporary directory
11
+ */
12
+ export declare function createTempDirectory(): Promise<string>;
13
+ /**
14
+ * Cleans up a temporary directory and all its contents
15
+ * @param dir - Directory path to clean up
16
+ */
17
+ export declare function cleanupTempDirectory(dir: string): Promise<void>;
18
+ /**
19
+ * Creates a profile file in the specified directory
20
+ * @param dir - Directory to create the profile in
21
+ * @param name - Name of the profile (without .json extension)
22
+ * @param profile - Profile data to write
23
+ */
24
+ export declare function createTempProfile(dir: string, name: string, profile: Profile): Promise<void>;
25
+ /**
26
+ * Creates a keyfile with proper permissions (600)
27
+ * @param dir - Directory to create the keyfile in
28
+ * @param apiKey - API key content to write
29
+ * @returns Path to the created keyfile
30
+ */
31
+ export declare function createTempKeyfile(dir: string, apiKey: string): Promise<string>;
32
+ /**
33
+ * Reads and parses settings.json from the specified directory
34
+ * @param dir - Directory containing .llxprt/settings.json
35
+ * @returns Parsed settings object
36
+ */
37
+ export declare function readSettingsFile(dir: string): Promise<unknown>;
38
+ /**
39
+ * Writes settings.json to the specified directory
40
+ * @param dir - Directory to write .llxprt/settings.json in
41
+ * @param settings - Settings object to write
42
+ */
43
+ export declare function writeSettingsFile(dir: string, settings: unknown): Promise<void>;
44
+ /**
45
+ * Waits for a file to exist with timeout
46
+ * @param filepath - Path to the file to wait for
47
+ * @param timeout - Maximum time to wait in milliseconds
48
+ * @returns Promise that resolves when file exists or rejects on timeout
49
+ */
50
+ export declare function waitForFile(filepath: string, timeout: number): Promise<void>;
51
+ interface MockApiServerRequest {
52
+ method?: string;
53
+ url?: string;
54
+ headers: http.IncomingHttpHeaders;
55
+ body: string;
56
+ }
57
+ interface MockApiServer {
58
+ server: http.Server;
59
+ port: number;
60
+ requests: MockApiServerRequest[];
61
+ close: () => Promise<void>;
62
+ }
63
+ /**
64
+ * Creates a simple HTTP server that logs requests
65
+ * @returns Mock server object with server instance, port, and request log
66
+ */
67
+ export declare function createMockApiServer(): Promise<MockApiServer>;
68
+ export {};
@@ -0,0 +1,167 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import * as fs from 'fs/promises';
7
+ import * as path from 'path';
8
+ import * as os from 'os';
9
+ import * as http from 'http';
10
+ /**
11
+ * Creates a temporary directory for tests
12
+ * @returns Path to the created temporary directory
13
+ */
14
+ export async function createTempDirectory() {
15
+ const prefix = 'llxprt-test-';
16
+ const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), prefix));
17
+ return tempDir;
18
+ }
19
+ /**
20
+ * Cleans up a temporary directory and all its contents
21
+ * @param dir - Directory path to clean up
22
+ */
23
+ export async function cleanupTempDirectory(dir) {
24
+ try {
25
+ await fs.rm(dir, { recursive: true, force: true });
26
+ }
27
+ catch (error) {
28
+ // Ignore errors if directory doesn't exist
29
+ if (error &&
30
+ typeof error === 'object' &&
31
+ 'code' in error &&
32
+ error.code !== 'ENOENT') {
33
+ throw error;
34
+ }
35
+ }
36
+ }
37
+ /**
38
+ * Creates a profile file in the specified directory
39
+ * @param dir - Directory to create the profile in
40
+ * @param name - Name of the profile (without .json extension)
41
+ * @param profile - Profile data to write
42
+ */
43
+ export async function createTempProfile(dir, name, profile) {
44
+ const profilesDir = path.join(dir, '.llxprt', 'profiles');
45
+ await fs.mkdir(profilesDir, { recursive: true });
46
+ const profilePath = path.join(profilesDir, `${name}.json`);
47
+ await fs.writeFile(profilePath, JSON.stringify(profile, null, 2), 'utf8');
48
+ }
49
+ /**
50
+ * Creates a keyfile with proper permissions (600)
51
+ * @param dir - Directory to create the keyfile in
52
+ * @param apiKey - API key content to write
53
+ * @returns Path to the created keyfile
54
+ */
55
+ export async function createTempKeyfile(dir, apiKey) {
56
+ const keysDir = path.join(dir, '.keys');
57
+ await fs.mkdir(keysDir, { recursive: true });
58
+ const keyfilePath = path.join(keysDir, 'api-key');
59
+ await fs.writeFile(keyfilePath, apiKey, { mode: 0o600 });
60
+ return keyfilePath;
61
+ }
62
+ /**
63
+ * Reads and parses settings.json from the specified directory
64
+ * @param dir - Directory containing .llxprt/settings.json
65
+ * @returns Parsed settings object
66
+ */
67
+ export async function readSettingsFile(dir) {
68
+ const settingsPath = path.join(dir, '.llxprt', 'settings.json');
69
+ try {
70
+ const content = await fs.readFile(settingsPath, 'utf8');
71
+ return JSON.parse(content);
72
+ }
73
+ catch (error) {
74
+ if (error &&
75
+ typeof error === 'object' &&
76
+ 'code' in error &&
77
+ error.code === 'ENOENT') {
78
+ return {};
79
+ }
80
+ throw error;
81
+ }
82
+ }
83
+ /**
84
+ * Writes settings.json to the specified directory
85
+ * @param dir - Directory to write .llxprt/settings.json in
86
+ * @param settings - Settings object to write
87
+ */
88
+ export async function writeSettingsFile(dir, settings) {
89
+ const llxprtDir = path.join(dir, '.llxprt');
90
+ await fs.mkdir(llxprtDir, { recursive: true });
91
+ const settingsPath = path.join(llxprtDir, 'settings.json');
92
+ await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
93
+ }
94
+ /**
95
+ * Waits for a file to exist with timeout
96
+ * @param filepath - Path to the file to wait for
97
+ * @param timeout - Maximum time to wait in milliseconds
98
+ * @returns Promise that resolves when file exists or rejects on timeout
99
+ */
100
+ export async function waitForFile(filepath, timeout) {
101
+ const startTime = Date.now();
102
+ const checkInterval = 100; // Check every 100ms
103
+ while (Date.now() - startTime < timeout) {
104
+ try {
105
+ await fs.access(filepath);
106
+ return; // File exists
107
+ }
108
+ catch {
109
+ // File doesn't exist yet, wait and try again
110
+ await new Promise((resolve) => setTimeout(resolve, checkInterval));
111
+ }
112
+ }
113
+ throw new Error(`Timeout waiting for file: ${filepath}`);
114
+ }
115
+ /**
116
+ * Creates a simple HTTP server that logs requests
117
+ * @returns Mock server object with server instance, port, and request log
118
+ */
119
+ export async function createMockApiServer() {
120
+ const requests = [];
121
+ const server = http.createServer((req, res) => {
122
+ let body = '';
123
+ req.on('data', (chunk) => {
124
+ body += chunk.toString();
125
+ });
126
+ req.on('end', () => {
127
+ requests.push({
128
+ method: req.method,
129
+ url: req.url,
130
+ headers: req.headers,
131
+ body,
132
+ });
133
+ // Send a simple success response
134
+ res.writeHead(200, { 'Content-Type': 'application/json' });
135
+ res.end(JSON.stringify({
136
+ success: true,
137
+ message: 'Mock response',
138
+ }));
139
+ });
140
+ });
141
+ // Find an available port
142
+ await new Promise((resolve) => {
143
+ server.listen(0, '127.0.0.1', () => {
144
+ resolve();
145
+ });
146
+ });
147
+ const address = server.address();
148
+ if (!address || typeof address === 'string') {
149
+ throw new Error('Failed to get server port');
150
+ }
151
+ return {
152
+ server,
153
+ port: address.port,
154
+ requests,
155
+ close: () => new Promise((resolve, reject) => {
156
+ server.close((err) => {
157
+ if (err) {
158
+ reject(err);
159
+ }
160
+ else {
161
+ resolve();
162
+ }
163
+ });
164
+ }),
165
+ };
166
+ }
167
+ //# sourceMappingURL=test-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../../src/integration-tests/test-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,MAAM,MAAM,GAAG,cAAc,CAAC;IAC9B,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IACjE,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,GAAW;IACpD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,2C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AO,EAAE,EAAE;QAClC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE;YACjC,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACjC,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO;QACL,MAAM;QACN,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,QAAQ;QACR,KAAK,EAAE,GAAG,EAAE,CACV,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnB,IAAI,GAAG,EAAE,CAAC;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;gBACd,CAAC;qBAAM,CAAC;oBACN,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;KACL,CAAC;AACJ,CAAC"}
@@ -3,7 +3,7 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { executeToolCall, shutdownTelemetry, isTelemetrySdkInitialized, } from '@vybestack/llxprt-code-core';
6
+ import { executeToolCall, shutdownTelemetry, isTelemetrySdkInitialized, GeminiEventType, ToolErrorType, } from '@vybestack/llxprt-code-core';
7
7
  import { parseAndFormatApiError } from './ui/utils/errorParsing.js';
8
8
  export async function runNonInteractive(config, input, prompt_id) {
9
9
  await config.initialize();
@@ -26,78 +26,29 @@ export async function runNonInteractive(config, input, prompt_id) {
26
26
  try {
27
27
  while (true) {
28
28
  turnCount++;
29
- if (config.getMaxSessionTurns() > 0 &&
29
+ if (config.getMaxSessionTurns() >= 0 &&
30
30
  turnCount > config.getMaxSessionTurns()) {
31
31
  console.error('\n Reached max session turns for this session. Increase the number of turns by specifying maxSessionTurns in settings.json.');
32
32
  return;
33
33
  }
34
34
  const functionCalls = [];
35
- // For tool responses, send the parts directly; otherwise send just the parts array
36
- let messageToSend;
37
- if (process.env.DEBUG) {
38
- console.log('DEBUG [nonInteractiveCli]: ===== MESSAGE PROCESSING START =====');
39
- console.log('DEBUG [nonInteractiveCli]: Model:', config.getModel());
40
- console.log('DEBUG [nonInteractiveCli]: Provider:', config.getProvider());
41
- console.log('DEBUG [nonInteractiveCli]: Current messages count:', currentMessages.length);
42
- console.log('DEBUG [nonInteractiveCli]: Full currentMessages:', JSON.stringify(currentMessages, null, 2));
43
- }
44
- if (currentMessages[0]?.parts?.[0]?.functionResponse) {
45
- // Send tool response parts directly
46
- messageToSend = currentMessages[0].parts;
47
- if (process.env.DEBUG) {
48
- console.log('DEBUG [nonInteractiveCli]: Message type: TOOL RESPONSE');
49
- console.log('DEBUG [nonInteractiveCli]: Sending tool response parts:', JSON.stringify(messageToSend, null, 2));
50
- }
51
- }
52
- else {
53
- // Send just the parts array from the first message
54
- // This matches what interactive mode does when it sends req (PartListUnion)
55
- messageToSend = currentMessages[0]?.parts || [];
56
- if (process.env.DEBUG) {
57
- console.log('DEBUG [nonInteractiveCli]: Message type: REGULAR MESSAGE');
58
- console.log('DEBUG [nonInteractiveCli]: Sending message parts:', JSON.stringify(messageToSend, null, 2));
59
- console.log('DEBUG [nonInteractiveCli]: Parts array length:', messageToSend.length);
60
- console.log('DEBUG [nonInteractiveCli]: Parts array types:', messageToSend.map((p) => Object.keys(p)));
61
- }
62
- }
63
- if (process.env.DEBUG) {
64
- console.log('DEBUG [nonInteractiveCli]: ===== MESSAGE PROCESSING END =====');
65
- }
66
- if (process.env.DEBUG) {
67
- console.log('DEBUG [nonInteractiveCli]: Model being used:', config.getModel());
68
- console.log('DEBUG [nonInteractiveCli]: About to call sendMessageStream with messageToSend');
69
- }
70
- const responseStream = geminiClient.sendMessageStream(messageToSend, abortController.signal, prompt_id);
35
+ const responseStream = geminiClient.sendMessageStream(currentMessages[0]?.parts || [], abortController.signal, prompt_id);
71
36
  for await (const event of responseStream) {
72
37
  if (abortController.signal.aborted) {
73
38
  console.error('Operation cancelled.');
74
39
  return;
75
40
  }
76
- // Handle different event types
77
- switch (event.type) {
78
- case 'content':
79
- process.stdout.write(event.value);
80
- break;
81
- case 'tool_call_request':
82
- // Store the tool call request for processing
83
- functionCalls.push({
84
- name: event.value.name,
85
- args: event.value.args,
86
- id: event.value.callId,
87
- });
88
- break;
89
- case 'error':
90
- console.error('\nError:', event.value.error.message);
91
- return;
92
- case 'max_session_turns':
93
- console.error('\nReached max session turns for this session.');
94
- return;
95
- case 'loop_detected':
96
- console.error('\nLoop detected in conversation.');
97
- return;
98
- default:
99
- // Handle any unexpected event types
100
- break;
41
+ if (event.type === GeminiEventType.Content) {
42
+ process.stdout.write(event.value);
43
+ }
44
+ else if (event.type === GeminiEventType.ToolCallRequest) {
45
+ const toolCallRequest = event.value;
46
+ const fc = {
47
+ name: toolCallRequest.name,
48
+ args: toolCallRequest.args,
49
+ id: toolCallRequest.callId,
50
+ };
51
+ functionCalls.push(fc);
101
52
  }
102
53
  }
103
54
  if (functionCalls.length > 0) {
@@ -113,12 +64,15 @@ export async function runNonInteractive(config, input, prompt_id) {
113
64
  };
114
65
  const toolResponse = await executeToolCall(config, requestInfo, toolRegistry, abortController.signal);
115
66
  if (toolResponse.error) {
116
- const isToolNotFound = toolResponse.error.message.includes('not found in registry');
117
- console.error(`Error executing tool ${fc.name}: ${toolResponse.resultDisplay || toolResponse.error.message}`);
118
- if (!isToolNotFound) {
67
+ console.error(`Error executing tool ${fc.name}: ${toolResponse.error.message}`);
68
+ if (toolResponse.errorType === ToolErrorType.UNHANDLED_EXCEPTION) {
119
69
  process.exit(1);
120
70
  }
121
71
  }
72
+ // Emit resultDisplay to stdout exactly as produced when available (string only)
73
+ if (typeof toolResponse.resultDisplay === 'string') {
74
+ process.stdout.write(toolResponse.resultDisplay);
75
+ }
122
76
  if (toolResponse.responseParts) {
123
77
  // Handle responseParts as PartListUnion (can be Part, Part[], or string)
124
78
  const parts = toolResponse.responseParts;
@@ -147,6 +101,10 @@ export async function runNonInteractive(config, input, prompt_id) {
147
101
  }
148
102
  else {
149
103
  process.stdout.write('\n'); // Ensure a final newline
104
+ // Ensure telemetry is flushed before exiting
105
+ if (isTelemetrySdkInitialized()) {
106
+ await shutdownTelemetry();
107
+ }
150
108
  return;
151
109
  }
152
110
  }
@@ -1 +1 @@
1
- {"version":3,"file":"nonInteractiveCli.js","sourceRoot":"","sources":["../../src/nonInteractiveCli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,eAAe,EAEf,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAc,EACd,KAAa,EACb,SAAiB;IAEjB,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC1B,+EAA+E;IAC/E,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;QACxD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACzB,yCAAyC;YACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAC9C,MAAM,YAAY,GAAiB,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC;IAElE,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,8CAA8C;IAC9C,MAAM,cAAc,GAAG,qCAAqC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;IAC5E,IAAI,eAAe,GAAc;QAC/B,EAAE,IA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;gBACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB;gBACrD,6CAA6C;gBAC7C,IAAI,yBAAyB,EAAE,EAAE,CAAC;oBAChC,MAAM,iBAAiB,EAAE,CAAC;gBAC5B,CAAC;gBACD,OAAO;YACT,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,sBAAsB,CACpB,KAAK,EACL,MAAM,CAAC,yBAAyB,EAAE,EAAE,QAAQ,CAC7C,CACF,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,IAAI,yBAAyB,EAAE,EAAE,CAAC;YAChC,MAAM,iBAAiB,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ /**
7
+ * Interface for file system operations to enable dependency injection
8
+ * and eliminate NODE_ENV checks in production code.
9
+ */
10
+ export interface IFileSystem {
11
+ /**
12
+ * Check if a file exists at the given path.
13
+ */
14
+ existsSync(path: string): boolean;
15
+ /**
16
+ * Read a file synchronously and return its contents as a string.
17
+ */
18
+ readFileSync(path: string, encoding: BufferEncoding): string;
19
+ }
20
+ /**
21
+ * Real file system implementation using Node.js fs module.
22
+ */
23
+ export declare class NodeFileSystem implements IFileSystem {
24
+ existsSync(path: string): boolean;
25
+ readFileSync(path: string, encoding: BufferEncoding): string;
26
+ }
27
+ /**
28
+ * Mock file system implementation for testing that doesn't read real files.
29
+ */
30
+ export declare class MockFileSystem implements IFileSystem {
31
+ private mockFiles;
32
+ existsSync(path: string): boolean;
33
+ readFileSync(path: string, _encoding: BufferEncoding): string;
34
+ /**
35
+ * Set mock file content for testing.
36
+ */
37
+ setMockFile(path: string, content: string): void;
38
+ /**
39
+ * Clear all mock files.
40
+ */
41
+ clearMocks(): void;
42
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Vybestack LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { existsSync as fsExistsSync, readFileSync as fsReadFileSync } from 'fs';
7
+ /**
8
+ * Real file system implementation using Node.js fs module.
9
+ */
10
+ export class NodeFileSystem {
11
+ existsSync(path) {
12
+ return fsExistsSync(path);
13
+ }
14
+ readFileSync(path, encoding) {
15
+ return fsReadFileSync(path, encoding);
16
+ }
17
+ }
18
+ /**
19
+ * Mock file system implementation for testing that doesn't read real files.
20
+ */
21
+ export class MockFileSystem {
22
+ mockFiles = new Map();
23
+ existsSync(path) {
24
+ return this.mockFiles.has(path);
25
+ }
26
+ readFileSync(path, _encoding) {
27
+ const content = this.mockFiles.get(path);
28
+ if (!content) {
29
+ throw new Error(`ENOENT: no such file or directory, open '${path}'`);
30
+ }
31
+ return content;
32
+ }
33
+ /**
34
+ * Set mock file content for testing.
35
+ */
36
+ setMockFile(path, content) {
37
+ this.mockFiles.set(path, content);
38
+ }
39
+ /**
40
+ * Clear all mock files.
41
+ */
42
+ clearMocks() {
43
+ this.mockFiles.clear();
44
+ }
45
+ }
46
+ //# sourceMappingURL=IFileSystem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IFileSystem.js","sourceRoot":"","sources":["../../../src/providers/IFileSystem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,IAAI,CAAC;AAkBhF;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB,UAAU,CAAC,IAAY;QACrB,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,YAAY,CAAC,IAAY,EAAE,QAAwB;QACjD,OAAO,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,SAAS,GAAwB,IAAI,GAAG,EAAE,CAAC;IAEnD,UAAU,CAAC,IAAY;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,YAAY,CAAC,IAAY,EAAE,SAAyB;QAClD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,4CAA4C,IAAI,GAAG,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,IAAY,EAAE,OAAe;QACvC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF"}
@@ -15,10 +15,6 @@ export interface ProviderConfigResult {
15
15
  * Sets or removes the API key for the active provider
16
16
  */
17
17
  export declare function setProviderApiKey(providerManager: ProviderManager, settings: LoadedSettings, apiKey: string | undefined, config?: Config): Promise<ProviderConfigResult>;
18
- /**
19
- * Sets the API key from a file for the active provider
20
- */
21
- export declare function setProviderApiKeyFromFile(providerManager: ProviderManager, settings: LoadedSettings, filePath: string, config?: Config): Promise<ProviderConfigResult>;
22
18
  /**
23
19
  * Sets or clears the base URL for the active provider
24
20
  */