Skip to content

Commit 9f81331

Browse files
committed
feat: update to use the new agent package log in s3
1 parent 577b8e2 commit 9f81331

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"@ai-sdk/openai": "^2.0.52",
6464
"@dnd-kit/react": "^0.1.21",
6565
"@phosphor-icons/react": "^2.1.10",
66-
"@posthog/agent": "1.17.0",
66+
"@posthog/agent": "1.18.0",
6767
"@radix-ui/react-icons": "^1.3.2",
6868
"@radix-ui/themes": "^3.2.1",
6969
"@tanstack/react-query": "^5.90.2",

src/api/posthogClient.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,28 @@ export class PostHogAPIClient {
184184
async getTaskLogs(taskId: string): Promise<LogEntry[]> {
185185
try {
186186
const task = (await this.getTask(taskId)) as unknown as Task;
187-
return task?.latest_run?.log ?? [];
187+
const logUrl = task?.latest_run?.log_url;
188+
189+
if (!logUrl) {
190+
return [];
191+
}
192+
193+
const response = await fetch(logUrl);
194+
195+
if (!response.ok) {
196+
console.warn(`Failed to fetch logs: ${response.status} ${response.statusText}`);
197+
return [];
198+
}
199+
200+
const content = await response.text();
201+
202+
if (!content.trim()) {
203+
return [];
204+
}
205+
return content
206+
.trim()
207+
.split('\n')
208+
.map(line => JSON.parse(line) as LogEntry);
188209
} catch (err) {
189210
console.warn("Failed to fetch task logs from latest run", err);
190211
return [];

src/shared/types.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export interface TaskRun {
4545
team: number;
4646
branch: string | null;
4747
status: "started" | "in_progress" | "completed" | "failed";
48-
log: LogEntry[]; // Array of log entry objects
48+
log_url?: string;
4949
error_message: string | null;
5050
output: Record<string, unknown> | null; // Structured output (PR URL, commit SHA, etc.)
5151
state: Record<string, unknown>; // Intermediate run state (defaults to {}, never null)
@@ -54,14 +54,6 @@ export interface TaskRun {
5454
completed_at: string | null;
5555
}
5656

57-
export interface LogEntry {
58-
id: string;
59-
timestamp: string;
60-
level: "info" | "warning" | "error" | "success";
61-
message: string;
62-
data?: unknown;
63-
}
64-
6557
export interface TabState {
6658
id: string;
6759
type: "task-list" | "task-detail" | "backlog" | "settings";

0 commit comments

Comments
 (0)