diff --git a/app/lib/common/prompts/prompts.ts b/app/lib/common/prompts/prompts.ts index a2007d37..9bfb26b8 100644 --- a/app/lib/common/prompts/prompts.ts +++ b/app/lib/common/prompts/prompts.ts @@ -1,6 +1,6 @@ import { stripIndents } from '~/utils/stripIndent'; -export const DeveloperSystemPrompt = ` +export const developerSystemPrompt = ` You are Nut, an expert AI assistant and exceptional senior software developer with vast knowledge across multiple programming languages, frameworks, and best practices. For all designs you produce, make them beautiful and modern. diff --git a/app/lib/hooks/pingTelemetry.ts b/app/lib/hooks/pingTelemetry.ts index 5f80acc7..d1ae17a9 100644 --- a/app/lib/hooks/pingTelemetry.ts +++ b/app/lib/hooks/pingTelemetry.ts @@ -24,10 +24,10 @@ export class ChatMessageTelemetry { constructor(numMessages: number) { this.id = Math.random().toString(36).substring(2, 15); this.numMessages = numMessages; - this.ping('StartMessage'); + this._ping('StartMessage'); } - private ping(event: string, data: any = {}) { + private _ping(event: string, data: any = {}) { pingTelemetry(event, { ...data, loginKey: getNutLoginKey(), @@ -37,22 +37,22 @@ export class ChatMessageTelemetry { } finish() { - this.ping('FinishMessage'); + this._ping('FinishMessage'); } abort(reason: string) { - this.ping('AbortMessage', { reason }); + this._ping('AbortMessage', { reason }); } startSimulation() { - this.ping('StartSimulation'); + this._ping('StartSimulation'); } endSimulation(status: string) { - this.ping('EndSimulation', { status }); + this._ping('EndSimulation', { status }); } sendPrompt(simulationStatus: string) { - this.ping('SendPrompt', { simulationStatus }); + this._ping('SendPrompt', { simulationStatus }); } } diff --git a/app/lib/replay/Recording.ts b/app/lib/replay/Recording.ts index a206f845..06d28b1e 100644 --- a/app/lib/replay/Recording.ts +++ b/app/lib/replay/Recording.ts @@ -366,22 +366,22 @@ function addRecordingMessageHandler(messageHandlerId: string) { }); } - const IDBFactoryMethods = { + const idbFactoryMethods = { _name: 'IDBFactory', open: (v: any) => createFunctionProxy(v, 'open'), }; - const IDBOpenDBRequestMethods = { + const idbOpenDBRequestMethods = { _name: 'IDBOpenDBRequest', result: createProxy, }; - const IDBDatabaseMethods = { + const idbDatabaseMethods = { _name: 'IDBDatabase', transaction: (v: any) => createFunctionProxy(v, 'transaction'), }; - const IDBTransactionMethods = { + const idbTransactionMethods = { _name: 'IDBTransaction', objectStore: (v: any) => createFunctionProxy(v, 'objectStore'), }; @@ -400,7 +400,7 @@ function addRecordingMessageHandler(messageHandlerId: string) { // Map "get" requests to their keys. const getRequestKeys: Map = new Map(); - const IDBObjectStoreMethods = { + const idbObjectStoreMethods = { _name: 'IDBObjectStore', get: (v: any) => createFunctionProxy(v, 'get', (request, key) => { @@ -420,7 +420,7 @@ function addRecordingMessageHandler(messageHandlerId: string) { }), }; - const IDBRequestMethods = { + const idbRequestMethods = { _name: 'IDBRequest', result: (value: any, target: any) => { const key = getRequestKeys.get(target); @@ -437,7 +437,7 @@ function addRecordingMessageHandler(messageHandlerId: string) { addLocalStorageAccess({ kind, key, value }); } - const StorageMethods = { + const storageMethods = { _name: 'Storage', getItem: (v: any) => createFunctionProxy(v, 'getItem', (value: string, key: string) => { @@ -462,7 +462,7 @@ function addRecordingMessageHandler(messageHandlerId: string) { return result; } - const ResponseMethods = { + const responseMethods = { _name: 'Response', json: (v: any, response: Response) => createFunctionProxy(v, 'json', async (promise: Promise) => { @@ -492,21 +492,21 @@ function addRecordingMessageHandler(messageHandlerId: string) { let methods; if (obj instanceof IDBFactory) { - methods = IDBFactoryMethods; + methods = idbFactoryMethods; } else if (obj instanceof IDBOpenDBRequest) { - methods = IDBOpenDBRequestMethods; + methods = idbOpenDBRequestMethods; } else if (obj instanceof IDBDatabase) { - methods = IDBDatabaseMethods; + methods = idbDatabaseMethods; } else if (obj instanceof IDBTransaction) { - methods = IDBTransactionMethods; + methods = idbTransactionMethods; } else if (obj instanceof IDBObjectStore) { - methods = IDBObjectStoreMethods; + methods = idbObjectStoreMethods; } else if (obj instanceof IDBRequest) { - methods = IDBRequestMethods; + methods = idbRequestMethods; } else if (obj instanceof Storage) { - methods = StorageMethods; + methods = storageMethods; } else if (obj instanceof Response) { - methods = ResponseMethods; + methods = responseMethods; } assert(methods, 'Unknown object for createProxy'); diff --git a/app/lib/replay/SimulationData.ts b/app/lib/replay/SimulationData.ts index c96fd3b6..3c06ffad 100644 --- a/app/lib/replay/SimulationData.ts +++ b/app/lib/replay/SimulationData.ts @@ -1,6 +1,6 @@ // Data structures for simulation. -export const SimulationDataVersion = '0.1'; +export const simulationDataVersion = '0.1'; // Simulation data specifying the server URL to connect to for static resources. interface SimulationPacketServerURL { diff --git a/app/lib/replay/SimulationPrompt.ts b/app/lib/replay/SimulationPrompt.ts index 46c8efe5..cddc071f 100644 --- a/app/lib/replay/SimulationPrompt.ts +++ b/app/lib/replay/SimulationPrompt.ts @@ -5,12 +5,12 @@ import type { Message } from 'ai'; import type { SimulationData, SimulationPacket } from './SimulationData'; -import { SimulationDataVersion } from './SimulationData'; +import { simulationDataVersion } from './SimulationData'; import { assert, generateRandomId, ProtocolClient } from './ReplayProtocolClient'; import type { MouseData } from './Recording'; import type { FileMap } from '~/lib/stores/files'; import { shouldIncludeFile } from '~/utils/fileUtils'; -import { DeveloperSystemPrompt } from '~/lib/common/prompts/prompts'; +import { developerSystemPrompt } from '~/lib/common/prompts/prompts'; import { detectProjectCommands } from '~/utils/projectCommands'; function createRepositoryContentsPacket(contents: string): SimulationPacket { @@ -105,7 +105,7 @@ class ChatManager { method: 'Nut.addSimulation', params: { chatId, - version: SimulationDataVersion, + version: simulationDataVersion, simulationData: [packet], completeData: false, saveRecording: true, @@ -315,7 +315,7 @@ export function getLastSimulationChatMessages(): ProtocolMessage[] | undefined { return gLastSimulationChatMessages; } -const SimulationSystemPrompt = ` +const simulationSystemPrompt = ` The following user message describes a bug or other problem on the page which needs to be fixed. You must respond with a useful explanation that will help the user understand the source of the problem. Do not describe the specific fix needed. @@ -329,7 +329,7 @@ export async function getSimulationEnhancedPrompt( assert(gChatManager, 'Chat not started'); assert(gChatManager.simulationFinished, 'Simulation not finished'); - let system = SimulationSystemPrompt; + let system = simulationSystemPrompt; if (mouseData) { system += `The user pointed to an element on the page `; @@ -413,24 +413,24 @@ function getProtocolRule(message: Message): 'user' | 'assistant' | 'system' { } function removeBoltArtifacts(text: string): string { - const OpenTag = '