Read chat logs incrementally and drain retention (Refs #62)
This commit is contained in:
@@ -83,3 +83,11 @@ export async function nativeTail(path: string, lines: number) {
|
||||
if (!target) return undefined;
|
||||
return nativeRequest<import('../fleet/logs.js').TailResult | null>(target.instance, 'logs.read', { path: target.path, lines });
|
||||
}
|
||||
|
||||
export async function nativeLogChunk(path: string, cursor?: import('../fleet/logs.js').LogCursor) {
|
||||
const target = remote(path);
|
||||
if (!target) return undefined;
|
||||
const incremental = getHost(target.instance.host_id)?.inventory.capabilities?.includes('logs.read-offset');
|
||||
return nativeRequest<import('../fleet/logs.js').LogChunk | import('../fleet/logs.js').TailResult | null>(target.instance, 'logs.read',
|
||||
{ path: target.path, ...(incremental ? { mode: 'incremental', cursor } : { lines: 2000 }) });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user