Skip to content

Commit 367446f

Browse files
committed
feat: move to read from s3
1 parent 2602982 commit 367446f

File tree

7 files changed

+270
-60
lines changed

7 files changed

+270
-60
lines changed

pnpm-lock.yaml

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/preload.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ contextBridge.exposeInMainWorld("electronAPI", {
3434
ipcRenderer.invoke("store-api-key", apiKey),
3535
retrieveApiKey: (encryptedKey: string): Promise<string | null> =>
3636
ipcRenderer.invoke("retrieve-api-key", encryptedKey),
37+
fetchS3Logs: (logUrl: string): Promise<string> =>
38+
ipcRenderer.invoke("fetch-s3-logs", logUrl),
3739
// OAuth API
3840
oauthStartFlow: (
3941
region: CloudRegion,

src/main/services/agent.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,6 @@ export function registerAgentIpc(
118118
posthogApiKey: apiKey,
119119
posthogApiUrl: apiHost,
120120
posthogProjectId: projectId,
121-
onEvent: (event) => {
122-
console.log("agent event", event);
123-
if (!event || abortController.signal.aborted) return;
124-
const payload =
125-
event.type === "done" ? { ...event, success: true } : event;
126-
emitToRenderer(payload);
127-
},
128121
debug: true,
129122
});
130123

src/main/services/posthog.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,28 @@ export function registerPosthogIpc(): void {
3030
return encryptedKey;
3131
},
3232
);
33+
34+
// Fetch S3 logs
35+
ipcMain.handle(
36+
"fetch-s3-logs",
37+
async (_event: IpcMainInvokeEvent, logUrl: string): Promise<string> => {
38+
try {
39+
console.log("Fetching S3 logs from:", logUrl);
40+
const response = await fetch(logUrl);
41+
42+
if (!response.ok) {
43+
throw new Error(
44+
`Failed to fetch logs: ${response.status} ${response.statusText}`,
45+
);
46+
}
47+
48+
const content = await response.text();
49+
console.log("S3 logs fetched:", content);
50+
return content;
51+
} catch (error) {
52+
console.error("Failed to fetch S3 logs:", error);
53+
throw error;
54+
}
55+
},
56+
);
3357
}

src/renderer/features/editor/components/PlanEditor.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@ export function PlanEditor({
8585

8686
// Track unsaved changes
8787
useEffect(() => {
88-
if (content !== fetchedContent) {
89-
setHasUnsavedChanges(true);
90-
} else {
91-
setHasUnsavedChanges(false);
92-
}
88+
setHasUnsavedChanges(content !== fetchedContent);
9389
}, [content, fetchedContent]);
9490

9591
return (

0 commit comments

Comments
 (0)