Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/agent/src/server/agent-server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,11 @@ describe("AgentServer HTTP Mode", () => {
const body = await response.json();

expect(response.status).toBe(200);
expect(body).toEqual({ status: "ok", hasSession: true });
expect(body).toEqual({
status: "ok",
hasSession: true,
bootMs: expect.any(Number),
});
}, 30000);
});

Expand Down
13 changes: 11 additions & 2 deletions packages/agent/src/server/agent-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ function getTaskRunStateString(

export class AgentServer {
private config: AgentServerConfig;
private sessionReadyBootMs?: number;
private logger: Logger;
private server: ServerType | null = null;
private session: ActiveSession | null = null;
Expand Down Expand Up @@ -364,7 +365,11 @@ export class AgentServer {
const app = new Hono();

app.get("/health", (c) => {
return c.json({ status: "ok", hasSession: !!this.session });
return c.json({
status: "ok",
hasSession: !!this.session,
bootMs: this.sessionReadyBootMs,
});
});

app.get("/events", async (c) => {
Expand Down Expand Up @@ -558,6 +563,7 @@ export class AgentServer {
() => {
this.logger.debug(
`HTTP server listening on port ${this.config.port}`,
{ bootMs: Math.round(process.uptime() * 1000) },
);
resolve();
},
Expand Down Expand Up @@ -1225,7 +1231,10 @@ export class AgentServer {
},
});

this.logger.debug("Session initialized successfully");
this.sessionReadyBootMs = Math.round(process.uptime() * 1000);
this.logger.debug("Session initialized successfully", {
bootMs: this.sessionReadyBootMs,
});
this.logger.debug(
`Agent version: ${this.config.version ?? packageJson.version}`,
);
Expand Down
Loading