mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-23 09:42:53 +00:00
* fix(cli): honor --since in agent logs * test(cli): verify logs cutoff in the daemon-owned suite Keep the real CLI and WebSocket regression while placing daemon fixtures in the server suite, as the CI ownership contract requires. Invoke the source CLI so the test runs with the server suite's dependency build. Co-authored-by: 见安 <73627805+Mar-garet@users.noreply.github.com> * test(server): use a portable loader URL for the logs regression --------- Co-authored-by: 见安 <73627805+Mar-garet@users.noreply.github.com> Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
29 lines
916 B
TypeScript
29 lines
916 B
TypeScript
import type { DaemonClient } from "@getpaseo/client/internal/daemon-client";
|
|
import type { AgentTimelineItem } from "@getpaseo/protocol/agent-types";
|
|
|
|
export const LIVE_HISTORY_FETCH_TIMEOUT_MS = 2_000;
|
|
|
|
interface FetchProjectedTimelineItemsInput {
|
|
client: DaemonClient;
|
|
agentId: string;
|
|
timeoutMs?: number;
|
|
sinceTimestampMs?: number;
|
|
}
|
|
|
|
export async function fetchProjectedTimelineItems(
|
|
input: FetchProjectedTimelineItemsInput,
|
|
): Promise<AgentTimelineItem[]> {
|
|
const timeline = await input.client.fetchAgentTimeline(input.agentId, {
|
|
direction: "tail",
|
|
limit: 0,
|
|
projection: "projected",
|
|
timeout: input.timeoutMs,
|
|
});
|
|
let entries = timeline.entries;
|
|
const sinceTimestampMs = input.sinceTimestampMs;
|
|
if (sinceTimestampMs !== undefined) {
|
|
entries = entries.filter((entry) => Date.parse(entry.timestamp) >= sinceTimestampMs);
|
|
}
|
|
return entries.map((entry) => entry.item);
|
|
}
|