Compare commits
No commits in common. "700a868a3aa41f07f7c314310c177c9d8d2b9b5d" and "8958ea6514e54dbdb7104455127f78c1716786fb" have entirely different histories.
700a868a3a
...
8958ea6514
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { execFileSync } from 'child_process';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { render } from 'ink';
|
import { render } from 'ink';
|
||||||
import { AppWrapper } from './ui/App.js';
|
import { AppWrapper } from './ui/App.js';
|
||||||
|
@ -134,6 +133,9 @@ ${reason.stack}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function main() {
|
export async function main() {
|
||||||
|
if (!process.env['SANDBOX']) {
|
||||||
|
console.log("regex --output 'startup'");
|
||||||
|
}
|
||||||
setupUnhandledRejectionHandler();
|
setupUnhandledRejectionHandler();
|
||||||
const workspaceRoot = process.cwd();
|
const workspaceRoot = process.cwd();
|
||||||
const settings = loadSettings(workspaceRoot);
|
const settings = loadSettings(workspaceRoot);
|
||||||
|
@ -160,15 +162,6 @@ export async function main() {
|
||||||
argv,
|
argv,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Create a new chat on startup.
|
|
||||||
try {
|
|
||||||
const topic = execFileSync('/home/jcarr/go/bin/regex', ['--get-next-auto-topic'], { encoding: 'utf8' });
|
|
||||||
execFileSync('/home/jcarr/go/bin/regex', ['--new-chat', sessionId, topic.trim()]);
|
|
||||||
} catch (e) {
|
|
||||||
console.error(`Error creating new chat: ${e}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const consolePatcher = new ConsolePatcher({
|
const consolePatcher = new ConsolePatcher({
|
||||||
stderr: true,
|
stderr: true,
|
||||||
debugMode: config.getDebugMode(),
|
debugMode: config.getDebugMode(),
|
||||||
|
|
|
@ -616,33 +616,6 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
|
||||||
[addMessage],
|
[addMessage],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const interval = setInterval(() => {
|
|
||||||
const filePath = '/tmp/regex.txt';
|
|
||||||
if (fs.existsSync(filePath)) {
|
|
||||||
const content = fs.readFileSync(filePath, 'utf-8');
|
|
||||||
fs.appendFileSync('/tmp/gemini-cli.log', content);
|
|
||||||
if (content.trim().length > 0) {
|
|
||||||
handleFinalSubmit(content);
|
|
||||||
}
|
|
||||||
fs.unlinkSync(filePath);
|
|
||||||
}
|
|
||||||
}, 5000); // Check every 5 seconds
|
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
|
||||||
}, [handleFinalSubmit]);
|
|
||||||
|
|
||||||
const previousStreamingState = useRef(streamingState);
|
|
||||||
useEffect(() => {
|
|
||||||
if (
|
|
||||||
previousStreamingState.current !== StreamingState.Idle &&
|
|
||||||
streamingState === StreamingState.Idle
|
|
||||||
) {
|
|
||||||
fs.writeFileSync('/tmp/regex.ready', sessionStats.sessionId + '\n');
|
|
||||||
}
|
|
||||||
previousStreamingState.current = streamingState;
|
|
||||||
}, [streamingState, sessionStats.sessionId]);
|
|
||||||
|
|
||||||
const handleIdePromptComplete = useCallback(
|
const handleIdePromptComplete = useCallback(
|
||||||
(result: IdeIntegrationNudgeResult) => {
|
(result: IdeIntegrationNudgeResult) => {
|
||||||
if (result.userSelection === 'yes') {
|
if (result.userSelection === 'yes') {
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { execFile } from 'child_process';
|
import React from 'react';
|
||||||
import React, { useEffect } from 'react';
|
|
||||||
import { Box, Text } from 'ink';
|
import { Box, Text } from 'ink';
|
||||||
import Gradient from 'ink-gradient';
|
import Gradient from 'ink-gradient';
|
||||||
import { theme } from '../semantic-colors.js';
|
import { theme } from '../semantic-colors.js';
|
||||||
|
@ -156,24 +155,6 @@ export const StatsDisplay: React.FC<StatsDisplayProps> = ({
|
||||||
const { models, tools, files } = metrics;
|
const { models, tools, files } = metrics;
|
||||||
const computed = computeSessionStats(metrics);
|
const computed = computeSessionStats(metrics);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const statsString = JSON.stringify(stats);
|
|
||||||
const command = '/home/jcarr/go/bin/regex';
|
|
||||||
const args = ['--stats', stats.sessionId, statsString];
|
|
||||||
execFile(command, args, (error, stdout, stderr) => {
|
|
||||||
if (error) {
|
|
||||||
console.error(`execFile error: ${error.message}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (stdout) {
|
|
||||||
console.log(`stdout: ${stdout}`);
|
|
||||||
}
|
|
||||||
if (stderr) {
|
|
||||||
console.error(`stderr: ${stderr}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, [stats]);
|
|
||||||
|
|
||||||
const successThresholds = {
|
const successThresholds = {
|
||||||
green: TOOL_SUCCESS_RATE_HIGH,
|
green: TOOL_SUCCESS_RATE_HIGH,
|
||||||
yellow: TOOL_SUCCESS_RATE_MEDIUM,
|
yellow: TOOL_SUCCESS_RATE_MEDIUM,
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { execFile } from 'child_process';
|
|
||||||
import { useCallback, useMemo, useEffect, useState } from 'react';
|
import { useCallback, useMemo, useEffect, useState } from 'react';
|
||||||
import { type PartListUnion } from '@google/genai';
|
import { type PartListUnion } from '@google/genai';
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
|
@ -404,22 +403,11 @@ export const useSlashCommandProcessor = (
|
||||||
return { type: 'handled' };
|
return { type: 'handled' };
|
||||||
}
|
}
|
||||||
case 'quit':
|
case 'quit':
|
||||||
const statsString = JSON.stringify(session.stats);
|
setQuittingMessages(result.messages);
|
||||||
const command = '/home/jcarr/go/bin/regex';
|
setTimeout(async () => {
|
||||||
const args = ['--stats', session.stats.sessionId, statsString];
|
await runExitCleanup();
|
||||||
execFile(command, args, (error, stdout, stderr) => {
|
process.exit(0);
|
||||||
if (error) {
|
}, 100);
|
||||||
console.error(`execFile error: ${error.message}`);
|
|
||||||
}
|
|
||||||
if (stderr) {
|
|
||||||
console.error(`stderr: ${stderr}`);
|
|
||||||
}
|
|
||||||
setQuittingMessages(result.messages);
|
|
||||||
setTimeout(async () => {
|
|
||||||
await runExitCleanup();
|
|
||||||
process.exit(0);
|
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
return { type: 'handled' };
|
return { type: 'handled' };
|
||||||
|
|
||||||
case 'submit_prompt':
|
case 'submit_prompt':
|
||||||
|
|
|
@ -66,7 +66,6 @@ export class Logger {
|
||||||
private messageId = 0; // Instance-specific counter for the next messageId
|
private messageId = 0; // Instance-specific counter for the next messageId
|
||||||
private initialized = false;
|
private initialized = false;
|
||||||
private logs: LogEntry[] = []; // In-memory cache, ideally reflects the last known state of the file
|
private logs: LogEntry[] = []; // In-memory cache, ideally reflects the last known state of the file
|
||||||
private regexLogFile: fs.FileHandle | undefined;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
sessionId: string,
|
sessionId: string,
|
||||||
|
@ -157,7 +156,6 @@ export class Logger {
|
||||||
? Math.max(...sessionLogs.map((entry) => entry.messageId)) + 1
|
? Math.max(...sessionLogs.map((entry) => entry.messageId)) + 1
|
||||||
: 0;
|
: 0;
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
this.regexLogFile = await fs.open('/tmp/regex.log', 'a');
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Failed to initialize logger:', err);
|
console.error('Failed to initialize logger:', err);
|
||||||
this.initialized = false;
|
this.initialized = false;
|
||||||
|
@ -266,10 +264,6 @@ export class Logger {
|
||||||
// If an entry was actually written (not a duplicate skip),
|
// If an entry was actually written (not a duplicate skip),
|
||||||
// then this instance can increment its idea of the next messageId for this session.
|
// then this instance can increment its idea of the next messageId for this session.
|
||||||
this.messageId = writtenEntry.messageId + 1;
|
this.messageId = writtenEntry.messageId + 1;
|
||||||
if (this.regexLogFile) {
|
|
||||||
const logString = `[${writtenEntry.timestamp}] [${writtenEntry.type}] ${writtenEntry.message}\n`;
|
|
||||||
await this.regexLogFile.write(logString);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
// Error already logged by _updateLogFile or _readLogFile
|
// Error already logged by _updateLogFile or _readLogFile
|
||||||
|
@ -437,9 +431,6 @@ export class Logger {
|
||||||
}
|
}
|
||||||
|
|
||||||
close(): void {
|
close(): void {
|
||||||
if (this.regexLogFile) {
|
|
||||||
this.regexLogFile.close();
|
|
||||||
}
|
|
||||||
this.initialized = false;
|
this.initialized = false;
|
||||||
this.logFilePath = undefined;
|
this.logFilePath = undefined;
|
||||||
this.logs = [];
|
this.logs = [];
|
||||||
|
|
Loading…
Reference in New Issue