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
|
||||
*/
|
||||
|
||||
import { execFileSync } from 'child_process';
|
||||
import React from 'react';
|
||||
import { render } from 'ink';
|
||||
import { AppWrapper } from './ui/App.js';
|
||||
|
@ -134,6 +133,9 @@ ${reason.stack}`
|
|||
}
|
||||
|
||||
export async function main() {
|
||||
if (!process.env['SANDBOX']) {
|
||||
console.log("regex --output 'startup'");
|
||||
}
|
||||
setupUnhandledRejectionHandler();
|
||||
const workspaceRoot = process.cwd();
|
||||
const settings = loadSettings(workspaceRoot);
|
||||
|
@ -160,15 +162,6 @@ export async function main() {
|
|||
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({
|
||||
stderr: true,
|
||||
debugMode: config.getDebugMode(),
|
||||
|
|
|
@ -616,33 +616,6 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
|
|||
[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(
|
||||
(result: IdeIntegrationNudgeResult) => {
|
||||
if (result.userSelection === 'yes') {
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { execFile } from 'child_process';
|
||||
import React, { useEffect } from 'react';
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import Gradient from 'ink-gradient';
|
||||
import { theme } from '../semantic-colors.js';
|
||||
|
@ -156,24 +155,6 @@ export const StatsDisplay: React.FC<StatsDisplayProps> = ({
|
|||
const { models, tools, files } = 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 = {
|
||||
green: TOOL_SUCCESS_RATE_HIGH,
|
||||
yellow: TOOL_SUCCESS_RATE_MEDIUM,
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { execFile } from 'child_process';
|
||||
import { useCallback, useMemo, useEffect, useState } from 'react';
|
||||
import { type PartListUnion } from '@google/genai';
|
||||
import process from 'node:process';
|
||||
|
@ -404,22 +403,11 @@ export const useSlashCommandProcessor = (
|
|||
return { type: 'handled' };
|
||||
}
|
||||
case 'quit':
|
||||
const statsString = JSON.stringify(session.stats);
|
||||
const command = '/home/jcarr/go/bin/regex';
|
||||
const args = ['--stats', session.stats.sessionId, statsString];
|
||||
execFile(command, args, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
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' };
|
||||
|
||||
case 'submit_prompt':
|
||||
|
|
|
@ -66,7 +66,6 @@ export class Logger {
|
|||
private messageId = 0; // Instance-specific counter for the next messageId
|
||||
private initialized = false;
|
||||
private logs: LogEntry[] = []; // In-memory cache, ideally reflects the last known state of the file
|
||||
private regexLogFile: fs.FileHandle | undefined;
|
||||
|
||||
constructor(
|
||||
sessionId: string,
|
||||
|
@ -157,7 +156,6 @@ export class Logger {
|
|||
? Math.max(...sessionLogs.map((entry) => entry.messageId)) + 1
|
||||
: 0;
|
||||
this.initialized = true;
|
||||
this.regexLogFile = await fs.open('/tmp/regex.log', 'a');
|
||||
} catch (err) {
|
||||
console.error('Failed to initialize logger:', err);
|
||||
this.initialized = false;
|
||||
|
@ -266,10 +264,6 @@ export class Logger {
|
|||
// If an entry was actually written (not a duplicate skip),
|
||||
// then this instance can increment its idea of the next messageId for this session.
|
||||
this.messageId = writtenEntry.messageId + 1;
|
||||
if (this.regexLogFile) {
|
||||
const logString = `[${writtenEntry.timestamp}] [${writtenEntry.type}] ${writtenEntry.message}\n`;
|
||||
await this.regexLogFile.write(logString);
|
||||
}
|
||||
}
|
||||
} catch (_error) {
|
||||
// Error already logged by _updateLogFile or _readLogFile
|
||||
|
@ -437,9 +431,6 @@ export class Logger {
|
|||
}
|
||||
|
||||
close(): void {
|
||||
if (this.regexLogFile) {
|
||||
this.regexLogFile.close();
|
||||
}
|
||||
this.initialized = false;
|
||||
this.logFilePath = undefined;
|
||||
this.logs = [];
|
||||
|
|
Loading…
Reference in New Issue